Restore "reset ShortcutManager rate limiting" dev option

Bug 30031093

Change-Id: I28cbf56e61937b15eb5806823f40e43d6bac4e72
This commit is contained in:
Makoto Onuki
2016-07-08 09:17:25 -07:00
parent 96bc7b5d03
commit 0651701930
3 changed files with 17 additions and 28 deletions

View File

@@ -1911,7 +1911,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
} else if (preference == mWebViewMultiprocess) {
writeWebViewMultiprocessOptions();
} else if (SHORTCUT_MANAGER_RESET_KEY.equals(preference.getKey())) {
confirmResetShortcutManagerThrottling();
resetShortcutManagerThrottling();
} else {
return super.onPreferenceTreeClick(preference);
}
@@ -2153,30 +2153,18 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
}
};
private void confirmResetShortcutManagerThrottling() {
private void resetShortcutManagerThrottling() {
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) {
}
}
if (service != null) {
try {
service.resetThrottling();
Toast.makeText(getActivity(), R.string.reset_shortcut_manager_throttling_complete,
Toast.LENGTH_SHORT).show();
} catch (RemoteException e) {
Log.e(TAG, "Failed to reset rate limiting", 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();
}
}
private void updateOemUnlockSettingDescription() {