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

Commit d974605c authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Delay vold connectors until published, fix NPE." into nyc-dev

parents 7a3bff18 cd575992
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -165,6 +165,7 @@ class MountService extends IMountService.Stub
        public void onStart() {
            mMountService = new MountService(getContext());
            publishBinderService("mount", mMountService);
            mMountService.start();
        }

        @Override
@@ -430,9 +431,13 @@ class MountService extends IMountService.Stub
        = { "password", "default", "pattern", "pin" };

    private final Context mContext;

    private final NativeDaemonConnector mConnector;
    private final NativeDaemonConnector mCryptConnector;

    private final Thread mConnectorThread;
    private final Thread mCryptConnectorThread;

    private volatile boolean mSystemReady = false;
    private volatile boolean mBootCompleted = false;
    private volatile boolean mDaemonConnected = false;
@@ -1494,17 +1499,13 @@ class MountService extends IMountService.Stub
                null);
        mConnector.setDebug(true);
        mConnector.setWarnIfHeld(mLock);

        Thread thread = new Thread(mConnector, VOLD_TAG);
        thread.start();
        mConnectorThread = new Thread(mConnector, VOLD_TAG);

        // Reuse parameters from first connector since they are tested and safe
        mCryptConnector = new NativeDaemonConnector(this, "cryptd",
                MAX_CONTAINERS * 2, CRYPTD_TAG, 25, null);
        mCryptConnector.setDebug(true);

        Thread crypt_thread = new Thread(mCryptConnector, CRYPTD_TAG);
        crypt_thread.start();
        mCryptConnectorThread = new Thread(mCryptConnector, CRYPTD_TAG);

        final IntentFilter userFilter = new IntentFilter();
        userFilter.addAction(Intent.ACTION_USER_ADDED);
@@ -1521,6 +1522,11 @@ class MountService extends IMountService.Stub
        }
    }

    private void start() {
        mConnectorThread.start();
        mCryptConnectorThread.start();
    }

    private void systemReady() {
        mSystemReady = true;
        mHandler.obtainMessage(H_SYSTEM_READY).sendToTarget();
+13 −11
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.UserInfo;
@@ -924,12 +923,12 @@ public class UserManagerService extends IUserManager.Stub {
        }
        // Don't call them within the mRestrictionsLock.
        synchronized (mPackagesLock) {
            if (globalChanged) {
                writeUserListLP();
            }
            if (localChanged) {
                writeUserLP(getUserDataNoChecks(userId));
            }
            if (globalChanged) {
                writeUserListLP();
            }
        }

        synchronized (mRestrictionsLock) {
@@ -1491,8 +1490,8 @@ public class UserManagerService extends IUserManager.Stub {
        updateUserIds();
        initDefaultGuestRestrictions();

        writeUserListLP();
        writeUserLP(userData);
        writeUserListLP();
    }

    private String getOwnerName() {
@@ -1542,8 +1541,10 @@ public class UserManagerService extends IUserManager.Stub {
            serializer.attribute(null, ATTR_CREATION_TIME, Long.toString(userInfo.creationTime));
            serializer.attribute(null, ATTR_LAST_LOGGED_IN_TIME,
                    Long.toString(userInfo.lastLoggedInTime));
            if (userInfo.lastLoggedInFingerprint != null) {
                serializer.attribute(null, ATTR_LAST_LOGGED_IN_FINGERPRINT,
                        userInfo.lastLoggedInFingerprint);
            }
            if (userInfo.iconPath != null) {
                serializer.attribute(null,  ATTR_ICON_PATH, userInfo.iconPath);
            }
@@ -1599,7 +1600,7 @@ public class UserManagerService extends IUserManager.Stub {
            serializer.endDocument();
            userFile.finishWrite(fos);
        } catch (Exception ioe) {
            Slog.e(LOG_TAG, "Error writing user info " + userData.info.id + "\n" + ioe);
            Slog.e(LOG_TAG, "Error writing user info " + userData.info.id, ioe);
            userFile.failWrite(fos);
        }
    }
@@ -1944,6 +1945,7 @@ public class UserManagerService extends IUserManager.Stub {
                    userData.info = userInfo;
                    mUsers.put(userId, userData);
                }
                writeUserLP(userData);
                writeUserListLP();
                if (parent != null) {
                    if (isManagedProfile) {
@@ -2217,13 +2219,13 @@ public class UserManagerService extends IUserManager.Stub {
            mCachedEffectiveUserRestrictions.remove(userHandle);
            mDevicePolicyLocalUserRestrictions.remove(userHandle);
        }
        // Remove user file
        AtomicFile userFile = new AtomicFile(new File(mUsersDir, userHandle + XML_SUFFIX));
        userFile.delete();
        // Update the user list
        synchronized (mPackagesLock) {
            writeUserListLP();
        }
        // Remove user file
        AtomicFile userFile = new AtomicFile(new File(mUsersDir, userHandle + XML_SUFFIX));
        userFile.delete();
        updateUserIds();
        File userDir = Environment.getUserSystemDirectory(userHandle);
        File renamedUserDir = Environment.getUserSystemDirectory(UserHandle.USER_NULL - userHandle);