1 /*
2  * Copyright (C) 2022 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.permissioncontroller.permission.ui.television
18 
19 import android.app.Application
20 import android.content.Context
21 import android.os.UserHandle
22 import androidx.preference.Preference
23 import com.android.permissioncontroller.permission.ui.RemovablePref
24 import com.android.permissioncontroller.permission.utils.KotlinUtils
25 
26 /**
27  * A TV-styled preference which represents an app that has been auto revoked. Has the app icon and
28  * label, as well as a button to open the app.
29  *
30  * @param app The current application
31  * @param packageName The name of the package whose icon this preference will retrieve
32  * @param user The user whose package icon will be retrieved
33  * @param context The current context
34  */
35 class TvUnusedAppsPreference(
36     app: Application,
37     packageName: String,
38     user: UserHandle,
39     context: Context
40 ) : Preference(context), RemovablePref {
41 
42     init {
43         icon = KotlinUtils.getBadgedPackageIcon(app, packageName, user)
44     }
45 
setRemoveClickRunnablenull46     override fun setRemoveClickRunnable(runnable: Runnable) {
47         // TV Settings don't have secondary icons and actions
48     }
49 
setRemoveComponentEnablednull50     override fun setRemoveComponentEnabled(enabled: Boolean) {
51         // TV Settings doesn't have a remove component
52     }
53 }
54