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 package com.android.settings.supervision 17 18 import android.content.Context 19 import com.android.settings.R 20 import com.android.settingslib.metadata.PreferenceAvailabilityProvider 21 import com.android.settingslib.metadata.ProvidePreferenceScreen 22 import com.android.settingslib.metadata.preferenceHierarchy 23 import com.android.settingslib.preference.PreferenceScreenCreator 24 25 /** Pin Management landing page (Settings > Supervision > Manage Pin). */ 26 @ProvidePreferenceScreen(SupervisionPinManagementScreen.KEY) 27 class SupervisionPinManagementScreen : PreferenceScreenCreator, PreferenceAvailabilityProvider { 28 override val key: String 29 get() = KEY 30 isAvailablenull31 override fun isAvailable(context: Context) = 32 SupervisionHelper.getInstance(context).isSupervisingCredentialSet() 33 34 override val title: Int 35 get() = R.string.supervision_pin_management_preference_title 36 37 // TODO(b/391994031): dynamically update the summary according to PIN status. 38 override val summary: Int 39 get() = R.string.supervision_pin_management_preference_summary_add 40 41 // TODO(b/391994031): dynamically update the icon according to PIN status. 42 override val icon: Int 43 get() = R.drawable.ic_pin_outline 44 45 override fun fragmentClass() = SupervisionPinManagementFragment::class.java 46 47 override fun getPreferenceHierarchy(context: Context) = 48 preferenceHierarchy(context, this) { 49 +SupervisionPinRecoveryPreference() 50 // TODO(b/391992481) implement the screen. 51 +SupervisionChangePinPreference() 52 } 53 54 companion object { 55 const val KEY = "supervision_pin_management" 56 } 57 } 58