Merge "Compute visibilities when finishing show-when-lock activity" into rvc-dev
This commit is contained in:
@@ -2669,6 +2669,17 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure activity visibilities and update lockscreen occluded/dismiss state when
|
||||||
|
// finishing the top activity that occluded keyguard. So that, the
|
||||||
|
// ActivityStack#mTopActivityOccludesKeyguard can be updated and the activity below won't
|
||||||
|
// be resumed.
|
||||||
|
if (isState(PAUSED)
|
||||||
|
&& mStackSupervisor.getKeyguardController().isKeyguardLocked()
|
||||||
|
&& getStack().topActivityOccludesKeyguard()) {
|
||||||
|
getStack().ensureActivitiesVisible(null /* starting */, 0 /* configChanges */,
|
||||||
|
false /* preserveWindows */, false /* notifyClients */);
|
||||||
|
}
|
||||||
|
|
||||||
boolean activityRemoved = false;
|
boolean activityRemoved = false;
|
||||||
|
|
||||||
// If this activity is currently visible, and the resumed activity is not yet visible, then
|
// If this activity is currently visible, and the resumed activity is not yet visible, then
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.any;
|
|||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.anyBoolean;
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.anyBoolean;
|
||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.atLeast;
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.atLeast;
|
||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doAnswer;
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doAnswer;
|
||||||
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doCallRealMethod;
|
||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
|
||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.eq;
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.eq;
|
||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.reset;
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.reset;
|
||||||
@@ -1024,6 +1025,38 @@ public class ActivityRecordTests extends ActivityTestsBase {
|
|||||||
verify(topActivity).destroyIfPossible(anyString());
|
verify(topActivity).destroyIfPossible(anyString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify that complete finish request for a show-when-locked activity must ensure the
|
||||||
|
* keyguard occluded state being updated.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testCompleteFinishing_showWhenLocked() {
|
||||||
|
// Make keyguard locked and set the top activity show-when-locked.
|
||||||
|
KeyguardController keyguardController = mActivity.mStackSupervisor.getKeyguardController();
|
||||||
|
doReturn(true).when(keyguardController).isKeyguardLocked();
|
||||||
|
final ActivityRecord topActivity = new ActivityBuilder(mService).setTask(mTask).build();
|
||||||
|
topActivity.mVisibleRequested = true;
|
||||||
|
topActivity.nowVisible = true;
|
||||||
|
topActivity.setState(RESUMED, "true");
|
||||||
|
doCallRealMethod().when(mRootWindowContainer).ensureActivitiesVisible(
|
||||||
|
any() /* starting */, anyInt() /* configChanges */,
|
||||||
|
anyBoolean() /* preserveWindows */, anyBoolean() /* notifyClients */);
|
||||||
|
topActivity.setShowWhenLocked(true);
|
||||||
|
|
||||||
|
// Verify the stack-top activity is occluded keyguard.
|
||||||
|
assertEquals(topActivity, mStack.topRunningActivity());
|
||||||
|
assertTrue(mStack.topActivityOccludesKeyguard());
|
||||||
|
|
||||||
|
// Finish the top activity
|
||||||
|
topActivity.setState(PAUSED, "true");
|
||||||
|
topActivity.finishing = true;
|
||||||
|
topActivity.completeFinishing("test");
|
||||||
|
|
||||||
|
// Verify new top activity does not occlude keyguard.
|
||||||
|
assertEquals(mActivity, mStack.topRunningActivity());
|
||||||
|
assertFalse(mStack.topActivityOccludesKeyguard());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify destroy activity request completes successfully.
|
* Verify destroy activity request completes successfully.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user