summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2015-04-18 16:22:10 -0700
committerJeff Sharkey <jsharkey@android.com>2015-04-18 16:22:12 -0700
commit90daa80c5bf3fdba3489be776640018ca578d955 (patch)
treecdf5e164b676eb931c95da9109590b9718bfb0a2 /src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
parente0a14922ea9d89e6eacc2580d453844e54c7900e (diff)
downloadpackages_apps_Settings-90daa80c5bf3fdba3489be776640018ca578d955.tar.gz
packages_apps_Settings-90daa80c5bf3fdba3489be776640018ca578d955.tar.bz2
packages_apps_Settings-90daa80c5bf3fdba3489be776640018ca578d955.zip
Use new VolumeInfo helper methods.
Makes it clearer if we're checking for readable/writable state, and puts emulated/private conversion logic in single place. Bug: 19993667 Change-Id: I953f5c184ca62afc631d855e64cd8a4972320148
Diffstat (limited to 'src/com/android/settings/deviceinfo/PrivateVolumeSettings.java')
-rw-r--r--src/com/android/settings/deviceinfo/PrivateVolumeSettings.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
index a280b2ddd..00fb09418 100644
--- a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
+++ b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
@@ -53,10 +53,9 @@ import android.widget.EditText;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.util.Preconditions;
import com.android.settings.R;
-import com.android.settings.Settings;
+import com.android.settings.Settings.StorageUseActivity;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils;
-import com.android.settings.Settings.StorageUseActivity;
import com.android.settings.applications.ManageApplications;
import com.android.settings.deviceinfo.StorageMeasurement.MeasurementDetails;
import com.android.settings.deviceinfo.StorageMeasurement.MeasurementReceiver;
@@ -75,6 +74,7 @@ import java.util.Objects;
*/
public class PrivateVolumeSettings extends SettingsPreferenceFragment {
// TODO: disable unmount when providing over MTP/PTP
+ // TODO: warn when mounted read-only
private static final String TAG_RENAME = "rename";
private static final String TAG_CONFIRM_CLEAR_CACHE = "confirmClearCache";
@@ -129,8 +129,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
addPreferencesFromResource(R.xml.device_info_storage_volume);
// Find the emulated shared storage layered above this private volume
- mSharedVolume = mStorageManager.findVolumeById(
- mVolume.getId().replace("private", "emulated"));
+ mSharedVolume = mStorageManager.findEmulatedForPrivate(mVolume);
mMeasure = new StorageMeasurement(context, mVolume, mSharedVolume);
mMeasure.setReceiver(mReceiver);
@@ -171,7 +170,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
screen.removeAll();
- if (mVolume.getState() != VolumeInfo.STATE_MOUNTED) {
+ if (!mVolume.isMountedReadable()) {
return;
}
@@ -283,7 +282,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
} else {
rename.setVisible(mVolume.getType() == VolumeInfo.TYPE_PRIVATE);
mount.setVisible(mVolume.getState() == VolumeInfo.STATE_UNMOUNTED);
- unmount.setVisible(mVolume.getState() == VolumeInfo.STATE_MOUNTED);
+ unmount.setVisible(mVolume.isMountedReadable());
format.setVisible(true);
}