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

Commit b271771b authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add Window Infos state to dumpsys" into udc-dev

parents 9da41a1f d828f302
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ filegroup {
        "android/gui/IWindowInfosListener.aidl",
        "android/gui/IWindowInfosReportedListener.aidl",
        "android/gui/WindowInfo.aidl",
        "android/gui/WindowInfosUpdate.aidl",
    ],
}

@@ -90,9 +91,11 @@ cc_library_static {
        "android/gui/InputApplicationInfo.aidl",
        "android/gui/IWindowInfosListener.aidl",
        "android/gui/IWindowInfosReportedListener.aidl",
        "android/gui/WindowInfosUpdate.aidl",
        "android/gui/WindowInfo.aidl",
        "DisplayInfo.cpp",
        "WindowInfo.cpp",
        "WindowInfosUpdate.cpp",
    ],

    shared_libs: [
+5 −4
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include <android/gui/ISurfaceComposer.h>
#include <gui/AidlStatusUtil.h>
#include <gui/WindowInfosListenerReporter.h>
#include "gui/WindowInfosUpdate.h"

namespace android {

@@ -84,7 +85,7 @@ status_t WindowInfosListenerReporter::removeWindowInfosListener(
}

binder::Status WindowInfosListenerReporter::onWindowInfosChanged(
        const std::vector<WindowInfo>& windowInfos, const std::vector<DisplayInfo>& displayInfos,
        const gui::WindowInfosUpdate& update,
        const sp<IWindowInfosReportedListener>& windowInfosReportedListener) {
    std::unordered_set<sp<WindowInfosListener>, gui::SpHash<WindowInfosListener>>
            windowInfosListeners;
@@ -95,12 +96,12 @@ binder::Status WindowInfosListenerReporter::onWindowInfosChanged(
            windowInfosListeners.insert(listener);
        }

        mLastWindowInfos = windowInfos;
        mLastDisplayInfos = displayInfos;
        mLastWindowInfos = update.windowInfos;
        mLastDisplayInfos = update.displayInfos;
    }

    for (auto listener : windowInfosListeners) {
        listener->onWindowInfosChanged(windowInfos, displayInfos);
        listener->onWindowInfosChanged(update);
    }

    if (windowInfosReportedListener) {
+72 −0
Original line number Diff line number Diff line
/*
 * Copyright 2023 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.
 */

#include <gui/WindowInfosUpdate.h>
#include <private/gui/ParcelUtils.h>

namespace android::gui {

status_t WindowInfosUpdate::readFromParcel(const android::Parcel* parcel) {
    if (parcel == nullptr) {
        ALOGE("%s: Null parcel", __func__);
        return BAD_VALUE;
    }

    uint32_t size;

    SAFE_PARCEL(parcel->readUint32, &size);
    windowInfos.reserve(size);
    for (uint32_t i = 0; i < size; i++) {
        windowInfos.push_back({});
        SAFE_PARCEL(windowInfos.back().readFromParcel, parcel);
    }

    SAFE_PARCEL(parcel->readUint32, &size);
    displayInfos.reserve(size);
    for (uint32_t i = 0; i < size; i++) {
        displayInfos.push_back({});
        SAFE_PARCEL(displayInfos.back().readFromParcel, parcel);
    }

    SAFE_PARCEL(parcel->readInt64, &vsyncId);
    SAFE_PARCEL(parcel->readInt64, &timestamp);

    return OK;
}

status_t WindowInfosUpdate::writeToParcel(android::Parcel* parcel) const {
    if (parcel == nullptr) {
        ALOGE("%s: Null parcel", __func__);
        return BAD_VALUE;
    }

    SAFE_PARCEL(parcel->writeUint32, static_cast<uint32_t>(windowInfos.size()));
    for (auto& windowInfo : windowInfos) {
        SAFE_PARCEL(windowInfo.writeToParcel, parcel);
    }

    SAFE_PARCEL(parcel->writeUint32, static_cast<uint32_t>(displayInfos.size()));
    for (auto& displayInfo : displayInfos) {
        SAFE_PARCEL(displayInfo.writeToParcel, parcel);
    }

    SAFE_PARCEL(parcel->writeInt64, vsyncId);
    SAFE_PARCEL(parcel->writeInt64, timestamp);

    return OK;
}

} // namespace android::gui
+4 −5
Original line number Diff line number Diff line
@@ -16,12 +16,11 @@

package android.gui;

import android.gui.DisplayInfo;
import android.gui.IWindowInfosReportedListener;
import android.gui.WindowInfo;
import android.gui.WindowInfosUpdate;

/** @hide */
oneway interface IWindowInfosListener
{
    void onWindowInfosChanged(in WindowInfo[] windowInfos, in DisplayInfo[] displayInfos, in @nullable IWindowInfosReportedListener windowInfosReportedListener);
oneway interface IWindowInfosListener {
    void onWindowInfosChanged(
        in WindowInfosUpdate update, in @nullable IWindowInfosReportedListener windowInfosReportedListener);
}
+22 −0
Original line number Diff line number Diff line
/*
** Copyright 2023, 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.gui;

import android.gui.DisplayInfo;
import android.gui.WindowInfo;

parcelable WindowInfosUpdate cpp_header "gui/WindowInfosUpdate.h";
Loading