Files
android_development/apps/Development/src/com/android/development/Development.java
Weilun Du f11e49ee42 Fixed the bug where there are multiple developer options
BUG: 69679218

Change-Id: Ib44bf9441ecc7378d810cb55e5d9acdedbde99d6
Signed-off-by: Weilun Du <wdu@google.com>
2017-12-01 17:59:56 -08:00

46 lines
1.6 KiB
Java

/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.development;
import java.util.List;
import android.app.LauncherActivity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.provider.Settings;
public class Development extends LauncherActivity
{
@Override
protected Intent getTargetIntent() {
Intent targetIntent = new Intent(Intent.ACTION_MAIN, null);
targetIntent.addCategory(Intent.CATEGORY_TEST);
return targetIntent;
}
protected void onSortResultList(List<ResolveInfo> results) {
super.onSortResultList(results);
Intent settingsIntent = new Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS);
//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);
}
}
}