xref: /aosp_15_r20/frameworks/native/include/gui/Flags.h (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
1*38e8c45fSAndroid Build Coastguard Worker /*
2*38e8c45fSAndroid Build Coastguard Worker  * Copyright 2024 The Android Open Source Project
3*38e8c45fSAndroid Build Coastguard Worker  *
4*38e8c45fSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*38e8c45fSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*38e8c45fSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*38e8c45fSAndroid Build Coastguard Worker  *
8*38e8c45fSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*38e8c45fSAndroid Build Coastguard Worker  *
10*38e8c45fSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*38e8c45fSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*38e8c45fSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*38e8c45fSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*38e8c45fSAndroid Build Coastguard Worker  * limitations under the License.
15*38e8c45fSAndroid Build Coastguard Worker  */
16*38e8c45fSAndroid Build Coastguard Worker 
17*38e8c45fSAndroid Build Coastguard Worker #pragma once
18*38e8c45fSAndroid Build Coastguard Worker 
19*38e8c45fSAndroid Build Coastguard Worker #include <com_android_graphics_libgui_flags.h>
20*38e8c45fSAndroid Build Coastguard Worker #include <utils/StrongPointer.h>
21*38e8c45fSAndroid Build Coastguard Worker 
22*38e8c45fSAndroid Build Coastguard Worker namespace android {
23*38e8c45fSAndroid Build Coastguard Worker 
24*38e8c45fSAndroid Build Coastguard Worker class IGraphicBufferProducer;
25*38e8c45fSAndroid Build Coastguard Worker class Surface;
26*38e8c45fSAndroid Build Coastguard Worker namespace view {
27*38e8c45fSAndroid Build Coastguard Worker class Surface;
28*38e8c45fSAndroid Build Coastguard Worker }
29*38e8c45fSAndroid Build Coastguard Worker 
30*38e8c45fSAndroid Build Coastguard Worker #define WB_CAMERA3_AND_PROCESSORS_WITH_DEPENDENCIES                  \
31*38e8c45fSAndroid Build Coastguard Worker     (COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CAMERA3_AND_PROCESSORS) && \
32*38e8c45fSAndroid Build Coastguard Worker      COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ) &&  \
33*38e8c45fSAndroid Build Coastguard Worker      COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_PLATFORM_API_IMPROVEMENTS))
34*38e8c45fSAndroid Build Coastguard Worker 
35*38e8c45fSAndroid Build Coastguard Worker #define WB_LIBCAMERASERVICE_WITH_DEPENDENCIES       \
36*38e8c45fSAndroid Build Coastguard Worker     (WB_CAMERA3_AND_PROCESSORS_WITH_DEPENDENCIES && \
37*38e8c45fSAndroid Build Coastguard Worker      COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_LIBCAMERASERVICE))
38*38e8c45fSAndroid Build Coastguard Worker 
39*38e8c45fSAndroid Build Coastguard Worker #if WB_LIBCAMERASERVICE_WITH_DEPENDENCIES
40*38e8c45fSAndroid Build Coastguard Worker typedef android::Surface SurfaceType;
41*38e8c45fSAndroid Build Coastguard Worker typedef android::view::Surface ParcelableSurfaceType;
42*38e8c45fSAndroid Build Coastguard Worker #else
43*38e8c45fSAndroid Build Coastguard Worker typedef android::IGraphicBufferProducer SurfaceType;
44*38e8c45fSAndroid Build Coastguard Worker typedef android::sp<android::IGraphicBufferProducer> ParcelableSurfaceType;
45*38e8c45fSAndroid Build Coastguard Worker #endif
46*38e8c45fSAndroid Build Coastguard Worker 
47*38e8c45fSAndroid Build Coastguard Worker namespace flagtools {
48*38e8c45fSAndroid Build Coastguard Worker sp<SurfaceType> surfaceToSurfaceType(const sp<Surface>& surface);
49*38e8c45fSAndroid Build Coastguard Worker ParcelableSurfaceType toParcelableSurfaceType(const view::Surface& surface);
50*38e8c45fSAndroid Build Coastguard Worker sp<IGraphicBufferProducer> surfaceTypeToIGBP(const sp<SurfaceType>& surface);
51*38e8c45fSAndroid Build Coastguard Worker bool isSurfaceTypeValid(const sp<SurfaceType>& surface);
52*38e8c45fSAndroid Build Coastguard Worker ParcelableSurfaceType convertSurfaceTypeToParcelable(sp<SurfaceType> surface);
53*38e8c45fSAndroid Build Coastguard Worker sp<SurfaceType> convertParcelableSurfaceTypeToSurface(const ParcelableSurfaceType& surface);
54*38e8c45fSAndroid Build Coastguard Worker } // namespace flagtools
55*38e8c45fSAndroid Build Coastguard Worker 
56*38e8c45fSAndroid Build Coastguard Worker } // namespace android
57