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

Commit b80fdde4 authored by Charles Chen's avatar Charles Chen
Browse files

Remove addWindowTokenWithOptions

Since WindowContext won't add WindowToken from the client side,
addWindowTokenWithOption is no more needed. Also remove the logic
to invoke removeWindowToken from the client side.

Bug: 159767464
Bug: 153369119
Test: atest WindowManagerServiceTests WindowManagerPermissionTests
Change-Id: Ib0c948dca223cf8d056865ce3a0d4adaef07d247
parent c8c9f874
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -44,8 +44,8 @@ public class WindowTokenClient extends IWindowToken.Stub {
     * Attaches {@code context} to this {@link WindowTokenClient}. Each {@link WindowTokenClient}
     * can only attach one {@link Context}.
     * <p>This method must be called before invoking
     * {@link android.view.IWindowManager#addWindowTokenWithOptions(IBinder, int, int, Bundle,
     * String)}.<p/>
     * {@link android.view.IWindowManager#registerWindowContextListener(IBinder, int, int,
     * Bundle, boolean)}.<p/>
     *
     * @param context context to be attached
     * @throws IllegalStateException if attached context has already existed.
+6 −8
Original line number Diff line number Diff line
@@ -124,16 +124,10 @@ interface IWindowManager
     *
     * @param token Token to be registered.
     * @param type Window type to be used with this token.
     * @param options A bundle used to pass window-related options.
     * @param displayId The ID of the display where this token should be added.
     * @param packageName The name of package to request to add window token. Could be {@code null}
     *                    if callers holds the MANAGE_APP_TOKENS permission.
     * @return {@link WindowManagerGlobal#ADD_OKAY} if the addition was successful, an error code
     *         otherwise.
     * @param options A bundle used to pass window-related options.
     */
    int addWindowTokenWithOptions(IBinder token, int type, int displayId, in Bundle options,
            String packageName);
    void addWindowToken(IBinder token, int type, int displayId);
    void addWindowToken(IBinder token, int type, int displayId, in Bundle options);
    /**
     * Remove window token on a specific display.
     *
@@ -784,6 +778,10 @@ interface IWindowManager
    /**
     * Registers a listener for a {@link android.app.WindowContext} to handle configuration changes
     * from the server side.
     * <p>
     * Note that this API should be invoked after calling
     * {@link android.app.WindowTokenClient#attachContext(WindowContext)}
     * </p>
     *
     * @param clientToken the window context's token
     * @param type Window type of the window context
+0 −1
Original line number Diff line number Diff line
@@ -139,7 +139,6 @@ public final class WindowManagerGlobal {
    public static final int ADD_INVALID_DISPLAY = -9;
    public static final int ADD_INVALID_TYPE = -10;
    public static final int ADD_INVALID_USER = -11;
    public static final int ADD_TOO_MANY_TOKENS = -12;

    @UnsupportedAppUsage
    private static WindowManagerGlobal sDefaultWindowManager;
+2 −1
Original line number Diff line number Diff line
@@ -184,7 +184,8 @@ public class WindowContextTest {
        final IBinder token = windowContext.getWindowContextToken();

        final IBinder existingToken = new Binder();
        mWms.addWindowToken(existingToken, TYPE_INPUT_METHOD, windowContext.getDisplayId());
        mWms.addWindowToken(existingToken, TYPE_INPUT_METHOD, windowContext.getDisplayId(),
                null /* options */);

        final WindowManager.LayoutParams params =
                new WindowManager.LayoutParams(TYPE_INPUT_METHOD);
+2 −1
Original line number Diff line number Diff line
@@ -315,7 +315,8 @@ public class CustomTile extends QSTileImpl<State> implements TileChangeListener
        }
        try {
            if (DEBUG) Log.d(TAG, "Adding token");
            mWindowManager.addWindowToken(mToken, TYPE_QS_DIALOG, DEFAULT_DISPLAY);
            mWindowManager.addWindowToken(mToken, TYPE_QS_DIALOG, DEFAULT_DISPLAY,
                    null /* options */);
            mIsTokenGranted = true;
        } catch (RemoteException e) {
        }
Loading