Update summary of Gesture
when quick gesture enabled, update summary to reflect correct status Bug: 138149556 Test: manual & robotest Change-Id: I072134cd8327ad5eb1d0862604acef83e1bdcec0
This commit is contained in:
@@ -29,4 +29,8 @@ public interface AwareFeatureProvider {
|
|||||||
|
|
||||||
/** Show information dialog. */
|
/** Show information dialog. */
|
||||||
void showRestrictionDialog(Fragment parent);
|
void showRestrictionDialog(Fragment parent);
|
||||||
|
|
||||||
|
/** Return Quick Gestures Summary. */
|
||||||
|
CharSequence getGestureSummary(Context context, boolean sensorSupported,
|
||||||
|
boolean assistGestureEnabled, boolean assistGestureSilenceEnabled);
|
||||||
}
|
}
|
||||||
|
@@ -34,4 +34,10 @@ public class AwareFeatureProviderImpl implements AwareFeatureProvider {
|
|||||||
@Override
|
@Override
|
||||||
public void showRestrictionDialog(Fragment parent) {
|
public void showRestrictionDialog(Fragment parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CharSequence getGestureSummary(Context context, boolean sensorSupported,
|
||||||
|
boolean assistGestureEnabled, boolean assistGestureSilenceEnabled) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,10 +20,12 @@ import android.content.ContentResolver;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.hardware.display.AmbientDisplayConfiguration;
|
import android.hardware.display.AmbientDisplayConfiguration;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.aware.AwareFeatureProvider;
|
||||||
import com.android.settings.core.BasePreferenceController;
|
import com.android.settings.core.BasePreferenceController;
|
||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
import com.android.settingslib.core.AbstractPreferenceController;
|
||||||
@@ -33,6 +35,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class GesturesSettingPreferenceController extends BasePreferenceController {
|
public class GesturesSettingPreferenceController extends BasePreferenceController {
|
||||||
private final AssistGestureFeatureProvider mFeatureProvider;
|
private final AssistGestureFeatureProvider mFeatureProvider;
|
||||||
|
private final AwareFeatureProvider mAwareFeatureProvider;
|
||||||
private List<AbstractPreferenceController> mGestureControllers;
|
private List<AbstractPreferenceController> mGestureControllers;
|
||||||
|
|
||||||
private static final String KEY_GESTURES_SETTINGS = "gesture_settings";
|
private static final String KEY_GESTURES_SETTINGS = "gesture_settings";
|
||||||
@@ -41,6 +44,7 @@ public class GesturesSettingPreferenceController extends BasePreferenceControlle
|
|||||||
public GesturesSettingPreferenceController(Context context) {
|
public GesturesSettingPreferenceController(Context context) {
|
||||||
super(context, KEY_GESTURES_SETTINGS);
|
super(context, KEY_GESTURES_SETTINGS);
|
||||||
mFeatureProvider = FeatureFactory.getFactory(context).getAssistGestureFeatureProvider();
|
mFeatureProvider = FeatureFactory.getFactory(context).getAssistGestureFeatureProvider();
|
||||||
|
mAwareFeatureProvider = FeatureFactory.getFactory(context).getAwareFeatureProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -90,8 +94,15 @@ public class GesturesSettingPreferenceController extends BasePreferenceControlle
|
|||||||
contentResolver, Settings.Secure.ASSIST_GESTURE_ENABLED, 1) != 0;
|
contentResolver, Settings.Secure.ASSIST_GESTURE_ENABLED, 1) != 0;
|
||||||
final boolean assistGestureSilenceEnabled = Settings.Secure.getInt(
|
final boolean assistGestureSilenceEnabled = Settings.Secure.getInt(
|
||||||
contentResolver, Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, 1) != 0;
|
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(
|
return mContext.getText(
|
||||||
R.string.language_input_gesture_summary_on_with_assist);
|
R.string.language_input_gesture_summary_on_with_assist);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user