diff options
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; } } |