Fixed the bug where there are multiple developer options

BUG: 69679218

Change-Id: Ib44bf9441ecc7378d810cb55e5d9acdedbde99d6
Signed-off-by: Weilun Du <wdu@google.com>
This commit is contained in:
Weilun Du
2017-11-29 11:30:53 -08:00
parent 8ab62faed3
commit f11e49ee42

View File

@@ -36,11 +36,10 @@ public class Development extends LauncherActivity
protected void onSortResultList(List<ResolveInfo> results) {
super.onSortResultList(results);
Intent settingsIntent = new Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS);
List<ResolveInfo> 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);
}
}
}