Merge "Pass nav button disable and AOD events to launcher" into sc-v2-dev
This commit is contained in:
@@ -114,6 +114,8 @@ public class QuickStepContract {
|
||||
public static final int SYSUI_STATE_MAGNIFICATION_OVERLAP = 1 << 19;
|
||||
// ImeSwitcher is showing
|
||||
public static final int SYSUI_STATE_IME_SWITCHER_SHOWING = 1 << 20;
|
||||
// Device dozing/AOD state
|
||||
public static final int SYSUI_STATE_DEVICE_DOZING = 1 << 21;
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({SYSUI_STATE_SCREEN_PINNING,
|
||||
@@ -136,7 +138,8 @@ public class QuickStepContract {
|
||||
SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY,
|
||||
SYSUI_STATE_IME_SHOWING,
|
||||
SYSUI_STATE_MAGNIFICATION_OVERLAP,
|
||||
SYSUI_STATE_IME_SWITCHER_SHOWING
|
||||
SYSUI_STATE_IME_SWITCHER_SHOWING,
|
||||
SYSUI_STATE_DEVICE_DOZING
|
||||
})
|
||||
public @interface SystemUiStateFlags {}
|
||||
|
||||
@@ -166,6 +169,7 @@ public class QuickStepContract {
|
||||
str.add((flags & SYSUI_STATE_IME_SHOWING) != 0 ? "ime_visible" : "");
|
||||
str.add((flags & SYSUI_STATE_MAGNIFICATION_OVERLAP) != 0 ? "magnification_overlap" : "");
|
||||
str.add((flags & SYSUI_STATE_IME_SWITCHER_SHOWING) != 0 ? "ime_switcher_showing" : "");
|
||||
str.add((flags & SYSUI_STATE_DEVICE_DOZING) != 0 ? "device_dozing" : "");
|
||||
return str.toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ public class SystemActions extends SystemUI {
|
||||
mNotificationShadeController = notificationShadeController;
|
||||
// Saving in instance variable since to prevent GC since
|
||||
// NotificationShadeWindowController.registerCallback() only keeps weak references.
|
||||
mNotificationShadeCallback = (keyguardShowing, keyguardOccluded, bouncerShowing) ->
|
||||
mNotificationShadeCallback = (keyguardShowing, keyguardOccluded, bouncerShowing, mDozing) ->
|
||||
registerOrUnregisterDismissNotificationShadeAction();
|
||||
mStatusBar = statusBar;
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ import com.android.systemui.navigationbar.NavigationBarA11yHelper;
|
||||
import com.android.systemui.navigationbar.NavigationBarController;
|
||||
import com.android.systemui.navigationbar.NavigationBarOverlayController;
|
||||
import com.android.systemui.navigationbar.NavigationModeController;
|
||||
import com.android.systemui.navigationbar.TaskbarDelegate;
|
||||
import com.android.systemui.plugins.PluginInitializerImpl;
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||
import com.android.systemui.qs.ReduceBrightColorsController;
|
||||
@@ -233,7 +234,8 @@ public class DependencyProvider {
|
||||
UiEventLogger uiEventLogger,
|
||||
NavigationBarOverlayController navBarOverlayController,
|
||||
ConfigurationController configurationController,
|
||||
NavigationBarA11yHelper navigationBarA11yHelper) {
|
||||
NavigationBarA11yHelper navigationBarA11yHelper,
|
||||
TaskbarDelegate taskbarDelegate) {
|
||||
return new NavigationBarController(context,
|
||||
windowManager,
|
||||
assistManagerLazy,
|
||||
@@ -259,7 +261,8 @@ public class DependencyProvider {
|
||||
uiEventLogger,
|
||||
navBarOverlayController,
|
||||
configurationController,
|
||||
navigationBarA11yHelper);
|
||||
navigationBarA11yHelper,
|
||||
taskbarDelegate);
|
||||
}
|
||||
|
||||
/** */
|
||||
|
||||
@@ -153,7 +153,8 @@ public class NavigationBarController implements Callbacks,
|
||||
UiEventLogger uiEventLogger,
|
||||
NavigationBarOverlayController navBarOverlayController,
|
||||
ConfigurationController configurationController,
|
||||
NavigationBarA11yHelper navigationBarA11yHelper) {
|
||||
NavigationBarA11yHelper navigationBarA11yHelper,
|
||||
TaskbarDelegate taskbarDelegate) {
|
||||
mContext = context;
|
||||
mWindowManager = windowManager;
|
||||
mAssistManagerLazy = assistManagerLazy;
|
||||
@@ -185,7 +186,8 @@ public class NavigationBarController implements Callbacks,
|
||||
mNavBarOverlayController = navBarOverlayController;
|
||||
mNavMode = mNavigationModeController.addListener(this);
|
||||
mNavigationModeController.addListener(this);
|
||||
mTaskbarDelegate = new TaskbarDelegate(mOverviewProxyService,
|
||||
mTaskbarDelegate = taskbarDelegate;
|
||||
mTaskbarDelegate.setOverviewProxyService(overviewProxyService,
|
||||
navigationBarA11yHelper, mSysUiFlagsContainer);
|
||||
mIsTablet = isTablet(mContext.getResources().getConfiguration());
|
||||
}
|
||||
|
||||
@@ -33,19 +33,26 @@ import com.android.systemui.recents.OverviewProxyService;
|
||||
import com.android.systemui.shared.recents.utilities.Utilities;
|
||||
import com.android.systemui.statusbar.CommandQueue;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@Singleton
|
||||
public class TaskbarDelegate implements CommandQueue.Callbacks {
|
||||
|
||||
private final OverviewProxyService mOverviewProxyService;
|
||||
private final NavigationBarA11yHelper mNavigationBarA11yHelper;
|
||||
private final SysUiState mSysUiState;
|
||||
private OverviewProxyService mOverviewProxyService;
|
||||
private NavigationBarA11yHelper mNavigationBarA11yHelper;
|
||||
private SysUiState mSysUiState;
|
||||
private int mDisplayId;
|
||||
private int mNavigationIconHints;
|
||||
private final NavigationBarA11yHelper.NavA11yEventListener mNavA11yEventListener =
|
||||
this::updateSysuiFlags;
|
||||
@Inject
|
||||
public TaskbarDelegate() { /* no-op */ }
|
||||
|
||||
public TaskbarDelegate(OverviewProxyService overviewProxyService,
|
||||
public void setOverviewProxyService(OverviewProxyService overviewProxyService,
|
||||
NavigationBarA11yHelper navigationBarA11yHelper,
|
||||
SysUiState sysUiState) {
|
||||
// TODO: adding this in the ctor results in a dagger dependency cycle :(
|
||||
mOverviewProxyService = overviewProxyService;
|
||||
mNavigationBarA11yHelper = navigationBarA11yHelper;
|
||||
mSysUiState = sysUiState;
|
||||
|
||||
@@ -34,6 +34,7 @@ import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SUP
|
||||
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SYSUI_PROXY;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_WINDOW_CORNER_RADIUS;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_DEVICE_DOZING;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_TRACING_ENABLED;
|
||||
@@ -736,12 +737,13 @@ public class OverviewProxyService extends CurrentUserTracker implements
|
||||
}
|
||||
|
||||
private void onStatusBarStateChanged(boolean keyguardShowing, boolean keyguardOccluded,
|
||||
boolean bouncerShowing) {
|
||||
boolean bouncerShowing, boolean isDozing) {
|
||||
mSysUiState.setFlag(SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING,
|
||||
keyguardShowing && !keyguardOccluded)
|
||||
.setFlag(SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED,
|
||||
keyguardShowing && keyguardOccluded)
|
||||
.setFlag(SYSUI_STATE_BOUNCER_SHOWING, bouncerShowing)
|
||||
.setFlag(SYSUI_STATE_DEVICE_DOZING, isDozing)
|
||||
.commitUpdate(mContext.getDisplayId());
|
||||
}
|
||||
|
||||
@@ -967,18 +969,6 @@ public class OverviewProxyService extends CurrentUserTracker implements
|
||||
}
|
||||
}
|
||||
|
||||
public void onRotationProposal(int rotation, boolean isValid) {
|
||||
try {
|
||||
if (mOverviewProxy != null) {
|
||||
mOverviewProxy.onRotationProposal(rotation, isValid);
|
||||
} else {
|
||||
Log.e(TAG_OPS, "Failed to get overview proxy for proposing rotation.");
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG_OPS, "Failed to call onRotationProposal()", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void disable(int displayId, int state1, int state2, boolean animate) {
|
||||
try {
|
||||
if (mOverviewProxy != null) {
|
||||
@@ -991,6 +981,18 @@ public class OverviewProxyService extends CurrentUserTracker implements
|
||||
}
|
||||
}
|
||||
|
||||
public void onRotationProposal(int rotation, boolean isValid) {
|
||||
try {
|
||||
if (mOverviewProxy != null) {
|
||||
mOverviewProxy.onRotationProposal(rotation, isValid);
|
||||
} else {
|
||||
Log.e(TAG_OPS, "Failed to get overview proxy for proposing rotation.");
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG_OPS, "Failed to call onRotationProposal()", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void onSystemBarAttributesChanged(int displayId, int behavior) {
|
||||
try {
|
||||
if (mOverviewProxy != null) {
|
||||
|
||||
@@ -435,7 +435,8 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
if (cb != null) {
|
||||
cb.onStateChanged(mCurrentState.mKeyguardShowing,
|
||||
mCurrentState.mKeyguardOccluded,
|
||||
mCurrentState.mBouncerShowing);
|
||||
mCurrentState.mBouncerShowing,
|
||||
mCurrentState.mDozing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,5 +16,6 @@
|
||||
package com.android.systemui.statusbar.phone;
|
||||
|
||||
public interface StatusBarWindowCallback {
|
||||
void onStateChanged(boolean keyguardShowing, boolean keyguardOccluded, boolean bouncerShowing);
|
||||
void onStateChanged(boolean keyguardShowing, boolean keyguardOccluded, boolean bouncerShowing,
|
||||
boolean isDozing);
|
||||
}
|
||||
|
||||
@@ -79,6 +79,8 @@ public class NavigationBarControllerTest extends SysuiTestCase {
|
||||
private NavigationBar mDefaultNavBar;
|
||||
private NavigationBar mSecondaryNavBar;
|
||||
|
||||
private CommandQueue mCommandQueue = mock(CommandQueue.class);
|
||||
|
||||
private static final int SECONDARY_DISPLAY = 1;
|
||||
|
||||
@Before
|
||||
@@ -97,7 +99,7 @@ public class NavigationBarControllerTest extends SysuiTestCase {
|
||||
mock(StatusBarStateController.class),
|
||||
mock(SysUiState.class),
|
||||
mock(BroadcastDispatcher.class),
|
||||
mock(CommandQueue.class),
|
||||
mCommandQueue,
|
||||
Optional.of(mock(Pip.class)),
|
||||
Optional.of(mock(LegacySplitScreen.class)),
|
||||
Optional.of(mock(Recents.class)),
|
||||
@@ -109,7 +111,8 @@ public class NavigationBarControllerTest extends SysuiTestCase {
|
||||
mock(UiEventLogger.class),
|
||||
mock(NavigationBarOverlayController.class),
|
||||
mock(ConfigurationController.class),
|
||||
mock(NavigationBarA11yHelper.class)));
|
||||
mock(NavigationBarA11yHelper.class),
|
||||
mock(TaskbarDelegate.class)));
|
||||
initializeNavigationBars();
|
||||
}
|
||||
|
||||
@@ -272,4 +275,9 @@ public class NavigationBarControllerTest extends SysuiTestCase {
|
||||
|
||||
verify(mSecondaryNavBar).disableAnimationsDuringHide(eq(500L));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test3ButtonTaskbarFlagDisabledNoRegister() {
|
||||
verify(mCommandQueue, never()).addCallback(any(TaskbarDelegate.class));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user