ApplicationFeatureProvider.java revision f5bd885a1d0cd5e61aeb3d4a03261dea6548789a
1/* 2 * Copyright (C) 2016 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.annotation.UserIdInt; 20import android.app.Fragment; 21import android.content.Intent; 22import android.view.View; 23 24import com.android.settings.applications.instantapps.InstantAppButtonsController; 25 26import java.util.List; 27 28public interface ApplicationFeatureProvider { 29 30 /** 31 * Returns a new {@link EntityHeaderController} instance to customize app header. 32 */ 33 EntityHeaderController newAppHeaderController(Fragment fragment, View appHeader); 34 35 /** 36 * Returns a new {@link InstantAppButtonsController} instance for showing buttons 37 * only relevant to instant apps. 38 */ 39 InstantAppButtonsController newInstantAppButtonsController(Fragment fragment, 40 View view, InstantAppButtonsController.ShowDialogDelegate showDialogDelegate); 41 42 /** 43 * Calculates the total number of apps installed on the device via policy in the current user 44 * and all its managed profiles. 45 * 46 * @param async Whether to count asynchronously in a background thread 47 * @param callback The callback to invoke with the result 48 */ 49 void calculateNumberOfPolicyInstalledApps(boolean async, NumberOfAppsCallback callback); 50 51 /** 52 * Asynchronously builds the list of apps installed on the device via policy in the current user 53 * and all its managed profiles. 54 * 55 * @param callback The callback to invoke with the result 56 */ 57 void listPolicyInstalledApps(ListOfAppsCallback callback); 58 59 /** 60 * Asynchronously calculates the total number of apps installed in the current user and all its 61 * managed profiles that have been granted one or more of the given permissions by the admin. 62 * 63 * @param permissions Only consider apps that have been granted one or more of these 64 * permissions by the admin, either at run-time or install-time 65 * @param async Whether to count asynchronously in a background thread 66 * @param callback The callback to invoke with the result 67 */ 68 void calculateNumberOfAppsWithAdminGrantedPermissions(String[] permissions, boolean async, 69 NumberOfAppsCallback callback); 70 71 /** 72 * Asynchronously builds the list of apps installed in the current user and all its 73 * managed profiles that have been granted one or more of the given permissions by the admin. 74 * 75 * @param permissions Only consider apps that have been granted one or more of these 76 * permissions by the admin, either at run-time or install-time 77 * @param callback The callback to invoke with the result 78 */ 79 void listAppsWithAdminGrantedPermissions(String[] permissions, ListOfAppsCallback callback); 80 81 /** 82 * Return the persistent preferred activities configured by the admin for the given user. 83 * A persistent preferred activity is an activity that the admin configured to always handle a 84 * given intent (e.g. open browser), even if the user has other apps installed that would also 85 * be able to handle the intent. 86 * 87 * @param userId ID of the user for which to find persistent preferred activities 88 * @param intents The intents for which to find persistent preferred activities 89 * @return the persistent preferred activities for the given intents, ordered first by user id, 90 * then by package name 91 */ 92 List<UserAppInfo> findPersistentPreferredActivities(@UserIdInt int userId, Intent[] intents); 93 94 /** 95 * Callback that receives the number of packages installed on the device. 96 */ 97 interface NumberOfAppsCallback { 98 void onNumberOfAppsResult(int num); 99 } 100 101 /** 102 * Callback that receives the list of packages installed on the device. 103 */ 104 interface ListOfAppsCallback { 105 void onListOfAppsResult(List<UserAppInfo> result); 106 } 107} 108