Merge "Destroy ActivityRecord when it is removed from the hierarchy" into sc-v2-dev
This commit is contained in:
@@ -3687,7 +3687,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
void removeImmediately() {
|
void removeImmediately() {
|
||||||
if (!finishing) {
|
if (!isState(DESTROYING, DESTROYED)) {
|
||||||
// If Task#removeImmediately is called directly with alive activities, ensure that the
|
// If Task#removeImmediately is called directly with alive activities, ensure that the
|
||||||
// activities are destroyed and detached from process.
|
// activities are destroyed and detached from process.
|
||||||
destroyImmediately("removeImmediately");
|
destroyImmediately("removeImmediately");
|
||||||
|
|||||||
@@ -1615,6 +1615,21 @@ public class ActivityRecordTests extends WindowTestsBase {
|
|||||||
assertFalse(wpc.hasActivities());
|
assertFalse(wpc.hasActivities());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRemoveImmediatelyWithFinishingActivity() throws RemoteException {
|
||||||
|
final ActivityRecord activity = createActivityWithTask();
|
||||||
|
final WindowProcessController wpc = activity.app;
|
||||||
|
activity.makeFinishingLocked();
|
||||||
|
assertTrue(activity.finishing);
|
||||||
|
|
||||||
|
activity.getTask().removeImmediately("test");
|
||||||
|
|
||||||
|
verify(mAtm.getLifecycleManager()).scheduleTransaction(any(), eq(activity.appToken),
|
||||||
|
isA(DestroyActivityItem.class));
|
||||||
|
assertFalse(wpc.hasActivities());
|
||||||
|
assertEquals(DESTROYING, activity.getState());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRemoveFromHistory() {
|
public void testRemoveFromHistory() {
|
||||||
final ActivityRecord activity = createActivityWithTask();
|
final ActivityRecord activity = createActivityWithTask();
|
||||||
|
|||||||
Reference in New Issue
Block a user