blob: d208fe7c10ca1c5f8bac3b1daba4d68313866ad1 [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
Makoto Onuki2d5b4652016-03-11 16:09:54 -080019import android.content.ComponentName;
Todd Kennedy39bfee52016-02-24 10:28:21 -080020import android.content.pm.PackageManager.NameNotFoundException;
Makoto Onukic29f62c2016-06-07 12:19:46 -070021import android.util.SparseArray;
Todd Kennedy39bfee52016-02-24 10:28:21 -080022
Fyodor Kupolovcb6fd802015-11-05 14:27:06 -080023import java.util.List;
Svet Ganovadc1cf42015-06-15 16:36:24 -070024
25/**
26 * Package manager local system service interface.
27 *
28 * @hide Only for use within the system server.
29 */
30public abstract class PackageManagerInternal {
31
32 /**
33 * Provider for package names.
34 */
35 public interface PackagesProvider {
36
37 /**
38 * Gets the packages for a given user.
39 * @param userId The user id.
40 * @return The package names.
41 */
42 public String[] getPackages(int userId);
43 }
44
45 /**
Svetoslav0010b702015-06-30 18:05:26 -070046 * Provider for package names.
47 */
48 public interface SyncAdapterPackagesProvider {
49
50 /**
51 * Gets the sync adapter packages for given authority and user.
52 * @param authority The authority.
53 * @param userId The user id.
54 * @return The package names.
55 */
56 public String[] getPackages(String authority, int userId);
57 }
58
59 /**
Svet Ganovadc1cf42015-06-15 16:36:24 -070060 * Sets the location provider packages provider.
61 * @param provider The packages provider.
62 */
63 public abstract void setLocationPackagesProvider(PackagesProvider provider);
64
65 /**
Svet Ganovadc1cf42015-06-15 16:36:24 -070066 * Sets the voice interaction packages provider.
67 * @param provider The packages provider.
68 */
69 public abstract void setVoiceInteractionPackagesProvider(PackagesProvider provider);
Svetoslavcdfd2302015-06-25 19:07:31 -070070
71 /**
72 * Sets the SMS packages provider.
73 * @param provider The packages provider.
74 */
75 public abstract void setSmsAppPackagesProvider(PackagesProvider provider);
76
77 /**
78 * Sets the dialer packages provider.
79 * @param provider The packages provider.
80 */
81 public abstract void setDialerAppPackagesProvider(PackagesProvider provider);
82
83 /**
Sailesh Nepalcf855622015-07-28 19:22:14 -070084 * Sets the sim call manager packages provider.
85 * @param provider The packages provider.
86 */
87 public abstract void setSimCallManagerPackagesProvider(PackagesProvider provider);
88
89 /**
Svetoslav0010b702015-06-30 18:05:26 -070090 * Sets the sync adapter packages provider.
91 * @param provider The provider.
92 */
93 public abstract void setSyncAdapterPackagesprovider(SyncAdapterPackagesProvider provider);
94
95 /**
Svetoslavcdfd2302015-06-25 19:07:31 -070096 * Requests granting of the default permissions to the current default SMS app.
97 * @param packageName The default SMS package name.
98 * @param userId The user for which to grant the permissions.
99 */
100 public abstract void grantDefaultPermissionsToDefaultSmsApp(String packageName, int userId);
101
102 /**
103 * Requests granting of the default permissions to the current default dialer app.
104 * @param packageName The default dialer package name.
105 * @param userId The user for which to grant the permissions.
106 */
107 public abstract void grantDefaultPermissionsToDefaultDialerApp(String packageName, int userId);
Sailesh Nepalcf855622015-07-28 19:22:14 -0700108
109 /**
110 * Requests granting of the default permissions to the current default sim call manager.
111 * @param packageName The default sim call manager package name.
112 * @param userId The user for which to grant the permissions.
113 */
114 public abstract void grantDefaultPermissionsToDefaultSimCallManager(String packageName,
115 int userId);
Fyodor Kupolovcb6fd802015-11-05 14:27:06 -0800116
117 /**
118 * Sets a list of apps to keep in PM's internal data structures and as APKs even if no user has
119 * currently installed it. The apps are not preloaded.
120 * @param packageList List of package names to keep cached.
121 */
122 public abstract void setKeepUninstalledPackages(List<String> packageList);
Svet Ganov9c165d72015-12-01 19:52:26 -0800123
124 /**
125 * Gets whether some of the permissions used by this package require a user
126 * review before any of the app components can run.
127 * @param packageName The package name for which to check.
128 * @param userId The user under which to check.
129 * @return True a permissions review is required.
130 */
131 public abstract boolean isPermissionsReviewRequired(String packageName, int userId);
Todd Kennedy39bfee52016-02-24 10:28:21 -0800132
133 /**
134 * Gets all of the information we know about a particular package.
135 *
136 * @param packageName The package name to find.
137 * @param userId The user under which to check.
138 *
139 * @return An {@link ApplicationInfo} containing information about the
140 * package.
141 * @throws NameNotFoundException if a package with the given name cannot be
142 * found on the system.
143 */
144 public abstract ApplicationInfo getApplicationInfo(String packageName, int userId);
Makoto Onuki2d5b4652016-03-11 16:09:54 -0800145
146 /**
147 * Interface to {@link com.android.server.pm.PackageManagerService#getHomeActivitiesAsUser}.
148 */
149 public abstract ComponentName getHomeActivitiesAsUser(List<ResolveInfo> allHomeCandidates,
150 int userId);
Makoto Onukic29f62c2016-06-07 12:19:46 -0700151
152 /**
153 * Called by DeviceOwnerManagerService to set the package names of device owner and profile
154 * owners.
155 */
156 public abstract void setDeviceAndProfileOwnerPackages(
157 int deviceOwnerUserId, String deviceOwner, SparseArray<String> profileOwners);
158
159 /**
Steven Ng9d48a732016-06-24 19:04:14 +0100160 * Returns {@code true} if a given package can't be wiped. Otherwise, returns {@code false}.
Makoto Onukic29f62c2016-06-07 12:19:46 -0700161 */
Steven Ng9d48a732016-06-24 19:04:14 +0100162 public abstract boolean isPackageDataProtected(int userId, String packageName);
Svet Ganovadc1cf42015-06-15 16:36:24 -0700163}