Fix crash in clicking Default Home gear icon.

- change the way that default home query the resolve activity to only
check for LAUNCHER activity.

Change-Id: Ib53154afe7951f4e2c7c3ab147be4c691113e0e7
Merged-In: Ib53154afe7951f4e2c7c3ab147be4c691113e0e7
Fixes: 112249115
Test: make RunSettingsRoboTests
This commit is contained in:
Doris Ling
2018-08-23 13:25:06 -07:00
parent da38b41b9a
commit 72836a99d2
2 changed files with 29 additions and 22 deletions

View File

@@ -106,7 +106,9 @@ public class DefaultHomePreferenceController extends DefaultAppPreferenceControl
Intent intent = new Intent(Intent.ACTION_APPLICATION_PREFERENCES)
.setPackage(packageName)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
return mPackageManager.queryIntentActivities(intent, 0).size() == 1 ? intent : null;
return intent.resolveActivity(mPackageManager.getPackageManager()) != null
? intent
: null;
}
public static boolean hasHomePreference(String pkg, Context context) {