Merge "Remove unnecessary removeFromApp parameter"
This commit is contained in:
@@ -2786,8 +2786,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
}
|
||||
makeFinishingLocked();
|
||||
|
||||
final boolean activityRemoved = destroyImmediately(true /* removeFromApp */,
|
||||
"finish-imm:" + reason);
|
||||
final boolean activityRemoved = destroyImmediately("finish-imm:" + reason);
|
||||
|
||||
// If the display does not have running activity, the configuration may need to be
|
||||
// updated for restoring original orientation of the display.
|
||||
@@ -2835,7 +2834,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
* @return {@code true} if activity was immediately removed from history, {@code false}
|
||||
* otherwise.
|
||||
*/
|
||||
boolean destroyImmediately(boolean removeFromApp, String reason) {
|
||||
boolean destroyImmediately(String reason) {
|
||||
if (DEBUG_SWITCH || DEBUG_CLEANUP) {
|
||||
Slog.v(TAG_SWITCH, "Removing activity from " + reason + ": token=" + this
|
||||
+ ", app=" + (hasProcess() ? app.mName : "(null)"));
|
||||
@@ -2857,17 +2856,15 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
cleanUp(false /* cleanServices */, false /* setState */);
|
||||
|
||||
if (hasProcess()) {
|
||||
if (removeFromApp) {
|
||||
app.removeActivity(this, true /* keepAssociation */);
|
||||
if (!app.hasActivities()) {
|
||||
mAtmService.clearHeavyWeightProcessIfEquals(app);
|
||||
// Update any services we are bound to that might care about whether
|
||||
// their client may have activities.
|
||||
// No longer have activities, so update LRU list and oom adj.
|
||||
app.updateProcessInfo(true /* updateServiceConnectionActivities */,
|
||||
false /* activityChange */, true /* updateOomAdj */,
|
||||
false /* addPendingTopUid */);
|
||||
}
|
||||
app.removeActivity(this, true /* keepAssociation */);
|
||||
if (!app.hasActivities()) {
|
||||
mAtmService.clearHeavyWeightProcessIfEquals(app);
|
||||
// Update any services we are bound to that might care about whether
|
||||
// their client may have activities.
|
||||
// No longer have activities, so update LRU list and oom adj.
|
||||
app.updateProcessInfo(true /* updateServiceConnectionActivities */,
|
||||
false /* activityChange */, true /* updateOomAdj */,
|
||||
false /* addPendingTopUid */);
|
||||
}
|
||||
|
||||
boolean skipDestroy = false;
|
||||
@@ -2934,7 +2931,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
+ " pausing=" + stack.mPausingActivity
|
||||
+ " for reason " + reason);
|
||||
}
|
||||
return destroyImmediately(true /* removeFromApp */, reason);
|
||||
return destroyImmediately(reason);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -5122,7 +5119,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
if (DEBUG_STATES) Slog.v(TAG_STATES, "Stop failed; moving to STOPPED: " + this);
|
||||
setState(STOPPED, "stopIfPossible");
|
||||
if (deferRelaunchUntilPaused) {
|
||||
destroyImmediately(true /* removeFromApp */, "stop-except");
|
||||
destroyImmediately("stop-except");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5163,7 +5160,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
clearOptionsLocked();
|
||||
} else {
|
||||
if (deferRelaunchUntilPaused) {
|
||||
destroyImmediately(true /* removeFromApp */, "stop-config");
|
||||
destroyImmediately("stop-config");
|
||||
mRootWindowContainer.resumeFocusedStacksTopActivities();
|
||||
} else {
|
||||
mRootWindowContainer.updatePreviousProcess(this);
|
||||
@@ -7113,7 +7110,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
if (!attachedToProcess()) {
|
||||
if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION,
|
||||
"Config is destroying non-running " + this);
|
||||
destroyImmediately(true /* removeFromApp */, "config");
|
||||
destroyImmediately("config");
|
||||
} else if (mState == PAUSING) {
|
||||
// A little annoying: we are waiting for this activity to finish pausing. Let's not
|
||||
// do anything now, but just flag that it needs to be restarted when done pausing.
|
||||
|
||||
@@ -41,10 +41,8 @@ import static android.content.pm.PackageManager.PERMISSION_DENIED;
|
||||
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||
import static android.os.PowerManager.PARTIAL_WAKE_LOCK;
|
||||
import static android.os.Process.INVALID_UID;
|
||||
import static android.os.Process.SYSTEM_UID;
|
||||
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
import static android.view.Display.TYPE_VIRTUAL;
|
||||
|
||||
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_ALL;
|
||||
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_CLEANUP;
|
||||
@@ -1869,7 +1867,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
|
||||
for (int i = 0; i < numFinishingActivities; i++) {
|
||||
final ActivityRecord r = finishingActivities.get(i);
|
||||
if (r.isInHistory()) {
|
||||
r.destroyImmediately(true /* removeFromApp */, "finish-" + reason);
|
||||
r.destroyImmediately("finish-" + reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3379,7 +3379,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
if (r == null || !r.isDestroyable()) {
|
||||
return false;
|
||||
}
|
||||
r.destroyImmediately(true /* removeFromApp */, "app-req");
|
||||
r.destroyImmediately("app-req");
|
||||
return r.isState(DESTROYING, DESTROYED);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(origId);
|
||||
|
||||
@@ -2716,7 +2716,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
|
||||
+ " resumed=" + r.getStack().mResumedActivity + " pausing="
|
||||
+ r.getStack().mPausingActivity + " for reason " + mDestroyAllActivitiesReason);
|
||||
|
||||
r.destroyImmediately(true /* removeFromTask */, mDestroyAllActivitiesReason);
|
||||
r.destroyImmediately(mDestroyAllActivitiesReason);
|
||||
}
|
||||
|
||||
// Tries to put all activity stacks to sleep. Returns true if all stacks were
|
||||
|
||||
@@ -941,7 +941,7 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio
|
||||
final ActivityRecord r = candidates.remove(0);
|
||||
if (DEBUG_RELEASE) Slog.v(TAG_RELEASE, "Destroying " + r
|
||||
+ " in state " + r.getState() + " for reason " + reason);
|
||||
r.destroyImmediately(true /*removeFromApp*/, reason);
|
||||
r.destroyImmediately(reason);
|
||||
--maxRelease;
|
||||
} while (maxRelease > 0);
|
||||
}
|
||||
|
||||
@@ -1190,7 +1190,7 @@ public class ActivityRecordTests extends WindowTestsBase {
|
||||
|
||||
assertEquals(DESTROYING, mActivity.getState());
|
||||
assertTrue(mActivity.finishing);
|
||||
verify(mActivity).destroyImmediately(eq(true) /* removeFromApp */, anyString());
|
||||
verify(mActivity).destroyImmediately(anyString());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1214,7 +1214,7 @@ public class ActivityRecordTests extends WindowTestsBase {
|
||||
|
||||
// Verify that the activity was not actually destroyed, but waits for next one to come up
|
||||
// instead.
|
||||
verify(mActivity, never()).destroyImmediately(eq(true) /* removeFromApp */, anyString());
|
||||
verify(mActivity, never()).destroyImmediately(anyString());
|
||||
assertEquals(FINISHING, mActivity.getState());
|
||||
assertTrue(mActivity.mStackSupervisor.mFinishingActivities.contains(mActivity));
|
||||
}
|
||||
@@ -1238,7 +1238,7 @@ public class ActivityRecordTests extends WindowTestsBase {
|
||||
mActivity.completeFinishing("test");
|
||||
|
||||
// Verify that the activity is not destroyed immediately, but waits for next one to come up.
|
||||
verify(mActivity, never()).destroyImmediately(eq(true) /* removeFromApp */, anyString());
|
||||
verify(mActivity, never()).destroyImmediately(anyString());
|
||||
assertEquals(FINISHING, mActivity.getState());
|
||||
assertTrue(mActivity.mStackSupervisor.mFinishingActivities.contains(mActivity));
|
||||
}
|
||||
@@ -1250,26 +1250,26 @@ public class ActivityRecordTests extends WindowTestsBase {
|
||||
@Test
|
||||
public void testDestroyImmediately_hadApp_finishing() {
|
||||
mActivity.finishing = true;
|
||||
mActivity.destroyImmediately(false /* removeFromApp */, "test");
|
||||
mActivity.destroyImmediately("test");
|
||||
|
||||
assertEquals(DESTROYING, mActivity.getState());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the activity will be moved to destroyed state immediately if it was not marked as
|
||||
* finishing before {@link ActivityRecord#destroyImmediately(boolean, String)}.
|
||||
* finishing before {@link ActivityRecord#destroyImmediately(String)}.
|
||||
*/
|
||||
@Test
|
||||
public void testDestroyImmediately_hadApp_notFinishing() {
|
||||
mActivity.finishing = false;
|
||||
mActivity.destroyImmediately(false /* removeFromApp */, "test");
|
||||
mActivity.destroyImmediately("test");
|
||||
|
||||
assertEquals(DESTROYED, mActivity.getState());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that an activity with no process attached and that is marked as finishing will be
|
||||
* removed from task when {@link ActivityRecord#destroyImmediately(boolean, String)} is called.
|
||||
* removed from task when {@link ActivityRecord#destroyImmediately(String)} is called.
|
||||
*/
|
||||
@Test
|
||||
public void testDestroyImmediately_noApp_finishing() {
|
||||
@@ -1277,7 +1277,7 @@ public class ActivityRecordTests extends WindowTestsBase {
|
||||
mActivity.finishing = true;
|
||||
final Task task = mActivity.getTask();
|
||||
|
||||
mActivity.destroyImmediately(false /* removeFromApp */, "test");
|
||||
mActivity.destroyImmediately("test");
|
||||
|
||||
assertEquals(DESTROYED, mActivity.getState());
|
||||
assertNull(mActivity.getTask());
|
||||
@@ -1294,7 +1294,7 @@ public class ActivityRecordTests extends WindowTestsBase {
|
||||
mActivity.finishing = false;
|
||||
final Task task = mActivity.getTask();
|
||||
|
||||
mActivity.destroyImmediately(false /* removeFromApp */, "test");
|
||||
mActivity.destroyImmediately("test");
|
||||
|
||||
assertEquals(DESTROYED, mActivity.getState());
|
||||
assertEquals(task, mActivity.getTask());
|
||||
@@ -1310,7 +1310,7 @@ public class ActivityRecordTests extends WindowTestsBase {
|
||||
|
||||
mActivity.safelyDestroy("test");
|
||||
|
||||
verify(mActivity, never()).destroyImmediately(eq(true) /* removeFromApp */, anyString());
|
||||
verify(mActivity, never()).destroyImmediately(anyString());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1322,7 +1322,7 @@ public class ActivityRecordTests extends WindowTestsBase {
|
||||
|
||||
mActivity.safelyDestroy("test");
|
||||
|
||||
verify(mActivity).destroyImmediately(eq(true) /* removeFromApp */, anyString());
|
||||
verify(mActivity).destroyImmediately(anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1655,13 +1655,13 @@ public class ActivityRecordTests extends WindowTestsBase {
|
||||
assertEquals(0, thirdActivity.getMergedOverrideConfiguration()
|
||||
.diff(wpc.getRequestedOverrideConfiguration()));
|
||||
|
||||
secondActivity.destroyImmediately(true, "");
|
||||
secondActivity.destroyImmediately("");
|
||||
|
||||
assertTrue(wpc.registeredForActivityConfigChanges());
|
||||
assertEquals(0, thirdActivity.getMergedOverrideConfiguration()
|
||||
.diff(wpc.getRequestedOverrideConfiguration()));
|
||||
|
||||
firstActivity.destroyImmediately(true, "");
|
||||
firstActivity.destroyImmediately("");
|
||||
|
||||
assertTrue(wpc.registeredForActivityConfigChanges());
|
||||
assertEquals(0, thirdActivity.getMergedOverrideConfiguration()
|
||||
|
||||
@@ -184,7 +184,7 @@ public class RootWindowContainerTests extends WindowTestsBase {
|
||||
};
|
||||
activities[0].detachFromProcess();
|
||||
activities[1].finishing = true;
|
||||
activities[1].destroyImmediately(true /* removeFromApp */, "test");
|
||||
activities[1].destroyImmediately("test");
|
||||
spyOn(wpc);
|
||||
doReturn(true).when(wpc).isRemoved();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user