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

Commit 18b2a13a authored by Fyodor Kupolov's avatar Fyodor Kupolov
Browse files

Fix StrictMode I/O violations

Bug: 68872660
Bug: 68871386
Test: manual + UserControllerTest
Change-Id: Ibc88ff4200a1ce192d096201ec6bfdf93bbfaee1
parent d37f28b8
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ import com.android.internal.logging.MetricsLogger;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.Preconditions;
import com.android.internal.widget.LockPatternUtils;
import com.android.server.FgThread;
import com.android.server.LocalServices;
import com.android.server.SystemServiceManager;
import com.android.server.pm.UserManagerService;
@@ -369,6 +370,9 @@ class UserController implements Handler.Callback {
        // Prepare app storage before we go any further
        uss.mUnlockProgress.setProgress(5,
                    mInjector.getContext().getString(R.string.android_start_title));

        // Call onBeforeUnlockUser on a worker thread that allows disk I/O
        FgThread.getHandler().post(() -> {
            mInjector.getUserManager().onBeforeUnlockUser(userId);
            uss.mUnlockProgress.setProgress(20);

@@ -376,6 +380,7 @@ class UserController implements Handler.Callback {
            // that calls through to the next "unlocked" phase
            mHandler.obtainMessage(SYSTEM_USER_UNLOCK_MSG, userId, 0, uss)
                    .sendToTarget();
        });
    }

    /**
@@ -1819,7 +1824,10 @@ class UserController implements Handler.Callback {
            case SYSTEM_USER_UNLOCK_MSG:
                final int userId = msg.arg1;
                mInjector.getSystemServiceManager().unlockUser(userId);
                // Loads recents on a worker thread that allows disk I/O
                FgThread.getHandler().post(() -> {
                    mInjector.loadUserRecents(userId);
                });
                if (userId == UserHandle.USER_SYSTEM) {
                    mInjector.startPersistentApps(PackageManager.MATCH_DIRECT_BOOT_UNAWARE);
                }