From f11e49ee4275312a94e8c52482bfac726d4f41cc Mon Sep 17 00:00:00 2001 From: Weilun Du Date: Wed, 29 Nov 2017 11:30:53 -0800 Subject: [PATCH] Fixed the bug where there are multiple developer options BUG: 69679218 Change-Id: Ib44bf9441ecc7378d810cb55e5d9acdedbde99d6 Signed-off-by: Weilun Du --- .../src/com/android/development/Development.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/Development/src/com/android/development/Development.java b/apps/Development/src/com/android/development/Development.java index 8a317cd27..649f56644 100644 --- a/apps/Development/src/com/android/development/Development.java +++ b/apps/Development/src/com/android/development/Development.java @@ -36,11 +36,10 @@ public class Development extends LauncherActivity protected void onSortResultList(List results) { super.onSortResultList(results); Intent settingsIntent = new Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS); - List topItems = getPackageManager().queryIntentActivities( - settingsIntent, PackageManager.MATCH_DEFAULT_ONLY); - if (topItems != null) { - super.onSortResultList(topItems); - results.addAll(0, topItems); + //In API 26, there are multiplte developer settings activities, choose the one with highest priority + ResolveInfo topItem = getPackageManager().resolveActivity(settingsIntent, PackageManager.MATCH_DEFAULT_ONLY); + if (topItem != null) { + results.add(0, topItem); } } }