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