Add force external setting

Adds a developer setting that overrides the package's storage
preference. This allows any [non-system] package to be moved
to external storage.

Bug: 22282121
Change-Id: Ie21bc13b1d92fe0972f789a2187e11d2e413f040
This commit is contained in:
Todd Kennedy
2015-08-07 14:39:08 -07:00
parent 40daa4c181
commit 97162821f9
3 changed files with 19 additions and 0 deletions

View File

@@ -5121,6 +5121,11 @@
<string name="show_all_anrs_summary">Show App Not Responding dialog
for background apps</string>
<!-- UI debug setting: force allow on external [CHAR LIMIT=25] -->
<string name="force_allow_on_external">Force allow on external</string>
<!-- UI debug setting: force allow on external summary [CHAR LIMIT=50] -->
<string name="force_allow_on_external_summary">Makes any app elligible to be written to external storage, regardless of manifest values</string>
<!-- Activity title for network data usage summary. [CHAR LIMIT=25] -->
<string name="data_usage_summary_title">Data usage</string>
<!-- Activity title for Appk data usage summary. [CHAR LIMIT=25] -->

View File

@@ -342,6 +342,11 @@
android:key="inactive_apps"
android:title="@string/inactive_apps_title" />
<SwitchPreference
android:key="force_allow_on_external"
android:title="@string/force_allow_on_external"
android:summary="@string/force_allow_on_external_summary"/>
</PreferenceCategory>
</PreferenceScreen>

View File

@@ -123,6 +123,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
private static final String MOCK_LOCATION_APP_KEY = "mock_location_app";
private static final String VERIFY_APPS_OVER_USB_KEY = "verify_apps_over_usb";
private static final String DEBUG_VIEW_ATTRIBUTES = "debug_view_attributes";
private static final String FORCE_ALLOW_ON_EXTERNAL_KEY = "force_allow_on_external";
private static final String STRICT_MODE_KEY = "strict_mode";
private static final String POINTER_LOCATION_KEY = "pointer_location";
private static final String SHOW_TOUCHES_KEY = "show_touches";
@@ -206,6 +207,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
private SwitchPreference mBtHciSnoopLog;
private SwitchPreference mEnableOemUnlock;
private SwitchPreference mDebugViewAttributes;
private SwitchPreference mForceAllowOnExternal;
private PreferenceScreen mPassword;
private String mDebugApp;
@@ -325,6 +327,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
}
mDebugViewAttributes = findAndInitSwitchPref(DEBUG_VIEW_ATTRIBUTES);
mForceAllowOnExternal = findAndInitSwitchPref(FORCE_ALLOW_ON_EXTERNAL_KEY);
mPassword = (PreferenceScreen) findPreference(LOCAL_BACKUP_PASSWORD);
mAllPrefs.add(mPassword);
@@ -587,6 +590,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
}
updateSwitchPreference(mDebugViewAttributes, Settings.Global.getInt(cr,
Settings.Global.DEBUG_VIEW_ATTRIBUTES, 0) != 0);
updateSwitchPreference(mForceAllowOnExternal, Settings.Global.getInt(cr,
Settings.Global.FORCE_ALLOW_ON_EXTERNAL, 0) != 0);
updateHdcpValues();
updatePasswordSummary();
updateDebuggerOptions();
@@ -1649,6 +1654,10 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
Settings.Global.putInt(getActivity().getContentResolver(),
Settings.Global.DEBUG_VIEW_ATTRIBUTES,
mDebugViewAttributes.isChecked() ? 1 : 0);
} else if (preference == mForceAllowOnExternal) {
Settings.Global.putInt(getActivity().getContentResolver(),
Settings.Global.FORCE_ALLOW_ON_EXTERNAL,
mForceAllowOnExternal.isChecked() ? 1 : 0);
} else if (preference == mDebugAppPref) {
Intent intent = new Intent(getActivity(), AppPicker.class);
intent.putExtra(AppPicker.EXTRA_DEBUGGABLE, true);