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 androidx.annotation.VisibleForTesting 21 import com.android.safetycenter.resources.SafetyCenterResourcesApk 22 23 // (TODO:b/242573074) Remove for Android U. 24 class NotificationListenerPregrants(private val context: Context) { 25 @VisibleForTesting <lambda>null26 val pregrantedPackagesDelegate = lazy { 27 hashSetOf( 28 "android", 29 "com.android.cellbroadcastreceiver", 30 "com.android.server.telecom", 31 "com.android.settings", 32 "com.android.systemui", 33 "com.android.launcher3", 34 "com.android.dynsystem", 35 "com.android.providers.settings", 36 "com.android.inputdevices", 37 "com.android.keychain", 38 "com.android.localtransport", 39 "com.android.wallpaperbackup", 40 "com.android.location.fused" 41 ) 42 .also { 43 it.addAll( 44 SafetyCenterResourcesApk(context) 45 .getStringByName("config_NotificationListenerServicePregrants") 46 .split(",") 47 ) 48 } 49 } 50 val pregrantedPackages: Set<String> by pregrantedPackagesDelegate 51 } 52