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

Commit 3b59466f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Make window token add/remove APIs require displayId"

parents d0bc76db ac2561e8
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -85,8 +85,8 @@ interface IWindowManager
    void pauseKeyDispatching(IBinder token);
    void resumeKeyDispatching(IBinder token);
    void setEventDispatching(boolean enabled);
    void addWindowToken(IBinder token, int type);
    void removeWindowToken(IBinder token);
    void addWindowToken(IBinder token, int type, int displayId);
    void removeWindowToken(IBinder token, int displayId);
    /**
     * Adds an application token to the specified task Id.
     * @param addPos The position to add the token to in the task.
@@ -183,7 +183,7 @@ interface IWindowManager
    void notifyAppStopped(IBinder token);
    void startAppFreezingScreen(IBinder token, int configChanges);
    void stopAppFreezingScreen(IBinder token, boolean force);
    void removeAppToken(IBinder token);
    void removeAppToken(IBinder token, int displayId);

    /** Used by system ui to report that recents has shown itself. */
    void endProlongedAnimations();
+5 −2
Original line number Diff line number Diff line
@@ -241,16 +241,19 @@ public abstract class WindowManagerInternal {
     *
     * @param token The token to add.
     * @param type The window type.
     * @param displayId The display to add the token to.
     */
    public abstract void addWindowToken(android.os.IBinder token, int type);
    public abstract void addWindowToken(android.os.IBinder token, int type, int displayId);

    /**
     * Removes a window token.
     *
     * @param token The toke to remove.
     * @param removeWindows Whether to also remove the windows associated with the token.
     * @param displayId The display to remove the token from.
     */
    public abstract void removeWindowToken(android.os.IBinder token, boolean removeWindows);
    public abstract void removeWindowToken(android.os.IBinder token, boolean removeWindows,
            int displayId);

    /**
     * Registers a listener to be notified about app transition events.
+7 −4
Original line number Diff line number Diff line
@@ -44,6 +44,9 @@ import com.android.systemui.qs.external.TileLifecycleManager.TileChangeListener;
import com.android.systemui.statusbar.phone.QSTileHost;
import libcore.util.Objects;

import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.WindowManager.LayoutParams.TYPE_QS_DIALOG;

public class CustomTile extends QSTile<QSTile.State> implements TileChangeListener {
    public static final String PREFIX = "custom(";

@@ -171,7 +174,7 @@ public class CustomTile extends QSTile<QSTile.State> implements TileChangeListen
        mIsShowingDialog = false;
        try {
            if (DEBUG) Log.d(TAG, "Removing token");
            mWindowManager.removeWindowToken(mToken);
            mWindowManager.removeWindowToken(mToken, DEFAULT_DISPLAY);
        } catch (RemoteException e) {
        }
    }
@@ -193,7 +196,7 @@ public class CustomTile extends QSTile<QSTile.State> implements TileChangeListen
                if (mIsTokenGranted && !mIsShowingDialog) {
                    try {
                        if (DEBUG) Log.d(TAG, "Removing token");
                        mWindowManager.removeWindowToken(mToken);
                        mWindowManager.removeWindowToken(mToken, DEFAULT_DISPLAY);
                    } catch (RemoteException e) {
                    }
                    mIsTokenGranted = false;
@@ -212,7 +215,7 @@ public class CustomTile extends QSTile<QSTile.State> implements TileChangeListen
        if (mIsTokenGranted) {
            try {
                if (DEBUG) Log.d(TAG, "Removing token");
                mWindowManager.removeWindowToken(mToken);
                mWindowManager.removeWindowToken(mToken, DEFAULT_DISPLAY);
            } catch (RemoteException e) {
            }
        }
@@ -252,7 +255,7 @@ public class CustomTile extends QSTile<QSTile.State> implements TileChangeListen
        }
        try {
            if (DEBUG) Log.d(TAG, "Adding token");
            mWindowManager.addWindowToken(mToken, WindowManager.LayoutParams.TYPE_QS_DIALOG);
            mWindowManager.addWindowToken(mToken, TYPE_QS_DIALOG, DEFAULT_DISPLAY);
            mIsTokenGranted = true;
        } catch (RemoteException e) {
        }
+5 −3
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
package com.android.server.accessibility;

import static android.accessibilityservice.AccessibilityServiceInfo.DEFAULT;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY;

import android.Manifest;
import android.accessibilityservice.AccessibilityService;
@@ -3129,7 +3131,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
            final long identity = Binder.clearCallingIdentity();
            try {
                mWindowManagerService.addWindowToken(mOverlayWindowToken,
                        WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY);
                        TYPE_ACCESSIBILITY_OVERLAY, DEFAULT_DISPLAY);
            } finally {
                Binder.restoreCallingIdentity(identity);
            }
@@ -3138,7 +3140,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
        public void onRemoved() {
            final long identity = Binder.clearCallingIdentity();
            try {
                mWindowManagerService.removeWindowToken(mOverlayWindowToken, true);
                mWindowManagerService.removeWindowToken(mOverlayWindowToken, true, DEFAULT_DISPLAY);
            } finally {
                Binder.restoreCallingIdentity(identity);
            }
@@ -3668,7 +3670,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
                    return AccessibilityWindowInfo.TYPE_SPLIT_SCREEN_DIVIDER;
                }

                case WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY: {
                case TYPE_ACCESSIBILITY_OVERLAY: {
                    return AccessibilityWindowInfo.TYPE_ACCESSIBILITY_OVERLAY;
                }

+4 −3
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@

package com.android.server;

import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
import static java.lang.annotation.RetentionPolicy.SOURCE;

import com.android.internal.content.PackageMonitor;
@@ -1481,8 +1483,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
            mCurToken = new Binder();
            try {
                if (true || DEBUG) Slog.v(TAG, "Adding window token: " + mCurToken);
                mIWindowManager.addWindowToken(mCurToken,
                        WindowManager.LayoutParams.TYPE_INPUT_METHOD);
                mIWindowManager.addWindowToken(mCurToken, TYPE_INPUT_METHOD, DEFAULT_DISPLAY);
            } catch (RemoteException e) {
            }
            return new InputBindResult(null, null, mCurId, mCurSeq,
@@ -1590,7 +1591,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                    // The current IME is shown. Hence an IME switch (transition) is happening.
                    mWindowManagerInternal.saveLastInputMethodWindowForTransition();
                }
                mIWindowManager.removeWindowToken(mCurToken);
                mIWindowManager.removeWindowToken(mCurToken, DEFAULT_DISPLAY);
            } catch (RemoteException e) {
            }
            mCurToken = null;
Loading