Merge "Don't block while dispatching PRE_BOOT." into nyc-dev

This commit is contained in:
TreeHugger Robot
2016-04-19 23:23:48 +00:00
committed by Android (Google) Code Review
4 changed files with 16 additions and 17 deletions

View File

@@ -690,17 +690,17 @@ public class LockSettingsService extends ILockSettings.Stub {
final IProgressListener listener = new IProgressListener.Stub() {
@Override
public void onStarted(int id, Bundle extras) throws RemoteException {
// Ignored
Log.d(TAG, "unlockUser started");
}
@Override
public void onProgress(int id, int progress, Bundle extras) throws RemoteException {
// Ignored
Log.d(TAG, "unlockUser progress " + progress);
}
@Override
public void onFinished(int id, Bundle extras) throws RemoteException {
Log.d(TAG, "unlockUser finished!");
Log.d(TAG, "unlockUser finished");
latch.countDown();
}
};

View File

@@ -1945,6 +1945,9 @@ public final class ActivityManagerService extends ActivityManagerNative
startPersistentApps(PackageManager.MATCH_DIRECT_BOOT_UNAWARE);
}
installEncryptionUnawareProviders(userId);
if (msg.obj instanceof ProgressReporter) {
((ProgressReporter) msg.obj).finish();
}
break;
}
case SYSTEM_USER_CURRENT_MSG: {

View File

@@ -78,9 +78,12 @@ public abstract class PreBootBroadcaster extends IIntentReceiver.Stub {
final ResolveInfo ri = mTargets.get(mIndex++);
final ComponentName componentName = ri.activityInfo.getComponentName();
final CharSequence label = ri.activityInfo.loadLabel(mService.mContext.getPackageManager());
mProgress.setProgress(mIndex, mTargets.size(),
mService.mContext.getString(R.string.android_preparing_apk, label));
if (mProgress != null) {
final CharSequence label = ri.activityInfo
.loadLabel(mService.mContext.getPackageManager());
mProgress.setProgress(mIndex, mTargets.size(),
mService.mContext.getString(R.string.android_preparing_apk, label));
}
Slog.i(TAG, "Pre-boot of " + componentName.toShortString() + " for user " + mUserId);
EventLogTags.writeAmPreBoot(mUserId, componentName.getPackageName());

View File

@@ -101,6 +101,7 @@ import java.util.Set;
*/
final class UserController {
private static final String TAG = TAG_WITH_CLASS_NAME ? "UserController" : TAG_AM;
// Maximum number of users we allow to be running at a time.
static final int MAX_RUNNING_USERS = 3;
@@ -279,7 +280,8 @@ final class UserController {
uss.mUnlockProgress.setProgress(20);
// Dispatch unlocked to system services
mHandler.sendMessage(mHandler.obtainMessage(SYSTEM_USER_UNLOCK_MSG, userId, 0));
mHandler.obtainMessage(SYSTEM_USER_UNLOCK_MSG, userId, 0, uss.mUnlockProgress)
.sendToTarget();
// Dispatch unlocked to external apps
final Intent unlockedIntent = new Intent(Intent.ACTION_USER_UNLOCKED);
@@ -309,8 +311,7 @@ final class UserController {
// Send PRE_BOOT broadcasts if fingerprint changed
final UserInfo info = getUserInfo(userId);
if (!Objects.equals(info.lastLoggedInFingerprint, Build.FINGERPRINT)) {
uss.mUnlockProgress.startSegment(80);
new PreBootBroadcaster(mService, userId, uss.mUnlockProgress) {
new PreBootBroadcaster(mService, userId, null) {
@Override
public void onFinished() {
finishUserUnlocked(uss);
@@ -328,14 +329,6 @@ final class UserController {
* {@link UserState#STATE_RUNNING_UNLOCKED}.
*/
private void finishUserUnlocked(UserState uss) {
try {
finishUserUnlockedInternal(uss);
} finally {
uss.mUnlockProgress.finish();
}
}
private void finishUserUnlockedInternal(UserState uss) {
final int userId = uss.mHandle.getIdentifier();
synchronized (mService) {
// Bail if we ended up with a stale user