Start home on empty display when user unlock the device
If the home app on primary display is encryption aware, the home app will be launched during direct boot instead of FallbackHome. This may cause the non-encryption aware home app not being launched on secondary display after user unlock the device. This CL try to start home on empty display again when user unlock the device. Bug: 171931543 Test: atest ActivityTaskSupervisorTests#testStartHomeAfterUserUnlocked Change-Id: I5e4a2a7125bf49dc01ce5804de7596d29ded6d5c
This commit is contained in:
@@ -1056,7 +1056,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserUnlocking(@NonNull TargetUser user) {
|
||||
public void onUserUnlocked(@NonNull TargetUser user) {
|
||||
synchronized (mService.getGlobalLock()) {
|
||||
mService.mTaskSupervisor.onUserUnlocked(user.getUserIdentifier());
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
|
||||
private static final int RESTART_ACTIVITY_PROCESS_TIMEOUT_MSG = FIRST_SUPERVISOR_STACK_MSG + 13;
|
||||
private static final int REPORT_MULTI_WINDOW_MODE_CHANGED_MSG = FIRST_SUPERVISOR_STACK_MSG + 14;
|
||||
private static final int REPORT_PIP_MODE_CHANGED_MSG = FIRST_SUPERVISOR_STACK_MSG + 15;
|
||||
private static final int REPORT_HOME_CHANGED_MSG = FIRST_SUPERVISOR_STACK_MSG + 16;
|
||||
private static final int START_HOME_MSG = FIRST_SUPERVISOR_STACK_MSG + 16;
|
||||
private static final int TOP_RESUMED_STATE_LOSS_TIMEOUT_MSG = FIRST_SUPERVISOR_STACK_MSG + 17;
|
||||
|
||||
// Used to indicate that windows of activities should be preserved during the resize.
|
||||
@@ -446,6 +446,9 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
|
||||
// unlocked.
|
||||
mPersisterQueue.startPersisting();
|
||||
mLaunchParamsPersister.onUnlockUser(userId);
|
||||
|
||||
// Need to launch home again for those displays that do not have encryption aware home app.
|
||||
scheduleStartHome("userUnlocked");
|
||||
}
|
||||
|
||||
public ActivityMetricsLogger getActivityMetricsLogger() {
|
||||
@@ -956,13 +959,17 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
|
||||
|
||||
void updateHomeProcess(WindowProcessController app) {
|
||||
if (app != null && mService.mHomeProcess != app) {
|
||||
if (!mHandler.hasMessages(REPORT_HOME_CHANGED_MSG)) {
|
||||
mHandler.sendEmptyMessage(REPORT_HOME_CHANGED_MSG);
|
||||
}
|
||||
scheduleStartHome("homeChanged");
|
||||
mService.mHomeProcess = app;
|
||||
}
|
||||
}
|
||||
|
||||
private void scheduleStartHome(String reason) {
|
||||
if (!mHandler.hasMessages(START_HOME_MSG)) {
|
||||
mHandler.obtainMessage(START_HOME_MSG, reason).sendToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
private void logIfTransactionTooLarge(Intent intent, Bundle icicle) {
|
||||
int extrasSize = 0;
|
||||
if (intent != null) {
|
||||
@@ -2472,11 +2479,11 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
|
||||
handleLaunchTaskBehindCompleteLocked(r);
|
||||
}
|
||||
} break;
|
||||
case REPORT_HOME_CHANGED_MSG: {
|
||||
mHandler.removeMessages(REPORT_HOME_CHANGED_MSG);
|
||||
case START_HOME_MSG: {
|
||||
mHandler.removeMessages(START_HOME_MSG);
|
||||
|
||||
// Start home activities on displays with no activities.
|
||||
mRootWindowContainer.startHomeOnEmptyDisplays("homeChanged");
|
||||
mRootWindowContainer.startHomeOnEmptyDisplays((String) msg.obj);
|
||||
} break;
|
||||
case TOP_RESUMED_STATE_LOSS_TIMEOUT_MSG: {
|
||||
final ActivityRecord r = (ActivityRecord) msg.obj;
|
||||
|
||||
@@ -34,6 +34,7 @@ import static org.junit.Assert.assertNull;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.timeout;
|
||||
|
||||
import android.app.WaitResult;
|
||||
import android.content.pm.ActivityInfo;
|
||||
@@ -45,6 +46,8 @@ import androidx.test.filters.MediumTest;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Tests for the {@link ActivityTaskSupervisor} class.
|
||||
*
|
||||
@@ -190,4 +193,16 @@ public class ActivityTaskSupervisorTests extends WindowTestsBase {
|
||||
|
||||
assertThat(allowedOnUntrusted).isFalse();
|
||||
}
|
||||
|
||||
/**
|
||||
* We need to launch home again after user unlocked for those displays that do not have
|
||||
* encryption aware home app.
|
||||
*/
|
||||
@Test
|
||||
public void testStartHomeAfterUserUnlocked() {
|
||||
mSupervisor.onUserUnlocked(0);
|
||||
waitHandlerIdle(mAtm.mH);
|
||||
verify(mRootWindowContainer, timeout(TimeUnit.SECONDS.toMillis(10)))
|
||||
.startHomeOnEmptyDisplays("userUnlocked");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user