Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 005b4724 authored by Fan Zhang's avatar Fan Zhang Committed by Android (Google) Code Review
Browse files

Merge "Rename panic gesture to emergency gesture in Settings"

parents de36a60b f797a48a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -462,11 +462,11 @@
    <!-- Whether to show Smooth Display feature in Settings Options -->
    <bool name="config_show_smooth_display">false</bool>

    <!-- Whether to show panic button gesture in Settings -->
    <bool name="config_show_panic_gesture_settings">true</bool>
    <!-- Whether to show emergency gesture in Settings -->
    <bool name="config_show_emergency_gesture_settings">true</bool>

    <!-- Optional package name if another 1p app wants to take over the panic settings UI -->
    <string name="panic_gesture_settings_package"></string>
    <!-- Optional package name if another 1p app wants to take over the emergency gesture settings UI -->
    <string name="emergency_gesture_settings_package"></string>

    <!-- Whether to show the Preference for Adaptive connectivity -->
    <bool name="config_show_adaptive_connectivity">false</bool>
+5 −5
Original line number Diff line number Diff line
@@ -11049,19 +11049,19 @@
    <string name="ambient_display_tap_screen_summary">To check time, notifications, and other info, tap your screen.</string>
    <!-- Preference title to enable feature for calling emergency services at panic/distress moments[CHAR_LIMIT=60]-->
    <string name="panic_gesture_screen_title">Panic button</string>
    <string name="emergency_gesture_screen_title">Emergency SOS</string>
    <!-- Preference title to enable feature for calling emergency services at panic/distress moments[CHAR_LIMIT=60]-->
    <string name="panic_gesture_entrypoint_summary">Managed by <xliff:g id="app_name" example="Emergency Info">%1$s</xliff:g></string>
    <string name="emergency_gesture_entrypoint_summary">Managed by <xliff:g id="app_name" example="Emergency Info">%1$s</xliff:g></string>
    <!-- Preference summary to enable feature for calling emergency services at panic/distress moments[CHAR_LIMIT=NONE]-->
    <string name="panic_gesture_screen_summary">Start the emergency SOS actions by pressing the power button quickly 5 times.</string>
    <string name="emergency_gesture_screen_summary">Start the emergency SOS actions by pressing the power button quickly 5 times.</string>
    <!-- Preference title to enable generating noisy sound before calling emergency services at panic/distress moments[CHAR_LIMIT=60]-->
    <string name="panic_gesture_sound_setting_title">Warning sound</string>
    <string name="emergency_gesture_sound_setting_title">Warning sound</string>
    <!-- Preference summary to enable generating noisy sound before calling emergency services at panic/distress moments[CHAR_LIMIT=NONE]-->
    <string name="panic_gesture_sound_setting_summary">Alert before starting the actions</string>
    <string name="emergency_gesture_sound_setting_summary">Alert before starting the actions</string>
    <!-- Title text for swiping downwards on fingerprint sensor for notifications [CHAR LIMIT=80]-->
    <string name="fingerprint_swipe_for_notifications_title">Swipe fingerprint for notifications</string>
+10 −10
Original line number Diff line number Diff line
@@ -18,29 +18,29 @@
<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:title="@string/panic_gesture_screen_title">
    android:title="@string/emergency_gesture_screen_title">

    <com.android.settings.widget.VideoPreference
        android:key="panic_button_screen_video"
        android:key="emergency_gesture_screen_video"
        app:animation="@raw/gesture_double_tap"
        app:preview="@drawable/gesture_double_tap"/>

    <SwitchPreference
        android:key="gesture_panic_button"
        android:title="@string/panic_gesture_screen_title"
        android:summary="@string/panic_gesture_screen_summary"
        android:key="gesture_emergency_button"
        android:title="@string/emergency_gesture_screen_title"
        android:summary="@string/emergency_gesture_screen_summary"
        android:icon="@drawable/ic_hand_gesture"
        app:keywords="@string/keywords_gesture"
        app:controller="com.android.settings.gestures.PanicGesturePreferenceController"
        app:controller="com.android.settings.gestures.EmergencyGesturePreferenceController"
        app:allowDividerAbove="true"/>

    <SwitchPreference
        android:key="panic_gesture_sound"
        android:key="emergency_gesture_sound"
        android:icon="@drawable/ic_hearing"
        android:title="@string/panic_gesture_sound_setting_title"
        android:summary="@string/panic_gesture_sound_setting_summary"
        android:title="@string/emergency_gesture_sound_setting_title"
        android:summary="@string/emergency_gesture_sound_setting_summary"
        app:keywords="@string/keywords_gesture"
        app:controller="com.android.settings.gestures.PanicGestureSoundPreferenceController"
        app:controller="com.android.settings.gestures.EmergencyGestureSoundPreferenceController"
        app:allowDividerAbove="true"/>

