• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 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.settings.development;
18 
19 import android.app.settings.SettingsEnums;
20 import android.content.Context;
21 import android.debug.PairDevice;
22 import android.os.Bundle;
23 
24 import com.android.settings.R;
25 import com.android.settings.dashboard.DashboardFragment;
26 import com.android.settingslib.core.AbstractPreferenceController;
27 
28 import java.util.ArrayList;
29 import java.util.List;
30 
31 /**
32  * Fragment shown when clicking on a paired device in the Wireless
33  * Debugging fragment.
34  */
35 public class AdbDeviceDetailsFragment extends DashboardFragment {
36     private static final String TAG = "AdbDeviceDetailsFrag";
37     private PairDevice mPairedDevice;
38 
AdbDeviceDetailsFragment()39     public AdbDeviceDetailsFragment() {
40         super();
41     }
42 
43     @Override
onAttach(Context context)44     public void onAttach(Context context) {
45         // Get the paired device stored in the extras
46         Bundle bundle = getArguments();
47         if (bundle.containsKey(AdbPairedDevicePreference.PAIRED_DEVICE_EXTRA)) {
48             mPairedDevice = (PairDevice) bundle.getParcelable(
49                     AdbPairedDevicePreference.PAIRED_DEVICE_EXTRA);
50         }
51         super.onAttach(context);
52     }
53 
54     @Override
getMetricsCategory()55     public int getMetricsCategory() {
56         return SettingsEnums.ADB_WIRELESS_DEVICE_DETAILS;
57     }
58 
59     @Override
getLogTag()60     protected String getLogTag() {
61         return TAG;
62     }
63 
64     @Override
getPreferenceScreenResId()65     protected int getPreferenceScreenResId() {
66         return R.xml.adb_device_details_fragment;
67     }
68 
69     @Override
createPreferenceControllers(Context context)70     protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
71         final List<AbstractPreferenceController> controllers = new ArrayList<>();
72         controllers.add(new AdbDeviceDetailsHeaderController(mPairedDevice, context, this));
73         controllers.add(new AdbDeviceDetailsActionController(mPairedDevice, context, this));
74         controllers.add(new AdbDeviceDetailsFingerprintController(mPairedDevice, context, this));
75 
76         return controllers;
77     }
78 }
79