• 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 package com.android.settings.deviceinfo.legal
17 
18 import android.content.Context
19 import com.android.settings.LegalSettings
20 import com.android.settings.R
21 import com.android.settings.flags.Flags
22 import com.android.settingslib.metadata.ProvidePreferenceScreen
23 import com.android.settingslib.metadata.preferenceHierarchy
24 import com.android.settingslib.preference.PreferenceScreenCreator
25 
26 @ProvidePreferenceScreen(LegalSettingsScreen.KEY)
27 open class LegalSettingsScreen : PreferenceScreenCreator {
28     override val key: String
29         get() = KEY
30 
31     override val title: Int
32         get() = R.string.legal_information
33 
isFlagEnablednull34     override fun isFlagEnabled(context: Context) = Flags.catalystLegalInformation()
35 
36     override fun fragmentClass() = LegalSettings::class.java
37 
38     override fun getPreferenceHierarchy(context: Context) =
39         preferenceHierarchy(context, this) {
40             +LegalPreference("copyright", R.string.copyright_title, "android.settings.COPYRIGHT")
41             +LegalPreference("license", R.string.license_title, "android.settings.LICENSE")
42             +LegalPreference("terms", R.string.terms_title, "android.settings.TERMS")
43             +ModuleLicensesScreen.KEY // Use screen key in case it is overlaid.
44             +LegalPreference(
45                 "webview_license",
46                 R.string.webview_license_title,
47                 "android.settings.WEBVIEW_LICENSE",
48             )
49             +WallpaperAttributionsPreference()
50         }
51 
52     companion object {
53         const val KEY = "legal_information"
54     }
55 }
56