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

Commit bf023a62 authored by chaviw's avatar chaviw
Browse files

Use WindowInfosListener instead of SF reporting to IF

1. Moved ISetInputWindowsListener and renamed to
IWindowInfosReportedListener to be more generic

2. Updated SurfaceFlinger so it reports window infos changed instead of
directly reporting window info to InputManager

Test: Existing tests pass
Test: WindowInfosListenerTest
Bug: 188792659
Change-Id: Ia8e688652663734aa01d008c2f524c6cf4971e17
parent ad494f0a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ cc_library_static {
        "android/gui/FocusRequest.aidl",
        "android/gui/InputApplicationInfo.aidl",
        "android/gui/IWindowInfosListener.aidl",
        "android/gui/IWindowInfosReportedListener.aidl",
        "android/gui/WindowInfo.aidl",
        "WindowInfo.cpp",
    ],
+7 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@

namespace android {

using gui::IWindowInfosReportedListener;
using gui::WindowInfo;
using gui::WindowInfosListener;

@@ -64,7 +65,8 @@ status_t WindowInfosListenerReporter::removeWindowInfosListener(
}

binder::Status WindowInfosListenerReporter::onWindowInfosChanged(
        const std::vector<WindowInfo>& windowInfos) {
        const std::vector<WindowInfo>& windowInfos,
        const sp<IWindowInfosReportedListener>& windowInfosReportedListener) {
    std::unordered_set<sp<WindowInfosListener>, ISurfaceComposer::SpHash<WindowInfosListener>>
            windowInfosListeners;

@@ -79,6 +81,10 @@ binder::Status WindowInfosListenerReporter::onWindowInfosChanged(
        listener->onWindowInfosChanged(windowInfos);
    }

    if (windowInfosReportedListener) {
        windowInfosReportedListener->onWindowInfosReported();
    }

    return binder::Status::ok();
}

+2 −1
Original line number Diff line number Diff line
@@ -16,10 +16,11 @@

package android.gui;

import android.gui.IWindowInfosReportedListener;
import android.gui.WindowInfo;

/** @hide */
oneway interface IWindowInfosListener
{
    void onWindowInfosChanged(in WindowInfo[] windowInfos);
    void onWindowInfosChanged(in WindowInfo[] windowInfos, in @nullable IWindowInfosReportedListener windowInfosReportedListener);
}
+3 −3
Original line number Diff line number Diff line
@@ -14,10 +14,10 @@
 * limitations under the License.
 */

package android.os;
package android.gui;

/** @hide */
oneway interface ISetInputWindowsListener
oneway interface IWindowInfosReportedListener
{
    void onSetInputWindowsFinished();
    void onWindowInfosReported();
}
+3 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#pragma once

#include <android/gui/BnWindowInfosListener.h>
#include <android/gui/IWindowInfosReportedListener.h>
#include <binder/IBinder.h>
#include <gui/ISurfaceComposer.h>
#include <gui/WindowInfosListener.h>
@@ -29,8 +30,8 @@ class ISurfaceComposer;
class WindowInfosListenerReporter : public gui::BnWindowInfosListener {
public:
    static sp<WindowInfosListenerReporter> getInstance();

    binder::Status onWindowInfosChanged(const std::vector<gui::WindowInfo>& windowInfos) override;
    binder::Status onWindowInfosChanged(const std::vector<gui::WindowInfo>& windowInfos,
                                        const sp<gui::IWindowInfosReportedListener>&) override;

    status_t addWindowInfosListener(const sp<gui::WindowInfosListener>& windowInfosListener,
                                    const sp<ISurfaceComposer>&);
Loading