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.deviceinfo.firmwareversion 18 19 import android.content.Context 20 import android.os.SystemProperties 21 import androidx.preference.Preference 22 import com.android.settings.R 23 import com.android.settings.Utils 24 import com.android.settingslib.metadata.PreferenceAvailabilityProvider 25 import com.android.settingslib.metadata.PreferenceMetadata 26 import com.android.settingslib.metadata.PreferenceSummaryProvider 27 import com.android.settingslib.preference.PreferenceBinding 28 29 // LINT.IfChange 30 class BasebandVersionPreference : 31 PreferenceMetadata, 32 PreferenceSummaryProvider, 33 PreferenceAvailabilityProvider, 34 PreferenceBinding { 35 36 override val key: String 37 get() = "base_band" 38 39 override val title: Int 40 get() = R.string.baseband_version 41 getSummarynull42 override fun getSummary(context: Context): CharSequence? = 43 SystemProperties.get(BASEBAND_PROPERTY, context.getString(R.string.device_info_default)) 44 45 override fun isAvailable(context: Context) = !Utils.isWifiOnly(context) 46 47 override fun bind(preference: Preference, metadata: PreferenceMetadata) { 48 super.bind(preference, metadata) 49 preference.isSelectable = false 50 preference.isCopyingEnabled = true 51 } 52 53 companion object { 54 const val BASEBAND_PROPERTY: String = "gsm.version.baseband" 55 } 56 } 57 // LINT.ThenChange(BasebandVersionPreferenceController.java) 58