• 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.deviceinfo.firmwareversion
18 
19 import android.content.Context
20 import android.os.Build
21 import com.android.settings.R
22 import com.android.settings.flags.Flags
23 import com.android.settingslib.metadata.PreferenceSummaryProvider
24 import com.android.settingslib.metadata.ProvidePreferenceScreen
25 import com.android.settingslib.metadata.preferenceHierarchy
26 import com.android.settingslib.preference.PreferenceScreenCreator
27 
28 @ProvidePreferenceScreen(FirmwareVersionScreen.KEY)
29 class FirmwareVersionScreen : PreferenceScreenCreator, PreferenceSummaryProvider {
30 
isFlagEnablednull31     override fun isFlagEnabled(context: Context) = Flags.catalystFirmwareVersion()
32 
33     override val key: String
34         get() = KEY
35 
36     override val title: Int
37         get() = R.string.firmware_version
38 
39     override fun getSummary(context: Context): CharSequence? =
40         Build.VERSION.RELEASE_OR_PREVIEW_DISPLAY
41 
42     override val keywords: Int
43         get() = R.string.keywords_android_version
44 
45     override fun fragmentClass() = FirmwareVersionSettings::class.java
46 
47     override fun getPreferenceHierarchy(context: Context) =
48         preferenceHierarchy(context, this) {
49             +FirmwareVersionDetailPreference()
50             +SecurityPatchLevelPreference()
51             +MainlineModuleVersionPreference()
52             +BasebandVersionPreference()
53             +KernelVersionPreference()
54             +SimpleBuildNumberPreference()
55         }
56 
57     companion object {
58         const val KEY = "firmware_version"
59     }
60 }
61