return activityInfo.persistableMode == ActivityInfo.PERSIST_ACROSS_REBOOTS;
}
+ public boolean isInStack() {
+ try {
+ int stackId = ActivityManagerNative.getDefault().getActivityStackId(token);
+ int taskId = ActivityManagerNative.getDefault().getTaskForActivity(token, false);
+ // INVALID_STACK_ID = -1 and INVALID_TASK_ID = -1
+ if (stackId != -1 && taskId != -1) {
+ return true;
+ }
+ } catch (RemoteException e) {
+ Log.w(TAG, "remote exception occur while check the task and stack of activity:"
+ + this.toString(), e);
+ }
+ return false;
+ }
+
public String toString() {
ComponentName componentName = intent != null ? intent.getComponent() : null;
return "ActivityRecord{"
}
private void handleLaunchActivity(ActivityClientRecord r, Intent customIntent, String reason) {
+ // can not launch the activity that its taskId or stackId is invalid.
+ if (!r.isInStack()) {
+ Log.w(TAG,"handleLaunchActivity stack or task is invalid, can not launch it, r:" + r);
+ return;
+ }
+
// If we are getting ready to gc after going to the background, well
// we are back active so skip it.
unscheduleGcIdler();