summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaj Yengisetty <rajesh@cyngn.com>2015-01-26 12:02:25 -0800
committerGerrit Code Review <gerrit@cyanogenmod.org>2015-02-05 01:17:52 +0000
commitf58422e6775518c352bfd983e46589bbf642692d (patch)
treef011e5ea3d3d0f1c476340425a2fe88ec09d515e
parent3191a91e0c5119eac7ba29f9ae20ce29eb745a92 (diff)
downloadandroid_packages_apps_DeskClock-f58422e6775518c352bfd983e46589bbf642692d.tar.gz
android_packages_apps_DeskClock-f58422e6775518c352bfd983e46589bbf642692d.tar.bz2
android_packages_apps_DeskClock-f58422e6775518c352bfd983e46589bbf642692d.zip
DeskClock: Handle alarm playback when the uri is not valid
- If the user deletes the file that the alarm URI is pointing to recover gracefully by falling back to system default alarm when it's time to play the alarm. - This was already fixed if the user returns to the app before the alarm goes off and checks the UI, but if the user never goes back to the app after deleting the file, the playback is broken (will default to silent). Change-Id: I3896ae37b4c8252ba8d55d7660696a01cdc4d4df
-rwxr-xr-xsrc/com/android/deskclock/alarms/AlarmKlaxon.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/com/android/deskclock/alarms/AlarmKlaxon.java b/src/com/android/deskclock/alarms/AlarmKlaxon.java
index 85b890afa..ba728cc8c 100755
--- a/src/com/android/deskclock/alarms/AlarmKlaxon.java
+++ b/src/com/android/deskclock/alarms/AlarmKlaxon.java
@@ -133,6 +133,12 @@ public class AlarmKlaxon {
} else if (!Utils.isRingToneUriValid(context, alarmNoise)) {
alarmNoise = RingtoneManager.getActualDefaultRingtoneUri(context,
RingtoneManager.TYPE_ALARM);
+
+ // Verify that the default Uri is actually valid, if not get system default
+ if (!Utils.isRingToneUriValid(context, alarmNoise)) {
+ alarmNoise = Utils.getSystemDefaultAlarm(context);
+ }
+
}
final Context appContext = context.getApplicationContext();