1 /* 2 * Copyright 2019 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 <cstdint> 20 #include <string> 21 22 #include <utils/StrongPointer.h> 23 24 namespace android { 25 26 typedef int64_t nsecs_t; 27 28 namespace compositionengine { 29 30 class Display; 31 class LayerFE; 32 33 namespace impl { 34 struct LayerCompositionState; 35 } // namespace impl 36 37 /** 38 * A layer contains the output-independent composition state for a front-end 39 * Layer 40 */ 41 class Layer { 42 public: 43 virtual ~Layer(); 44 45 // Gets the front-end interface for this layer. Can return nullptr if the 46 // front-end layer no longer exists. 47 virtual sp<LayerFE> getLayerFE() const = 0; 48 49 using CompositionState = impl::LayerCompositionState; 50 51 // Gets the raw composition state data for the layer 52 // TODO(lpique): Make this protected once it is only internally called. 53 virtual const CompositionState& getState() const = 0; 54 55 // Allows mutable access to the raw composition state data for the layer. 56 // This is meant to be used by the various functions that are part of the 57 // composition process. 58 // TODO(lpique): Make this protected once it is only internally called. 59 virtual CompositionState& editState() = 0; 60 61 // Debugging 62 virtual void dump(std::string& result) const = 0; 63 }; 64 65 } // namespace compositionengine 66 } // namespace android 67