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

Commit f6bc30c7 authored by Yasuhiro Matsuda's avatar Yasuhiro Matsuda Committed by Android (Google) Code Review
Browse files

Merge "Do not broadcast VOLUME_STATE_CHANGED before boot has completed."

parents 6960966f 87a38b59
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -165,6 +165,8 @@ class MountService extends IMountService.Stub
        public void onBootPhase(int phase) {
            if (phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) {
                mMountService.systemReady();
            } else if (phase == SystemService.PHASE_BOOT_COMPLETED) {
                mMountService.bootCompleted();
            }
        }

@@ -405,6 +407,7 @@ class MountService extends IMountService.Stub
    private final NativeDaemonConnector mCryptConnector;

    private volatile boolean mSystemReady = false;
    private volatile boolean mBootCompleted = false;
    private volatile boolean mDaemonConnected = false;

    private PackageManagerService mPms;
@@ -1244,7 +1247,9 @@ class MountService extends IMountService.Stub

        mCallbacks.notifyVolumeStateChanged(vol, oldState, newState);

        if (isBroadcastWorthy(vol)) {
        // Do not broadcast before boot has completed to avoid launching the
        // processes that receive the intent unnecessarily.
        if (mBootCompleted && isBroadcastWorthy(vol)) {
            final Intent intent = new Intent(VolumeInfo.ACTION_VOLUME_STATE_CHANGED);
            intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, vol.id);
            intent.putExtra(VolumeInfo.EXTRA_VOLUME_STATE, newState);
@@ -1429,6 +1434,10 @@ class MountService extends IMountService.Stub
        mHandler.obtainMessage(H_SYSTEM_READY).sendToTarget();
    }

    private void bootCompleted() {
        mBootCompleted = true;
    }

    private String getDefaultPrimaryStorageUuid() {
        if (SystemProperties.getBoolean(StorageManager.PROP_PRIMARY_PHYSICAL, false)) {
            return StorageManager.UUID_PRIMARY_PHYSICAL;