• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.development;
18 
19 import java.util.List;
20 
21 import android.app.LauncherActivity;
22 import android.content.Intent;
23 import android.content.pm.PackageManager;
24 import android.content.pm.ResolveInfo;
25 import android.provider.Settings;
26 
27 public class Development extends LauncherActivity
28 {
29     @Override
getTargetIntent()30     protected Intent getTargetIntent() {
31         Intent targetIntent = new Intent(Intent.ACTION_MAIN, null);
32         targetIntent.addCategory(Intent.CATEGORY_TEST);
33         return targetIntent;
34     }
35 
onSortResultList(List<ResolveInfo> results)36     protected void onSortResultList(List<ResolveInfo> results) {
37         super.onSortResultList(results);
38         Intent settingsIntent = new Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS);
39         //In API 26, there are multiplte developer settings activities, choose the one with highest priority
40         ResolveInfo topItem = getPackageManager().resolveActivity(settingsIntent, PackageManager.MATCH_DEFAULT_ONLY);
41         if (topItem != null) {
42             results.add(0, topItem);
43         }
44     }
45 }
46