Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e23f5810 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

parents b77d0bcc fd24108c
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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();
            }
        };
+3 −0
Original line number Diff line number Diff line
@@ -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: {
+6 −3
Original line number Diff line number Diff line
@@ -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());
        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());
+4 −11
Original line number Diff line number Diff line
@@ -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