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

@@ -7465,13 +7465,10 @@
<string name="button_confirm_convert_fbe">Wipe and convert</string> <string name="button_confirm_convert_fbe">Wipe and convert</string>
<!-- Reset rate-limiting in the system service ShortcutManager. [CHAR_LIMIT=none] --> <!-- Reset rate-limiting in the system service ShortcutManager. [CHAR_LIMIT=none] -->
<string name="reset_shortcut_manager_throttling">Reset ShortcutManager rate-limiting counters</string> <string name="reset_shortcut_manager_throttling">Reset ShortcutManager rate-limiting</string>
<!-- Title of the dialog box to confirm resetting rate-limiting in the system service ShortcutManager. [CHAR_LIMIT=none] --> <!-- Toast message shown when "Reset ShortcutManager rate-limiting" has been performed. [CHAR_LIMIT=none] -->
<string name="confirm_reset_shortcut_manager_throttling_title">Reset ShortcutManager rate-limiting?</string> <string name="reset_shortcut_manager_throttling_complete">ShortcutManager rate-limiting has been reset</string>
<!-- Message of the dialog box to confirm resetting rate-limiting in the system service ShortcutManager. [CHAR_LIMIT=none] -->
<string name="confirm_reset_shortcut_manager_throttling_message">Reset ShortcutManager rate-limiting counters?</string>
<!-- Title of notification suggestion during optional steps of setup. [CHAR_LIMIT=60] --> <!-- Title of notification suggestion during optional steps of setup. [CHAR_LIMIT=60] -->
<string name="notification_suggestion_title">Control lock screen notifications</string> <string name="notification_suggestion_title">Control lock screen notifications</string>

View File

@@ -372,6 +372,10 @@
android:key="force_resizable_activities" android:key="force_resizable_activities"
android:title="@string/force_resizable_activities" android:title="@string/force_resizable_activities"
android:summary="@string/force_resizable_activities_summary"/> android:summary="@string/force_resizable_activities_summary"/>
<Preference
android:key="reset_shortcut_manager_throttling"
android:title="@string/reset_shortcut_manager_throttling" />
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>

View File

@@ -1911,7 +1911,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
} else if (preference == mWebViewMultiprocess) { } else if (preference == mWebViewMultiprocess) {
writeWebViewMultiprocessOptions(); writeWebViewMultiprocessOptions();
} else if (SHORTCUT_MANAGER_RESET_KEY.equals(preference.getKey())) { } else if (SHORTCUT_MANAGER_RESET_KEY.equals(preference.getKey())) {
confirmResetShortcutManagerThrottling(); resetShortcutManagerThrottling();
} else { } else {
return super.onPreferenceTreeClick(preference); 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( final IShortcutService service = IShortcutService.Stub.asInterface(
ServiceManager.getService(Context.SHORTCUT_SERVICE)); ServiceManager.getService(Context.SHORTCUT_SERVICE));
if (service != null) {
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() { try {
@Override service.resetThrottling();
public void onClick(DialogInterface dialog, int which) { Toast.makeText(getActivity(), R.string.reset_shortcut_manager_throttling_complete,
if (which == DialogInterface.BUTTON_POSITIVE) { Toast.LENGTH_SHORT).show();
try { } catch (RemoteException e) {
service.resetThrottling(); Log.e(TAG, "Failed to reset rate limiting", e);
} 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();
} }
private void updateOemUnlockSettingDescription() { private void updateOemUnlockSettingDescription() {