diff --git a/res/values/strings.xml b/res/values/strings.xml index fb7ff1400a1..0d4c1b88d56 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -2991,6 +2991,10 @@ Allow development settings? These settings are intended for development use only. They can cause your device and the applications on it to break or misbehave. + + Verify apps over USB + + Check apps installed via ADB/ADT for harmful behavior. Protect USB storage diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml index 93388fc5d39..8fdb03fa715 100644 --- a/res/xml/development_prefs.xml +++ b/res/xml/development_prefs.xml @@ -75,6 +75,11 @@ android:title="@string/wait_for_debugger" android:summary="@string/wait_for_debugger_summary"/> + + - receivers = pm.queryBroadcastReceivers(verification, 0); + if (receivers.size() == 0) { + return false; + } + } + return true; + } + + private boolean showVerifierSetting() { + return Settings.Global.getInt(getActivity().getContentResolver(), + Settings.Global.PACKAGE_VERIFIER_SETTING_VISIBLE, 1) > 0; + } + // Returns the current state of the system property that controls // strictmode flashes. One of: // 0: not explicitly set one way or another @@ -874,6 +929,8 @@ public class DevelopmentSettings extends PreferenceFragment } else { Settings.Global.putInt(getActivity().getContentResolver(), Settings.Global.ADB_ENABLED, 0); + mVerifyAppsOverUsb.setEnabled(false); + mVerifyAppsOverUsb.setChecked(false); } } else if (preference == mBugreportInPower) { Settings.Secure.putInt(getActivity().getContentResolver(), @@ -898,6 +955,8 @@ public class DevelopmentSettings extends PreferenceFragment startActivityForResult(new Intent(getActivity(), AppPicker.class), RESULT_DEBUG_APP); } else if (preference == mWaitForDebugger) { writeDebuggerOptions(); + } else if (preference == mVerifyAppsOverUsb) { + writeVerifyAppsOverUsbOptions(); } else if (preference == mStrictMode) { writeStrictModeVisualOptions(); } else if (preference == mPointerLocation) { @@ -977,6 +1036,8 @@ public class DevelopmentSettings extends PreferenceFragment mDialogClicked = true; Settings.Global.putInt(getActivity().getContentResolver(), Settings.Global.ADB_ENABLED, 1); + mVerifyAppsOverUsb.setEnabled(true); + updateVerifyAppsOverUsbOptions(); } else { // Reset the toggle mEnableAdb.setChecked(false); diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java index 420dcbcf7e3..afc7f4b7fde 100644 --- a/src/com/android/settings/SecuritySettings.java +++ b/src/com/android/settings/SecuritySettings.java @@ -72,6 +72,7 @@ public class SecuritySettings extends SettingsPreferenceFragment private static final String KEY_VISIBLE_PATTERN = "visiblepattern"; private static final String KEY_TACTILE_FEEDBACK_ENABLED = "unlock_tactile_feedback"; private static final String KEY_SECURITY_CATEGORY = "security_category"; + private static final String KEY_DEVICE_ADMIN_CATEGORY = "device_admin_category"; private static final String KEY_LOCK_AFTER_TIMEOUT = "lock_after_timeout"; private static final String EXTRA_NO_WIDGET = "com.android.settings.NO_WIDGET"; private static final String EXTRA_DEFAULT_WIDGET = "com.android.settings.DEFAULT_WIDGET"; @@ -289,8 +290,14 @@ public class SecuritySettings extends SettingsPreferenceFragment mToggleVerifyApps.setChecked(false); mToggleVerifyApps.setEnabled(false); } - } else if (mToggleVerifyApps != null) { - mToggleVerifyApps.setEnabled(false); + } else { + PreferenceGroup deviceAdminCategory= (PreferenceGroup) + root.findPreference(KEY_DEVICE_ADMIN_CATEGORY); + if (deviceAdminCategory != null) { + deviceAdminCategory.removePreference(mToggleVerifyApps); + } else { + mToggleVerifyApps.setEnabled(false); + } } return root;