Merge "Updating SysUI state when back enabled/disabled state change" into rvc-dev am: d71e76fd7b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11965840 Change-Id: I45773b216a2b93a3b0e1955eedccc497e1c12cd1
This commit is contained in:
@@ -121,6 +121,8 @@ public class EdgeBackGestureHandler extends CurrentUserTracker implements Displa
|
|||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final OverviewProxyService mOverviewProxyService;
|
private final OverviewProxyService mOverviewProxyService;
|
||||||
|
private final Runnable mStateChangeCallback;
|
||||||
|
|
||||||
private final PluginManager mPluginManager;
|
private final PluginManager mPluginManager;
|
||||||
// Activities which should not trigger Back gesture.
|
// Activities which should not trigger Back gesture.
|
||||||
private final List<ComponentName> mGestureBlockingActivities = new ArrayList<>();
|
private final List<ComponentName> mGestureBlockingActivities = new ArrayList<>();
|
||||||
@@ -196,13 +198,15 @@ public class EdgeBackGestureHandler extends CurrentUserTracker implements Displa
|
|||||||
};
|
};
|
||||||
|
|
||||||
public EdgeBackGestureHandler(Context context, OverviewProxyService overviewProxyService,
|
public EdgeBackGestureHandler(Context context, OverviewProxyService overviewProxyService,
|
||||||
SysUiState sysUiFlagContainer, PluginManager pluginManager) {
|
SysUiState sysUiFlagContainer, PluginManager pluginManager,
|
||||||
|
Runnable stateChangeCallback) {
|
||||||
super(Dependency.get(BroadcastDispatcher.class));
|
super(Dependency.get(BroadcastDispatcher.class));
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mDisplayId = context.getDisplayId();
|
mDisplayId = context.getDisplayId();
|
||||||
mMainExecutor = context.getMainExecutor();
|
mMainExecutor = context.getMainExecutor();
|
||||||
mOverviewProxyService = overviewProxyService;
|
mOverviewProxyService = overviewProxyService;
|
||||||
mPluginManager = pluginManager;
|
mPluginManager = pluginManager;
|
||||||
|
mStateChangeCallback = stateChangeCallback;
|
||||||
ComponentName recentsComponentName = ComponentName.unflattenFromString(
|
ComponentName recentsComponentName = ComponentName.unflattenFromString(
|
||||||
context.getString(com.android.internal.R.string.config_recentsComponentName));
|
context.getString(com.android.internal.R.string.config_recentsComponentName));
|
||||||
if (recentsComponentName != null) {
|
if (recentsComponentName != null) {
|
||||||
@@ -226,13 +230,13 @@ public class EdgeBackGestureHandler extends CurrentUserTracker implements Displa
|
|||||||
Log.e(TAG, "Failed to add gesture blocking activities", e);
|
Log.e(TAG, "Failed to add gesture blocking activities", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Dependency.get(ProtoTracer.class).add(this);
|
|
||||||
|
|
||||||
|
Dependency.get(ProtoTracer.class).add(this);
|
||||||
mLongPressTimeout = Math.min(MAX_LONG_PRESS_TIMEOUT,
|
mLongPressTimeout = Math.min(MAX_LONG_PRESS_TIMEOUT,
|
||||||
ViewConfiguration.getLongPressTimeout());
|
ViewConfiguration.getLongPressTimeout());
|
||||||
|
|
||||||
mGestureNavigationSettingsObserver = new GestureNavigationSettingsObserver(
|
mGestureNavigationSettingsObserver = new GestureNavigationSettingsObserver(
|
||||||
mContext.getMainThreadHandler(), mContext, this::updateCurrentUserResources);
|
mContext.getMainThreadHandler(), mContext, this::onNavigationSettingsChanged);
|
||||||
|
|
||||||
updateCurrentUserResources();
|
updateCurrentUserResources();
|
||||||
sysUiFlagContainer.addCallback(sysUiFlags -> mSysUiFlags = sysUiFlags);
|
sysUiFlagContainer.addCallback(sysUiFlags -> mSysUiFlags = sysUiFlags);
|
||||||
@@ -263,6 +267,14 @@ public class EdgeBackGestureHandler extends CurrentUserTracker implements Displa
|
|||||||
mTouchSlop = ViewConfiguration.get(mContext).getScaledTouchSlop() * backGestureSlop;
|
mTouchSlop = ViewConfiguration.get(mContext).getScaledTouchSlop() * backGestureSlop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onNavigationSettingsChanged() {
|
||||||
|
boolean wasBackAllowed = isHandlingGestures();
|
||||||
|
updateCurrentUserResources();
|
||||||
|
if (wasBackAllowed != isHandlingGestures()) {
|
||||||
|
mStateChangeCallback.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUserSwitched(int newUserId) {
|
public void onUserSwitched(int newUserId) {
|
||||||
updateIsEnabled();
|
updateIsEnabled();
|
||||||
|
|||||||
@@ -326,8 +326,8 @@ public class NavigationBarView extends FrameLayout implements
|
|||||||
|
|
||||||
mNavColorSampleMargin = getResources()
|
mNavColorSampleMargin = getResources()
|
||||||
.getDimensionPixelSize(R.dimen.navigation_handle_sample_horizontal_margin);
|
.getDimensionPixelSize(R.dimen.navigation_handle_sample_horizontal_margin);
|
||||||
mEdgeBackGestureHandler = new EdgeBackGestureHandler(
|
mEdgeBackGestureHandler = new EdgeBackGestureHandler(context, mOverviewProxyService,
|
||||||
context, mOverviewProxyService, mSysUiFlagContainer, mPluginManager);
|
mSysUiFlagContainer, mPluginManager, this::updateStates);
|
||||||
mRegionSamplingHelper = new RegionSamplingHelper(this,
|
mRegionSamplingHelper = new RegionSamplingHelper(this,
|
||||||
new RegionSamplingHelper.SamplingCallback() {
|
new RegionSamplingHelper.SamplingCallback() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user