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

Commit 8c4146c0 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

Merge remote-tracking branch 'origin/lineage-20.0' into v1-t

parents 1fddc237 b6ac55ff
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ import com.android.deskclock.data.DataModel.SilentSetting;
import com.android.deskclock.data.OnSilentSettingsListener;
import com.android.deskclock.events.Events;
import com.android.deskclock.provider.Alarm;
import com.android.deskclock.stopwatch.StopwatchService;
import com.android.deskclock.timer.TimerService;
import com.android.deskclock.uidata.TabListener;
import com.android.deskclock.uidata.UiDataModel;
@@ -295,10 +296,18 @@ public class DeskClock extends BaseActivity
        final Intent intent = getIntent();
        if (intent != null) {
            final String action = intent.getAction();
            if (action != null && action.equals(TimerService.ACTION_SHOW_TIMER)) {
            if (action != null ) {
                int label = intent.getIntExtra(Events.EXTRA_EVENT_LABEL, R.string.label_intent);
                switch (action) {
                    case TimerService.ACTION_SHOW_TIMER:
                        Events.sendTimerEvent(R.string.action_show, label);
                        UiDataModel.getUiDataModel().setSelectedTab(UiDataModel.Tab.TIMERS);
                        break;
                    case StopwatchService.ACTION_SHOW_STOPWATCH:
                        Events.sendStopwatchEvent(R.string.action_show, label);
                        UiDataModel.getUiDataModel().setSelectedTab(UiDataModel.Tab.STOPWATCH);
                        break;
                }
            }
        }

+3 −1
Original line number Diff line number Diff line
@@ -219,7 +219,9 @@ public class Utils {
     * @return a PendingIntent that will start an activity
     */
    public static PendingIntent pendingActivityIntent(Context context, Intent intent) {
        return PendingIntent.getActivity(context, 0, intent, FLAG_UPDATE_CURRENT | FLAG_IMMUTABLE);
        // explicitly set the flag here, as getActivity() documentation states we must do so
        return PendingIntent.getActivity(context, 0, intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
                FLAG_UPDATE_CURRENT | FLAG_IMMUTABLE);
    }

    /**
+3 −4
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import androidx.core.app.NotificationCompat.Action;
import androidx.core.app.NotificationCompat.Builder;
import androidx.core.content.ContextCompat;

import com.android.deskclock.DeskClock;
import com.android.deskclock.NotificationUtils;
import com.android.deskclock.R;
import com.android.deskclock.Utils;
@@ -52,13 +53,11 @@ class StopwatchNotificationBuilder {
        @StringRes final int eventLabel = R.string.label_notification;

        // Intent to load the app when the notification is tapped.
        final Intent showApp = new Intent(context, StopwatchService.class)
        final Intent showApp = new Intent(context, DeskClock.class)
                .setAction(StopwatchService.ACTION_SHOW_STOPWATCH)
                .putExtra(Events.EXTRA_EVENT_LABEL, eventLabel);

        final PendingIntent pendingShowApp = PendingIntent.getService(context, 0, showApp,
                PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT |
                PendingIntent.FLAG_IMMUTABLE);
        final PendingIntent pendingShowApp = Utils.pendingActivityIntent(context, showApp);

        // Compute some values required below.
        final boolean running = stopwatch.isRunning();
+0 −10
Original line number Diff line number Diff line
@@ -60,16 +60,6 @@ public final class StopwatchService extends Service {
        final String action = intent.getAction();
        final int label = intent.getIntExtra(Events.EXTRA_EVENT_LABEL, R.string.label_intent);
        switch (action) {
            case ACTION_SHOW_STOPWATCH: {
                Events.sendStopwatchEvent(R.string.action_show, label);

                // Open DeskClock positioned on the stopwatch tab.
                UiDataModel.getUiDataModel().setSelectedTab(STOPWATCH);
                final Intent showStopwatch = new Intent(this, DeskClock.class)
                        .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(showStopwatch);
                break;
            }
            case ACTION_START_STOPWATCH: {
                Events.sendStopwatchEvent(R.string.action_start, label);
                DataModel.getDataModel().startStopwatch();