• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 **
3 ** Copyright 2007, The Android Open Source Project
4 **
5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at
8 **
9 **     http://www.apache.org/licenses/LICENSE-2.0
10 **
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
16 */
17 
18 package android.content.pm;
19 
20 import android.content.ComponentName;
21 import android.content.Intent;
22 import android.content.IntentFilter;
23 import android.content.pm.ActivityInfo;
24 import android.content.pm.ApplicationInfo;
25 import android.content.pm.ContainerEncryptionParams;
26 import android.content.pm.FeatureInfo;
27 import android.content.pm.IPackageInstallObserver;
28 import android.content.pm.IPackageDeleteObserver;
29 import android.content.pm.IPackageDataObserver;
30 import android.content.pm.IPackageMoveObserver;
31 import android.content.pm.IPackageStatsObserver;
32 import android.content.pm.InstrumentationInfo;
33 import android.content.pm.PackageInfo;
34 import android.content.pm.ManifestDigest;
35 import android.content.pm.PackageCleanItem;
36 import android.content.pm.ParceledListSlice;
37 import android.content.pm.ProviderInfo;
38 import android.content.pm.PermissionGroupInfo;
39 import android.content.pm.PermissionInfo;
40 import android.content.pm.ResolveInfo;
41 import android.content.pm.ServiceInfo;
42 import android.content.pm.UserInfo;
43 import android.content.pm.VerificationParams;
44 import android.content.pm.VerifierDeviceIdentity;
45 import android.net.Uri;
46 import android.os.ParcelFileDescriptor;
47 import android.content.IntentSender;
48 
49 /**
50  *  See {@link PackageManager} for documentation on most of the APIs
51  *  here.
52  *
53  *  {@hide}
54  */
55 interface IPackageManager {
getPackageInfo(String packageName, int flags, int userId)56     PackageInfo getPackageInfo(String packageName, int flags, int userId);
getPackageUid(String packageName, int userId)57     int getPackageUid(String packageName, int userId);
getPackageGids(String packageName)58     int[] getPackageGids(String packageName);
59 
currentToCanonicalPackageNames(in String[] names)60     String[] currentToCanonicalPackageNames(in String[] names);
canonicalToCurrentPackageNames(in String[] names)61     String[] canonicalToCurrentPackageNames(in String[] names);
62 
getPermissionInfo(String name, int flags)63     PermissionInfo getPermissionInfo(String name, int flags);
64 
queryPermissionsByGroup(String group, int flags)65     List<PermissionInfo> queryPermissionsByGroup(String group, int flags);
66 
getPermissionGroupInfo(String name, int flags)67     PermissionGroupInfo getPermissionGroupInfo(String name, int flags);
68 
getAllPermissionGroups(int flags)69     List<PermissionGroupInfo> getAllPermissionGroups(int flags);
70 
getApplicationInfo(String packageName, int flags ,int userId)71     ApplicationInfo getApplicationInfo(String packageName, int flags ,int userId);
72 
getActivityInfo(in ComponentName className, int flags, int userId)73     ActivityInfo getActivityInfo(in ComponentName className, int flags, int userId);
74 
getReceiverInfo(in ComponentName className, int flags, int userId)75     ActivityInfo getReceiverInfo(in ComponentName className, int flags, int userId);
76 
getServiceInfo(in ComponentName className, int flags, int userId)77     ServiceInfo getServiceInfo(in ComponentName className, int flags, int userId);
78 
getProviderInfo(in ComponentName className, int flags, int userId)79     ProviderInfo getProviderInfo(in ComponentName className, int flags, int userId);
80 
checkPermission(String permName, String pkgName)81     int checkPermission(String permName, String pkgName);
82 
checkUidPermission(String permName, int uid)83     int checkUidPermission(String permName, int uid);
84 
addPermission(in PermissionInfo info)85     boolean addPermission(in PermissionInfo info);
86 
removePermission(String name)87     void removePermission(String name);
88 
grantPermission(String packageName, String permissionName)89     void grantPermission(String packageName, String permissionName);
90 
revokePermission(String packageName, String permissionName)91     void revokePermission(String packageName, String permissionName);
92 
isProtectedBroadcast(String actionName)93     boolean isProtectedBroadcast(String actionName);
94 
checkSignatures(String pkg1, String pkg2)95     int checkSignatures(String pkg1, String pkg2);
96 
checkUidSignatures(int uid1, int uid2)97     int checkUidSignatures(int uid1, int uid2);
98 
getPackagesForUid(int uid)99     String[] getPackagesForUid(int uid);
100 
getNameForUid(int uid)101     String getNameForUid(int uid);
102 
getUidForSharedUser(String sharedUserName)103     int getUidForSharedUser(String sharedUserName);
104 
resolveIntent(in Intent intent, String resolvedType, int flags, int userId)105     ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags, int userId);
106 
queryIntentActivities(in Intent intent, String resolvedType, int flags, int userId)107     List<ResolveInfo> queryIntentActivities(in Intent intent,
108             String resolvedType, int flags, int userId);
109 
queryIntentActivityOptions( in ComponentName caller, in Intent[] specifics, in String[] specificTypes, in Intent intent, String resolvedType, int flags, int userId)110     List<ResolveInfo> queryIntentActivityOptions(
111             in ComponentName caller, in Intent[] specifics,
112             in String[] specificTypes, in Intent intent,
113             String resolvedType, int flags, int userId);
114 
queryIntentReceivers(in Intent intent, String resolvedType, int flags, int userId)115     List<ResolveInfo> queryIntentReceivers(in Intent intent,
116             String resolvedType, int flags, int userId);
117 
resolveService(in Intent intent, String resolvedType, int flags, int userId)118     ResolveInfo resolveService(in Intent intent,
119             String resolvedType, int flags, int userId);
120 
queryIntentServices(in Intent intent, String resolvedType, int flags, int userId)121     List<ResolveInfo> queryIntentServices(in Intent intent,
122             String resolvedType, int flags, int userId);
123 
124     /**
125      * This implements getInstalledPackages via a "last returned row"
126      * mechanism that is not exposed in the API. This is to get around the IPC
127      * limit that kicks in when flags are included that bloat up the data
128      * returned.
129      */
getInstalledPackages(int flags, in int userId)130     ParceledListSlice getInstalledPackages(int flags, in int userId);
131 
132     /**
133      * This implements getPackagesHoldingPermissions via a "last returned row"
134      * mechanism that is not exposed in the API. This is to get around the IPC
135      * limit that kicks in when flags are included that bloat up the data
136      * returned.
137      */
getPackagesHoldingPermissions(in String[] permissions, int flags, int userId)138     ParceledListSlice getPackagesHoldingPermissions(in String[] permissions,
139             int flags, int userId);
140 
141     /**
142      * This implements getInstalledApplications via a "last returned row"
143      * mechanism that is not exposed in the API. This is to get around the IPC
144      * limit that kicks in when flags are included that bloat up the data
145      * returned.
146      */
getInstalledApplications(int flags, int userId)147     ParceledListSlice getInstalledApplications(int flags, int userId);
148 
149     /**
150      * Retrieve all applications that are marked as persistent.
151      *
152      * @return A List&lt;applicationInfo> containing one entry for each persistent
153      *         application.
154      */
getPersistentApplications(int flags)155     List<ApplicationInfo> getPersistentApplications(int flags);
156 
resolveContentProvider(String name, int flags, int userId)157     ProviderInfo resolveContentProvider(String name, int flags, int userId);
158 
159     /**
160      * Retrieve sync information for all content providers.
161      *
162      * @param outNames Filled in with a list of the root names of the content
163      *                 providers that can sync.
164      * @param outInfo Filled in with a list of the ProviderInfo for each
165      *                name in 'outNames'.
166      */
querySyncProviders(inout List<String> outNames, inout List<ProviderInfo> outInfo)167     void querySyncProviders(inout List<String> outNames,
168             inout List<ProviderInfo> outInfo);
169 
queryContentProviders( String processName, int uid, int flags)170     List<ProviderInfo> queryContentProviders(
171             String processName, int uid, int flags);
172 
getInstrumentationInfo( in ComponentName className, int flags)173     InstrumentationInfo getInstrumentationInfo(
174             in ComponentName className, int flags);
175 
queryInstrumentation( String targetPackage, int flags)176     List<InstrumentationInfo> queryInstrumentation(
177             String targetPackage, int flags);
178 
179     /**
180      * Install a package.
181      *
182      * @param packageURI The location of the package file to install.
183      * @param observer a callback to use to notify when the package installation in finished.
184      * @param flags - possible values: {@link #FORWARD_LOCK_PACKAGE},
185      * {@link #REPLACE_EXISITING_PACKAGE}
186      * @param installerPackageName Optional package name of the application that is performing the
187      * installation. This identifies which market the package came from.
188      */
installPackage(in Uri packageURI, IPackageInstallObserver observer, int flags, in String installerPackageName)189     void installPackage(in Uri packageURI, IPackageInstallObserver observer, int flags,
190             in String installerPackageName);
191 
finishPackageInstall(int token)192     void finishPackageInstall(int token);
193 
setInstallerPackageName(in String targetPackage, in String installerPackageName)194     void setInstallerPackageName(in String targetPackage, in String installerPackageName);
195 
196     /**
197      * Delete a package for a specific user.
198      *
199      * @param packageName The fully qualified name of the package to delete.
200      * @param observer a callback to use to notify when the package deletion in finished.
201      * @param userId the id of the user for whom to delete the package
202      * @param flags - possible values: {@link #DONT_DELETE_DATA}
203      */
deletePackageAsUser(in String packageName, IPackageDeleteObserver observer, int userId, int flags)204     void deletePackageAsUser(in String packageName, IPackageDeleteObserver observer,
205             int userId, int flags);
206 
getInstallerPackageName(in String packageName)207     String getInstallerPackageName(in String packageName);
208 
addPackageToPreferred(String packageName)209     void addPackageToPreferred(String packageName);
210 
removePackageFromPreferred(String packageName)211     void removePackageFromPreferred(String packageName);
212 
getPreferredPackages(int flags)213     List<PackageInfo> getPreferredPackages(int flags);
214 
resetPreferredActivities(int userId)215     void resetPreferredActivities(int userId);
216 
addPreferredActivity(in IntentFilter filter, int match, in ComponentName[] set, in ComponentName activity, int userId)217     void addPreferredActivity(in IntentFilter filter, int match,
218             in ComponentName[] set, in ComponentName activity, int userId);
219 
replacePreferredActivity(in IntentFilter filter, int match, in ComponentName[] set, in ComponentName activity)220     void replacePreferredActivity(in IntentFilter filter, int match,
221             in ComponentName[] set, in ComponentName activity);
222 
clearPackagePreferredActivities(String packageName)223     void clearPackagePreferredActivities(String packageName);
224 
getPreferredActivities(out List<IntentFilter> outFilters, out List<ComponentName> outActivities, String packageName)225     int getPreferredActivities(out List<IntentFilter> outFilters,
226             out List<ComponentName> outActivities, String packageName);
227 
228     /**
229      * As per {@link android.content.pm.PackageManager#setComponentEnabledSetting}.
230      */
setComponentEnabledSetting(in ComponentName componentName, in int newState, in int flags, int userId)231     void setComponentEnabledSetting(in ComponentName componentName,
232             in int newState, in int flags, int userId);
233 
234     /**
235      * As per {@link android.content.pm.PackageManager#getComponentEnabledSetting}.
236      */
getComponentEnabledSetting(in ComponentName componentName, int userId)237     int getComponentEnabledSetting(in ComponentName componentName, int userId);
238 
239     /**
240      * As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}.
241      */
setApplicationEnabledSetting(in String packageName, in int newState, int flags, int userId, String callingPackage)242     void setApplicationEnabledSetting(in String packageName, in int newState, int flags,
243             int userId, String callingPackage);
244 
245     /**
246      * As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}.
247      */
getApplicationEnabledSetting(in String packageName, int userId)248     int getApplicationEnabledSetting(in String packageName, int userId);
249 
250     /**
251      * Set whether the given package should be considered stopped, making
252      * it not visible to implicit intents that filter out stopped packages.
253      */
setPackageStoppedState(String packageName, boolean stopped, int userId)254     void setPackageStoppedState(String packageName, boolean stopped, int userId);
255 
256     /**
257      * Free storage by deleting LRU sorted list of cache files across
258      * all applications. If the currently available free storage
259      * on the device is greater than or equal to the requested
260      * free storage, no cache files are cleared. If the currently
261      * available storage on the device is less than the requested
262      * free storage, some or all of the cache files across
263      * all applications are deleted (based on last accessed time)
264      * to increase the free storage space on the device to
265      * the requested value. There is no guarantee that clearing all
266      * the cache files from all applications will clear up
267      * enough storage to achieve the desired value.
268      * @param freeStorageSize The number of bytes of storage to be
269      * freed by the system. Say if freeStorageSize is XX,
270      * and the current free storage is YY,
271      * if XX is less than YY, just return. if not free XX-YY number
272      * of bytes if possible.
273      * @param observer call back used to notify when
274      * the operation is completed
275      */
freeStorageAndNotify(in long freeStorageSize, IPackageDataObserver observer)276      void freeStorageAndNotify(in long freeStorageSize,
277              IPackageDataObserver observer);
278 
279     /**
280      * Free storage by deleting LRU sorted list of cache files across
281      * all applications. If the currently available free storage
282      * on the device is greater than or equal to the requested
283      * free storage, no cache files are cleared. If the currently
284      * available storage on the device is less than the requested
285      * free storage, some or all of the cache files across
286      * all applications are deleted (based on last accessed time)
287      * to increase the free storage space on the device to
288      * the requested value. There is no guarantee that clearing all
289      * the cache files from all applications will clear up
290      * enough storage to achieve the desired value.
291      * @param freeStorageSize The number of bytes of storage to be
292      * freed by the system. Say if freeStorageSize is XX,
293      * and the current free storage is YY,
294      * if XX is less than YY, just return. if not free XX-YY number
295      * of bytes if possible.
296      * @param pi IntentSender call back used to
297      * notify when the operation is completed.May be null
298      * to indicate that no call back is desired.
299      */
freeStorage(in long freeStorageSize, in IntentSender pi)300      void freeStorage(in long freeStorageSize,
301              in IntentSender pi);
302 
303     /**
304      * Delete all the cache files in an applications cache directory
305      * @param packageName The package name of the application whose cache
306      * files need to be deleted
307      * @param observer a callback used to notify when the deletion is finished.
308      */
deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer)309     void deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer);
310 
311     /**
312      * Clear the user data directory of an application.
313      * @param packageName The package name of the application whose cache
314      * files need to be deleted
315      * @param observer a callback used to notify when the operation is completed.
316      */
clearApplicationUserData(in String packageName, IPackageDataObserver observer, int userId)317     void clearApplicationUserData(in String packageName, IPackageDataObserver observer, int userId);
318 
319    /**
320      * Get package statistics including the code, data and cache size for
321      * an already installed package
322      * @param packageName The package name of the application
323      * @param userHandle Which user the size should be retrieved for
324      * @param observer a callback to use to notify when the asynchronous
325      * retrieval of information is complete.
326      */
getPackageSizeInfo(in String packageName, int userHandle, IPackageStatsObserver observer)327     void getPackageSizeInfo(in String packageName, int userHandle, IPackageStatsObserver observer);
328 
329     /**
330      * Get a list of shared libraries that are available on the
331      * system.
332      */
getSystemSharedLibraryNames()333     String[] getSystemSharedLibraryNames();
334 
335     /**
336      * Get a list of features that are available on the
337      * system.
338      */
getSystemAvailableFeatures()339     FeatureInfo[] getSystemAvailableFeatures();
340 
hasSystemFeature(String name)341     boolean hasSystemFeature(String name);
342 
enterSafeMode()343     void enterSafeMode();
isSafeMode()344     boolean isSafeMode();
systemReady()345     void systemReady();
hasSystemUidErrors()346     boolean hasSystemUidErrors();
347 
348     /**
349      * Ask the package manager to perform boot-time dex-opt of all
350      * existing packages.
351      */
performBootDexOpt()352     void performBootDexOpt();
353 
354     /**
355      * Ask the package manager to perform dex-opt (if needed) on the given
356      * package, if it already hasn't done mode.  Only does this if running
357      * in the special development "no pre-dexopt" mode.
358      */
performDexOpt(String packageName)359     boolean performDexOpt(String packageName);
360 
361     /**
362      * Update status of external media on the package manager to scan and
363      * install packages installed on the external media. Like say the
364      * MountService uses this to call into the package manager to update
365      * status of sdcard.
366      */
updateExternalMediaStatus(boolean mounted, boolean reportStatus)367     void updateExternalMediaStatus(boolean mounted, boolean reportStatus);
368 
nextPackageToClean(in PackageCleanItem lastPackage)369     PackageCleanItem nextPackageToClean(in PackageCleanItem lastPackage);
370 
movePackage(String packageName, IPackageMoveObserver observer, int flags)371     void movePackage(String packageName, IPackageMoveObserver observer, int flags);
372 
addPermissionAsync(in PermissionInfo info)373     boolean addPermissionAsync(in PermissionInfo info);
374 
setInstallLocation(int loc)375     boolean setInstallLocation(int loc);
getInstallLocation()376     int getInstallLocation();
377 
installPackageWithVerification(in Uri packageURI, in IPackageInstallObserver observer, int flags, in String installerPackageName, in Uri verificationURI, in ManifestDigest manifestDigest, in ContainerEncryptionParams encryptionParams)378     void installPackageWithVerification(in Uri packageURI, in IPackageInstallObserver observer,
379             int flags, in String installerPackageName, in Uri verificationURI,
380             in ManifestDigest manifestDigest, in ContainerEncryptionParams encryptionParams);
381 
installPackageWithVerificationAndEncryption(in Uri packageURI, in IPackageInstallObserver observer, int flags, in String installerPackageName, in VerificationParams verificationParams, in ContainerEncryptionParams encryptionParams)382     void installPackageWithVerificationAndEncryption(in Uri packageURI,
383             in IPackageInstallObserver observer, int flags, in String installerPackageName,
384             in VerificationParams verificationParams,
385             in ContainerEncryptionParams encryptionParams);
386 
installExistingPackageAsUser(String packageName, int userId)387     int installExistingPackageAsUser(String packageName, int userId);
388 
verifyPendingInstall(int id, int verificationCode)389     void verifyPendingInstall(int id, int verificationCode);
extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay)390     void extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay);
391 
getVerifierDeviceIdentity()392     VerifierDeviceIdentity getVerifierDeviceIdentity();
393 
isFirstBoot()394     boolean isFirstBoot();
isOnlyCoreApps()395     boolean isOnlyCoreApps();
396 
setPermissionEnforced(String permission, boolean enforced)397     void setPermissionEnforced(String permission, boolean enforced);
isPermissionEnforced(String permission)398     boolean isPermissionEnforced(String permission);
399 
400     /** Reflects current DeviceStorageMonitorService state */
isStorageLow()401     boolean isStorageLow();
402 }
403