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

Commit 30931373 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Remove sysui from having to manually notify pip visibility"

parents 93e9bcf5 8e511462
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -392,11 +392,6 @@ interface IWindowManager
     */
    oneway void setRecentsVisibility(boolean visible);

    /**
     * Called by System UI to notify of changes to the visibility of PIP.
     */
    oneway void setPipVisibility(boolean visible);

    /**
     * Called by System UI to enable or disable haptic feedback on the navigation bar buttons.
     */
+2 −5
Original line number Diff line number Diff line
@@ -153,12 +153,9 @@ public class WindowManagerWrapper {
        }
    }

    @Deprecated
    public void setPipVisibility(final boolean visible) {
        try {
            WindowManagerGlobal.getWindowManagerService().setPipVisibility(visible);
        } catch (RemoteException e) {
            Log.e(TAG, "Unable to reach window manager", e);
        }
        // To be removed
    }

    /**
+16 −1
Original line number Diff line number Diff line
@@ -2201,7 +2201,22 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
        ensureActivitiesVisible(null, 0, false /* preserveWindows */);
        resumeFocusedStacksTopActivities();

        notifyActivityPipModeChanged(r);
    }

    /**
     * Notifies when an activity enters or leaves PIP mode.
     * @param r indicates the activity currently in PIP, can be null to indicate no activity is
     *          currently in PIP mode.
     */
    void notifyActivityPipModeChanged(@Nullable ActivityRecord r) {
        final boolean inPip = r != null;
        if (inPip) {
            mService.getTaskChangeNotificationController().notifyActivityPinned(r);
        } else {
            mService.getTaskChangeNotificationController().notifyActivityUnpinned();
        }
        mWindowManager.mPolicy.setPipVisibilityLw(inPip);
    }

    void executeAppTransitionForAllDisplay() {
+3 −2
Original line number Diff line number Diff line
@@ -1434,7 +1434,7 @@ class Task extends WindowContainer<WindowContainer> {
                    && (newParent == null || !newParent.inPinnedWindowingMode())) {
                // Notify if a task from the pinned stack is being removed
                // (or moved depending on the mode).
                mAtmService.getTaskChangeNotificationController().notifyActivityUnpinned();
                mRootWindowContainer.notifyActivityPipModeChanged(null);
            }
        }

@@ -5102,10 +5102,11 @@ class Task extends WindowContainer<WindowContainer> {
                    : WINDOWING_MODE_FULLSCREEN;
        }
        if (currentMode == WINDOWING_MODE_PINNED) {
            mAtmService.getTaskChangeNotificationController().notifyActivityUnpinned();
            mRootWindowContainer.notifyActivityPipModeChanged(null);
        }
        if (likelyResolvedMode == WINDOWING_MODE_PINNED
                && taskDisplayArea.getRootPinnedTask() != null) {

            // Can only have 1 pip at a time, so replace an existing pip
            taskDisplayArea.getRootPinnedTask().dismissPip();
        }
+0 −13
Original line number Diff line number Diff line
@@ -5752,19 +5752,6 @@ public class WindowManagerService extends IWindowManager.Stub
        }
    }

    @Override
    public void setPipVisibility(boolean visible) {
        if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR)
                != PackageManager.PERMISSION_GRANTED) {
            throw new SecurityException("Caller does not hold permission "
                    + android.Manifest.permission.STATUS_BAR);
        }

        synchronized (mGlobalLock) {
            mPolicy.setPipVisibilityLw(visible);
        }
    }

    @Override
    public void statusBarVisibilityChanged(int displayId, int visibility) {
        if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR)