am a2e0e3b5: am 27e20ccd: Merge "Fix issue #6073913: onActivityResult() not getting called..." into ics-mr1

* commit 'a2e0e3b5f63dc741fd5e54f45f8dde1a3cb58c6c':
  Fix issue #6073913: onActivityResult() not getting called...
This commit is contained in:
Dianne Hackborn
2012-02-28 15:07:43 -08:00
committed by Android Git Automerger
2 changed files with 31 additions and 33 deletions

View File

@ -2730,14 +2730,7 @@ public final class ActivityManagerService extends ActivityManagerNative
r.task.taskId, r.shortComponentName,
"proc died without state saved");
}
r.makeFinishing();
mMainStack.mHistory.remove(i);
r.takeFromHistory();
mWindowManager.removeAppToken(r.appToken);
if (VALIDATE_TOKENS) {
mMainStack.validateAppTokensLocked();
}
r.removeUriPermissionsLocked();
mMainStack.removeActivityFromHistoryLocked(r);
} else {
// We have the current state for this activity, so

View File

@ -3362,6 +3362,33 @@ final class ActivityStack {
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
* list, or false if it is still in the list and will be removed later.
@ -3400,30 +3427,7 @@ final class ActivityStack {
}
}
// 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;
finishActivityResultsLocked(r, resultCode, resultData);
if (mService.mPendingThumbnails.size() > 0) {
// There are clients waiting to receive thumbnails so, in case
@ -3586,8 +3590,9 @@ final class ActivityStack {
mHandler.removeMessages(DESTROY_TIMEOUT_MSG, r);
}
private final void removeActivityFromHistoryLocked(ActivityRecord r) {
final void removeActivityFromHistoryLocked(ActivityRecord r) {
if (r.state != ActivityState.DESTROYED) {
finishActivityResultsLocked(r, Activity.RESULT_CANCELED, null);
r.makeFinishing();
if (DEBUG_ADD_REMOVE) {
RuntimeException here = new RuntimeException("here");