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