diff --git a/res/values/strings.xml b/res/values/strings.xml index ac278978493..c2ff86e416b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -7357,4 +7357,13 @@ Wipe and convert + + Reset ShortcutManager rate-limiting counters + + + Reset ShortcutManager rate-limiting? + + + Reset ShortcutManager rate-limiting counters? + diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml index 1b056b8ba0f..e58ff9561eb 100644 --- a/res/xml/development_prefs.xml +++ b/res/xml/development_prefs.xml @@ -365,6 +365,10 @@ android:key="force_resizable_activities" android:title="@string/force_resizable_activities" android:summary="@string/force_resizable_activities_summary"/> + + diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java index d6044735098..e33c0816eb4 100644 --- a/src/com/android/settings/DevelopmentSettings.java +++ b/src/com/android/settings/DevelopmentSettings.java @@ -23,8 +23,6 @@ import android.app.AlertDialog; import android.app.AppOpsManager; import android.app.AppOpsManager.PackageOps; import android.app.Dialog; -import android.app.DialogFragment; -import android.app.UiModeManager; import android.app.admin.DevicePolicyManager; import android.app.backup.IBackupManager; import android.bluetooth.BluetoothAdapter; @@ -36,6 +34,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ApplicationInfo; +import android.content.pm.IShortcutService; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ResolveInfo; @@ -60,7 +59,6 @@ import android.os.storage.IMountService; import android.provider.SearchIndexableResource; import android.provider.Settings; import android.support.v14.preference.SwitchPreference; -import android.support.v7.preference.DropDownPreference; import android.support.v7.preference.ListPreference; import android.support.v7.preference.Preference; import android.support.v7.preference.Preference.OnPreferenceChangeListener; @@ -212,6 +210,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment private static final String PERSISTENT_DATA_BLOCK_PROP = "ro.frp.pst"; private static final String FLASH_LOCKED_PROP = "ro.boot.flash.locked"; + private static final String SHORTCUT_MANAGER_RESET_KEY = "reset_shortcut_manager_throttling"; + private static final int REQUEST_CODE_ENABLE_OEM_UNLOCK = 0; private static final int[] MOCK_LOCATION_APP_OPS = new int[] {AppOpsManager.OP_MOCK_LOCATION}; @@ -1919,6 +1919,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment writeBluetoothDisableAbsVolumeOptions(); } else if (preference == mWebViewMultiprocess) { writeWebViewMultiprocessOptions(); + } else if (SHORTCUT_MANAGER_RESET_KEY.equals(preference.getKey())) { + confirmResetShortcutManagerThrottling(); } else { return super.onPreferenceTreeClick(preference); } @@ -2171,4 +2173,30 @@ public class DevelopmentSettings extends RestrictedSettingsFragment return keys; } }; + + private void confirmResetShortcutManagerThrottling() { + final IShortcutService service = IShortcutService.Stub.asInterface( + ServiceManager.getService(Context.SHORTCUT_SERVICE)); + + DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + if (which == DialogInterface.BUTTON_POSITIVE) { + try { + service.resetThrottling(); + } catch (RemoteException e) { + } + } + } + }; + + new AlertDialog.Builder(getActivity()) + .setTitle(R.string.confirm_reset_shortcut_manager_throttling_title) + .setMessage(R.string.confirm_reset_shortcut_manager_throttling_message) + .setPositiveButton(R.string.okay, onClickListener) + .setNegativeButton(android.R.string.cancel, null) + .create() + .show(); + + } }