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

Commit 95026d42 authored by Philip Junker's avatar Philip Junker
Browse files

Add testApi to query global keys.

This removes cts/GlobalKeyMapping which copied the behavior of
GlobalKeyManager.

Bug: 199182608
Test: GoogleAtvReferenceRemoteControlTest
Change-Id: I7d48f7ce5484fb360ff41c62516c06b27b3e1d88
parent 01a8beee
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -2937,6 +2937,7 @@ package android.view {
  public interface WindowManager extends android.view.ViewManager {
  public interface WindowManager extends android.view.ViewManager {
    method public default int getDisplayImePolicy(int);
    method public default int getDisplayImePolicy(int);
    method public default void holdLock(android.os.IBinder, int);
    method public default void holdLock(android.os.IBinder, int);
    method public default boolean isGlobalKey(int);
    method public default boolean isTaskSnapshotSupported();
    method public default boolean isTaskSnapshotSupported();
    method public default void setDisplayImePolicy(int, int);
    method public default void setDisplayImePolicy(int, int);
    method public default void setShouldShowSystemDecors(int, boolean);
    method public default void setShouldShowSystemDecors(int, boolean);
+8 −0
Original line number Original line Diff line number Diff line
@@ -985,4 +985,12 @@ interface IWindowManager
     */
     */
    oneway void captureDisplay(int displayId, in @nullable ScreenCapture.CaptureArgs captureArgs,
    oneway void captureDisplay(int displayId, in @nullable ScreenCapture.CaptureArgs captureArgs,
            in ScreenCapture.ScreenCaptureListener listener);
            in ScreenCapture.ScreenCaptureListener listener);

    /**
     * Returns {@code true} if the key will be handled globally and not forwarded to all apps.
     *
     * @param keyCode the key code to check
     * @return {@code true} if the key will be handled globally.
     */
    boolean isGlobalKey(int keyCode);
}
}
+12 −0
Original line number Original line Diff line number Diff line
@@ -944,6 +944,18 @@ public interface WindowManager extends ViewManager {
        return DISPLAY_IME_POLICY_FALLBACK_DISPLAY;
        return DISPLAY_IME_POLICY_FALLBACK_DISPLAY;
    }
    }


    /**
     * Returns {@code true} if the key will be handled globally and not forwarded to all apps.
     *
     * @param keyCode the key code to check
     * @return {@code true} if the key will be handled globally.
     * @hide
     */
    @TestApi
    default boolean isGlobalKey(int keyCode) {
        return false;
    }

    /**
    /**
     * <p>
     * <p>
     * Returns whether cross-window blur is currently enabled. This affects both window blur behind
     * Returns whether cross-window blur is currently enabled. This affects both window blur behind
+9 −0
Original line number Original line Diff line number Diff line
@@ -282,6 +282,15 @@ public final class WindowManagerImpl implements WindowManager {
        return DISPLAY_IME_POLICY_FALLBACK_DISPLAY;
        return DISPLAY_IME_POLICY_FALLBACK_DISPLAY;
    }
    }


    @Override
    public boolean isGlobalKey(int keyCode) {
        try {
            return WindowManagerGlobal.getWindowManagerService().isGlobalKey(keyCode);
        } catch (RemoteException e) {
        }
        return false;
    }

    @Override
    @Override
    public WindowMetrics getCurrentWindowMetrics() {
    public WindowMetrics getCurrentWindowMetrics() {
        final Context context = mParentWindow != null ? mParentWindow.getContext() : mContext;
        final Context context = mParentWindow != null ? mParentWindow.getContext() : mContext;
+5 −0
Original line number Original line Diff line number Diff line
@@ -5493,6 +5493,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            effectId, always, reason);
            effectId, always, reason);
    }
    }


    @Override
    public boolean isGlobalKey(int keyCode) {
        return mGlobalKeyManager.shouldHandleGlobalKey(keyCode);
    }

    @Override
    @Override
    public boolean performHapticFeedback(int uid, String packageName, int effectId,
    public boolean performHapticFeedback(int uid, String packageName, int effectId,
            boolean always, String reason) {
            boolean always, String reason) {
Loading