Mathias Agopian | db403e8 | 2012-06-18 16:47:56 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ANDROID_SF_CLIENT_H |
| 18 | #define ANDROID_SF_CLIENT_H |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <sys/types.h> |
| 22 | |
| 23 | #include <utils/Errors.h> |
| 24 | #include <utils/KeyedVector.h> |
| 25 | #include <utils/Mutex.h> |
| 26 | |
Huihong Luo | d3d8f8e | 2022-03-08 14:48:46 -0800 | [diff] [blame] | 27 | #include <android/gui/BnSurfaceComposerClient.h> |
Mathias Agopian | db403e8 | 2012-06-18 16:47:56 -0700 | [diff] [blame] | 28 | |
| 29 | namespace android { |
| 30 | |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 31 | class Layer; |
Mathias Agopian | db403e8 | 2012-06-18 16:47:56 -0700 | [diff] [blame] | 32 | class SurfaceFlinger; |
| 33 | |
Huihong Luo | d3d8f8e | 2022-03-08 14:48:46 -0800 | [diff] [blame] | 34 | class Client : public gui::BnSurfaceComposerClient { |
Mathias Agopian | db403e8 | 2012-06-18 16:47:56 -0700 | [diff] [blame] | 35 | public: |
Robert Carr | 1db73f6 | 2016-12-21 12:58:51 -0800 | [diff] [blame] | 36 | explicit Client(const sp<SurfaceFlinger>& flinger); |
Robert Carr | 6fb1a7e | 2018-12-11 12:07:25 -0800 | [diff] [blame] | 37 | ~Client() = default; |
Mathias Agopian | db403e8 | 2012-06-18 16:47:56 -0700 | [diff] [blame] | 38 | |
| 39 | status_t initCheck() const; |
| 40 | |
Mathias Agopian | db403e8 | 2012-06-18 16:47:56 -0700 | [diff] [blame] | 41 | private: |
| 42 | // ISurfaceComposerClient interface |
Mathias Agopian | db403e8 | 2012-06-18 16:47:56 -0700 | [diff] [blame] | 43 | |
Huihong Luo | d3d8f8e | 2022-03-08 14:48:46 -0800 | [diff] [blame] | 44 | binder::Status createSurface(const std::string& name, int32_t flags, const sp<IBinder>& parent, |
| 45 | const gui::LayerMetadata& metadata, |
| 46 | gui::CreateSurfaceResult* outResult) override; |
Marissa Wall | 35187b3 | 2019-01-08 10:08:52 -0800 | [diff] [blame] | 47 | |
Huihong Luo | d3d8f8e | 2022-03-08 14:48:46 -0800 | [diff] [blame] | 48 | binder::Status clearLayerFrameStats(const sp<IBinder>& handle) override; |
chaviw | fe94a22 | 2019-08-21 13:52:59 -0700 | [diff] [blame] | 49 | |
Huihong Luo | d3d8f8e | 2022-03-08 14:48:46 -0800 | [diff] [blame] | 50 | binder::Status getLayerFrameStats(const sp<IBinder>& handle, |
| 51 | gui::FrameStats* outStats) override; |
Svetoslav | d85084b | 2014-03-20 10:28:31 -0700 | [diff] [blame] | 52 | |
Huihong Luo | d3d8f8e | 2022-03-08 14:48:46 -0800 | [diff] [blame] | 53 | binder::Status mirrorSurface(const sp<IBinder>& mirrorFromHandle, |
Patrick Williams | a361de6 | 2022-10-06 20:34:10 +0000 | [diff] [blame] | 54 | gui::CreateSurfaceResult* outResult) override; |
Svetoslav | d85084b | 2014-03-20 10:28:31 -0700 | [diff] [blame] | 55 | |
Patrick Williams | a361de6 | 2022-10-06 20:34:10 +0000 | [diff] [blame] | 56 | binder::Status mirrorDisplay(int64_t displayId, gui::CreateSurfaceResult* outResult) override; |
Chavi Weingarten | 7043a7d | 2022-07-19 23:40:35 +0000 | [diff] [blame] | 57 | |
Ady Abraham | 07d03c4 | 2023-09-27 19:15:08 -0700 | [diff] [blame] | 58 | binder::Status getSchedulingPolicy(gui::SchedulingPolicy* outPolicy) override; |
| 59 | |
Mathias Agopian | db403e8 | 2012-06-18 16:47:56 -0700 | [diff] [blame] | 60 | // constant |
| 61 | sp<SurfaceFlinger> mFlinger; |
| 62 | |
Mathias Agopian | db403e8 | 2012-06-18 16:47:56 -0700 | [diff] [blame] | 63 | // thread-safe |
| 64 | mutable Mutex mLock; |
| 65 | }; |
| 66 | |
Mathias Agopian | db403e8 | 2012-06-18 16:47:56 -0700 | [diff] [blame] | 67 | }; // namespace android |
| 68 | |
| 69 | #endif // ANDROID_SF_CLIENT_H |