Show storage manager settings using a system property.

This removes a Settings-only configuration on whether or not the
storage manager is enabled and replaced it with a system property.

Bug: 29336081
Change-Id: I2328c213f5f11f89bf0fe61e77d3062459036fc3
This commit is contained in:
Daniel Nishi
2016-06-13 17:37:06 -07:00
parent 8b8a012913
commit 0074855229
2 changed files with 5 additions and 5 deletions

View File

@@ -41,9 +41,6 @@
<!-- Whether none security option is hide or not (country specific). --> <!-- Whether none security option is hide or not (country specific). -->
<bool name="config_hide_none_security_option">false</bool> <bool name="config_hide_none_security_option">false</bool>
<!--Whether the storage manager exists. -->
<bool name="config_has_storage_manager">false</bool>
<!-- Whether the automatic storage management job should be scheduled. --> <!-- Whether the automatic storage management job should be scheduled. -->
<bool name="enable_automatic_storage_management">false</bool> <bool name="enable_automatic_storage_management">false</bool>
</resources> </resources>

View File

@@ -30,6 +30,7 @@ import android.content.pm.PackageManager;
import android.content.pm.UserInfo; import android.content.pm.UserInfo;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.os.SystemProperties;
import android.os.UserHandle; import android.os.UserHandle;
import android.os.UserManager; import android.os.UserManager;
import android.os.storage.StorageEventListener; import android.os.storage.StorageEventListener;
@@ -92,6 +93,8 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
private static final String AUTHORITY_MEDIA = "com.android.providers.media.documents"; private static final String AUTHORITY_MEDIA = "com.android.providers.media.documents";
private static final String STORAGE_MANAGER_PROPERTY = "ro.storage_manager.enabled";
private static final int[] ITEMS_NO_SHOW_SHARED = new int[] { private static final int[] ITEMS_NO_SHOW_SHARED = new int[] {
R.string.storage_detail_apps, R.string.storage_detail_apps,
R.string.storage_detail_system, R.string.storage_detail_system,
@@ -212,7 +215,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
screen.removeAll(); screen.removeAll();
if (getResources().getBoolean(R.bool.config_has_storage_manager)) { if (SystemProperties.getBoolean(STORAGE_MANAGER_PROPERTY, false)) {
addPreference(screen, mAutomaticStorageManagement); addPreference(screen, mAutomaticStorageManagement);
} }
addPreference(screen, mSummary); addPreference(screen, mSummary);
@@ -396,7 +399,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
mount.setVisible(false); mount.setVisible(false);
unmount.setVisible(false); unmount.setVisible(false);
format.setVisible(false); format.setVisible(false);
manage.setVisible(getResources().getBoolean(R.bool.config_has_storage_manager)); manage.setVisible(SystemProperties.getBoolean(STORAGE_MANAGER_PROPERTY, false));
} else { } else {
rename.setVisible(mVolume.getType() == VolumeInfo.TYPE_PRIVATE); rename.setVisible(mVolume.getType() == VolumeInfo.TYPE_PRIVATE);
mount.setVisible(mVolume.getState() == VolumeInfo.STATE_UNMOUNTED); mount.setVisible(mVolume.getState() == VolumeInfo.STATE_UNMOUNTED);