blob: 89f2fc4334a45d2e0ce02b656ffb076fb178d477 [file] [log] [blame]
Svet Ganovadc1cf42015-06-15 16:36:24 -07001/*
2 * Copyright (C) 2015 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 android.content.pm;
18
Todd Kennedy39bfee52016-02-24 10:28:21 -080019import android.content.pm.PackageManager.NameNotFoundException;
20
Fyodor Kupolovcb6fd802015-11-05 14:27:06 -080021import java.util.List;
Svet Ganovadc1cf42015-06-15 16:36:24 -070022
23/**
24 * Package manager local system service interface.
25 *
26 * @hide Only for use within the system server.
27 */
28public abstract class PackageManagerInternal {
29
30 /**
31 * Provider for package names.
32 */
33 public interface PackagesProvider {
34
35 /**
36 * Gets the packages for a given user.
37 * @param userId The user id.
38 * @return The package names.
39 */
40 public String[] getPackages(int userId);
41 }
42
43 /**
Svetoslav0010b702015-06-30 18:05:26 -070044 * Provider for package names.
45 */
46 public interface SyncAdapterPackagesProvider {
47
48 /**
49 * Gets the sync adapter packages for given authority and user.
50 * @param authority The authority.
51 * @param userId The user id.
52 * @return The package names.
53 */
54 public String[] getPackages(String authority, int userId);
55 }
56
57 /**
Svet Ganovadc1cf42015-06-15 16:36:24 -070058 * Sets the location provider packages provider.
59 * @param provider The packages provider.
60 */
61 public abstract void setLocationPackagesProvider(PackagesProvider provider);
62
63 /**
Svet Ganovadc1cf42015-06-15 16:36:24 -070064 * Sets the voice interaction packages provider.
65 * @param provider The packages provider.
66 */
67 public abstract void setVoiceInteractionPackagesProvider(PackagesProvider provider);
Svetoslavcdfd2302015-06-25 19:07:31 -070068
69 /**
70 * Sets the SMS packages provider.
71 * @param provider The packages provider.
72 */
73 public abstract void setSmsAppPackagesProvider(PackagesProvider provider);
74
75 /**
76 * Sets the dialer packages provider.
77 * @param provider The packages provider.
78 */
79 public abstract void setDialerAppPackagesProvider(PackagesProvider provider);
80
81 /**
Sailesh Nepalcf855622015-07-28 19:22:14 -070082 * Sets the sim call manager packages provider.
83 * @param provider The packages provider.
84 */
85 public abstract void setSimCallManagerPackagesProvider(PackagesProvider provider);
86
87 /**
Svetoslav0010b702015-06-30 18:05:26 -070088 * Sets the sync adapter packages provider.
89 * @param provider The provider.
90 */
91 public abstract void setSyncAdapterPackagesprovider(SyncAdapterPackagesProvider provider);
92
93 /**
Svetoslavcdfd2302015-06-25 19:07:31 -070094 * Requests granting of the default permissions to the current default SMS app.
95 * @param packageName The default SMS package name.
96 * @param userId The user for which to grant the permissions.
97 */
98 public abstract void grantDefaultPermissionsToDefaultSmsApp(String packageName, int userId);
99
100 /**
101 * Requests granting of the default permissions to the current default dialer app.
102 * @param packageName The default dialer package name.
103 * @param userId The user for which to grant the permissions.
104 */
105 public abstract void grantDefaultPermissionsToDefaultDialerApp(String packageName, int userId);
Sailesh Nepalcf855622015-07-28 19:22:14 -0700106
107 /**
108 * Requests granting of the default permissions to the current default sim call manager.
109 * @param packageName The default sim call manager package name.
110 * @param userId The user for which to grant the permissions.
111 */
112 public abstract void grantDefaultPermissionsToDefaultSimCallManager(String packageName,
113 int userId);
Fyodor Kupolovcb6fd802015-11-05 14:27:06 -0800114
115 /**
116 * Sets a list of apps to keep in PM's internal data structures and as APKs even if no user has
117 * currently installed it. The apps are not preloaded.
118 * @param packageList List of package names to keep cached.
119 */
120 public abstract void setKeepUninstalledPackages(List<String> packageList);
Svet Ganov9c165d72015-12-01 19:52:26 -0800121
122 /**
123 * Gets whether some of the permissions used by this package require a user
124 * review before any of the app components can run.
125 * @param packageName The package name for which to check.
126 * @param userId The user under which to check.
127 * @return True a permissions review is required.
128 */
129 public abstract boolean isPermissionsReviewRequired(String packageName, int userId);
Todd Kennedy39bfee52016-02-24 10:28:21 -0800130
131 /**
132 * Gets all of the information we know about a particular package.
133 *
134 * @param packageName The package name to find.
135 * @param userId The user under which to check.
136 *
137 * @return An {@link ApplicationInfo} containing information about the
138 * package.
139 * @throws NameNotFoundException if a package with the given name cannot be
140 * found on the system.
141 */
142 public abstract ApplicationInfo getApplicationInfo(String packageName, int userId);
Svet Ganovadc1cf42015-06-15 16:36:24 -0700143}