blob: 9d2aaab23d847cfc4a8d5753073263da5e6c9a9a [file] [log] [blame]
Vishnu Naircb8be502022-10-12 19:03:23 +00001/*
2 * Copyright 2022 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#pragma once
18
19#include <binder/Binder.h>
20#include <gui/LayerMetadata.h>
Vishnu Naira9c43762023-01-27 19:10:25 +000021#include <ui/LayerStack.h>
Vishnu Naircb8be502022-10-12 19:03:23 +000022#include <utils/StrongPointer.h>
23#include <cstdint>
24#include <limits>
25#include <optional>
Vishnu Naira9c43762023-01-27 19:10:25 +000026
Vishnu Naircb8be502022-10-12 19:03:23 +000027constexpr uint32_t UNASSIGNED_LAYER_ID = std::numeric_limits<uint32_t>::max();
28
29namespace android {
30class SurfaceFlinger;
31class Client;
32} // namespace android
33
34namespace android::surfaceflinger {
35
36struct LayerCreationArgs {
37 static std::atomic<uint32_t> sSequence;
38
39 LayerCreationArgs(android::SurfaceFlinger*, sp<android::Client>, std::string name,
40 uint32_t flags, gui::LayerMetadata,
41 std::optional<uint32_t> id = std::nullopt);
42 LayerCreationArgs(const LayerCreationArgs&);
43
44 android::SurfaceFlinger* flinger;
45 sp<android::Client> client;
46 std::string name;
47 uint32_t flags; // ISurfaceComposerClient flags
48 gui::LayerMetadata metadata;
49 pid_t ownerPid;
50 uid_t ownerUid;
51 uint32_t textureName;
52 uint32_t sequence;
53 bool addToRoot = true;
54 wp<IBinder> parentHandle = nullptr;
55 wp<IBinder> mirrorLayerHandle = nullptr;
Vishnu Naira9c43762023-01-27 19:10:25 +000056 ui::LayerStack layerStackToMirror = ui::INVALID_LAYER_STACK;
Vishnu Naircb8be502022-10-12 19:03:23 +000057};
58
59} // namespace android::surfaceflinger