Merge branch 'lineage-21.0' of https://github.com/LineageOS/android_packages_apps_DeskClock into leaf-3.1

Change-Id: Ie1b7955579e5753aab54ab476e7d0d79c31afe9c
diff --git a/res/values-sc-rIT/cm_strings.xml b/res/values-sc-rIT/cm_strings.xml
index 844fa3d..714f3cf 100644
--- a/res/values-sc-rIT/cm_strings.xml
+++ b/res/values-sc-rIT/cm_strings.xml
@@ -18,7 +18,8 @@
 <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string-array name="action_setting_entries">
         <item>Snooze</item>
-        <item>Dismiss</item>
+        <item>Iscarta</item>
         <item>Nudda</item>
     </string-array>
+    <string name="dialog_permissions_dismiss">Iscarta</string>
 </resources>
diff --git a/src/com/android/deskclock/AlarmInitReceiver.java b/src/com/android/deskclock/AlarmInitReceiver.java
index 8361542..557afd8 100644
--- a/src/com/android/deskclock/AlarmInitReceiver.java
+++ b/src/com/android/deskclock/AlarmInitReceiver.java
@@ -16,6 +16,8 @@
 
 package com.android.deskclock;
 
+import static com.android.deskclock.DeskClockBackupAgent.ACTION_COMPLETE_RESTORE;
+
 import android.annotation.SuppressLint;
 import android.content.BroadcastReceiver;
 import android.content.ContentResolver;
@@ -75,6 +77,12 @@
         // We need to increment the global id out of the async task to prevent race conditions
         DataModel.getDataModel().updateGlobalIntentId();
 
+        if (ACTION_COMPLETE_RESTORE.equals(action)) {
+            // Our "minimalist" state in DeskClockBackupAgent's onRestoreFinished prevents
+            // accessing the data model from there, so we set this here.
+            DataModel.getDataModel().setRestoreBackupFinished(true);
+        }
+
         // Updates stopwatch and timer data after a device reboot so they are as accurate as
         // possible.
         if (ACTION_BOOT_COMPLETED.equals(action)) {
diff --git a/src/com/android/deskclock/DeskClockBackupAgent.java b/src/com/android/deskclock/DeskClockBackupAgent.java
index 97fddf4..3de0b4a 100644
--- a/src/com/android/deskclock/DeskClockBackupAgent.java
+++ b/src/com/android/deskclock/DeskClockBackupAgent.java
@@ -83,8 +83,9 @@
         // TODO: migrate restored database and preferences over into
         // the device-encrypted storage area
 
-        // Indicate a data restore has been completed.
-        DataModel.getDataModel().setRestoreBackupFinished(true);
+        // We are executing in a "minimalist" state in which DataModel.getDataModel() unexpectedly
+        // returns null, so we must call setRestoreBackupFinished in AlarmInitReceiver's handling
+        // of ACTION_COMPLETE_RESTORE instead.
 
         // Create an Intent to send into DeskClock indicating restore is complete.
         final PendingIntent restoreIntent = PendingIntent.getBroadcast(this, 0,