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

Commit ab216609 authored by Winson's avatar Winson
Browse files

Removing private system ui flags from status bar flags logic.

- Prevent third party apps from inadvertently changing internal SystemUI
  flags through a call to setSystemUiVisibility().  These flags are only
  set in the individual SystemUI components and can be updated in WMS
  directly.

Bug: 29875297
Change-Id: I5ea238c8fb16a0eccd6e993d95a912acb359cee6
parent a4fab41e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -330,6 +330,16 @@ interface IWindowManager
     */
    oneway void statusBarVisibilityChanged(int visibility);

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

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

    /**
     * Device has a software navigation bar (separate from the status bar).
     */
+0 −14
Original line number Diff line number Diff line
@@ -3083,20 +3083,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     */
    public static final int NAVIGATION_BAR_TRANSLUCENT = 0x80000000;
    /**
     * @hide
     *
     * Whether Recents is visible or not.
     */
    public static final int RECENT_APPS_VISIBLE = 0x00004000;
    /**
     * @hide
     *
     * Whether the TV's picture-in-picture is visible or not.
     */
    public static final int TV_PICTURE_IN_PICTURE_VISIBLE = 0x00010000;
    /**
     * @hide
     *
+10 −0
Original line number Diff line number Diff line
@@ -1305,6 +1305,16 @@ public interface WindowManagerPolicy {
     */
    public int adjustSystemUiVisibilityLw(int visibility);

    /**
     * Called by System UI to notify of changes to the visibility of Recents.
     */
    public void setRecentsVisibilityLw(boolean visible);

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

    /**
     * Specifies whether there is an on-screen navigation bar separate from the status bar.
     */
+1 −5
Original line number Diff line number Diff line
@@ -216,11 +216,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
     * {@link Recents#onBusEvent(RecentsVisibilityChangedEvent)}.
     */
    public void onVisibilityChanged(Context context, boolean visible) {
        SystemUIApplication app = (SystemUIApplication) context;
        PhoneStatusBar statusBar = app.getComponent(PhoneStatusBar.class);
        if (statusBar != null) {
            statusBar.updateRecentsVisibility(visible);
        }
        Recents.getSystemServices().setRecentsVisibility(visible);
    }

    /**
+25 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ import android.util.MutableBoolean;
import android.view.Display;
import android.view.IAppTransitionAnimationSpecsFuture;
import android.view.IDockedStackListener;
import android.view.IWindowManager;
import android.view.WindowManager;
import android.view.WindowManager.KeyboardShortcutsReceiver;
import android.view.WindowManagerGlobal;
@@ -120,6 +121,7 @@ public class SystemServicesProxy {
    IPackageManager mIpm;
    AssistUtils mAssistUtils;
    WindowManager mWm;
    IWindowManager mIwm;
    UserManager mUm;
    Display mDisplay;
    String mRecentsPackage;
@@ -207,6 +209,7 @@ public class SystemServicesProxy {
        mIpm = AppGlobals.getPackageManager();
        mAssistUtils = new AssistUtils(context);
        mWm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        mIwm = WindowManagerGlobal.getWindowManagerService();
        mUm = UserManager.get(context);
        mDisplay = mWm.getDefaultDisplay();
        mRecentsPackage = context.getPackageName();
@@ -1091,6 +1094,28 @@ public class SystemServicesProxy {
        }
    }

    /**
     * Updates the visibility of recents.
     */
    public void setRecentsVisibility(boolean visible) {
        try {
            mIwm.setRecentsVisibility(visible);
        } catch (RemoteException e) {
            Log.e(TAG, "Unable to reach window manager", e);
        }
    }

    /**
     * Updates the visibility of the picture-in-picture.
     */
    public void setTvPipVisibility(boolean visible) {
        try {
            mIwm.setTvPipVisibility(visible);
        } catch (RemoteException e) {
            Log.e(TAG, "Unable to reach window manager", e);
        }
    }

    private final class H extends Handler {
        private static final int ON_TASK_STACK_CHANGED = 1;
        private static final int ON_ACTIVITY_PINNED = 2;
Loading