Merge "Revert "Revert "Add setting for touch gesture and long-press hom..."" into sc-dev
This commit is contained in:
@@ -9175,6 +9175,22 @@ public final class Settings {
|
|||||||
@Readable
|
@Readable
|
||||||
public static final String ASSIST_GESTURE_SETUP_COMPLETE = "assist_gesture_setup_complete";
|
public static final String ASSIST_GESTURE_SETUP_COMPLETE = "assist_gesture_setup_complete";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the assistant can be triggered by a touch gesture.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String ASSIST_TOUCH_GESTURE_ENABLED =
|
||||||
|
"assist_touch_gesture_enabled";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the assistant can be triggered by long-pressing the home button
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String ASSIST_LONG_PRESS_HOME_ENABLED =
|
||||||
|
"assist_long_press_home_enabled";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Control whether Trust Agents are in active unlock or extend unlock mode.
|
* Control whether Trust Agents are in active unlock or extend unlock mode.
|
||||||
* @hide
|
* @hide
|
||||||
|
|||||||
@@ -123,6 +123,8 @@ message SecureSettingsProto {
|
|||||||
optional SettingProto gesture_silence_alerts_enabled = 7 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
optional SettingProto gesture_silence_alerts_enabled = 7 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
||||||
optional SettingProto gesture_wake_enabled = 8 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
optional SettingProto gesture_wake_enabled = 8 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
||||||
optional SettingProto gesture_setup_complete = 9 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
optional SettingProto gesture_setup_complete = 9 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
||||||
|
optional SettingProto touch_gesture_enabled = 10 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
||||||
|
optional SettingProto long_press_home_enabled = 11 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
||||||
}
|
}
|
||||||
optional Assist assist = 7;
|
optional Assist assist = 7;
|
||||||
|
|
||||||
|
|||||||
@@ -165,6 +165,8 @@ public class SecureSettingsValidators {
|
|||||||
VALIDATORS.put(Secure.ASSIST_GESTURE_ENABLED, BOOLEAN_VALIDATOR);
|
VALIDATORS.put(Secure.ASSIST_GESTURE_ENABLED, BOOLEAN_VALIDATOR);
|
||||||
VALIDATORS.put(Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, BOOLEAN_VALIDATOR);
|
VALIDATORS.put(Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, BOOLEAN_VALIDATOR);
|
||||||
VALIDATORS.put(Secure.ASSIST_GESTURE_WAKE_ENABLED, BOOLEAN_VALIDATOR);
|
VALIDATORS.put(Secure.ASSIST_GESTURE_WAKE_ENABLED, BOOLEAN_VALIDATOR);
|
||||||
|
VALIDATORS.put(Secure.ASSIST_TOUCH_GESTURE_ENABLED, BOOLEAN_VALIDATOR);
|
||||||
|
VALIDATORS.put(Secure.ASSIST_LONG_PRESS_HOME_ENABLED, BOOLEAN_VALIDATOR);
|
||||||
VALIDATORS.put(Secure.VR_DISPLAY_MODE, new DiscreteValueValidator(new String[] {"0", "1"}));
|
VALIDATORS.put(Secure.VR_DISPLAY_MODE, new DiscreteValueValidator(new String[] {"0", "1"}));
|
||||||
VALIDATORS.put(Secure.NOTIFICATION_BADGING, BOOLEAN_VALIDATOR);
|
VALIDATORS.put(Secure.NOTIFICATION_BADGING, BOOLEAN_VALIDATOR);
|
||||||
VALIDATORS.put(Secure.NOTIFICATION_DISMISS_RTL, BOOLEAN_VALIDATOR);
|
VALIDATORS.put(Secure.NOTIFICATION_DISMISS_RTL, BOOLEAN_VALIDATOR);
|
||||||
|
|||||||
@@ -1881,6 +1881,12 @@ class SettingsProtoDumpUtil {
|
|||||||
dumpSetting(s, p,
|
dumpSetting(s, p,
|
||||||
Settings.Secure.ASSIST_GESTURE_SETUP_COMPLETE,
|
Settings.Secure.ASSIST_GESTURE_SETUP_COMPLETE,
|
||||||
SecureSettingsProto.Assist.GESTURE_SETUP_COMPLETE);
|
SecureSettingsProto.Assist.GESTURE_SETUP_COMPLETE);
|
||||||
|
dumpSetting(s, p,
|
||||||
|
Settings.Secure.ASSIST_TOUCH_GESTURE_ENABLED,
|
||||||
|
SecureSettingsProto.Assist.TOUCH_GESTURE_ENABLED);
|
||||||
|
dumpSetting(s, p,
|
||||||
|
Settings.Secure.ASSIST_LONG_PRESS_HOME_ENABLED,
|
||||||
|
SecureSettingsProto.Assist.LONG_PRESS_HOME_ENABLED);
|
||||||
p.end(assistToken);
|
p.end(assistToken);
|
||||||
|
|
||||||
final long assistHandlesToken = p.start(SecureSettingsProto.ASSIST_HANDLES);
|
final long assistHandlesToken = p.start(SecureSettingsProto.ASSIST_HANDLES);
|
||||||
|
|||||||
@@ -209,6 +209,8 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
|
|||||||
private @TransitionMode int mNavigationBarMode;
|
private @TransitionMode int mNavigationBarMode;
|
||||||
private ContentResolver mContentResolver;
|
private ContentResolver mContentResolver;
|
||||||
private boolean mAssistantAvailable;
|
private boolean mAssistantAvailable;
|
||||||
|
private boolean mLongPressHomeEnabled;
|
||||||
|
private boolean mAssistantTouchGestureEnabled;
|
||||||
|
|
||||||
private int mDisabledFlags1;
|
private int mDisabledFlags1;
|
||||||
private int mDisabledFlags2;
|
private int mDisabledFlags2;
|
||||||
@@ -309,7 +311,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
|
|||||||
|
|
||||||
// Send the assistant availability upon connection
|
// Send the assistant availability upon connection
|
||||||
if (isConnected) {
|
if (isConnected) {
|
||||||
sendAssistantAvailability(mAssistantAvailable);
|
updateAssistantEntrypoints();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -404,12 +406,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
|
|||||||
new Handler(Looper.getMainLooper())) {
|
new Handler(Looper.getMainLooper())) {
|
||||||
@Override
|
@Override
|
||||||
public void onChange(boolean selfChange, Uri uri) {
|
public void onChange(boolean selfChange, Uri uri) {
|
||||||
boolean available = mAssistManagerLazy.get()
|
updateAssistantEntrypoints();
|
||||||
.getAssistInfoForUser(UserHandle.USER_CURRENT) != null;
|
|
||||||
if (mAssistantAvailable != available) {
|
|
||||||
sendAssistantAvailability(available);
|
|
||||||
mAssistantAvailable = available;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -531,6 +528,13 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
|
|||||||
mContentResolver.registerContentObserver(
|
mContentResolver.registerContentObserver(
|
||||||
Settings.Secure.getUriFor(Settings.Secure.ASSISTANT),
|
Settings.Secure.getUriFor(Settings.Secure.ASSISTANT),
|
||||||
false /* notifyForDescendants */, mAssistContentObserver, UserHandle.USER_ALL);
|
false /* notifyForDescendants */, mAssistContentObserver, UserHandle.USER_ALL);
|
||||||
|
mContentResolver.registerContentObserver(
|
||||||
|
Settings.Secure.getUriFor(Settings.Secure.ASSIST_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);
|
||||||
|
updateAssistantEntrypoints();
|
||||||
|
|
||||||
if (savedState != null) {
|
if (savedState != null) {
|
||||||
mDisabledFlags1 = savedState.getInt(EXTRA_DISABLE_STATE, 0);
|
mDisabledFlags1 = savedState.getInt(EXTRA_DISABLE_STATE, 0);
|
||||||
@@ -823,7 +827,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
|
|||||||
|| mNavigationBarView.getHomeButton().getCurrentView() == null) {
|
|| mNavigationBarView.getHomeButton().getCurrentView() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mHomeButtonLongPressDurationMs.isPresent()) {
|
if (mHomeButtonLongPressDurationMs.isPresent() || !mLongPressHomeEnabled) {
|
||||||
mNavigationBarView.getHomeButton().getCurrentView().setLongClickable(false);
|
mNavigationBarView.getHomeButton().getCurrentView().setLongClickable(false);
|
||||||
mNavigationBarView.getHomeButton().getCurrentView().setHapticFeedbackEnabled(false);
|
mNavigationBarView.getHomeButton().getCurrentView().setHapticFeedbackEnabled(false);
|
||||||
mNavigationBarView.getHomeButton().setOnLongClickListener(null);
|
mNavigationBarView.getHomeButton().setOnLongClickListener(null);
|
||||||
@@ -845,6 +849,8 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
|
|||||||
pw.println(" mStartingQuickSwitchRotation=" + mStartingQuickSwitchRotation);
|
pw.println(" mStartingQuickSwitchRotation=" + mStartingQuickSwitchRotation);
|
||||||
pw.println(" mCurrentRotation=" + mCurrentRotation);
|
pw.println(" mCurrentRotation=" + mCurrentRotation);
|
||||||
pw.println(" mHomeButtonLongPressDurationMs=" + mHomeButtonLongPressDurationMs);
|
pw.println(" mHomeButtonLongPressDurationMs=" + mHomeButtonLongPressDurationMs);
|
||||||
|
pw.println(" mLongPressHomeEnabled=" + mLongPressHomeEnabled);
|
||||||
|
pw.println(" mAssistantTouchGestureEnabled=" + mAssistantTouchGestureEnabled);
|
||||||
|
|
||||||
if (mNavigationBarView != null) {
|
if (mNavigationBarView != null) {
|
||||||
pw.println(" mNavigationBarWindowState="
|
pw.println(" mNavigationBarWindowState="
|
||||||
@@ -1206,9 +1212,11 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mHomeButtonLongPressDurationMs.ifPresent(longPressDuration -> {
|
if (mLongPressHomeEnabled) {
|
||||||
mHandler.postDelayed(mOnVariableDurationHomeLongClick, longPressDuration);
|
mHomeButtonLongPressDurationMs.ifPresent(longPressDuration -> {
|
||||||
});
|
mHandler.postDelayed(mOnVariableDurationHomeLongClick, longPressDuration);
|
||||||
|
});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_UP:
|
case MotionEvent.ACTION_UP:
|
||||||
case MotionEvent.ACTION_CANCEL:
|
case MotionEvent.ACTION_CANCEL:
|
||||||
@@ -1480,15 +1488,23 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
|
|||||||
| (requestingServices >= 2 ? SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE : 0);
|
| (requestingServices >= 2 ? SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendAssistantAvailability(boolean available) {
|
private void updateAssistantEntrypoints() {
|
||||||
|
mAssistantAvailable = mAssistManagerLazy.get()
|
||||||
|
.getAssistInfoForUser(UserHandle.USER_CURRENT) != null;
|
||||||
|
mLongPressHomeEnabled = Settings.Secure.getInt(mContentResolver,
|
||||||
|
Settings.Secure.ASSIST_LONG_PRESS_HOME_ENABLED, 1) != 0;
|
||||||
|
mAssistantTouchGestureEnabled = Settings.Secure.getInt(mContentResolver,
|
||||||
|
Settings.Secure.ASSIST_TOUCH_GESTURE_ENABLED, 1) != 0;
|
||||||
if (mOverviewProxyService.getProxy() != null) {
|
if (mOverviewProxyService.getProxy() != null) {
|
||||||
try {
|
try {
|
||||||
mOverviewProxyService.getProxy().onAssistantAvailable(available
|
mOverviewProxyService.getProxy().onAssistantAvailable(mAssistantAvailable
|
||||||
|
&& mAssistantTouchGestureEnabled
|
||||||
&& QuickStepContract.isGesturalMode(mNavBarMode));
|
&& QuickStepContract.isGesturalMode(mNavBarMode));
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.w(TAG, "Unable to send assistant availability data to launcher");
|
Log.w(TAG, "Unable to send assistant availability data to launcher");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
reconfigureHomeLongClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Methods that DisplayNavigationBarController talks to -----
|
// ----- Methods that DisplayNavigationBarController talks to -----
|
||||||
|
|||||||
Reference in New Issue
Block a user