DeskClock: Set FLAG_ACTIVITY_NEW_TASK explicitly
* From PendingIntent#getActivity() documentation:
"Note that the activity will be started outside of the context of
an existing activity, so you must use the
Intent.FLAG_ACTIVITY_NEW_TASK launch flag in the Intent."
* Removes the warning
ActivityTaskManager: startActivity called from non-Activity context;
forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent {flg=0x800000
cmp=com.android.deskclock/.timer.* }
Change-Id: I628a5b7fa9e8b00adca3d384dc0a12cb07b8efa8
diff --git a/src/com/android/deskclock/Utils.java b/src/com/android/deskclock/Utils.java
index 7da7b15..4eea6be 100644
--- a/src/com/android/deskclock/Utils.java
+++ b/src/com/android/deskclock/Utils.java
@@ -219,7 +219,9 @@
* @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);
}
/**