AppWithAdminGrantedPermissionsLister.java revision 60b2960cbb4df5310d054da57e2ec134b3fca0e6
1/* 2 * Copyright (C) 2017 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 17package com.android.settings.applications; 18 19import android.content.pm.ApplicationInfo; 20import android.os.UserManager; 21import com.android.settings.enterprise.DevicePolicyManagerWrapper; 22 23/** 24 * Lists installed apps across all users that have been granted one or more specific permissions by 25 * the admin. 26 */ 27public abstract class AppWithAdminGrantedPermissionsLister extends AppLister { 28 private final String[] mPermissions; 29 private final IPackageManagerWrapper mPackageManagerService; 30 private final DevicePolicyManagerWrapper mDevicePolicyManager; 31 32 public AppWithAdminGrantedPermissionsLister(String[] permissions, 33 PackageManagerWrapper packageManager, IPackageManagerWrapper packageManagerService, 34 DevicePolicyManagerWrapper devicePolicyManager, UserManager userManager) { 35 super(packageManager, userManager); 36 mPermissions = permissions; 37 mPackageManagerService = packageManagerService; 38 mDevicePolicyManager = devicePolicyManager; 39 } 40 41 @Override 42 protected boolean includeInCount(ApplicationInfo info) { 43 return AppWithAdminGrantedPermissionsCounter.includeInCount(mPermissions, 44 mDevicePolicyManager, mPm, mPackageManagerService, info); 45 } 46} 47