2 * Copyright (C) 2015 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package android.content.pm;
19 import android.content.ComponentName;
20 import android.content.pm.PackageManager.NameNotFoundException;
21 import android.util.SparseArray;
23 import java.util.List;
26 * Package manager local system service interface.
28 * @hide Only for use within the system server.
30 public abstract class PackageManagerInternal {
33 * Provider for package names.
35 public interface PackagesProvider {
38 * Gets the packages for a given user.
39 * @param userId The user id.
40 * @return The package names.
42 public String[] getPackages(int userId);
46 * Provider for package names.
48 public interface SyncAdapterPackagesProvider {
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.
56 public String[] getPackages(String authority, int userId);
60 * Sets the location provider packages provider.
61 * @param provider The packages provider.
63 public abstract void setLocationPackagesProvider(PackagesProvider provider);
66 * Sets the voice interaction packages provider.
67 * @param provider The packages provider.
69 public abstract void setVoiceInteractionPackagesProvider(PackagesProvider provider);
72 * Sets the SMS packages provider.
73 * @param provider The packages provider.
75 public abstract void setSmsAppPackagesProvider(PackagesProvider provider);
78 * Sets the dialer packages provider.
79 * @param provider The packages provider.
81 public abstract void setDialerAppPackagesProvider(PackagesProvider provider);
84 * Sets the sim call manager packages provider.
85 * @param provider The packages provider.
87 public abstract void setSimCallManagerPackagesProvider(PackagesProvider provider);
90 * Sets the sync adapter packages provider.
91 * @param provider The provider.
93 public abstract void setSyncAdapterPackagesprovider(SyncAdapterPackagesProvider provider);
96 * 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.
100 public abstract void grantDefaultPermissionsToDefaultSmsApp(String packageName, int userId);
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.
107 public abstract void grantDefaultPermissionsToDefaultDialerApp(String packageName, int userId);
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.
114 public abstract void grantDefaultPermissionsToDefaultSimCallManager(String packageName,
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.
122 public abstract void setKeepUninstalledPackages(List<String> packageList);
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.
131 public abstract boolean isPermissionsReviewRequired(String packageName, int userId);
134 * Gets all of the information we know about a particular package.
136 * @param packageName The package name to find.
137 * @param userId The user under which to check.
139 * @return An {@link ApplicationInfo} containing information about the
141 * @throws NameNotFoundException if a package with the given name cannot be
142 * found on the system.
144 public abstract ApplicationInfo getApplicationInfo(String packageName, int userId);
147 * Interface to {@link com.android.server.pm.PackageManagerService#getHomeActivitiesAsUser}.
149 public abstract ComponentName getHomeActivitiesAsUser(List<ResolveInfo> allHomeCandidates,
153 * Called by DeviceOwnerManagerService to set the package names of device owner and profile
156 public abstract void setDeviceAndProfileOwnerPackages(
157 int deviceOwnerUserId, String deviceOwner, SparseArray<String> profileOwners);
160 * Returns {@code true} if a given package can't be wiped. Otherwise, returns {@code false}.
162 public abstract boolean isPackageDataProtected(int userId, String packageName);