Update summary of Gesture
when quick gesture enabled, update summary to reflect correct status
Bug: 138149556
Test: manual & robotest
Change-Id: I072134cd8327ad5eb1d0862604acef83e1bdcec0
diff --git a/src/com/android/settings/aware/AwareFeatureProvider.java b/src/com/android/settings/aware/AwareFeatureProvider.java
index bda27c7..a4e9c0c 100644
--- a/src/com/android/settings/aware/AwareFeatureProvider.java
+++ b/src/com/android/settings/aware/AwareFeatureProvider.java
@@ -29,4 +29,8 @@
/** Show information dialog. */
void showRestrictionDialog(Fragment parent);
+
+ /** Return Quick Gestures Summary. */
+ CharSequence getGestureSummary(Context context, boolean sensorSupported,
+ boolean assistGestureEnabled, boolean assistGestureSilenceEnabled);
}
diff --git a/src/com/android/settings/aware/AwareFeatureProviderImpl.java b/src/com/android/settings/aware/AwareFeatureProviderImpl.java
index 5d16031..6f80d8a 100644
--- a/src/com/android/settings/aware/AwareFeatureProviderImpl.java
+++ b/src/com/android/settings/aware/AwareFeatureProviderImpl.java
@@ -34,4 +34,10 @@
@Override
public void showRestrictionDialog(Fragment parent) {
}
+
+ @Override
+ public CharSequence getGestureSummary(Context context, boolean sensorSupported,
+ boolean assistGestureEnabled, boolean assistGestureSilenceEnabled) {
+ return null;
+ }
}
diff --git a/src/com/android/settings/gestures/GesturesSettingPreferenceController.java b/src/com/android/settings/gestures/GesturesSettingPreferenceController.java
index 98eddff..9d4d538 100644
--- a/src/com/android/settings/gestures/GesturesSettingPreferenceController.java
+++ b/src/com/android/settings/gestures/GesturesSettingPreferenceController.java
@@ -20,10 +20,12 @@
import android.content.Context;
import android.hardware.display.AmbientDisplayConfiguration;
import android.provider.Settings;
+import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.android.settings.R;
+import com.android.settings.aware.AwareFeatureProvider;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.core.AbstractPreferenceController;
@@ -33,6 +35,7 @@
public class GesturesSettingPreferenceController extends BasePreferenceController {
private final AssistGestureFeatureProvider mFeatureProvider;
+ private final AwareFeatureProvider mAwareFeatureProvider;
private List<AbstractPreferenceController> mGestureControllers;
private static final String KEY_GESTURES_SETTINGS = "gesture_settings";
@@ -41,6 +44,7 @@
public GesturesSettingPreferenceController(Context context) {
super(context, KEY_GESTURES_SETTINGS);
mFeatureProvider = FeatureFactory.getFactory(context).getAssistGestureFeatureProvider();
+ mAwareFeatureProvider = FeatureFactory.getFactory(context).getAwareFeatureProvider();
}
@Override
@@ -90,8 +94,15 @@
contentResolver, Settings.Secure.ASSIST_GESTURE_ENABLED, 1) != 0;
final boolean assistGestureSilenceEnabled = Settings.Secure.getInt(
contentResolver, Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, 1) != 0;
+ final boolean sensorSupported = mFeatureProvider.isSupported(mContext);
- if (mFeatureProvider.isSupported(mContext) && assistGestureEnabled) {
+ final CharSequence awareSummary = mAwareFeatureProvider.getGestureSummary(mContext,
+ sensorSupported, assistGestureEnabled, assistGestureSilenceEnabled);
+ if (!TextUtils.isEmpty(awareSummary)) {
+ return awareSummary;
+ }
+
+ if (sensorSupported && assistGestureEnabled) {
return mContext.getText(
R.string.language_input_gesture_summary_on_with_assist);
}