1 /*
2  * Copyright (C) 2020 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.model.livedatatypes
18 
19 /**
20  * Tracks the state of auto revoke for a package
21  *
22  * @param isEnabledGlobal Whether or not the Auto Revoke feature is enabled globally
23  * @param isEnabledForApp Whether or not the OPSTR_AUTO_REVOKE_PERMISSIONS_IF_UNUSED is set to
24  * MODE_ALLOWED for this package
25  * @param revocableGroupNames A list of which permission groups of this package are eligible for
26  * auto-revoke. A permission group is auto-revocable if it does not contain a default granted
27  * permission.
28  */
29 class AutoRevokeState(
30     val isEnabledGlobal: Boolean,
31     val isEnabledForApp: Boolean,
32     val revocableGroupNames: List<String>
33 ) {
34 
35     /**
36      * If the auto revoke switch should be shown.
37      */
38     val shouldShowSwitch = revocableGroupNames.isNotEmpty()
39 }
40