Loading services/java/com/android/server/am/ActivityManagerService.java +1 −8 Original line number Original line Diff line number Diff line Loading @@ -2792,14 +2792,7 @@ public final class ActivityManagerService extends ActivityManagerNative r.task.taskId, r.shortComponentName, r.task.taskId, r.shortComponentName, "proc died without state saved"); "proc died without state saved"); } } r.makeFinishing(); mMainStack.removeActivityFromHistoryLocked(r); mMainStack.mHistory.remove(i); r.takeFromHistory(); mWindowManager.removeAppToken(r.appToken); if (VALIDATE_TOKENS) { mMainStack.validateAppTokensLocked(); } r.removeUriPermissionsLocked(); } else { } else { // We have the current state for this activity, so // We have the current state for this activity, so Loading services/java/com/android/server/am/ActivityStack.java +30 −25 Original line number Original line Diff line number Diff line Loading @@ -3414,6 +3414,33 @@ final class ActivityStack { return true; return true; } } final void finishActivityResultsLocked(ActivityRecord r, int resultCode, Intent resultData) { // send the result ActivityRecord resultTo = r.resultTo; if (resultTo != null) { if (DEBUG_RESULTS) Slog.v(TAG, "Adding result to " + resultTo + " who=" + r.resultWho + " req=" + r.requestCode + " res=" + resultCode + " data=" + resultData); if (r.info.applicationInfo.uid > 0) { mService.grantUriPermissionFromIntentLocked(r.info.applicationInfo.uid, resultTo.packageName, resultData, resultTo.getUriPermissionsLocked()); } resultTo.addResultLocked(r, r.resultWho, r.requestCode, resultCode, resultData); r.resultTo = null; } else if (DEBUG_RESULTS) Slog.v(TAG, "No result destination from " + r); // Make sure this HistoryRecord is not holding on to other resources, // because clients have remote IPC references to this object so we // can't assume that will go away and want to avoid circular IPC refs. r.results = null; r.pendingResults = null; r.newIntents = null; r.icicle = null; } /** /** * @return Returns true if this activity has been removed from the history * @return Returns true if this activity has been removed from the history * list, or false if it is still in the list and will be removed later. * list, or false if it is still in the list and will be removed later. Loading Loading @@ -3452,30 +3479,7 @@ final class ActivityStack { } } } } // send the result finishActivityResultsLocked(r, resultCode, resultData); ActivityRecord resultTo = r.resultTo; if (resultTo != null) { if (DEBUG_RESULTS) Slog.v(TAG, "Adding result to " + resultTo + " who=" + r.resultWho + " req=" + r.requestCode + " res=" + resultCode + " data=" + resultData); if (r.info.applicationInfo.uid > 0) { mService.grantUriPermissionFromIntentLocked(r.info.applicationInfo.uid, resultTo.packageName, resultData, resultTo.getUriPermissionsLocked()); } resultTo.addResultLocked(r, r.resultWho, r.requestCode, resultCode, resultData); r.resultTo = null; } else if (DEBUG_RESULTS) Slog.v(TAG, "No result destination from " + r); // Make sure this HistoryRecord is not holding on to other resources, // because clients have remote IPC references to this object so we // can't assume that will go away and want to avoid circular IPC refs. r.results = null; r.pendingResults = null; r.newIntents = null; r.icicle = null; if (mService.mPendingThumbnails.size() > 0) { if (mService.mPendingThumbnails.size() > 0) { // There are clients waiting to receive thumbnails so, in case // There are clients waiting to receive thumbnails so, in case Loading Loading @@ -3638,8 +3642,9 @@ final class ActivityStack { mHandler.removeMessages(DESTROY_TIMEOUT_MSG, r); mHandler.removeMessages(DESTROY_TIMEOUT_MSG, r); } } private final void removeActivityFromHistoryLocked(ActivityRecord r) { final void removeActivityFromHistoryLocked(ActivityRecord r) { if (r.state != ActivityState.DESTROYED) { if (r.state != ActivityState.DESTROYED) { finishActivityResultsLocked(r, Activity.RESULT_CANCELED, null); r.makeFinishing(); r.makeFinishing(); if (DEBUG_ADD_REMOVE) { if (DEBUG_ADD_REMOVE) { RuntimeException here = new RuntimeException("here"); RuntimeException here = new RuntimeException("here"); Loading Loading
services/java/com/android/server/am/ActivityManagerService.java +1 −8 Original line number Original line Diff line number Diff line Loading @@ -2792,14 +2792,7 @@ public final class ActivityManagerService extends ActivityManagerNative r.task.taskId, r.shortComponentName, r.task.taskId, r.shortComponentName, "proc died without state saved"); "proc died without state saved"); } } r.makeFinishing(); mMainStack.removeActivityFromHistoryLocked(r); mMainStack.mHistory.remove(i); r.takeFromHistory(); mWindowManager.removeAppToken(r.appToken); if (VALIDATE_TOKENS) { mMainStack.validateAppTokensLocked(); } r.removeUriPermissionsLocked(); } else { } else { // We have the current state for this activity, so // We have the current state for this activity, so Loading
services/java/com/android/server/am/ActivityStack.java +30 −25 Original line number Original line Diff line number Diff line Loading @@ -3414,6 +3414,33 @@ final class ActivityStack { return true; return true; } } final void finishActivityResultsLocked(ActivityRecord r, int resultCode, Intent resultData) { // send the result ActivityRecord resultTo = r.resultTo; if (resultTo != null) { if (DEBUG_RESULTS) Slog.v(TAG, "Adding result to " + resultTo + " who=" + r.resultWho + " req=" + r.requestCode + " res=" + resultCode + " data=" + resultData); if (r.info.applicationInfo.uid > 0) { mService.grantUriPermissionFromIntentLocked(r.info.applicationInfo.uid, resultTo.packageName, resultData, resultTo.getUriPermissionsLocked()); } resultTo.addResultLocked(r, r.resultWho, r.requestCode, resultCode, resultData); r.resultTo = null; } else if (DEBUG_RESULTS) Slog.v(TAG, "No result destination from " + r); // Make sure this HistoryRecord is not holding on to other resources, // because clients have remote IPC references to this object so we // can't assume that will go away and want to avoid circular IPC refs. r.results = null; r.pendingResults = null; r.newIntents = null; r.icicle = null; } /** /** * @return Returns true if this activity has been removed from the history * @return Returns true if this activity has been removed from the history * list, or false if it is still in the list and will be removed later. * list, or false if it is still in the list and will be removed later. Loading Loading @@ -3452,30 +3479,7 @@ final class ActivityStack { } } } } // send the result finishActivityResultsLocked(r, resultCode, resultData); ActivityRecord resultTo = r.resultTo; if (resultTo != null) { if (DEBUG_RESULTS) Slog.v(TAG, "Adding result to " + resultTo + " who=" + r.resultWho + " req=" + r.requestCode + " res=" + resultCode + " data=" + resultData); if (r.info.applicationInfo.uid > 0) { mService.grantUriPermissionFromIntentLocked(r.info.applicationInfo.uid, resultTo.packageName, resultData, resultTo.getUriPermissionsLocked()); } resultTo.addResultLocked(r, r.resultWho, r.requestCode, resultCode, resultData); r.resultTo = null; } else if (DEBUG_RESULTS) Slog.v(TAG, "No result destination from " + r); // Make sure this HistoryRecord is not holding on to other resources, // because clients have remote IPC references to this object so we // can't assume that will go away and want to avoid circular IPC refs. r.results = null; r.pendingResults = null; r.newIntents = null; r.icicle = null; if (mService.mPendingThumbnails.size() > 0) { if (mService.mPendingThumbnails.size() > 0) { // There are clients waiting to receive thumbnails so, in case // There are clients waiting to receive thumbnails so, in case Loading Loading @@ -3638,8 +3642,9 @@ final class ActivityStack { mHandler.removeMessages(DESTROY_TIMEOUT_MSG, r); mHandler.removeMessages(DESTROY_TIMEOUT_MSG, r); } } private final void removeActivityFromHistoryLocked(ActivityRecord r) { final void removeActivityFromHistoryLocked(ActivityRecord r) { if (r.state != ActivityState.DESTROYED) { if (r.state != ActivityState.DESTROYED) { finishActivityResultsLocked(r, Activity.RESULT_CANCELED, null); r.makeFinishing(); r.makeFinishing(); if (DEBUG_ADD_REMOVE) { if (DEBUG_ADD_REMOVE) { RuntimeException here = new RuntimeException("here"); RuntimeException here = new RuntimeException("here"); Loading