OSDN Git Service

Settings: Fix settings force close in monkey test.
authorguangl <guangl@codeaurora.org>
Thu, 22 Sep 2016 11:35:23 +0000 (19:35 +0800)
committerGerrit - the friendly Code Review server <code-review@localhost>
Thu, 22 Sep 2016 11:38:59 +0000 (04:38 -0700)
No Activity found to handle Intent
{act=android.intent.action.MANAGE_PERMISSIONS}

Check whether activity exists befor start activity.

Change-Id: Ie373d760cbd22a3b24b4b735b3a5fbe290fc25c4
CRs-Fixed: 1069238

src/com/android/settings/applications/AdvancedAppSettings.java

index ffa2236..e390606 100644 (file)
@@ -63,7 +63,10 @@ public class AdvancedAppSettings extends SettingsPreferenceFragment implements
         addPreferencesFromResource(R.xml.advanced_apps);
 
         Preference permissions = getPreferenceScreen().findPreference(KEY_APP_PERM);
-        permissions.setIntent(new Intent(Intent.ACTION_MANAGE_PERMISSIONS));
+        final Intent intent = new Intent(Intent.ACTION_MANAGE_PERMISSIONS);
+        if (!getPackageManager().queryIntentActivities(intent, 0).isEmpty()) {
+            permissions.setIntent(intent);
+        }
 
         ApplicationsState applicationsState = ApplicationsState.getInstance(
                 getActivity().getApplication());