- Updates default icon to outlined version - Makes availability conditional on existence of supervising credential - Does not disable entry point when the main switch is disabled Bug: 405159398 Test: atest SupervisionPinManagementScreenTest Test: atest SupervisionDashboardScreenTest Flag: android.app.supervision.flags.enable_supervision_settings_screen Change-Id: I764a6b767019007a93aacf29ecf47677e16cb058
58 lines
2.2 KiB
Kotlin
58 lines
2.2 KiB
Kotlin
/*
|
|
* Copyright (C) 2025 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
package com.android.settings.supervision
|
|
|
|
import android.content.Context
|
|
import com.android.settings.R
|
|
import com.android.settingslib.metadata.PreferenceAvailabilityProvider
|
|
import com.android.settingslib.metadata.ProvidePreferenceScreen
|
|
import com.android.settingslib.metadata.preferenceHierarchy
|
|
import com.android.settingslib.preference.PreferenceScreenCreator
|
|
|
|
/** Pin Management landing page (Settings > Supervision > Manage Pin). */
|
|
@ProvidePreferenceScreen(SupervisionPinManagementScreen.KEY)
|
|
class SupervisionPinManagementScreen : PreferenceScreenCreator, PreferenceAvailabilityProvider {
|
|
override val key: String
|
|
get() = KEY
|
|
|
|
override fun isAvailable(context: Context) =
|
|
SupervisionHelper.getInstance(context).isSupervisingCredentialSet()
|
|
|
|
override val title: Int
|
|
get() = R.string.supervision_pin_management_preference_title
|
|
|
|
// TODO(b/391994031): dynamically update the summary according to PIN status.
|
|
override val summary: Int
|
|
get() = R.string.supervision_pin_management_preference_summary_add
|
|
|
|
// TODO(b/391994031): dynamically update the icon according to PIN status.
|
|
override val icon: Int
|
|
get() = R.drawable.ic_pin_outline
|
|
|
|
override fun fragmentClass() = SupervisionPinManagementFragment::class.java
|
|
|
|
override fun getPreferenceHierarchy(context: Context) =
|
|
preferenceHierarchy(context, this) {
|
|
+SupervisionPinRecoveryPreference()
|
|
// TODO(b/391992481) implement the screen.
|
|
+SupervisionChangePinPreference()
|
|
}
|
|
|
|
companion object {
|
|
const val KEY = "supervision_pin_management"
|
|
}
|
|
}
|