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

Commit ac1506f1 authored by James Lemieux's avatar James Lemieux
Browse files

Rebuild notifications after app upgrade

Bug: 26676584
Change-Id: If6e905328265ad626ad9cc19b0ff6f128bdfe3a4
parent a21a311d
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ public class AlarmInitReceiver extends BroadcastReceiver {
     *     <li>Reset timers and stopwatch on ACTION_BOOT_COMPLETED</li>
     *     <li>Fix alarm states on ACTION_BOOT_COMPLETED, TIME_SET, TIMEZONE_CHANGED,
     *     and LOCALE_CHANGED</li>
     *     <li>Rebuild notifications on MY_PACKAGE_REPLACED</li>
     * </ul>
     */
    @Override
@@ -58,6 +59,12 @@ public class AlarmInitReceiver extends BroadcastReceiver {
            DataModel.getDataModel().resetTimers(R.string.label_reboot);
        }

        // Notifications are canceled by the system on application upgrade. This broadcast signals
        // that the new app is free to rebuild the notifications using the existing data.
        if (Intent.ACTION_MY_PACKAGE_REPLACED.equals(action)) {
            DataModel.getDataModel().updateAllNotifications();
        }

        AsyncHandler.post(new Runnable() {
            @Override
            public void run() {
+9 −0
Original line number Diff line number Diff line
@@ -152,6 +152,15 @@ public final class DataModel {
        return mNotificationModel.isApplicationInForeground();
    }

    /**
     * Called when the notifications may be stale or absent from the notification manager and must
     * be rebuilt. e.g. after upgrading the application
     */
    public void updateAllNotifications() {
        mTimerModel.updateNotification();
        mStopwatchModel.updateNotification();
    }

    //
    // Cities
    //