Make migrate option menu invisible when src volume is not mounted

When the adopted media storage is ejected, migrate operation from
adopted storage to internal storage always fails.

This CL makes the migrate option menu invisible when the source
volume of migration is not mounted and not accessible.

Bug: 117178027
Test: Settings robotests & manual
Change-Id: I8bfc9de552a8daf861315a5e46ee520ede14dd81
This commit is contained in:
Takamasa Kuramitsu
2018-10-02 17:12:06 +09:00
parent 811d817368
commit a88ed48cb8
3 changed files with 17 additions and 2 deletions

View File

@@ -67,7 +67,8 @@ public class PrivateVolumeOptionMenuController implements LifecycleObserver, OnC
if (migrate != null) {
migrate.setVisible((privateVol != null)
&& (privateVol.getType() == VolumeInfo.TYPE_PRIVATE)
&& !Objects.equals(mVolumeInfo, privateVol));
&& !Objects.equals(mVolumeInfo, privateVol)
&& privateVol.isMountedWritable());
}
}

View File

@@ -416,7 +416,8 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
.getPrimaryStorageCurrentVolume();
migrate.setVisible((privateVol != null)
&& (privateVol.getType() == VolumeInfo.TYPE_PRIVATE)
&& !Objects.equals(mVolume, privateVol));
&& !Objects.equals(mVolume, privateVol)
&& privateVol.isMountedWritable());
}
@Override