</PreferenceScreen>
+4 −4
Original line number Diff line number Diff line
@@ -21,10 +21,10 @@
    android:title="@string/gesture_preference_title">

    <Preference
        android:key="gesture_panic_button_summary"
        android:title="@string/panic_gesture_screen_title"
        android:fragment="com.android.settings.gestures.PanicGestureSettings"
        settings:controller="com.android.settings.gestures.PanicGesturePreferenceController" />
        android:key="gesture_emergency_summary"
        android:title="@string/emergency_gesture_screen_title"
        android:fragment="com.android.settings.gestures.EmergencyGestureSettings"
        settings:controller="com.android.settings.gestures.EmergencyGesturePreferenceController" />

    <Preference
        android:key="gesture_assist_input_summary"
+16 −16
Original line number Diff line number Diff line
@@ -31,36 +31,36 @@ import androidx.preference.Preference;
import com.android.settings.R;

/**
 * Preference controller for emergency sos gesture setting
 * Preference controller for emergency gesture setting
 */
public class PanicGesturePreferenceController extends GesturePreferenceController {
    private static final String TAG = "PanicGesturePreferenceC";
public class EmergencyGesturePreferenceController extends GesturePreferenceController {
    private static final String TAG = "EmergencyGesturePref";

    @VisibleForTesting
    static final int ON = 1;
    @VisibleForTesting
    static final int OFF = 0;
    @VisibleForTesting
    static final String ACTION_PANIC_SETTINGS =
            "com.android.settings.action.panic_settings";
    static final String ACTION_EMERGENCY_GESTURE_SETTINGS =
            "com.android.settings.action.emergency_gesture_settings";
    @VisibleForTesting
    Intent mIntent;

    private boolean mUseCustomIntent;

    private static final String PREF_KEY_VIDEO = "panic_button_screen_video";
    private static final String PREF_KEY_VIDEO = "emergency_gesture_screen_video";

    private static final String SECURE_KEY = Settings.Secure.EMERGENCY_GESTURE_ENABLED;

    public PanicGesturePreferenceController(Context context, String key) {
    public EmergencyGesturePreferenceController(Context context, String key) {
        super(context, key);
        final String panicSettingsPackageName = context.getResources().getString(
                R.string.panic_gesture_settings_package);
        if (!TextUtils.isEmpty(panicSettingsPackageName)) {
        final String emergencyGestureSettingsPackageName = context.getResources().getString(
                R.string.emergency_gesture_settings_package);
        if (!TextUtils.isEmpty(emergencyGestureSettingsPackageName)) {
            mUseCustomIntent = true;
            // Use custom intent if it's configured and system can resolve it.
            final Intent intent = new Intent(ACTION_PANIC_SETTINGS)
                    .setPackage(panicSettingsPackageName);
            final Intent intent = new Intent(ACTION_EMERGENCY_GESTURE_SETTINGS)
                    .setPackage(emergencyGestureSettingsPackageName);
            if (canResolveIntent(intent)) {
                mIntent = intent;
            }
@@ -80,7 +80,7 @@ public class PanicGesturePreferenceController extends GesturePreferenceControlle
    @Override
    public int getAvailabilityStatus() {
        final boolean isConfigEnabled = mContext.getResources()
                .getBoolean(R.bool.config_show_panic_gesture_settings);
                .getBoolean(R.bool.config_show_emergency_gesture_settings);

        if (!isConfigEnabled) {
            return UNSUPPORTED_ON_DEVICE;
@@ -90,7 +90,7 @@ public class PanicGesturePreferenceController extends GesturePreferenceControlle

    @Override
    public boolean isSliceable() {
        return TextUtils.equals(getPreferenceKey(), "gesture_panic_button");
        return TextUtils.equals(getPreferenceKey(), "gesture_emergency_button");
    }

    @Override
@@ -102,13 +102,13 @@ public class PanicGesturePreferenceController extends GesturePreferenceControlle
    public CharSequence getSummary() {
        if (mUseCustomIntent) {
            final String packageName = mContext.getResources().getString(
                    R.string.panic_gesture_settings_package);
                    R.string.emergency_gesture_settings_package);
            try {
                final PackageManager pm = mContext.getPackageManager();
                final ApplicationInfo appInfo = pm.getApplicationInfo(
                        packageName, PackageManager.MATCH_DISABLED_COMPONENTS
                                | PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS);
                return mContext.getString(R.string.panic_gesture_entrypoint_summary,
                return mContext.getString(R.string.emergency_gesture_entrypoint_summary,
                        appInfo.loadLabel(pm));
            } catch (Exception e) {
                Log.d(TAG, "Failed to get custom summary, falling back.");
Loading