Merge "Listen for SEARCH_LONG_PRESS_HOME_ENABLED settings changes" into udc-qpr-dev am: 60097ee593
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24796434
Change-Id: Ib2b44198758d3c8614bb1409ebb0b940b886b55a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
index f26404ca..4416b19 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
@@ -309,8 +309,14 @@
}
int invocationType = args.getInt(INVOCATION_TYPE_KEY);
- return mAssistOverrideInvocationTypes != null && Arrays.stream(
- mAssistOverrideInvocationTypes).anyMatch(override -> override == invocationType);
+ return shouldOverrideAssist(invocationType);
+ }
+
+ /** @return true if the invocation type should be handled by OverviewProxy instead of SysUI. */
+ public boolean shouldOverrideAssist(int invocationType) {
+ return mAssistOverrideInvocationTypes != null
+ && Arrays.stream(mAssistOverrideInvocationTypes).anyMatch(
+ override -> override == invocationType);
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavBarHelper.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavBarHelper.java
index c6f73ef..d7e062f 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavBarHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavBarHelper.java
@@ -233,6 +233,9 @@
Settings.Secure.getUriFor(Settings.Secure.ASSIST_LONG_PRESS_HOME_ENABLED),
false, mAssistContentObserver, UserHandle.USER_ALL);
mContentResolver.registerContentObserver(
+ Settings.Secure.getUriFor(Secure.SEARCH_LONG_PRESS_HOME_ENABLED),
+ false, mAssistContentObserver, UserHandle.USER_ALL);
+ mContentResolver.registerContentObserver(
Settings.Secure.getUriFor(Settings.Secure.ASSIST_TOUCH_GESTURE_ENABLED),
false, mAssistContentObserver, UserHandle.USER_ALL);
@@ -422,11 +425,17 @@
private void updateAssistantAvailability() {
boolean assistantAvailableForUser = mAssistManagerLazy.get()
.getAssistInfoForUser(mUserTracker.getUserId()) != null;
- boolean longPressDefault = mContext.getResources().getBoolean(
- com.android.internal.R.bool.config_assistLongPressHomeEnabledDefault);
+
+ boolean overrideLongPressHome = mAssistManagerLazy.get()
+ .shouldOverrideAssist(AssistManager.INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS);
+ boolean longPressDefault = mContext.getResources().getBoolean(overrideLongPressHome
+ ? com.android.internal.R.bool.config_searchLongPressHomeEnabledDefault
+ : com.android.internal.R.bool.config_assistLongPressHomeEnabledDefault);
mLongPressHomeEnabled = Settings.Secure.getIntForUser(mContentResolver,
- Settings.Secure.ASSIST_LONG_PRESS_HOME_ENABLED, longPressDefault ? 1 : 0,
+ overrideLongPressHome ? Secure.SEARCH_LONG_PRESS_HOME_ENABLED
+ : Settings.Secure.ASSIST_LONG_PRESS_HOME_ENABLED, longPressDefault ? 1 : 0,
mUserTracker.getUserId()) != 0;
+
boolean gestureDefault = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_assistTouchGestureEnabledDefault);
mAssistantTouchGestureEnabled = Settings.Secure.getIntForUser(mContentResolver,
@@ -455,6 +464,7 @@
@Override
public void setAssistantOverridesRequested(int[] invocationTypes) {
mAssistManagerLazy.get().setAssistantOverridesRequested(invocationTypes);
+ updateAssistantAvailability();
}
@Override