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

Commit 7e486910 authored by Winson Chung's avatar Winson Chung
Browse files

Fix a couple issues with sysui state

- Ensure that we only set the sysui state on the default display for the
  time being since gesture nav only really works for the default display
- Update the overview proxy service of the nav bar fragment window state
  whenever it is recreated
- Remove the screen pinning flag usage as there is no callback to
  accurately ensure that this flag is always up to date (launcher will
  have to use the activity manager call whenever it needs to check
  it for now)

Bug: 131552865
Test: Manual

Change-Id: I524f67f4fb6eb73e6e07454d9eb0c03d3ffb53af
parent 1923b35e
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.recents;

import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.MotionEvent.ACTION_CANCEL;
import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_UP;
@@ -32,7 +33,6 @@ import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_WIN
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NAV_BAR_HIDDEN;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING;

import android.annotation.FloatRange;
import android.app.ActivityTaskManager;
@@ -515,7 +515,12 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
        }
    }

    public void setSystemUiStateFlag(int flag, boolean enabled) {
    public void setSystemUiStateFlag(int flag, boolean enabled, int displayId) {
        if (displayId != DEFAULT_DISPLAY) {
            // Ignore non-default displays for now
            return;
        }

        int newState = mSysUiStateFlags;
        if (enabled) {
            newState |= flag;
@@ -540,8 +545,6 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
                && statusBar.getPanel().isFullyExpanded();
        final boolean bouncerShowing = statusBar != null && statusBar.isBouncerShowing();
        mSysUiStateFlags = 0;
        mSysUiStateFlags |= ActivityManagerWrapper.getInstance().isScreenPinningActive()
                ? SYSUI_STATE_SCREEN_PINNING : 0;
        mSysUiStateFlags |= (navBarFragment != null && !navBarFragment.isNavBarWindowVisible())
                ? SYSUI_STATE_NAV_BAR_HIDDEN : 0;
        mSysUiStateFlags |= panelExpanded
+0 −2
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.systemui.recents;

import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING;
import static com.android.systemui.util.leak.RotationUtils.ROTATION_LANDSCAPE;
import static com.android.systemui.util.leak.RotationUtils.ROTATION_SEASCAPE;

@@ -139,7 +138,6 @@ public class ScreenPinningRequest implements View.OnClickListener,
        if (v.getId() == R.id.screen_pinning_ok_button || mRequestWindow == v) {
            try {
                ActivityTaskManager.getService().startSystemLockTaskMode(taskId);
                mOverviewProxyService.setSystemUiStateFlag(SYSUI_STATE_SCREEN_PINNING, true);
            } catch (RemoteException e) {}
        }
        clearPrompt();
+7 −5
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import static com.android.systemui.shared.system.NavigationBarCompat.Interaction
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_CLICKABLE;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NAV_BAR_HIDDEN;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING;
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_LIGHTS_OUT;
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_LIGHTS_OUT_TRANSPARENT;
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_OPAQUE;
@@ -335,7 +334,10 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback
        filter.addAction(Intent.ACTION_USER_SWITCHED);
        getContext().registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL, filter, null, null);
        notifyNavigationBarScreenOn();

        mOverviewProxyService.addCallback(mOverviewProxyListener);
        mOverviewProxyService.setSystemUiStateFlag(SYSUI_STATE_NAV_BAR_HIDDEN,
                !isNavBarWindowVisible(), mDisplayId);

        // Currently there is no accelerometer sensor on non-default display.
        if (mIsOnDefaultDisplay) {
@@ -471,7 +473,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback
            if (DEBUG_WINDOW_STATE) Log.d(TAG, "Navigation bar " + windowStateToString(state));

            mOverviewProxyService.setSystemUiStateFlag(SYSUI_STATE_NAV_BAR_HIDDEN,
                    !isNavBarWindowVisible());
                    !isNavBarWindowVisible(), mDisplayId);
            mNavigationBarView.getRotateSuggestionButton()
                    .onNavigationBarWindowVisibilityChange(isNavBarWindowVisible());
        }
@@ -831,7 +833,6 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback
                    activityManager.stopSystemLockTaskMode();
                    // When exiting refresh disabled flags.
                    mNavigationBarView.updateNavButtonIcons();
                    mOverviewProxyService.setSystemUiStateFlag(SYSUI_STATE_SCREEN_PINNING, false);
                }
            }

@@ -883,9 +884,10 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback
        boolean clickable = (flags & SYSUI_STATE_A11Y_BUTTON_CLICKABLE) != 0;
        boolean longClickable = (flags & SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE) != 0;
        mNavigationBarView.setAccessibilityButtonState(clickable, longClickable);
        mOverviewProxyService.setSystemUiStateFlag(SYSUI_STATE_A11Y_BUTTON_CLICKABLE, clickable);
        mOverviewProxyService.setSystemUiStateFlag(
                SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE, longClickable);
                SYSUI_STATE_A11Y_BUTTON_CLICKABLE, clickable, mDisplayId);
        mOverviewProxyService.setSystemUiStateFlag(
                SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE, longClickable, mDisplayId);
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -730,7 +730,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
    public void onPanelExpandedChange(boolean expanded) {
        updateSlippery();
        mOverviewProxyService.setSystemUiStateFlag(SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED,
                expanded);
                expanded, getContext().getDisplayId());
    }

    public void updateStates() {
+1 −1
Original line number Diff line number Diff line
@@ -3584,7 +3584,7 @@ public class StatusBar extends SystemUI implements DemoMode,

        // Notify overview proxy service of the new states
        Dependency.get(OverviewProxyService.class).setSystemUiStateFlag(SYSUI_STATE_BOUNCER_SHOWING,
                isBouncerShowing());
                isBouncerShowing(), mContext.getDisplayId());
    }

    /**