blob: 77916e0a7869c2a3f1be7701182c4285424e8d41 [file] [log] [blame]
Mathias Agopiandb403e82012-06-18 16:47:56 -07001/*
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 Luod3d8f8e2022-03-08 14:48:46 -080027#include <android/gui/BnSurfaceComposerClient.h>
Mathias Agopiandb403e82012-06-18 16:47:56 -070028
29namespace android {
30
Mathias Agopian13127d82013-03-05 17:47:11 -080031class Layer;
Mathias Agopiandb403e82012-06-18 16:47:56 -070032class SurfaceFlinger;
33
Huihong Luod3d8f8e2022-03-08 14:48:46 -080034class Client : public gui::BnSurfaceComposerClient {
Mathias Agopiandb403e82012-06-18 16:47:56 -070035public:
Robert Carr1db73f62016-12-21 12:58:51 -080036 explicit Client(const sp<SurfaceFlinger>& flinger);
Robert Carr6fb1a7e2018-12-11 12:07:25 -080037 ~Client() = default;
Mathias Agopiandb403e82012-06-18 16:47:56 -070038
39 status_t initCheck() const;
40
Mathias Agopiandb403e82012-06-18 16:47:56 -070041private:
42 // ISurfaceComposerClient interface
Mathias Agopiandb403e82012-06-18 16:47:56 -070043
Huihong Luod3d8f8e2022-03-08 14:48:46 -080044 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 Wall35187b32019-01-08 10:08:52 -080047
Huihong Luod3d8f8e2022-03-08 14:48:46 -080048 binder::Status clearLayerFrameStats(const sp<IBinder>& handle) override;
chaviwfe94a222019-08-21 13:52:59 -070049
Huihong Luod3d8f8e2022-03-08 14:48:46 -080050 binder::Status getLayerFrameStats(const sp<IBinder>& handle,
51 gui::FrameStats* outStats) override;
Svetoslavd85084b2014-03-20 10:28:31 -070052
Huihong Luod3d8f8e2022-03-08 14:48:46 -080053 binder::Status mirrorSurface(const sp<IBinder>& mirrorFromHandle,
Patrick Williamsa361de62022-10-06 20:34:10 +000054 gui::CreateSurfaceResult* outResult) override;
Svetoslavd85084b2014-03-20 10:28:31 -070055
Patrick Williamsa361de62022-10-06 20:34:10 +000056 binder::Status mirrorDisplay(int64_t displayId, gui::CreateSurfaceResult* outResult) override;
Chavi Weingarten7043a7d2022-07-19 23:40:35 +000057
Ady Abraham07d03c42023-09-27 19:15:08 -070058 binder::Status getSchedulingPolicy(gui::SchedulingPolicy* outPolicy) override;
59
Mathias Agopiandb403e82012-06-18 16:47:56 -070060 // constant
61 sp<SurfaceFlinger> mFlinger;
62
Mathias Agopiandb403e82012-06-18 16:47:56 -070063 // thread-safe
64 mutable Mutex mLock;
65};
66
Mathias Agopiandb403e82012-06-18 16:47:56 -070067}; // namespace android
68
69#endif // ANDROID_SF_CLIENT_H