blob: 0e706456b9b28a3a861debc91cad4949918d302a [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
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
18package android.content.pm;
19
20import android.content.ComponentName;
21import android.content.Intent;
22import android.content.IntentFilter;
23import android.content.pm.ActivityInfo;
24import android.content.pm.ApplicationInfo;
Todd Kennedy9106c642017-02-08 14:16:53 -080025import android.content.pm.ChangedPackages;
Svetoslav Ganov096d3042017-01-30 16:34:13 -080026import android.content.pm.InstantAppInfo;
Dianne Hackborn49237342009-08-27 20:08:01 -070027import android.content.pm.FeatureInfo;
Calin Juravle3d2af7f2017-04-19 19:56:21 -070028import android.content.pm.IDexModuleRegisterCallback;
Christopher Tatef1977b42014-03-24 16:25:51 -070029import android.content.pm.IPackageInstallObserver2;
Jeff Sharkey3a44f3f2014-04-28 17:36:31 -070030import android.content.pm.IPackageInstaller;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080031import android.content.pm.IPackageDeleteObserver;
Jeff Sharkeyfbd0e9f2014-08-06 16:34:34 -070032import android.content.pm.IPackageDeleteObserver2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033import android.content.pm.IPackageDataObserver;
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -080034import android.content.pm.IPackageMoveObserver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.content.pm.IPackageStatsObserver;
Svetoslavf7c06eb2015-06-10 18:43:22 -070036import android.content.pm.IOnPermissionsChangeListener;
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -080037import android.content.pm.IntentFilterVerificationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038import android.content.pm.InstrumentationInfo;
dcashmanc6f22492014-08-14 09:54:51 -070039import android.content.pm.KeySet;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040import android.content.pm.PackageInfo;
Dianne Hackborn7767eac2012-08-23 18:25:40 -070041import android.content.pm.PackageCleanItem;
Kenny Root0e2c0f32011-04-15 17:50:10 -070042import android.content.pm.ParceledListSlice;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import android.content.pm.ProviderInfo;
44import android.content.pm.PermissionGroupInfo;
45import android.content.pm.PermissionInfo;
46import android.content.pm.ResolveInfo;
47import android.content.pm.ServiceInfo;
Amith Yamasani0b285492011-04-14 17:35:23 -070048import android.content.pm.UserInfo;
Kenny Root0aaa0d92011-09-12 16:42:55 -070049import android.content.pm.VerifierDeviceIdentity;
Svet Ganov67882122016-12-11 16:36:34 -080050import android.content.pm.VersionedPackage;
Svet Ganov2acf0632015-11-24 19:10:59 -080051import android.graphics.Bitmap;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052import android.net.Uri;
Svetoslavc6d1c342015-02-26 14:44:43 -080053import android.os.Bundle;
Amith Yamasanib8151ec2012-04-18 18:02:48 -070054import android.os.ParcelFileDescriptor;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070055import android.content.IntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056
57/**
58 * See {@link PackageManager} for documentation on most of the APIs
59 * here.
Svetoslavc6d1c342015-02-26 14:44:43 -080060 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080061 * {@hide}
62 */
63interface IPackageManager {
Jeff Sharkey8924e872015-11-30 12:52:10 -070064 void checkPackageStartable(String packageName, int userId);
Christopher Tateba629da2013-11-13 17:42:28 -080065 boolean isPackageAvailable(String packageName, int userId);
Amith Yamasani483f3b02012-03-13 16:08:00 -070066 PackageInfo getPackageInfo(String packageName, int flags, int userId);
Svet Ganov67882122016-12-11 16:36:34 -080067 PackageInfo getPackageInfoVersioned(in VersionedPackage versionedPackage,
68 int flags, int userId);
Jeff Sharkeycd654482016-01-08 17:42:11 -070069 int getPackageUid(String packageName, int flags, int userId);
70 int[] getPackageGids(String packageName, int flags, int userId);
Svetoslavc6d1c342015-02-26 14:44:43 -080071
Dianne Hackborn47096932010-02-11 15:57:09 -080072 String[] currentToCanonicalPackageNames(in String[] names);
73 String[] canonicalToCurrentPackageNames(in String[] names);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074
Svetoslav Ganovadb8c522017-07-28 05:46:53 +000075 PermissionInfo getPermissionInfo(String name, String packageName, int flags);
Svetoslavc6d1c342015-02-26 14:44:43 -080076
Jeff Sharkeyd5896632016-03-04 16:16:00 -070077 ParceledListSlice queryPermissionsByGroup(String group, int flags);
Svetoslavc6d1c342015-02-26 14:44:43 -080078
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080079 PermissionGroupInfo getPermissionGroupInfo(String name, int flags);
Svetoslavc6d1c342015-02-26 14:44:43 -080080
Jeff Sharkeyd5896632016-03-04 16:16:00 -070081 ParceledListSlice getAllPermissionGroups(int flags);
Svetoslavc6d1c342015-02-26 14:44:43 -080082
Amith Yamasani483f3b02012-03-13 16:08:00 -070083 ApplicationInfo getApplicationInfo(String packageName, int flags ,int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080084
Amith Yamasani483f3b02012-03-13 16:08:00 -070085 ActivityInfo getActivityInfo(in ComponentName className, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086
Dianne Hackborn91097de2014-04-04 18:02:06 -070087 boolean activitySupportsIntent(in ComponentName className, in Intent intent,
88 String resolvedType);
89
Amith Yamasani483f3b02012-03-13 16:08:00 -070090 ActivityInfo getReceiverInfo(in ComponentName className, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091
Amith Yamasani483f3b02012-03-13 16:08:00 -070092 ServiceInfo getServiceInfo(in ComponentName className, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093
Amith Yamasani483f3b02012-03-13 16:08:00 -070094 ProviderInfo getProviderInfo(in ComponentName className, int flags, int userId);
Dianne Hackborn361199b2010-08-30 17:42:07 -070095
Svetoslavc6d1c342015-02-26 14:44:43 -080096 int checkPermission(String permName, String pkgName, int userId);
97
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080098 int checkUidPermission(String permName, int uid);
Svetoslavc6d1c342015-02-26 14:44:43 -080099
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800100 boolean addPermission(in PermissionInfo info);
Svetoslavc6d1c342015-02-26 14:44:43 -0800101
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102 void removePermission(String name);
Dianne Hackborne639da72012-02-21 15:11:13 -0800103
Svet Ganov8c7f7002015-05-07 10:48:44 -0700104 void grantRuntimePermission(String packageName, String permissionName, int userId);
Dianne Hackborne639da72012-02-21 15:11:13 -0800105
Svet Ganov8c7f7002015-05-07 10:48:44 -0700106 void revokeRuntimePermission(String packageName, String permissionName, int userId);
107
Dianne Hackbornca8e6da2015-06-24 15:19:17 -0700108 void resetRuntimePermissions();
109
Svet Ganov8c7f7002015-05-07 10:48:44 -0700110 int getPermissionFlags(String permissionName, String packageName, int userId);
111
112 void updatePermissionFlags(String permissionName, String packageName, int flagMask,
113 int flagValues, int userId);
Dianne Hackborne639da72012-02-21 15:11:13 -0800114
Amith Yamasani0bf8f7c2015-06-22 13:00:32 -0700115 void updatePermissionFlagsForAllApps(int flagMask, int flagValues, int userId);
116
Svetoslav20770dd2015-05-29 15:43:04 -0700117 boolean shouldShowRequestPermissionRationale(String permissionName,
118 String packageName, int userId);
119
Dianne Hackborn854060af2009-07-09 18:14:31 -0700120 boolean isProtectedBroadcast(String actionName);
Svetoslavc6d1c342015-02-26 14:44:43 -0800121
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122 int checkSignatures(String pkg1, String pkg2);
Svetoslavc6d1c342015-02-26 14:44:43 -0800123
Dianne Hackborn766cbfe2009-08-12 18:33:39 -0700124 int checkUidSignatures(int uid1, int uid2);
Svetoslavc6d1c342015-02-26 14:44:43 -0800125
David Brazdil990fb6b2016-03-01 10:02:27 +0000126 List<String> getAllPackages();
127
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800128 String[] getPackagesForUid(int uid);
Svetoslavc6d1c342015-02-26 14:44:43 -0800129
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800130 String getNameForUid(int uid);
Todd Kennedyad192a32017-08-02 07:51:57 -0700131 String[] getNamesForUids(in int[] uids);
Svetoslavc6d1c342015-02-26 14:44:43 -0800132
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800133 int getUidForSharedUser(String sharedUserName);
Ben Gruverdd72c9e2013-08-06 12:34:17 -0700134
135 int getFlagsForUid(int uid);
136
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800137 int getPrivateFlagsForUid(int uid);
138
Dianne Hackborn2d7576b2014-10-03 16:26:04 -0700139 boolean isUidPrivileged(int uid);
140
Dianne Hackborn33f5ddd2014-07-21 15:35:45 -0700141 String[] getAppOpPermissionPackages(String permissionName);
142
Amith Yamasani483f3b02012-03-13 16:08:00 -0700143 ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144
Bartosz Fabianowskid9fa6672017-01-18 18:22:26 +0100145 ResolveInfo findPersistentPreferredActivity(in Intent intent, int userId);
146
Nicolas Prevot81948992014-05-16 18:25:26 +0100147 boolean canForwardTo(in Intent intent, String resolvedType, int sourceUserId, int targetUserId);
Nicolas Prevot10fa67c2014-03-24 13:44:38 +0000148
Jeff Sharkeyd5896632016-03-04 16:16:00 -0700149 ParceledListSlice queryIntentActivities(in Intent intent,
Amith Yamasani483f3b02012-03-13 16:08:00 -0700150 String resolvedType, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800151
Jeff Sharkeyd5896632016-03-04 16:16:00 -0700152 ParceledListSlice queryIntentActivityOptions(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800153 in ComponentName caller, in Intent[] specifics,
154 in String[] specificTypes, in Intent intent,
Amith Yamasani483f3b02012-03-13 16:08:00 -0700155 String resolvedType, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800156
Jeff Sharkeyd5896632016-03-04 16:16:00 -0700157 ParceledListSlice queryIntentReceivers(in Intent intent,
Amith Yamasani483f3b02012-03-13 16:08:00 -0700158 String resolvedType, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800159
160 ResolveInfo resolveService(in Intent intent,
Amith Yamasani483f3b02012-03-13 16:08:00 -0700161 String resolvedType, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800162
Jeff Sharkeyd5896632016-03-04 16:16:00 -0700163 ParceledListSlice queryIntentServices(in Intent intent,
Amith Yamasani483f3b02012-03-13 16:08:00 -0700164 String resolvedType, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800165
Jeff Sharkeyd5896632016-03-04 16:16:00 -0700166 ParceledListSlice queryIntentContentProviders(in Intent intent,
Jeff Sharkey85f5f812013-10-07 10:16:12 -0700167 String resolvedType, int flags, int userId);
168
Kenny Root0e2c0f32011-04-15 17:50:10 -0700169 /**
170 * This implements getInstalledPackages via a "last returned row"
171 * mechanism that is not exposed in the API. This is to get around the IPC
172 * limit that kicks in when flags are included that bloat up the data
173 * returned.
174 */
Dianne Hackbornd8e1dbb2013-01-17 17:47:37 -0800175 ParceledListSlice getInstalledPackages(int flags, in int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800176
Kenny Root0e2c0f32011-04-15 17:50:10 -0700177 /**
Dianne Hackborne7991752013-01-16 17:56:46 -0800178 * This implements getPackagesHoldingPermissions via a "last returned row"
179 * mechanism that is not exposed in the API. This is to get around the IPC
180 * limit that kicks in when flags are included that bloat up the data
181 * returned.
182 */
183 ParceledListSlice getPackagesHoldingPermissions(in String[] permissions,
Dianne Hackbornd8e1dbb2013-01-17 17:47:37 -0800184 int flags, int userId);
Dianne Hackborne7991752013-01-16 17:56:46 -0800185
186 /**
Kenny Root0e2c0f32011-04-15 17:50:10 -0700187 * This implements getInstalledApplications via a "last returned row"
188 * mechanism that is not exposed in the API. This is to get around the IPC
189 * limit that kicks in when flags are included that bloat up the data
190 * returned.
191 */
Dianne Hackbornd8e1dbb2013-01-17 17:47:37 -0800192 ParceledListSlice getInstalledApplications(int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800193
194 /**
195 * Retrieve all applications that are marked as persistent.
Svetoslavc6d1c342015-02-26 14:44:43 -0800196 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800197 * @return A List&lt;applicationInfo> containing one entry for each persistent
198 * application.
199 */
Jeff Sharkeyd5896632016-03-04 16:16:00 -0700200 ParceledListSlice getPersistentApplications(int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800201
Amith Yamasani483f3b02012-03-13 16:08:00 -0700202 ProviderInfo resolveContentProvider(String name, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800203
204 /**
205 * Retrieve sync information for all content providers.
Svetoslavc6d1c342015-02-26 14:44:43 -0800206 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800207 * @param outNames Filled in with a list of the root names of the content
208 * providers that can sync.
209 * @param outInfo Filled in with a list of the ProviderInfo for each
210 * name in 'outNames'.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800211 */
212 void querySyncProviders(inout List<String> outNames,
213 inout List<ProviderInfo> outInfo);
214
Dianne Hackborn28ec27c2015-08-03 15:28:28 -0700215 ParceledListSlice queryContentProviders(
Makoto Onuki32757292017-02-22 14:36:59 -0800216 String processName, int uid, int flags, String metaDataKey);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800217
218 InstrumentationInfo getInstrumentationInfo(
219 in ComponentName className, int flags);
220
Jeff Sharkeyd5896632016-03-04 16:16:00 -0700221 ParceledListSlice queryInstrumentation(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800222 String targetPackage, int flags);
223
Todd Kennedya6793232016-02-24 22:46:00 +0000224 /** @deprecated Use PackageInstaller instead */
Amith Yamasanidda003f2014-08-28 18:06:51 -0700225 void installPackageAsUser(in String originPath,
226 in IPackageInstallObserver2 observer,
227 int flags,
228 in String installerPackageName,
Amith Yamasanidda003f2014-08-28 18:06:51 -0700229 int userId);
230
Christopher Tate5cf55782016-04-25 17:08:56 -0700231 void finishPackageInstall(int token, boolean didLaunch);
Christopher Tate1bb69062010-02-19 17:02:12 -0800232
Dianne Hackborn880119b2010-11-18 22:26:40 -0800233 void setInstallerPackageName(in String targetPackage, in String installerPackageName);
234
Jeff Sharkey9bc89af2017-01-11 11:25:50 -0700235 void setApplicationCategoryHint(String packageName, int categoryHint, String callerPackageName);
236
Jeff Sharkeyfbd0e9f2014-08-06 16:34:34 -0700237 /** @deprecated rawr, don't call AIDL methods directly! */
Svet Ganov67882122016-12-11 16:36:34 -0800238 void deletePackageAsUser(in String packageName, int versionCode,
239 IPackageDeleteObserver observer, int userId, int flags);
Jeff Sharkeyfbd0e9f2014-08-06 16:34:34 -0700240
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800241 /**
Amith Yamasani67df64b2012-12-14 12:09:36 -0800242 * Delete a package for a specific user.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800243 *
Svet Ganov67882122016-12-11 16:36:34 -0800244 * @param versionedPackage The package to delete.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800245 * @param observer a callback to use to notify when the package deletion in finished.
Amith Yamasani67df64b2012-12-14 12:09:36 -0800246 * @param userId the id of the user for whom to delete the package
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800247 * @param flags - possible values: {@link #DONT_DELETE_DATA}
248 */
Svet Ganov67882122016-12-11 16:36:34 -0800249 void deletePackageVersioned(in VersionedPackage versionedPackage,
250 IPackageDeleteObserver2 observer, int userId, int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800251
Jacek Surazski65e13172009-04-28 15:26:38 +0200252 String getInstallerPackageName(in String packageName);
253
Svet Ganov9c8b8ab2015-07-23 09:32:26 -0700254 void resetApplicationPreferences(int userId);
Dianne Hackborn8a2ed1d2013-01-29 15:18:29 -0800255
Amith Yamasanie9ecc8b2013-08-22 11:16:27 -0700256 ResolveInfo getLastChosenActivity(in Intent intent,
257 String resolvedType, int flags);
258
259 void setLastChosenActivity(in Intent intent, String resolvedType, int flags,
260 in IntentFilter filter, int match, in ComponentName activity);
261
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800262 void addPreferredActivity(in IntentFilter filter, int match,
Amith Yamasania3f133a2012-08-09 17:11:28 -0700263 in ComponentName[] set, in ComponentName activity, int userId);
Satish Sampath8dbe6122009-06-02 23:35:54 +0100264
265 void replacePreferredActivity(in IntentFilter filter, int match,
Amith Yamasani41c1ded2014-08-05 11:15:05 -0700266 in ComponentName[] set, in ComponentName activity, int userId);
Satish Sampath8dbe6122009-06-02 23:35:54 +0100267
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800268 void clearPackagePreferredActivities(String packageName);
Satish Sampath8dbe6122009-06-02 23:35:54 +0100269
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800270 int getPreferredActivities(out List<IntentFilter> outFilters,
271 out List<ComponentName> outActivities, String packageName);
Amith Yamasanie9ecc8b2013-08-22 11:16:27 -0700272
Sander Alewijnsef475ca32014-02-17 15:13:58 +0000273 void addPersistentPreferredActivity(in IntentFilter filter, in ComponentName activity, int userId);
274
275 void clearPackagePersistentPreferredActivities(String packageName, int userId);
276
Nicolas Prevot3f7777f2014-07-24 15:58:39 +0100277 void addCrossProfileIntentFilter(in IntentFilter intentFilter, String ownerPackage,
Nicolas Prevot4b8d5822015-03-05 15:20:49 +0000278 int sourceUserId, int targetUserId, int flags);
Nicolas Prevot10fa67c2014-03-24 13:44:38 +0000279
Nicolas Prevot4b8d5822015-03-05 15:20:49 +0000280 void clearCrossProfileIntentFilters(int sourceUserId, String ownerPackage);
Nicolas Prevot10fa67c2014-03-24 13:44:38 +0000281
Andrei Stingaceanueb84b182016-01-26 18:39:55 +0000282 String[] setPackagesSuspendedAsUser(in String[] packageNames, boolean suspended, int userId);
Andrei Stingaceanu355b2322016-02-12 16:43:51 +0000283 boolean isPackageSuspendedForUser(String packageName, int userId);
Andrei Stingaceanu1e283912015-11-26 15:26:28 +0000284
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800285 /**
Christopher Tatee012a232015-04-01 17:18:50 -0700286 * Backup/restore support - only the system uid may use these.
287 */
288 byte[] getPreferredActivityBackup(int userId);
289 void restorePreferredActivities(in byte[] backup, int userId);
Christopher Tate6038d152015-06-17 13:07:46 -0700290 byte[] getDefaultAppsBackup(int userId);
291 void restoreDefaultApps(in byte[] backup, int userId);
292 byte[] getIntentFilterVerificationBackup(int userId);
293 void restoreIntentFilterVerification(in byte[] backup, int userId);
Christopher Tatee9fd1fa2015-09-15 16:43:07 -0700294 byte[] getPermissionGrantBackup(int userId);
295 void restorePermissionGrants(in byte[] backup, int userId);
Christopher Tatee012a232015-04-01 17:18:50 -0700296
297 /**
Christopher Tatea2a0850d2013-09-05 16:38:58 -0700298 * Report the set of 'Home' activity candidates, plus (if any) which of them
299 * is the current "always use this one" setting.
300 */
301 ComponentName getHomeActivities(out List<ResolveInfo> outHomeCandidates);
302
Makoto Onuki4828a592016-03-15 18:06:57 -0700303 void setHomeActivity(in ComponentName className, int userId);
304
Christopher Tatea2a0850d2013-09-05 16:38:58 -0700305 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800306 * As per {@link android.content.pm.PackageManager#setComponentEnabledSetting}.
307 */
308 void setComponentEnabledSetting(in ComponentName componentName,
Amith Yamasani483f3b02012-03-13 16:08:00 -0700309 in int newState, in int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800310
311 /**
312 * As per {@link android.content.pm.PackageManager#getComponentEnabledSetting}.
313 */
Amith Yamasani483f3b02012-03-13 16:08:00 -0700314 int getComponentEnabledSetting(in ComponentName componentName, int userId);
Jeff Davidson2a880312015-06-22 16:54:34 -0700315
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800316 /**
317 * As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}.
318 */
Dianne Hackborn3fa3c28a2013-03-26 16:15:41 -0700319 void setApplicationEnabledSetting(in String packageName, in int newState, int flags,
320 int userId, String callingPackage);
Jeff Davidson2a880312015-06-22 16:54:34 -0700321
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800322 /**
323 * As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}.
324 */
Amith Yamasani483f3b02012-03-13 16:08:00 -0700325 int getApplicationEnabledSetting(in String packageName, int userId);
Jeff Davidson2a880312015-06-22 16:54:34 -0700326
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800327 /**
Michal Karpinskib52a4612016-03-21 13:39:42 +0000328 * Logs process start information (including APK hash) to the security log.
329 */
330 void logAppProcessStartIfNeeded(String processName, int uid, String seinfo, String apkFile,
331 int pid);
332
333 /**
Sudheer Shankabbb3ff22015-07-09 15:39:23 +0100334 * As per {@link android.content.pm.PackageManager#flushPackageRestrictionsAsUser}.
335 */
336 void flushPackageRestrictionsAsUser(in int userId);
337
338 /**
Dianne Hackborne7f97212011-02-24 14:40:20 -0800339 * Set whether the given package should be considered stopped, making
340 * it not visible to implicit intents that filter out stopped packages.
341 */
Amith Yamasani483f3b02012-03-13 16:08:00 -0700342 void setPackageStoppedState(String packageName, boolean stopped, int userId);
Dianne Hackborne7f97212011-02-24 14:40:20 -0800343
344 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800345 * Free storage by deleting LRU sorted list of cache files across
346 * all applications. If the currently available free storage
347 * on the device is greater than or equal to the requested
348 * free storage, no cache files are cleared. If the currently
349 * available storage on the device is less than the requested
350 * free storage, some or all of the cache files across
351 * all applications are deleted (based on last accessed time)
352 * to increase the free storage space on the device to
353 * the requested value. There is no guarantee that clearing all
354 * the cache files from all applications will clear up
355 * enough storage to achieve the desired value.
356 * @param freeStorageSize The number of bytes of storage to be
357 * freed by the system. Say if freeStorageSize is XX,
358 * and the current free storage is YY,
359 * if XX is less than YY, just return. if not free XX-YY number
360 * of bytes if possible.
361 * @param observer call back used to notify when
362 * the operation is completed
363 */
Jeff Sharkey529f91f2015-04-18 20:23:13 -0700364 void freeStorageAndNotify(in String volumeUuid, in long freeStorageSize,
Jeff Sharkeyddff8072017-05-26 13:10:46 -0600365 int storageFlags, IPackageDataObserver observer);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800366
367 /**
368 * Free storage by deleting LRU sorted list of cache files across
369 * all applications. If the currently available free storage
370 * on the device is greater than or equal to the requested
371 * free storage, no cache files are cleared. If the currently
372 * available storage on the device is less than the requested
373 * free storage, some or all of the cache files across
374 * all applications are deleted (based on last accessed time)
375 * to increase the free storage space on the device to
376 * the requested value. There is no guarantee that clearing all
377 * the cache files from all applications will clear up
378 * enough storage to achieve the desired value.
379 * @param freeStorageSize The number of bytes of storage to be
380 * freed by the system. Say if freeStorageSize is XX,
381 * and the current free storage is YY,
382 * if XX is less than YY, just return. if not free XX-YY number
383 * of bytes if possible.
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700384 * @param pi IntentSender call back used to
385 * notify when the operation is completed.May be null
386 * to indicate that no call back is desired.
387 */
Jeff Sharkey529f91f2015-04-18 20:23:13 -0700388 void freeStorage(in String volumeUuid, in long freeStorageSize,
Jeff Sharkeyddff8072017-05-26 13:10:46 -0600389 int storageFlags, in IntentSender pi);
Jeff Davidson2a880312015-06-22 16:54:34 -0700390
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800391 /**
392 * Delete all the cache files in an applications cache directory
393 * @param packageName The package name of the application whose cache
394 * files need to be deleted
395 * @param observer a callback used to notify when the deletion is finished.
396 */
397 void deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer);
Jeff Davidson2a880312015-06-22 16:54:34 -0700398
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800399 /**
Suprabh Shukla78c9eb82016-04-12 15:51:35 -0700400 * Delete all the cache files in an applications cache directory
401 * @param packageName The package name of the application whose cache
402 * files need to be deleted
403 * @param userId the user to delete application cache for
404 * @param observer a callback used to notify when the deletion is finished.
405 */
406 void deleteApplicationCacheFilesAsUser(in String packageName, int userId, IPackageDataObserver observer);
407
408 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800409 * Clear the user data directory of an application.
410 * @param packageName The package name of the application whose cache
411 * files need to be deleted
412 * @param observer a callback used to notify when the operation is completed.
413 */
Amith Yamasani483f3b02012-03-13 16:08:00 -0700414 void clearApplicationUserData(in String packageName, IPackageDataObserver observer, int userId);
Jeff Davidson2a880312015-06-22 16:54:34 -0700415
David Brazdil9aa6db02016-03-08 12:57:12 +0000416 /**
417 * Clear the profile data of an application.
418 * @param packageName The package name of the application whose profile data
419 * need to be deleted
420 */
421 void clearApplicationProfileData(in String packageName);
422
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800423 /**
424 * Get package statistics including the code, data and cache size for
425 * an already installed package
426 * @param packageName The package name of the application
Dianne Hackborn0c380492012-08-20 17:23:30 -0700427 * @param userHandle Which user the size should be retrieved for
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800428 * @param observer a callback to use to notify when the asynchronous
429 * retrieval of information is complete.
430 */
Dianne Hackborn0c380492012-08-20 17:23:30 -0700431 void getPackageSizeInfo(in String packageName, int userHandle, IPackageStatsObserver observer);
Jeff Davidson2a880312015-06-22 16:54:34 -0700432
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800433 /**
434 * Get a list of shared libraries that are available on the
435 * system.
436 */
437 String[] getSystemSharedLibraryNames();
438
Dianne Hackborn49237342009-08-27 20:08:01 -0700439 /**
440 * Get a list of features that are available on the
441 * system.
442 */
Jeff Sharkeyd5896632016-03-04 16:16:00 -0700443 ParceledListSlice getSystemAvailableFeatures();
Dianne Hackborn49237342009-08-27 20:08:01 -0700444
Jeff Sharkey115d2c12016-02-15 17:25:57 -0700445 boolean hasSystemFeature(String name, int version);
Jeff Davidson2a880312015-06-22 16:54:34 -0700446
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800447 void enterSafeMode();
448 boolean isSafeMode();
449 void systemReady();
450 boolean hasSystemUidErrors();
Dianne Hackborn661cd522011-08-22 00:26:20 -0700451
452 /**
Nicolas Geoffray27c07372015-11-05 16:54:09 +0000453 * Ask the package manager to fstrim the disk if needed.
Dianne Hackborn661cd522011-08-22 00:26:20 -0700454 */
Nicolas Geoffray27c07372015-11-05 16:54:09 +0000455 void performFstrimIfNeeded();
456
457 /**
David Brazdilf5c444f2016-03-30 11:45:52 +0100458 * Ask the package manager to update packages if needed.
David Brazdila0e10432016-01-20 14:04:40 +0000459 */
David Brazdilf5c444f2016-03-30 11:45:52 +0100460 void updatePackagesIfNeeded();
David Brazdila0e10432016-01-20 14:04:40 +0000461
462 /**
Brian Carlstromca82e612016-04-19 23:16:08 -0700463 * Notify the package manager that a package is going to be used and why.
464 *
465 * See PackageManager.NOTIFY_PACKAGE_USE_* for reasons.
Nicolas Geoffray27c07372015-11-05 16:54:09 +0000466 */
Calin Juravle0a3693c2017-05-01 19:49:21 -0700467 oneway void notifyPackageUse(String packageName, int reason);
Dianne Hackborn661cd522011-08-22 00:26:20 -0700468
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700469 /**
Calin Juravle8d2a51f2016-11-23 19:50:58 +0000470 * Notify the package manager that a list of dex files have been loaded.
471 *
472 * @param loadingPackageName the name of the package who performs the load
Calin Juravlef1ff36f2017-07-22 12:33:41 -0700473 * @param classLoadersNames the names of the class loaders present in the loading chain. The
474 * list encodes the class loader chain in the natural order. The first class loader has
475 * the second one as its parent and so on. The dex files present in the class path of the
476 * first class loader will be recorded in the usage file.
477 * @param classPaths the class paths corresponding to the class loaders names from
478 * {@param classLoadersNames}. The the first element corresponds to the first class loader
479 * and so on. A classpath is represented as a list of dex files separated by
480 * {@code File.pathSeparator}.
481 * The dex files found in the first class path will be recorded in the usage file.
Calin Juravle8d2a51f2016-11-23 19:50:58 +0000482 * @param loaderIsa the ISA of the loader process
483 */
Calin Juravlef1ff36f2017-07-22 12:33:41 -0700484 oneway void notifyDexLoad(String loadingPackageName, in List<String> classLoadersNames,
485 in List<String> classPaths, String loaderIsa);
Calin Juravle8d2a51f2016-11-23 19:50:58 +0000486
487 /**
Calin Juravle3d2af7f2017-04-19 19:56:21 -0700488 * Register an application dex module with the package manager.
489 * The package manager will keep track of the given module for future optimizations.
490 *
491 * Dex module optimizations will disable the classpath checking at runtime. The client bares
492 * the responsibility to ensure that the static assumptions on classes in the optimized code
493 * hold at runtime (e.g. there's no duplicate classes in the classpath).
494 *
495 * Note that the package manager already keeps track of dex modules loaded with
496 * {@link dalvik.system.DexClassLoader} and {@link dalvik.system.PathClassLoader}.
497 * This can be called for an eager registration.
498 *
499 * The call might take a while and the results will be posted on the main thread, using
500 * the given callback.
501 *
502 * If the module is intended to be shared with other apps, make sure that the file
503 * permissions allow for it.
504 * If at registration time the permissions allow for others to read it, the module would
505 * be marked as a shared module which might undergo a different optimization strategy.
506 * (usually shared modules will generated larger optimizations artifacts,
507 * taking more disk space).
508 *
509 * @param packageName the package name to which the dex module belongs
510 * @param dexModulePath the absolute path of the dex module.
511 * @param isSharedModule whether or not the module is intended to be used by other apps.
512 * @param callback if not null,
513 * {@link android.content.pm.IDexModuleRegisterCallback.IDexModuleRegisterCallback#onDexModuleRegistered}
514 * will be called once the registration finishes.
515 */
Calin Juravle0ace6ac2017-05-01 19:19:34 -0700516 oneway void registerDexModule(in String packageName, in String dexModulePath,
Calin Juravle3d2af7f2017-04-19 19:56:21 -0700517 in boolean isSharedModule, IDexModuleRegisterCallback callback);
518
519 /**
Andreas Gampebdd30d82016-03-20 11:32:11 -0700520 * Ask the package manager to perform a dex-opt with the given compiler filter.
521 *
522 * Note: exposed only for the shell command to allow moving packages explicitly to a
523 * definite state.
524 */
Nicolas Geoffrayfb6cf772016-05-27 13:09:19 +0100525 boolean performDexOptMode(String packageName, boolean checkProfiles,
Calin Juravleb6f844d2017-07-17 15:23:21 -0700526 String targetCompilerFilter, boolean force, boolean bootComplete, String splitName);
David Brazdil493411a2016-02-01 13:48:46 +0000527
David Sehra8777082016-05-24 15:25:23 -0700528 /**
Calin Juravlec22c30e2017-01-16 19:18:48 -0800529 * Ask the package manager to perform a dex-opt with the given compiler filter on the
530 * secondary dex files belonging to the given package.
531 *
532 * Note: exposed only for the shell command to allow moving packages explicitly to a
533 * definite state.
534 */
535 boolean performDexOptSecondary(String packageName,
536 String targetCompilerFilter, boolean force);
537
538 /**
David Sehra8777082016-05-24 15:25:23 -0700539 * Ask the package manager to dump profiles associated with a package.
540 */
541 void dumpProfiles(String packageName);
542
Jeff Sharkey20e0c502014-07-25 14:09:37 -0700543 void forceDexOpt(String packageName);
544
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800545 /**
Calin Juravlecb5f41e2017-01-25 17:16:08 -0800546 * Execute the background dexopt job immediately.
547 */
548 boolean runBackgroundDexoptJob();
549
550 /**
Calin Juravle1aa5f882017-01-25 01:05:50 -0800551 * Reconcile the information we have about the secondary dex files belonging to
552 * {@code packagName} and the actual dex files. For all dex files that were
553 * deleted, update the internal records and delete the generated oat files.
554 */
555 void reconcileSecondaryDexFiles(String packageName);
556
557 /**
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800558 * Update status of external media on the package manager to scan and
559 * install packages installed on the external media. Like say the
Sudheer Shanka2250d562016-11-07 15:41:02 -0800560 * StorageManagerService uses this to call into the package manager to update
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800561 * status of sdcard.
562 */
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -0700563 void updateExternalMediaStatus(boolean mounted, boolean reportStatus);
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800564
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700565 PackageCleanItem nextPackageToClean(in PackageCleanItem lastPackage);
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800566
Jeff Sharkey620b32b2015-04-23 19:36:02 -0700567 int getMoveStatus(int moveId);
568
569 void registerMoveCallback(in IPackageMoveObserver callback);
570 void unregisterMoveCallback(in IPackageMoveObserver callback);
571
572 int movePackage(in String packageName, in String volumeUuid);
573 int movePrimaryStorage(in String volumeUuid);
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700574
Dianne Hackbornd7c09682010-03-30 10:42:20 -0700575 boolean addPermissionAsync(in PermissionInfo info);
Suchi Amalapurapu40e47252010-04-07 16:15:50 -0700576
577 boolean setInstallLocation(int loc);
578 int getInstallLocation();
Amith Yamasani0b285492011-04-14 17:35:23 -0700579
Todd Kennedybe0b8892017-02-15 14:13:52 -0800580 int installExistingPackageAsUser(String packageName, int userId, int installFlags,
581 int installReason);
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700582
Kenny Root3a9b5fb2011-09-20 14:15:38 -0700583 void verifyPendingInstall(int id, int verificationCode);
rich canningsd9ef3e52012-08-22 14:28:05 -0700584 void extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay);
Kenny Root0aaa0d92011-09-12 16:42:55 -0700585
Fabrice Di Megliod3d8a322015-04-01 15:58:47 -0700586 void verifyIntentFilter(int id, int verificationCode, in List<String> failedDomains);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -0800587 int getIntentVerificationStatus(String packageName, int userId);
588 boolean updateIntentVerificationStatus(String packageName, int status, int userId);
Jeff Sharkeyd5896632016-03-04 16:16:00 -0700589 ParceledListSlice getIntentFilterVerifications(String packageName);
590 ParceledListSlice getAllIntentFilters(String packageName);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -0800591
Fabrice Di Meglio62271722015-04-10 17:24:02 -0700592 boolean setDefaultBrowserPackageName(String packageName, int userId);
593 String getDefaultBrowserPackageName(int userId);
594
Kenny Root0aaa0d92011-09-12 16:42:55 -0700595 VerifierDeviceIdentity getVerifierDeviceIdentity();
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700596
597 boolean isFirstBoot();
Dianne Hackborn13579ed2012-11-28 18:05:36 -0800598 boolean isOnlyCoreApps();
Jeff Hao9f60c082014-10-28 18:51:07 -0700599 boolean isUpgrade();
Amith Yamasani742a6712011-05-04 14:49:28 -0700600
Jeff Sharkey5d32e772012-04-12 15:59:23 -0700601 void setPermissionEnforced(String permission, boolean enforced);
602 boolean isPermissionEnforced(String permission);
Jeff Sharkeyf6f7f1d2012-06-12 17:12:08 -0700603
604 /** Reflects current DeviceStorageMonitorService state */
605 boolean isStorageLow();
Amith Yamasani655d0e22013-06-12 14:19:10 -0700606
Amith Yamasanie5bcff62014-07-19 15:44:09 -0700607 boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, int userId);
608 boolean getApplicationHiddenSettingAsUser(String packageName, int userId);
Jeff Sharkey3a44f3f2014-04-28 17:36:31 -0700609
610 IPackageInstaller getPackageInstaller();
Kenny Guyc13053b2014-05-29 14:17:17 +0100611
612 boolean setBlockUninstallForUser(String packageName, boolean blockUninstall, int userId);
613 boolean getBlockUninstallForUser(String packageName, int userId);
dcashman9d2f4412014-06-09 09:27:54 -0700614
dcashmanc6f22492014-08-14 09:54:51 -0700615 KeySet getKeySetByAlias(String packageName, String alias);
616 KeySet getSigningKeySet(String packageName);
617 boolean isPackageSignedByKeySet(String packageName, in KeySet ks);
618 boolean isPackageSignedByKeySetExactly(String packageName, in KeySet ks);
Svetoslavf7c06eb2015-06-10 18:43:22 -0700619
620 void addOnPermissionsChangeListener(in IOnPermissionsChangeListener listener);
621 void removeOnPermissionsChangeListener(in IOnPermissionsChangeListener listener);
Svetoslavcdfd2302015-06-25 19:07:31 -0700622 void grantDefaultPermissionsToEnabledCarrierApps(in String[] packageNames, int userId);
Brad Ebingerf4779792017-01-23 16:44:23 -0800623 void grantDefaultPermissionsToEnabledImsServices(in String[] packageNames, int userId);
Svet Ganovad3b2972015-07-07 22:49:17 -0700624
625 boolean isPermissionRevokedByPolicy(String permission, String packageName, int userId);
Svet Ganovf1b7f202015-07-29 08:33:42 -0700626
627 String getPermissionControllerPackageName();
Svet Ganov2acf0632015-11-24 19:10:59 -0800628
Svetoslav Ganov096d3042017-01-30 16:34:13 -0800629 ParceledListSlice getInstantApps(int userId);
630 byte[] getInstantAppCookie(String packageName, int userId);
631 boolean setInstantAppCookie(String packageName, in byte[] cookie, int userId);
632 Bitmap getInstantAppIcon(String packageName, int userId);
633 boolean isInstantApp(String packageName, int userId);
Fyodor Kupolovbdbc9692015-12-14 13:11:13 -0800634
635 boolean setRequiredForSystemUser(String packageName, boolean systemUserApp);
Svet Ganovd7b1f4112016-02-09 18:49:23 -0800636
Todd Kennedyab532892017-03-08 14:19:49 -0800637 /**
638 * Sets whether or not an update is available. Ostensibly for instant apps
639 * to force exteranl resolution.
640 */
641 void setUpdateAvailable(String packageName, boolean updateAvaialble);
642
Svet Ganovd7b1f4112016-02-09 18:49:23 -0800643 String getServicesSystemSharedLibraryPackageName();
Svetoslav Ganova9c25002016-04-13 19:25:56 -0700644 String getSharedSystemSharedLibraryPackageName();
Makoto Onukif34db0a2016-02-17 11:17:15 -0800645
Todd Kennedy9106c642017-02-08 14:16:53 -0800646 ChangedPackages getChangedPackages(int sequenceNumber, int userId);
647
Makoto Onukif34db0a2016-02-17 11:17:15 -0800648 boolean isPackageDeviceAdminOnAnyUser(String packageName);
Todd Kennedy39bfee52016-02-24 10:28:21 -0800649
650 List<String> getPreviousCodePaths(in String packageName);
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +0100651
652 int getInstallReason(String packageName, int userId);
Svet Ganov67882122016-12-11 16:36:34 -0800653
Svet Ganov58c99f02017-05-15 14:07:17 -0700654 ParceledListSlice getSharedLibraries(in String packageName, int flags, int userId);
Suprabh Shuklaaef25132017-01-23 18:09:03 -0800655
656 boolean canRequestPackageInstalls(String packageName, int userId);
Fyodor Kupolov935618a2017-03-22 16:50:44 -0700657
658 void deletePreloadsFileCache();
Chad Brubaker336ae5b2017-03-24 15:53:09 -0700659
Todd Kennedy0a3f0812017-05-08 14:43:15 -0700660 ComponentName getInstantAppResolverComponent();
661
Chad Brubaker336ae5b2017-03-24 15:53:09 -0700662 ComponentName getInstantAppResolverSettingsComponent();
Todd Kennedy801e6592017-04-12 14:10:12 -0700663
664 ComponentName getInstantAppInstallerComponent();
Chad Brubaker0d277a72017-04-12 16:56:53 -0700665
666 String getInstantAppAndroidId(String packageName, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800667}