Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f474d3db authored by Daichi Hirono's avatar Daichi Hirono
Browse files

Add AIDL for LayerMetadtaKey

to share the same definition between C++ and Java code

Bug: 143912669
Test: make
Change-Id: I7f2a189f134f1f924906a22dfc30ccf221cfd2d7
parent c58d6be0
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.view;

/** @hide */
@Backing(type="int")
enum LayerMetadataKey {
    METADATA_OWNER_UID = 1,
    METADATA_WINDOW_TYPE = 2,
    METADATA_TASK_ID = 3,
    METADATA_MOUSE_CURSOR = 4,
}
+5 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ cc_library_shared {
    defaults: ["libgui_bufferqueue-defaults"],

    srcs: [
        ":framework_native_aidl",
        ":libgui_bufferqueue_sources",

        "BitTube.cpp",
@@ -106,6 +107,10 @@ cc_library_shared {
        "libdvr_headers",
        "libpdx_headers",
    ],

    aidl: {
        export_aidl_headers: true,
    }
}

// Used by media codec services exclusively as a static lib for
+6 −4
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@
#include <binder/Parcel.h>
#include <gui/LayerMetadata.h>

#include "android/view/LayerMetadataKey.h"

using android::base::StringPrintf;

namespace android {
@@ -113,12 +115,12 @@ void LayerMetadata::setInt32(uint32_t key, int32_t value) {

std::string LayerMetadata::itemToString(uint32_t key, const char* separator) const {
    if (!has(key)) return std::string();
    switch (key) {
        case METADATA_OWNER_UID:
    switch (static_cast<view::LayerMetadataKey>(key)) {
        case view::LayerMetadataKey::METADATA_OWNER_UID:
            return StringPrintf("ownerUID%s%d", separator, getInt32(key, 0));
        case METADATA_WINDOW_TYPE:
        case view::LayerMetadataKey::METADATA_WINDOW_TYPE:
            return StringPrintf("windowType%s%d", separator, getInt32(key, 0));
        case METADATA_TASK_ID:
        case view::LayerMetadataKey::METADATA_TASK_ID:
            return StringPrintf("taskId%s%d", separator, getInt32(key, 0));
        default:
            return StringPrintf("%d%s%dbytes", key, separator,