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.privacysources
18 
19 import android.content.Context
20 import android.content.Intent
21 
22 interface PrivacySource {
23 
24     /**
25      * It is {@code true} for privacy source that wants to receive broadcasts signals for profiles
26      */
27     val shouldProcessProfileRequest: Boolean
28 
29     /**
30      * Indicates that permission controller has received the safety center enabled changed broadcast
31      *
32      * <p> Invoked when {@link SafetyCenterManager.ACTION_SAFETY_CENTER_ENABLED_CHANGED} received
33      *
34      * @param context: Context of the broadcast
35      * @param enabled: {@code true} if Safety Center now enabled
36      */
safetyCenterEnabledChangednull37     fun safetyCenterEnabledChanged(context: Context, enabled: Boolean)
38 
39     /**
40      * Indicates that permission controller has received the safety center rescan broadcast.
41      * context: Context of the broadcast intent: Intent of the broadcast refreshEvent: Enum
42      * explaining why this rescan was triggered. If the value is EVENT_REFRESH_REQUESTED, get the
43      * broadcast id using code below, val refreshBroadcastId =
44      * intent.getStringExtra(SafetyCenterManager .EXTRA_REFRESH_SAFETY_SOURCES_BROADCAST_ID) and add
45      * it to the safety event, when sending SafetyCenterManager#setSafetyCenterUpdate val
46      * safetyEvent = SafetyEvent.Builder(SAFETY_EVENT_TYPE_REFRESH_REQUESTED)
47      * .setRefreshBroadcastId(refreshBroadcastId).build()
48      */
49     fun rescanAndPushSafetyCenterData(
50         context: Context,
51         intent: Intent,
52         refreshEvent: SafetyCenterReceiver.RefreshEvent
53     )
54 }
55