Loading services/core/java/com/android/server/StorageManagerService.java +14 −5 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import static org.xmlpull.v1.XmlPullParser.START_TAG; import android.Manifest; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.UserIdInt; import android.app.ActivityManager; import android.app.ActivityManagerInternal; import android.app.AppOpsManager; Loading Loading @@ -482,14 +483,21 @@ class StorageManagerService extends IStorageManager.Stub } } private @Nullable VolumeInfo findStorageForUuid(String volumeUuid) { private @Nullable VolumeInfo findStorageForUuidAsUser(String volumeUuid, @UserIdInt int userId) { final StorageManager storage = mContext.getSystemService(StorageManager.class); if (Objects.equals(StorageManager.UUID_PRIVATE_INTERNAL, volumeUuid)) { return storage.findVolumeById(VolumeInfo.ID_EMULATED_INTERNAL + ";" + 0); return storage.findVolumeById(VolumeInfo.ID_EMULATED_INTERNAL + ";" + userId); } else if (Objects.equals(StorageManager.UUID_PRIMARY_PHYSICAL, volumeUuid)) { return storage.getPrimaryPhysicalVolume(); } else { return storage.findEmulatedForPrivate(storage.findVolumeByUuid(volumeUuid)); VolumeInfo info = storage.findVolumeByUuid(volumeUuid); if (info == null) { Slog.w(TAG, "findStorageForUuidAsUser cannot find volumeUuid:" + volumeUuid); return null; } String emulatedUuid = info.getId().replace("private", "emulated") + ";" + userId; return storage.findVolumeById(emulatedUuid); } } Loading Loading @@ -2605,8 +2613,9 @@ class StorageManagerService extends IStorageManager.Stub return; } else { from = findStorageForUuid(mPrimaryStorageUuid); to = findStorageForUuid(volumeUuid); int currentUserId = mCurrentUserId; from = findStorageForUuidAsUser(mPrimaryStorageUuid, currentUserId); to = findStorageForUuidAsUser(volumeUuid, currentUserId); if (from == null) { Slog.w(TAG, "Failing move due to missing from volume " + mPrimaryStorageUuid); Loading Loading
services/core/java/com/android/server/StorageManagerService.java +14 −5 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import static org.xmlpull.v1.XmlPullParser.START_TAG; import android.Manifest; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.UserIdInt; import android.app.ActivityManager; import android.app.ActivityManagerInternal; import android.app.AppOpsManager; Loading Loading @@ -482,14 +483,21 @@ class StorageManagerService extends IStorageManager.Stub } } private @Nullable VolumeInfo findStorageForUuid(String volumeUuid) { private @Nullable VolumeInfo findStorageForUuidAsUser(String volumeUuid, @UserIdInt int userId) { final StorageManager storage = mContext.getSystemService(StorageManager.class); if (Objects.equals(StorageManager.UUID_PRIVATE_INTERNAL, volumeUuid)) { return storage.findVolumeById(VolumeInfo.ID_EMULATED_INTERNAL + ";" + 0); return storage.findVolumeById(VolumeInfo.ID_EMULATED_INTERNAL + ";" + userId); } else if (Objects.equals(StorageManager.UUID_PRIMARY_PHYSICAL, volumeUuid)) { return storage.getPrimaryPhysicalVolume(); } else { return storage.findEmulatedForPrivate(storage.findVolumeByUuid(volumeUuid)); VolumeInfo info = storage.findVolumeByUuid(volumeUuid); if (info == null) { Slog.w(TAG, "findStorageForUuidAsUser cannot find volumeUuid:" + volumeUuid); return null; } String emulatedUuid = info.getId().replace("private", "emulated") + ";" + userId; return storage.findVolumeById(emulatedUuid); } } Loading Loading @@ -2605,8 +2613,9 @@ class StorageManagerService extends IStorageManager.Stub return; } else { from = findStorageForUuid(mPrimaryStorageUuid); to = findStorageForUuid(volumeUuid); int currentUserId = mCurrentUserId; from = findStorageForUuidAsUser(mPrimaryStorageUuid, currentUserId); to = findStorageForUuidAsUser(volumeUuid, currentUserId); if (from == null) { Slog.w(TAG, "Failing move due to missing from volume " + mPrimaryStorageUuid); Loading