Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06517019 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Restore "reset ShortcutManager rate limiting" dev option

Bug 30031093

Change-Id: I28cbf56e61937b15eb5806823f40e43d6bac4e72
parent 96bc7b5d
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -7465,13 +7465,10 @@
    <string name="button_confirm_convert_fbe">Wipe and convert</string>
    <!-- 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] -->
    <string name="confirm_reset_shortcut_manager_throttling_title">Reset ShortcutManager rate-limiting?</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>
    <!-- Toast message shown when "Reset ShortcutManager rate-limiting" has been performed. [CHAR_LIMIT=none] -->
    <string name="reset_shortcut_manager_throttling_complete">ShortcutManager rate-limiting has been reset</string>
    <!-- Title of notification suggestion during optional steps of setup. [CHAR_LIMIT=60] -->
    <string name="notification_suggestion_title">Control lock screen notifications</string>
+4 −0
Original line number Diff line number Diff line
@@ -372,6 +372,10 @@
            android:key="force_resizable_activities"
            android:title="@string/force_resizable_activities"
            android:summary="@string/force_resizable_activities_summary"/>

        <Preference
            android:key="reset_shortcut_manager_throttling"
            android:title="@string/reset_shortcut_manager_throttling" />
     </PreferenceCategory>

</PreferenceScreen>
+10 −22
Original line number Diff line number Diff line
@@ -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,31 +2153,19 @@ 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) {
        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() {
        if (mEnableOemUnlock != null) {