Java Code Examples for android.os.storage.StorageManager#findVolumeById()

The following examples show how to use android.os.storage.StorageManager#findVolumeById() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@Override
public @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app) {
    final StorageManager storage = mContext.getSystemService(StorageManager.class);
    if (app.isInternal()) {
        return storage.findVolumeById(VolumeInfo.ID_PRIVATE_INTERNAL);
    } else if (app.isExternalAsec()) {
        return storage.getPrimaryPhysicalVolume();
    } else {
        return storage.findVolumeByUuid(app.volumeUuid);
    }
}
 
Example 2
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
protected @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app,
        StorageManager storage) {
    if (app.isInternal()) {
        return storage.findVolumeById(VolumeInfo.ID_PRIVATE_INTERNAL);
    } else if (app.isExternalAsec()) {
        return storage.getPrimaryPhysicalVolume();
    } else {
        return storage.findVolumeByUuid(app.volumeUuid);
    }
}
 
Example 3
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@Override
public @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app) {
    final StorageManager storage = mContext.getSystemService(StorageManager.class);
    if (app.isInternal()) {
        return storage.findVolumeById(VolumeInfo.ID_PRIVATE_INTERNAL);
    } else if (app.isExternalAsec()) {
        return storage.getPrimaryPhysicalVolume();
    } else {
        return storage.findVolumeByUuid(app.volumeUuid);
    }
}
 
Example 4
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
protected @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app,
        StorageManager storage) {
    if (app.isInternal()) {
        return storage.findVolumeById(VolumeInfo.ID_PRIVATE_INTERNAL);
    } else if (app.isExternalAsec()) {
        return storage.getPrimaryPhysicalVolume();
    } else {
        return storage.findVolumeByUuid(app.volumeUuid);
    }
}
 
Example 5
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
protected @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app,
        StorageManager storage) {
    if (app.isInternal()) {
        return storage.findVolumeById(VolumeInfo.ID_PRIVATE_INTERNAL);
    } else if (app.isExternalAsec()) {
        return storage.getPrimaryPhysicalVolume();
    } else {
        return storage.findVolumeByUuid(app.volumeUuid);
    }
}
 
Example 6
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
protected @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app,
        StorageManager storage) {
    if (app.isInternal()) {
        return storage.findVolumeById(VolumeInfo.ID_PRIVATE_INTERNAL);
    } else if (app.isExternalAsec()) {
        return storage.getPrimaryPhysicalVolume();
    } else {
        return storage.findVolumeByUuid(app.volumeUuid);
    }
}
 
Example 7
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
protected @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app,
        StorageManager storage) {
    if (app.isInternal()) {
        return storage.findVolumeById(VolumeInfo.ID_PRIVATE_INTERNAL);
    } else {
        return storage.findVolumeByUuid(app.volumeUuid);
    }
}
 
Example 8
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@Override
public @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app) {
    final StorageManager storage = mContext.getSystemService(StorageManager.class);
    if (app.isInternal()) {
        return storage.findVolumeById(VolumeInfo.ID_PRIVATE_INTERNAL);
    } else if (app.isExternalAsec()) {
        return storage.getPrimaryPhysicalVolume();
    } else {
        return storage.findVolumeByUuid(app.volumeUuid);
    }
}
 
Example 9
Source File: StorageManagerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private @Nullable VolumeInfo findStorageForUuid(String volumeUuid) {
    final StorageManager storage = mContext.getSystemService(StorageManager.class);
    if (Objects.equals(StorageManager.UUID_PRIVATE_INTERNAL, volumeUuid)) {
        return storage.findVolumeById(VolumeInfo.ID_EMULATED_INTERNAL);
    } else if (Objects.equals(StorageManager.UUID_PRIMARY_PHYSICAL, volumeUuid)) {
        return storage.getPrimaryPhysicalVolume();
    } else {
        return storage.findEmulatedForPrivate(storage.findVolumeByUuid(volumeUuid));
    }
}
 
Example 10
Source File: ApplicationPackageManager.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
protected @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app,
        StorageManager storage) {
    if (app.isInternal()) {
        return storage.findVolumeById(VolumeInfo.ID_PRIVATE_INTERNAL);
    } else if (app.isExternalAsec()) {
        return storage.getPrimaryPhysicalVolume();
    } else {
        return storage.findVolumeByUuid(app.volumeUuid);
    }
}