OSDN Git Service

Suspend action in security patch when browser is disabled
authorjackqdyulei <jackqdyulei@google.com>
Fri, 14 Oct 2016 20:53:14 +0000 (13:53 -0700)
committerjackqdyulei <jackqdyulei@google.com>
Mon, 17 Oct 2016 21:35:15 +0000 (14:35 -0700)
When queryIntentActivities(intent, flag) return empty, don't send out
that intent to stop crash. This is a special catch only in security
patch.

Bug: 32054067
Test: Manual, hard to mock the situation to disable all the apps for
a specific action.

Change-Id: Ibc96b814a4170926972cff8e0bc954ea57b33c10

src/com/android/settings/DeviceInfoSettings.java

index dd8064f..de62f92 100644 (file)
@@ -277,6 +277,13 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment implements In
                         Toast.LENGTH_LONG);
                 mDevHitToast.show();
             }
+        } else if (preference.getKey().equals(KEY_SECURITY_PATCH)) {
+            if (getPackageManager().queryIntentActivities(preference.getIntent(), 0).isEmpty()) {
+                // Don't send out the intent to stop crash
+                Log.w(LOG_TAG, "Stop click action on " + KEY_SECURITY_PATCH + ": "
+                        + "queryIntentActivities() returns empty" );
+                return true;
+            }
         } else if (preference.getKey().equals(KEY_DEVICE_FEEDBACK)) {
             sendFeedback();
         } else if(preference.getKey().equals(KEY_SYSTEM_UPDATE_SETTINGS)) {