• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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.connecteddevice.virtual;
18 
19 import android.app.settings.SettingsEnums;
20 import android.content.Context;
21 
22 import androidx.annotation.NonNull;
23 
24 import com.android.settings.R;
25 import com.android.settings.dashboard.DashboardFragment;
26 
27 /**
28  * Dedicated screen displaying the information for a single virtual device to the user and allowing
29  * them to manage that device.
30  */
31 public class VirtualDeviceDetailsFragment extends DashboardFragment {
32 
33     private static final String TAG = VirtualDeviceDetailsFragment.class.getSimpleName();
34 
35     static final String DEVICE_ARG = "virtual_device_arg";
36 
37     @Override
onAttach(@onNull Context context)38     public void onAttach(@NonNull Context context) {
39         super.onAttach(context);
40 
41         VirtualDeviceWrapper device =
42                 getArguments().getParcelable(DEVICE_ARG, VirtualDeviceWrapper.class);
43 
44         use(VirtualDeviceDetailsHeaderController.class).init(device);
45         use(VirtualDeviceDetailsButtonsController.class).init(this, device);
46         use(VirtualDeviceDetailsCompanionAppController.class)
47                 .init(this, device.getAssociationInfo().getPackageName());
48         use(VirtualDeviceDetailsFooterController.class).init(device.getDeviceName(context));
49     }
50 
51     @Override
getMetricsCategory()52     public int getMetricsCategory() {
53         return SettingsEnums.VIRTUAL_DEVICE_DETAILS;
54     }
55 
56     @Override
getLogTag()57     protected String getLogTag() {
58         return TAG;
59     }
60 
61     @Override
getPreferenceScreenResId()62     protected int getPreferenceScreenResId() {
63         return R.xml.virtual_device_details_fragment;
64     }
65 }
66