Send USER_UNLOCKED broadcasts before PRE_BOOT.
Apps handling the PRE_BOOT_COMPLETED broadcast expect the user to be fully unlocked and working. Most system internals are using the SystemServer interface, and we dispatch the unlocked event through them before starting the PRE_BOOT process. However, there are still some system internals that haven't been converted to SystemServer, so we need to also send USER_UNLOCKED for them to pick up before starting PRE_BOOT work. Bug: 28086245 Change-Id: Ie847b463ea55a6dddcc49d243ef8fb308e5179a7
This commit is contained in:
@@ -278,6 +278,31 @@ final class UserController {
|
||||
// Dispatch unlocked to system services
|
||||
mHandler.sendMessage(mHandler.obtainMessage(SYSTEM_USER_UNLOCK_MSG, userId, 0));
|
||||
|
||||
// Dispatch unlocked to external apps
|
||||
final Intent unlockedIntent = new Intent(Intent.ACTION_USER_UNLOCKED);
|
||||
unlockedIntent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
|
||||
unlockedIntent.addFlags(
|
||||
Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND);
|
||||
mService.broadcastIntentLocked(null, null, unlockedIntent, null, null, 0, null,
|
||||
null, null, AppOpsManager.OP_NONE, null, false, false, MY_PID, SYSTEM_UID,
|
||||
userId);
|
||||
|
||||
if (getUserInfo(userId).isManagedProfile()) {
|
||||
UserInfo parent = getUserManager().getProfileParent(userId);
|
||||
if (parent != null) {
|
||||
final Intent profileUnlockedIntent = new Intent(
|
||||
Intent.ACTION_MANAGED_PROFILE_UNLOCKED);
|
||||
profileUnlockedIntent.putExtra(Intent.EXTRA_USER, UserHandle.of(userId));
|
||||
profileUnlockedIntent.addFlags(
|
||||
Intent.FLAG_RECEIVER_REGISTERED_ONLY
|
||||
| Intent.FLAG_RECEIVER_FOREGROUND);
|
||||
mService.broadcastIntentLocked(null, null, profileUnlockedIntent,
|
||||
null, null, 0, null, null, null, AppOpsManager.OP_NONE,
|
||||
null, false, false, MY_PID, SYSTEM_UID,
|
||||
parent.id);
|
||||
}
|
||||
}
|
||||
|
||||
// Send PRE_BOOT broadcasts if fingerprint changed
|
||||
final UserInfo info = getUserInfo(userId);
|
||||
if (!Objects.equals(info.lastLoggedInFingerprint, Build.FINGERPRINT)) {
|
||||
@@ -320,31 +345,6 @@ final class UserController {
|
||||
// Remember that we logged in
|
||||
mUserManager.onUserLoggedIn(userId);
|
||||
|
||||
// Dispatch unlocked to external apps
|
||||
final Intent unlockedIntent = new Intent(Intent.ACTION_USER_UNLOCKED);
|
||||
unlockedIntent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
|
||||
unlockedIntent.addFlags(
|
||||
Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND);
|
||||
mService.broadcastIntentLocked(null, null, unlockedIntent, null, null, 0, null,
|
||||
null, null, AppOpsManager.OP_NONE, null, false, false, MY_PID, SYSTEM_UID,
|
||||
userId);
|
||||
|
||||
if (getUserInfo(userId).isManagedProfile()) {
|
||||
UserInfo parent = getUserManager().getProfileParent(userId);
|
||||
if (parent != null) {
|
||||
final Intent profileUnlockedIntent = new Intent(
|
||||
Intent.ACTION_MANAGED_PROFILE_UNLOCKED);
|
||||
profileUnlockedIntent.putExtra(Intent.EXTRA_USER, UserHandle.of(userId));
|
||||
profileUnlockedIntent.addFlags(
|
||||
Intent.FLAG_RECEIVER_REGISTERED_ONLY
|
||||
| Intent.FLAG_RECEIVER_FOREGROUND);
|
||||
mService.broadcastIntentLocked(null, null, profileUnlockedIntent,
|
||||
null, null, 0, null, null, null, AppOpsManager.OP_NONE,
|
||||
null, false, false, MY_PID, SYSTEM_UID,
|
||||
parent.id);
|
||||
}
|
||||
}
|
||||
|
||||
final Intent bootIntent = new Intent(Intent.ACTION_BOOT_COMPLETED, null);
|
||||
bootIntent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
|
||||
bootIntent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT
|
||||
|
||||
Reference in New Issue
Block a user