blob: a2b8889eb7a83a3481fcda9986e919abd672155c [file] [log] [blame]
Vishnu Nair6b591152021-10-08 11:45:14 -07001/*
2 * Copyright (C) 2021 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#pragma once
17
18#include <layerproto/TransactionProto.h>
19#include <utils/RefBase.h>
20
21#include "TransactionState.h"
22
23namespace android::surfaceflinger {
24class TransactionProtoParser {
25public:
26 static proto::TransactionState toProto(
27 const TransactionState&, std::function<int32_t(const sp<IBinder>&)> getLayerIdFn,
28 std::function<int32_t(const sp<IBinder>&)> getDisplayIdFn);
29 static TransactionState fromProto(const proto::TransactionState&,
30 std::function<sp<IBinder>(int32_t)> getLayerHandleFn,
31 std::function<sp<IBinder>(int32_t)> getDisplayHandleFn);
32
33private:
34 static proto::LayerState toProto(const layer_state_t&,
35 std::function<int32_t(const sp<IBinder>&)> getLayerId);
36 static proto::DisplayState toProto(const DisplayState&,
37 std::function<int32_t(const sp<IBinder>&)> getDisplayId);
38 static layer_state_t fromProto(const proto::LayerState&,
39 std::function<sp<IBinder>(int32_t)> getLayerHandle);
40 static DisplayState fromProto(const proto::DisplayState&,
41 std::function<sp<IBinder>(int32_t)> getDisplayHandle);
42};
43
44} // namespace android::surfaceflinger