The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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; |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 25 | import android.content.pm.FeatureInfo; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 26 | import android.content.pm.IPackageInstallObserver; |
| 27 | import android.content.pm.IPackageDeleteObserver; |
| 28 | import android.content.pm.IPackageDataObserver; |
| 29 | import android.content.pm.IPackageStatsObserver; |
| 30 | import android.content.pm.InstrumentationInfo; |
| 31 | import android.content.pm.PackageInfo; |
| 32 | import android.content.pm.ProviderInfo; |
| 33 | import android.content.pm.PermissionGroupInfo; |
| 34 | import android.content.pm.PermissionInfo; |
| 35 | import android.content.pm.ResolveInfo; |
| 36 | import android.content.pm.ServiceInfo; |
| 37 | import android.net.Uri; |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 38 | import android.content.IntentSender; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 39 | |
| 40 | /** |
| 41 | * See {@link PackageManager} for documentation on most of the APIs |
| 42 | * here. |
| 43 | * |
| 44 | * {@hide} |
| 45 | */ |
| 46 | interface IPackageManager { |
| 47 | PackageInfo getPackageInfo(String packageName, int flags); |
| 48 | int getPackageUid(String packageName); |
| 49 | int[] getPackageGids(String packageName); |
| 50 | |
| 51 | PermissionInfo getPermissionInfo(String name, int flags); |
| 52 | |
| 53 | List<PermissionInfo> queryPermissionsByGroup(String group, int flags); |
| 54 | |
| 55 | PermissionGroupInfo getPermissionGroupInfo(String name, int flags); |
| 56 | |
| 57 | List<PermissionGroupInfo> getAllPermissionGroups(int flags); |
| 58 | |
| 59 | ApplicationInfo getApplicationInfo(String packageName, int flags); |
| 60 | |
| 61 | ActivityInfo getActivityInfo(in ComponentName className, int flags); |
| 62 | |
| 63 | ActivityInfo getReceiverInfo(in ComponentName className, int flags); |
| 64 | |
| 65 | ServiceInfo getServiceInfo(in ComponentName className, int flags); |
| 66 | |
| 67 | int checkPermission(String permName, String pkgName); |
| 68 | |
| 69 | int checkUidPermission(String permName, int uid); |
| 70 | |
| 71 | boolean addPermission(in PermissionInfo info); |
| 72 | |
| 73 | void removePermission(String name); |
| 74 | |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 75 | boolean isProtectedBroadcast(String actionName); |
| 76 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 77 | int checkSignatures(String pkg1, String pkg2); |
| 78 | |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 79 | int checkUidSignatures(int uid1, int uid2); |
| 80 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 81 | String[] getPackagesForUid(int uid); |
| 82 | |
| 83 | String getNameForUid(int uid); |
| 84 | |
| 85 | int getUidForSharedUser(String sharedUserName); |
| 86 | |
| 87 | ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags); |
| 88 | |
| 89 | List<ResolveInfo> queryIntentActivities(in Intent intent, |
| 90 | String resolvedType, int flags); |
| 91 | |
| 92 | List<ResolveInfo> queryIntentActivityOptions( |
| 93 | in ComponentName caller, in Intent[] specifics, |
| 94 | in String[] specificTypes, in Intent intent, |
| 95 | String resolvedType, int flags); |
| 96 | |
| 97 | List<ResolveInfo> queryIntentReceivers(in Intent intent, |
| 98 | String resolvedType, int flags); |
| 99 | |
| 100 | ResolveInfo resolveService(in Intent intent, |
| 101 | String resolvedType, int flags); |
| 102 | |
| 103 | List<ResolveInfo> queryIntentServices(in Intent intent, |
| 104 | String resolvedType, int flags); |
| 105 | |
| 106 | List<PackageInfo> getInstalledPackages(int flags); |
| 107 | |
| 108 | List<ApplicationInfo> getInstalledApplications(int flags); |
| 109 | |
| 110 | /** |
| 111 | * Retrieve all applications that are marked as persistent. |
| 112 | * |
| 113 | * @return A List<applicationInfo> containing one entry for each persistent |
| 114 | * application. |
| 115 | */ |
| 116 | List<ApplicationInfo> getPersistentApplications(int flags); |
| 117 | |
| 118 | ProviderInfo resolveContentProvider(String name, int flags); |
| 119 | |
| 120 | /** |
| 121 | * Retrieve sync information for all content providers. |
| 122 | * |
| 123 | * @param outNames Filled in with a list of the root names of the content |
| 124 | * providers that can sync. |
| 125 | * @param outInfo Filled in with a list of the ProviderInfo for each |
| 126 | * name in 'outNames'. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 127 | */ |
| 128 | void querySyncProviders(inout List<String> outNames, |
| 129 | inout List<ProviderInfo> outInfo); |
| 130 | |
| 131 | List<ProviderInfo> queryContentProviders( |
| 132 | String processName, int uid, int flags); |
| 133 | |
| 134 | InstrumentationInfo getInstrumentationInfo( |
| 135 | in ComponentName className, int flags); |
| 136 | |
| 137 | List<InstrumentationInfo> queryInstrumentation( |
| 138 | String targetPackage, int flags); |
| 139 | |
| 140 | /** |
| 141 | * Install a package. |
| 142 | * |
| 143 | * @param packageURI The location of the package file to install. |
| 144 | * @param observer a callback to use to notify when the package installation in finished. |
| 145 | * @param flags - possible values: {@link #FORWARD_LOCK_PACKAGE}, |
| 146 | * {@link #REPLACE_EXISITING_PACKAGE} |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 147 | * @param installerPackageName Optional package name of the application that is performing the |
| 148 | * installation. This identifies which market the package came from. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 149 | */ |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 150 | void installPackage(in Uri packageURI, IPackageInstallObserver observer, int flags, |
| 151 | in String installerPackageName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 152 | |
| 153 | /** |
| 154 | * Delete a package. |
| 155 | * |
| 156 | * @param packageName The fully qualified name of the package to delete. |
| 157 | * @param observer a callback to use to notify when the package deletion in finished. |
| 158 | * @param flags - possible values: {@link #DONT_DELETE_DATA} |
| 159 | */ |
| 160 | void deletePackage(in String packageName, IPackageDeleteObserver observer, int flags); |
| 161 | |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 162 | String getInstallerPackageName(in String packageName); |
| 163 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 164 | void addPackageToPreferred(String packageName); |
| 165 | |
| 166 | void removePackageFromPreferred(String packageName); |
| 167 | |
| 168 | List<PackageInfo> getPreferredPackages(int flags); |
| 169 | |
| 170 | void addPreferredActivity(in IntentFilter filter, int match, |
| 171 | in ComponentName[] set, in ComponentName activity); |
Satish Sampath | 8dbe612 | 2009-06-02 23:35:54 +0100 | [diff] [blame] | 172 | |
| 173 | void replacePreferredActivity(in IntentFilter filter, int match, |
| 174 | in ComponentName[] set, in ComponentName activity); |
| 175 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 176 | void clearPackagePreferredActivities(String packageName); |
Satish Sampath | 8dbe612 | 2009-06-02 23:35:54 +0100 | [diff] [blame] | 177 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 178 | int getPreferredActivities(out List<IntentFilter> outFilters, |
| 179 | out List<ComponentName> outActivities, String packageName); |
| 180 | |
| 181 | /** |
| 182 | * As per {@link android.content.pm.PackageManager#setComponentEnabledSetting}. |
| 183 | */ |
| 184 | void setComponentEnabledSetting(in ComponentName componentName, |
| 185 | in int newState, in int flags); |
| 186 | |
| 187 | /** |
| 188 | * As per {@link android.content.pm.PackageManager#getComponentEnabledSetting}. |
| 189 | */ |
| 190 | int getComponentEnabledSetting(in ComponentName componentName); |
| 191 | |
| 192 | /** |
| 193 | * As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}. |
| 194 | */ |
| 195 | void setApplicationEnabledSetting(in String packageName, in int newState, int flags); |
| 196 | |
| 197 | /** |
| 198 | * As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}. |
| 199 | */ |
| 200 | int getApplicationEnabledSetting(in String packageName); |
| 201 | |
| 202 | /** |
| 203 | * Free storage by deleting LRU sorted list of cache files across |
| 204 | * all applications. If the currently available free storage |
| 205 | * on the device is greater than or equal to the requested |
| 206 | * free storage, no cache files are cleared. If the currently |
| 207 | * available storage on the device is less than the requested |
| 208 | * free storage, some or all of the cache files across |
| 209 | * all applications are deleted (based on last accessed time) |
| 210 | * to increase the free storage space on the device to |
| 211 | * the requested value. There is no guarantee that clearing all |
| 212 | * the cache files from all applications will clear up |
| 213 | * enough storage to achieve the desired value. |
| 214 | * @param freeStorageSize The number of bytes of storage to be |
| 215 | * freed by the system. Say if freeStorageSize is XX, |
| 216 | * and the current free storage is YY, |
| 217 | * if XX is less than YY, just return. if not free XX-YY number |
| 218 | * of bytes if possible. |
| 219 | * @param observer call back used to notify when |
| 220 | * the operation is completed |
| 221 | */ |
| 222 | void freeStorageAndNotify(in long freeStorageSize, |
| 223 | IPackageDataObserver observer); |
| 224 | |
| 225 | /** |
| 226 | * Free storage by deleting LRU sorted list of cache files across |
| 227 | * all applications. If the currently available free storage |
| 228 | * on the device is greater than or equal to the requested |
| 229 | * free storage, no cache files are cleared. If the currently |
| 230 | * available storage on the device is less than the requested |
| 231 | * free storage, some or all of the cache files across |
| 232 | * all applications are deleted (based on last accessed time) |
| 233 | * to increase the free storage space on the device to |
| 234 | * the requested value. There is no guarantee that clearing all |
| 235 | * the cache files from all applications will clear up |
| 236 | * enough storage to achieve the desired value. |
| 237 | * @param freeStorageSize The number of bytes of storage to be |
| 238 | * freed by the system. Say if freeStorageSize is XX, |
| 239 | * and the current free storage is YY, |
| 240 | * if XX is less than YY, just return. if not free XX-YY number |
| 241 | * of bytes if possible. |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 242 | * @param pi IntentSender call back used to |
| 243 | * notify when the operation is completed.May be null |
| 244 | * to indicate that no call back is desired. |
| 245 | */ |
Suchi Amalapurapu | bc806f6 | 2009-06-17 15:18:19 -0700 | [diff] [blame] | 246 | void freeStorage(in long freeStorageSize, |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 247 | in IntentSender pi); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 248 | |
| 249 | /** |
| 250 | * Delete all the cache files in an applications cache directory |
| 251 | * @param packageName The package name of the application whose cache |
| 252 | * files need to be deleted |
| 253 | * @param observer a callback used to notify when the deletion is finished. |
| 254 | */ |
| 255 | void deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer); |
| 256 | |
| 257 | /** |
| 258 | * Clear the user data directory of an application. |
| 259 | * @param packageName The package name of the application whose cache |
| 260 | * files need to be deleted |
| 261 | * @param observer a callback used to notify when the operation is completed. |
| 262 | */ |
| 263 | void clearApplicationUserData(in String packageName, IPackageDataObserver observer); |
| 264 | |
| 265 | /** |
| 266 | * Get package statistics including the code, data and cache size for |
| 267 | * an already installed package |
| 268 | * @param packageName The package name of the application |
| 269 | * @param observer a callback to use to notify when the asynchronous |
| 270 | * retrieval of information is complete. |
| 271 | */ |
| 272 | void getPackageSizeInfo(in String packageName, IPackageStatsObserver observer); |
| 273 | |
| 274 | /** |
| 275 | * Get a list of shared libraries that are available on the |
| 276 | * system. |
| 277 | */ |
| 278 | String[] getSystemSharedLibraryNames(); |
| 279 | |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 280 | /** |
| 281 | * Get a list of features that are available on the |
| 282 | * system. |
| 283 | */ |
| 284 | FeatureInfo[] getSystemAvailableFeatures(); |
| 285 | |
Dianne Hackborn | 039c68e | 2009-09-26 16:39:23 -0700 | [diff] [blame] | 286 | boolean hasSystemFeature(String name); |
| 287 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 288 | void enterSafeMode(); |
| 289 | boolean isSafeMode(); |
| 290 | void systemReady(); |
| 291 | boolean hasSystemUidErrors(); |
Dianne Hackborn | 5c1e00b | 2009-06-18 17:10:57 -0700 | [diff] [blame] | 292 | |
| 293 | /** |
| 294 | * Ask the package manager to perform dex-opt (if needed) on the given |
| 295 | * package, if it already hasn't done mode. Only does this if running |
| 296 | * in the special development "no pre-dexopt" mode. |
| 297 | */ |
| 298 | boolean performDexOpt(String packageName); |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 299 | |
| 300 | /** |
| 301 | * Update status of external media on the package manager to scan and |
| 302 | * install packages installed on the external media. Like say the |
| 303 | * MountService uses this to call into the package manager to update |
| 304 | * status of sdcard. |
| 305 | */ |
| 306 | void updateExternalMediaStatus(boolean mounted); |
| 307 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 308 | } |