diff options
author | Jieli Zhong <jieli.zhong@sony.com> | 2022-11-15 23:36:19 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-11-15 23:36:19 +0000 |
commit | bf30c5d63ea368302bc560986495613c330119b3 (patch) | |
tree | 3adec76088e16eaff4bda3a6a297cde4b49742d3 /EmergencyGestureAction | |
parent | 9d54ae80aa38ebf54257e44bbb0e0e0b34761991 (diff) | |
parent | f594a96a21ffc271fccc2d3ebac8becdf8d08c02 (diff) | |
download | EmergencyInfo-bf30c5d63ea368302bc560986495613c330119b3.tar.gz |
Set default value for countdown alarm and Emergency SOS am: f594a96a21
Original change: https://android-review.googlesource.com/c/platform/packages/apps/EmergencyInfo/+/2282376
Change-Id: I5d209fe82dc50580289af3d396fb3481da92944d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'EmergencyGestureAction')
3 files changed, 18 insertions, 2 deletions
diff --git a/EmergencyGestureAction/src/com/android/emergency/action/EmergencyActionActivity.java b/EmergencyGestureAction/src/com/android/emergency/action/EmergencyActionActivity.java index 63c1fd1b..34a31b10 100644 --- a/EmergencyGestureAction/src/com/android/emergency/action/EmergencyActionActivity.java +++ b/EmergencyGestureAction/src/com/android/emergency/action/EmergencyActionActivity.java @@ -17,6 +17,7 @@ package com.android.emergency.action; import static com.android.settingslib.emergencynumber.EmergencyNumberUtils.EMERGENCY_SETTING_ON; +import static com.android.settingslib.emergencynumber.EmergencyNumberUtils.EMERGENCY_SETTING_OFF; import android.annotation.Nullable; import android.os.Bundle; @@ -26,6 +27,7 @@ import android.util.Log; import android.view.WindowInsets; import android.view.WindowInsetsController; +import com.android.emergency.action.EmergencyActionUtils; import com.android.emergency.R; /** @@ -40,7 +42,9 @@ public class EmergencyActionActivity extends FragmentActivity { super.onCreate(savedInstanceState); setContentView(R.layout.emergency_action_activity); if (Settings.Secure.getInt(getContentResolver(), - Settings.Secure.EMERGENCY_GESTURE_ENABLED, EMERGENCY_SETTING_ON) + Settings.Secure.EMERGENCY_GESTURE_ENABLED, + EmergencyActionUtils.isDefaultEmergencyGestureEnabled(this) ? + EMERGENCY_SETTING_ON : EMERGENCY_SETTING_OFF) != EMERGENCY_SETTING_ON) { Log.w(TAG, "Emergency gesture is not enabled, exiting"); finish(); diff --git a/EmergencyGestureAction/src/com/android/emergency/action/EmergencyActionUtils.java b/EmergencyGestureAction/src/com/android/emergency/action/EmergencyActionUtils.java index 347bbcad..88ddcb16 100644 --- a/EmergencyGestureAction/src/com/android/emergency/action/EmergencyActionUtils.java +++ b/EmergencyGestureAction/src/com/android/emergency/action/EmergencyActionUtils.java @@ -39,4 +39,14 @@ public class EmergencyActionUtils { context.getContentResolver().call(EMERGENCY_ACTION_AUTHORITY, ACTION_START_EMERGENCY_CALL, null, null); } + + public static boolean isDefaultEmergencyGestureEnabled(Context context) { + return context.getResources().getBoolean( + com.android.internal.R.bool.config_defaultEmergencyGestureEnabled); + } + + public static boolean isDefaultEmergencyGestureSoundEnabled(Context context) { + return context.getResources().getBoolean( + com.android.internal.R.bool.config_defaultEmergencyGestureSoundEnabled); + } } diff --git a/EmergencyGestureAction/src/com/android/emergency/action/sensoryfeedback/EmergencyActionAlarmHelper.java b/EmergencyGestureAction/src/com/android/emergency/action/sensoryfeedback/EmergencyActionAlarmHelper.java index b2d6ff61..64043262 100644 --- a/EmergencyGestureAction/src/com/android/emergency/action/sensoryfeedback/EmergencyActionAlarmHelper.java +++ b/EmergencyGestureAction/src/com/android/emergency/action/sensoryfeedback/EmergencyActionAlarmHelper.java @@ -23,6 +23,7 @@ import android.media.MediaPlayer; import android.provider.Settings; import android.util.Log; +import com.android.emergency.action.EmergencyActionUtils; import com.android.emergency.R; @@ -115,6 +116,7 @@ public class EmergencyActionAlarmHelper { private boolean isPlayWarningSoundEnabled() { return Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.EMERGENCY_GESTURE_SOUND_ENABLED, 0) != 0; + Settings.Secure.EMERGENCY_GESTURE_SOUND_ENABLED, + EmergencyActionUtils.isDefaultEmergencyGestureSoundEnabled(mContext) ? 1 : 0) != 0; } } |