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

Commit b261c94f authored by Martijn Coenen's avatar Martijn Coenen Committed by Android (Google) Code Review
Browse files

Merge "Only remountUid when uid is active"

parents d9de49d0 64726cb4
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.Manifest.permission.INSTALL_PACKAGES;
import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
import static android.Manifest.permission.WRITE_MEDIA_STORAGE;
import static android.app.ActivityManager.PROCESS_STATE_NONEXISTENT;
import static android.app.AppOpsManager.MODE_ALLOWED;
import static android.app.AppOpsManager.OP_LEGACY_STORAGE;
import static android.app.AppOpsManager.OP_READ_EXTERNAL_STORAGE;
@@ -3423,7 +3424,13 @@ class StorageManagerService extends IStorageManager.Stub
        public void opChanged(int op, int uid, String packageName) throws RemoteException {
            if (!ENABLE_ISOLATED_STORAGE) return;

            remountUidExternalStorage(uid, getMountMode(uid, packageName));
            int mountMode = getMountMode(uid, packageName);
            boolean isUidActive = LocalServices.getService(ActivityManagerInternal.class)
                    .getUidProcessState(uid) != PROCESS_STATE_NONEXISTENT;

            if (isUidActive) {
                remountUidExternalStorage(uid, mountMode);
            }
        }
    };