• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 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.network.ethernet
18 
19 import android.app.settings.SettingsEnums
20 import android.content.Context
21 import android.os.Bundle
22 import androidx.annotation.VisibleForTesting
23 import com.android.settings.R
24 import com.android.settings.dashboard.DashboardFragment
25 import com.android.settingslib.core.AbstractPreferenceController
26 
27 class EthernetInterfaceDetailsFragment : DashboardFragment() {
28     private val TAG = "EthernetInterfaceDetailsFragment"
29     private val ETHERNET_INTERFACE_KEY = "EthernetInterfaceKey"
30     private var preferenceId: String? = null
31 
onCreatenull32     override fun onCreate(bundle: Bundle?) {
33         super.onCreate(bundle)
34         preferenceId = bundle?.getString(ETHERNET_INTERFACE_KEY)
35     }
36 
getPreferenceScreenResIdnull37     override public fun getPreferenceScreenResId(): Int {
38         return R.xml.ethernet_interface_details
39     }
40 
41     @VisibleForTesting
getMetricsCategorynull42     override fun getMetricsCategory(): Int {
43         return SettingsEnums.ETHERNET_SETTINGS
44     }
45 
getLogTagnull46     override public fun getLogTag(): String {
47         return TAG
48     }
49 
createPreferenceControllersnull50     override public fun createPreferenceControllers(
51         context: Context
52     ): List<AbstractPreferenceController> {
53         return listOf(
54             EthernetInterfaceDetailsController(
55                 context,
56                 this,
57                 preferenceId ?: "",
58                 getSettingsLifecycle(),
59             )
60         )
61     }
62 }
63