Svet Ganov | adc1cf4 | 2015-06-15 16:36:24 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.content.pm; |
| 18 | |
Todd Kennedy | 82b0842 | 2017-09-28 13:32:05 -0700 | [diff] [blame^] | 19 | import android.annotation.IntDef; |
| 20 | import android.annotation.NonNull; |
| 21 | import android.annotation.Nullable; |
Makoto Onuki | 2d5b465 | 2016-03-11 16:09:54 -0800 | [diff] [blame] | 22 | import android.content.ComponentName; |
Todd Kennedy | 01ad0c7 | 2016-11-11 15:33:12 -0800 | [diff] [blame] | 23 | import android.content.Intent; |
Todd Kennedy | 18211fd | 2017-06-06 09:15:46 -0700 | [diff] [blame] | 24 | import android.content.pm.PackageManager.ApplicationInfoFlags; |
| 25 | import android.content.pm.PackageManager.ComponentInfoFlags; |
Todd Kennedy | 18211fd | 2017-06-06 09:15:46 -0700 | [diff] [blame] | 26 | import android.content.pm.PackageManager.PackageInfoFlags; |
| 27 | import android.content.pm.PackageManager.ResolveInfoFlags; |
Chad Brubaker | 0606861 | 2017-04-06 09:43:47 -0700 | [diff] [blame] | 28 | import android.os.Bundle; |
Makoto Onuki | c29f62c | 2016-06-07 12:19:46 -0700 | [diff] [blame] | 29 | import android.util.SparseArray; |
Todd Kennedy | 39bfee5 | 2016-02-24 10:28:21 -0800 | [diff] [blame] | 30 | |
Todd Kennedy | 82b0842 | 2017-09-28 13:32:05 -0700 | [diff] [blame^] | 31 | import java.lang.annotation.Retention; |
| 32 | import java.lang.annotation.RetentionPolicy; |
Fyodor Kupolov | cb6fd80 | 2015-11-05 14:27:06 -0800 | [diff] [blame] | 33 | import java.util.List; |
Svet Ganov | adc1cf4 | 2015-06-15 16:36:24 -0700 | [diff] [blame] | 34 | |
| 35 | /** |
| 36 | * Package manager local system service interface. |
| 37 | * |
| 38 | * @hide Only for use within the system server. |
| 39 | */ |
| 40 | public abstract class PackageManagerInternal { |
Todd Kennedy | 82b0842 | 2017-09-28 13:32:05 -0700 | [diff] [blame^] | 41 | public static final int PACKAGE_SYSTEM = 0; |
| 42 | public static final int PACKAGE_SETUP_WIZARD = 1; |
| 43 | public static final int PACKAGE_INSTALLER = 2; |
| 44 | public static final int PACKAGE_VERIFIER = 3; |
| 45 | public static final int PACKAGE_BROWSER = 4; |
| 46 | @IntDef(value = { |
| 47 | PACKAGE_SYSTEM, |
| 48 | PACKAGE_SETUP_WIZARD, |
| 49 | PACKAGE_INSTALLER, |
| 50 | PACKAGE_VERIFIER, |
| 51 | PACKAGE_BROWSER, |
| 52 | }) |
| 53 | @Retention(RetentionPolicy.SOURCE) |
| 54 | public @interface KnownPackage {} |
Svet Ganov | adc1cf4 | 2015-06-15 16:36:24 -0700 | [diff] [blame] | 55 | |
| 56 | /** |
| 57 | * Provider for package names. |
| 58 | */ |
| 59 | public interface PackagesProvider { |
| 60 | |
| 61 | /** |
| 62 | * Gets the packages for a given user. |
| 63 | * @param userId The user id. |
| 64 | * @return The package names. |
| 65 | */ |
| 66 | public String[] getPackages(int userId); |
| 67 | } |
| 68 | |
| 69 | /** |
Svetoslav | 0010b70 | 2015-06-30 18:05:26 -0700 | [diff] [blame] | 70 | * Provider for package names. |
| 71 | */ |
| 72 | public interface SyncAdapterPackagesProvider { |
| 73 | |
| 74 | /** |
| 75 | * Gets the sync adapter packages for given authority and user. |
| 76 | * @param authority The authority. |
| 77 | * @param userId The user id. |
| 78 | * @return The package names. |
| 79 | */ |
| 80 | public String[] getPackages(String authority, int userId); |
| 81 | } |
| 82 | |
| 83 | /** |
Svet Ganov | adc1cf4 | 2015-06-15 16:36:24 -0700 | [diff] [blame] | 84 | * Sets the location provider packages provider. |
| 85 | * @param provider The packages provider. |
| 86 | */ |
| 87 | public abstract void setLocationPackagesProvider(PackagesProvider provider); |
| 88 | |
| 89 | /** |
Svet Ganov | adc1cf4 | 2015-06-15 16:36:24 -0700 | [diff] [blame] | 90 | * Sets the voice interaction packages provider. |
| 91 | * @param provider The packages provider. |
| 92 | */ |
| 93 | public abstract void setVoiceInteractionPackagesProvider(PackagesProvider provider); |
Svetoslav | cdfd230 | 2015-06-25 19:07:31 -0700 | [diff] [blame] | 94 | |
| 95 | /** |
| 96 | * Sets the SMS packages provider. |
| 97 | * @param provider The packages provider. |
| 98 | */ |
| 99 | public abstract void setSmsAppPackagesProvider(PackagesProvider provider); |
| 100 | |
| 101 | /** |
| 102 | * Sets the dialer packages provider. |
| 103 | * @param provider The packages provider. |
| 104 | */ |
| 105 | public abstract void setDialerAppPackagesProvider(PackagesProvider provider); |
| 106 | |
| 107 | /** |
Sailesh Nepal | cf85562 | 2015-07-28 19:22:14 -0700 | [diff] [blame] | 108 | * Sets the sim call manager packages provider. |
| 109 | * @param provider The packages provider. |
| 110 | */ |
| 111 | public abstract void setSimCallManagerPackagesProvider(PackagesProvider provider); |
| 112 | |
| 113 | /** |
Svetoslav | 0010b70 | 2015-06-30 18:05:26 -0700 | [diff] [blame] | 114 | * Sets the sync adapter packages provider. |
| 115 | * @param provider The provider. |
| 116 | */ |
| 117 | public abstract void setSyncAdapterPackagesprovider(SyncAdapterPackagesProvider provider); |
| 118 | |
| 119 | /** |
Svetoslav | cdfd230 | 2015-06-25 19:07:31 -0700 | [diff] [blame] | 120 | * Requests granting of the default permissions to the current default SMS app. |
| 121 | * @param packageName The default SMS package name. |
| 122 | * @param userId The user for which to grant the permissions. |
| 123 | */ |
| 124 | public abstract void grantDefaultPermissionsToDefaultSmsApp(String packageName, int userId); |
| 125 | |
| 126 | /** |
| 127 | * Requests granting of the default permissions to the current default dialer app. |
| 128 | * @param packageName The default dialer package name. |
| 129 | * @param userId The user for which to grant the permissions. |
| 130 | */ |
| 131 | public abstract void grantDefaultPermissionsToDefaultDialerApp(String packageName, int userId); |
Sailesh Nepal | cf85562 | 2015-07-28 19:22:14 -0700 | [diff] [blame] | 132 | |
| 133 | /** |
| 134 | * Requests granting of the default permissions to the current default sim call manager. |
| 135 | * @param packageName The default sim call manager package name. |
| 136 | * @param userId The user for which to grant the permissions. |
| 137 | */ |
| 138 | public abstract void grantDefaultPermissionsToDefaultSimCallManager(String packageName, |
| 139 | int userId); |
Fyodor Kupolov | cb6fd80 | 2015-11-05 14:27:06 -0800 | [diff] [blame] | 140 | |
| 141 | /** |
| 142 | * Sets a list of apps to keep in PM's internal data structures and as APKs even if no user has |
| 143 | * currently installed it. The apps are not preloaded. |
| 144 | * @param packageList List of package names to keep cached. |
| 145 | */ |
| 146 | public abstract void setKeepUninstalledPackages(List<String> packageList); |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 147 | |
| 148 | /** |
| 149 | * Gets whether some of the permissions used by this package require a user |
| 150 | * review before any of the app components can run. |
| 151 | * @param packageName The package name for which to check. |
| 152 | * @param userId The user under which to check. |
| 153 | * @return True a permissions review is required. |
| 154 | */ |
| 155 | public abstract boolean isPermissionsReviewRequired(String packageName, int userId); |
Todd Kennedy | 39bfee5 | 2016-02-24 10:28:21 -0800 | [diff] [blame] | 156 | |
| 157 | /** |
Todd Kennedy | 18211fd | 2017-06-06 09:15:46 -0700 | [diff] [blame] | 158 | * Retrieve all of the information we know about a particular package/application. |
| 159 | * @param filterCallingUid The results will be filtered in the context of this UID instead |
| 160 | * of the calling UID. |
| 161 | * @see PackageManager#getPackageInfo(String, int) |
Todd Kennedy | 39bfee5 | 2016-02-24 10:28:21 -0800 | [diff] [blame] | 162 | */ |
Todd Kennedy | 18211fd | 2017-06-06 09:15:46 -0700 | [diff] [blame] | 163 | public abstract PackageInfo getPackageInfo(String packageName, |
| 164 | @PackageInfoFlags int flags, int filterCallingUid, int userId); |
| 165 | |
| 166 | /** |
| 167 | * Retrieve all of the information we know about a particular package/application. |
| 168 | * @param filterCallingUid The results will be filtered in the context of this UID instead |
| 169 | * of the calling UID. |
| 170 | * @see PackageManager#getApplicationInfo(String, int) |
| 171 | */ |
| 172 | public abstract ApplicationInfo getApplicationInfo(String packageName, |
| 173 | @ApplicationInfoFlags int flags, int filterCallingUid, int userId); |
| 174 | |
| 175 | /** |
| 176 | * Retrieve all of the information we know about a particular activity class. |
| 177 | * @param filterCallingUid The results will be filtered in the context of this UID instead |
| 178 | * of the calling UID. |
| 179 | * @see PackageManager#getActivityInfo(ComponentName, int) |
| 180 | */ |
| 181 | public abstract ActivityInfo getActivityInfo(ComponentName component, |
| 182 | @ComponentInfoFlags int flags, int filterCallingUid, int userId); |
| 183 | |
| 184 | /** |
| 185 | * Retrieve all activities that can be performed for the given intent. |
| 186 | * @param filterCallingUid The results will be filtered in the context of this UID instead |
| 187 | * of the calling UID. |
| 188 | * @see PackageManager#queryIntentActivities(Intent, int) |
| 189 | */ |
| 190 | public abstract List<ResolveInfo> queryIntentActivities(Intent intent, |
| 191 | @ResolveInfoFlags int flags, int filterCallingUid, int userId); |
Makoto Onuki | 2d5b465 | 2016-03-11 16:09:54 -0800 | [diff] [blame] | 192 | |
| 193 | /** |
Todd Kennedy | 82b0842 | 2017-09-28 13:32:05 -0700 | [diff] [blame^] | 194 | * Retrieve all services that can be performed for the given intent. |
| 195 | * @see PackageManager#queryIntentServices(Intent, int) |
| 196 | */ |
| 197 | public abstract List<ResolveInfo> queryIntentServices( |
| 198 | Intent intent, int flags, int callingUid, int userId); |
| 199 | |
| 200 | /** |
Makoto Onuki | 2d5b465 | 2016-03-11 16:09:54 -0800 | [diff] [blame] | 201 | * Interface to {@link com.android.server.pm.PackageManagerService#getHomeActivitiesAsUser}. |
| 202 | */ |
| 203 | public abstract ComponentName getHomeActivitiesAsUser(List<ResolveInfo> allHomeCandidates, |
| 204 | int userId); |
Makoto Onuki | c29f62c | 2016-06-07 12:19:46 -0700 | [diff] [blame] | 205 | |
| 206 | /** |
| 207 | * Called by DeviceOwnerManagerService to set the package names of device owner and profile |
| 208 | * owners. |
| 209 | */ |
| 210 | public abstract void setDeviceAndProfileOwnerPackages( |
| 211 | int deviceOwnerUserId, String deviceOwner, SparseArray<String> profileOwners); |
| 212 | |
| 213 | /** |
Steven Ng | 9d48a73 | 2016-06-24 19:04:14 +0100 | [diff] [blame] | 214 | * Returns {@code true} if a given package can't be wiped. Otherwise, returns {@code false}. |
Makoto Onuki | c29f62c | 2016-06-07 12:19:46 -0700 | [diff] [blame] | 215 | */ |
Steven Ng | 9d48a73 | 2016-06-24 19:04:14 +0100 | [diff] [blame] | 216 | public abstract boolean isPackageDataProtected(int userId, String packageName); |
Svet Ganov | 973edd19 | 2016-09-08 20:15:55 -0700 | [diff] [blame] | 217 | |
| 218 | /** |
Dianne Hackborn | e07641d | 2016-11-09 15:07:23 -0800 | [diff] [blame] | 219 | * Returns {@code true} if a given package is installed as ephemeral. Otherwise, returns |
| 220 | * {@code false}. |
| 221 | */ |
| 222 | public abstract boolean isPackageEphemeral(int userId, String packageName); |
| 223 | |
| 224 | /** |
Svet Ganov | 973edd19 | 2016-09-08 20:15:55 -0700 | [diff] [blame] | 225 | * Gets whether the package was ever launched. |
| 226 | * @param packageName The package name. |
| 227 | * @param userId The user for which to check. |
| 228 | * @return Whether was launched. |
Amith Yamasani | 2cbfa1e | 2017-03-28 10:34:01 -0700 | [diff] [blame] | 229 | * @throws IllegalArgumentException if the package is not found |
Svet Ganov | 973edd19 | 2016-09-08 20:15:55 -0700 | [diff] [blame] | 230 | */ |
| 231 | public abstract boolean wasPackageEverLaunched(String packageName, int userId); |
Nicolas Prevot | 700e1e7 | 2016-09-28 15:17:18 +0100 | [diff] [blame] | 232 | |
| 233 | /** |
| 234 | * Grants a runtime permission |
| 235 | * @param packageName The package name. |
| 236 | * @param name The name of the permission. |
| 237 | * @param userId The userId for which to grant the permission. |
| 238 | * @param overridePolicy If true, grant this permission even if it is fixed by policy. |
| 239 | */ |
| 240 | public abstract void grantRuntimePermission(String packageName, String name, int userId, |
| 241 | boolean overridePolicy); |
| 242 | |
| 243 | /** |
| 244 | * Revokes a runtime permission |
| 245 | * @param packageName The package name. |
| 246 | * @param name The name of the permission. |
| 247 | * @param userId The userId for which to revoke the permission. |
| 248 | * @param overridePolicy If true, revoke this permission even if it is fixed by policy. |
| 249 | */ |
| 250 | public abstract void revokeRuntimePermission(String packageName, String name, int userId, |
| 251 | boolean overridePolicy); |
| 252 | |
Michal Karpinski | f77ee4f | 2016-10-12 16:40:06 +0100 | [diff] [blame] | 253 | /** |
Michal Karpinski | cb67dc9 | 2016-12-13 18:20:23 +0000 | [diff] [blame] | 254 | * Retrieve the official name associated with a uid. This name is |
Michal Karpinski | f77ee4f | 2016-10-12 16:40:06 +0100 | [diff] [blame] | 255 | * guaranteed to never change, though it is possible for the underlying |
Michal Karpinski | cb67dc9 | 2016-12-13 18:20:23 +0000 | [diff] [blame] | 256 | * uid to be changed. That is, if you are storing information about |
| 257 | * uids in persistent storage, you should use the string returned |
| 258 | * by this function instead of the raw uid. |
Michal Karpinski | f77ee4f | 2016-10-12 16:40:06 +0100 | [diff] [blame] | 259 | * |
Michal Karpinski | cb67dc9 | 2016-12-13 18:20:23 +0000 | [diff] [blame] | 260 | * @param uid The uid for which you would like to retrieve a name. |
| 261 | * @return Returns a unique name for the given uid, or null if the |
| 262 | * uid is not currently assigned. |
Michal Karpinski | f77ee4f | 2016-10-12 16:40:06 +0100 | [diff] [blame] | 263 | */ |
| 264 | public abstract String getNameForUid(int uid); |
| 265 | |
Todd Kennedy | 01ad0c7 | 2016-11-11 15:33:12 -0800 | [diff] [blame] | 266 | /** |
| 267 | * Request to perform the second phase of ephemeral resolution. |
| 268 | * @param responseObj The response of the first phase of ephemeral resolution |
| 269 | * @param origIntent The original intent that triggered ephemeral resolution |
| 270 | * @param resolvedType The resolved type of the intent |
Todd Kennedy | 01ad0c7 | 2016-11-11 15:33:12 -0800 | [diff] [blame] | 271 | * @param callingPackage The name of the package requesting the ephemeral application |
Chad Brubaker | 0606861 | 2017-04-06 09:43:47 -0700 | [diff] [blame] | 272 | * @param verificationBundle Optional bundle to pass to the installer for additional |
| 273 | * verification |
Todd Kennedy | 01ad0c7 | 2016-11-11 15:33:12 -0800 | [diff] [blame] | 274 | * @param userId The ID of the user that triggered ephemeral resolution |
| 275 | */ |
Todd Kennedy | e991022 | 2017-02-21 16:00:11 -0800 | [diff] [blame] | 276 | public abstract void requestInstantAppResolutionPhaseTwo(AuxiliaryResolveInfo responseObj, |
| 277 | Intent origIntent, String resolvedType, String callingPackage, |
Chad Brubaker | 0606861 | 2017-04-06 09:43:47 -0700 | [diff] [blame] | 278 | Bundle verificationBundle, int userId); |
Svetoslav Ganov | e080da9 | 2016-12-21 17:10:35 -0800 | [diff] [blame] | 279 | |
| 280 | /** |
Todd Kennedy | 0e989d0 | 2017-01-13 14:15:36 -0800 | [diff] [blame] | 281 | * Grants access to the package metadata for an ephemeral application. |
| 282 | * <p> |
| 283 | * When an ephemeral application explicitly tries to interact with a full |
| 284 | * install application [via an activity, service or provider that has been |
| 285 | * exposed using the {@code visibleToInstantApp} attribute], the normal |
| 286 | * application must be able to see metadata about the connecting ephemeral |
| 287 | * app. If the ephemeral application uses an implicit intent [ie action VIEW, |
| 288 | * category BROWSABLE], it remains hidden from the launched activity. |
| 289 | * <p> |
| 290 | * If the {@code sourceUid} is not for an ephemeral app or {@code targetUid} |
| 291 | * is not for a fully installed app, this method will be a no-op. |
| 292 | * |
| 293 | * @param userId the user |
| 294 | * @param intent the intent that triggered the grant |
| 295 | * @param targetAppId The app ID of the fully installed application |
| 296 | * @param ephemeralAppId The app ID of the ephemeral application |
| 297 | */ |
| 298 | public abstract void grantEphemeralAccess(int userId, Intent intent, |
| 299 | int targetAppId, int ephemeralAppId); |
| 300 | |
Todd Kennedy | b21be12 | 2017-03-24 14:10:01 -0700 | [diff] [blame] | 301 | public abstract boolean isInstantAppInstallerComponent(ComponentName component); |
Todd Kennedy | 0e989d0 | 2017-01-13 14:15:36 -0800 | [diff] [blame] | 302 | /** |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 303 | * Prunes instant apps and state associated with uninstalled |
| 304 | * instant apps according to the current platform policy. |
| 305 | */ |
| 306 | public abstract void pruneInstantApps(); |
| 307 | |
| 308 | /** |
Svetoslav Ganov | e080da9 | 2016-12-21 17:10:35 -0800 | [diff] [blame] | 309 | * @return The SetupWizard package name. |
| 310 | */ |
| 311 | public abstract String getSetupWizardPackageName(); |
Suprabh Shukla | aef2513 | 2017-01-23 18:09:03 -0800 | [diff] [blame] | 312 | |
| 313 | public interface ExternalSourcesPolicy { |
| 314 | |
| 315 | int USER_TRUSTED = 0; // User has trusted the package to install apps |
| 316 | int USER_BLOCKED = 1; // User has blocked the package to install apps |
| 317 | int USER_DEFAULT = 2; // Default code to use when user response is unavailable |
| 318 | |
| 319 | /** |
| 320 | * Checks the user preference for whether a package is trusted to request installs through |
| 321 | * package installer |
| 322 | * |
| 323 | * @param packageName The package to check for |
| 324 | * @param uid the uid in which the package is running |
| 325 | * @return {@link USER_TRUSTED} if the user has trusted the package, {@link USER_BLOCKED} |
| 326 | * if user has blocked requests from the package, {@link USER_DEFAULT} if the user response |
| 327 | * is not yet available |
| 328 | */ |
| 329 | int getPackageTrustedToInstallApps(String packageName, int uid); |
| 330 | } |
| 331 | |
| 332 | public abstract void setExternalSourcesPolicy(ExternalSourcesPolicy policy); |
Mårten Kongstad | eabc9e9 | 2015-12-15 16:40:23 +0100 | [diff] [blame] | 333 | |
| 334 | /** |
Dianne Hackborn | b1e7776 | 2017-02-13 11:42:18 -0800 | [diff] [blame] | 335 | * Return true if the given package is a persistent app process. |
| 336 | */ |
| 337 | public abstract boolean isPackagePersistent(String packageName); |
| 338 | |
| 339 | /** |
Mårten Kongstad | eabc9e9 | 2015-12-15 16:40:23 +0100 | [diff] [blame] | 340 | * Get all overlay packages for a user. |
| 341 | * @param userId The user for which to get the overlays. |
| 342 | * @return A list of overlay packages. An empty list is returned if the |
| 343 | * user has no installed overlay packages. |
| 344 | */ |
| 345 | public abstract List<PackageInfo> getOverlayPackages(int userId); |
| 346 | |
| 347 | /** |
| 348 | * Get the names of all target packages for a user. |
| 349 | * @param userId The user for which to get the package names. |
| 350 | * @return A list of target package names. This list includes the "android" package. |
| 351 | */ |
| 352 | public abstract List<String> getTargetPackageNames(int userId); |
| 353 | |
| 354 | /** |
| 355 | * Set which overlay to use for a package. |
| 356 | * @param userId The user for which to update the overlays. |
| 357 | * @param targetPackageName The package name of the package for which to update the overlays. |
| 358 | * @param overlayPackageNames The complete list of overlay packages that should be enabled for |
| 359 | * the target. Previously enabled overlays not specified in the list |
| 360 | * will be disabled. Pass in null or an empty list to disable |
| 361 | * all overlays. The order of the items is significant if several |
| 362 | * overlays modify the same resource. |
| 363 | * @return true if all packages names were known by the package manager, false otherwise |
| 364 | */ |
| 365 | public abstract boolean setEnabledOverlayPackages(int userId, String targetPackageName, |
| 366 | List<String> overlayPackageNames); |
Todd Kennedy | 4d1de7d | 2017-02-23 10:32:18 -0800 | [diff] [blame] | 367 | |
| 368 | /** |
Todd Kennedy | 51b3aac | 2017-03-30 17:50:42 -0700 | [diff] [blame] | 369 | * Resolves an activity intent, allowing instant apps to be resolved. |
Todd Kennedy | 4d1de7d | 2017-02-23 10:32:18 -0800 | [diff] [blame] | 370 | */ |
| 371 | public abstract ResolveInfo resolveIntent(Intent intent, String resolvedType, |
Todd Kennedy | 82b0842 | 2017-09-28 13:32:05 -0700 | [diff] [blame^] | 372 | int flags, int userId, boolean resolveForStart); |
Chad Brubaker | 0f28a80 | 2017-03-29 14:05:52 -0700 | [diff] [blame] | 373 | |
| 374 | /** |
Todd Kennedy | 51b3aac | 2017-03-30 17:50:42 -0700 | [diff] [blame] | 375 | * Resolves a service intent, allowing instant apps to be resolved. |
| 376 | */ |
Todd Kennedy | 82b0842 | 2017-09-28 13:32:05 -0700 | [diff] [blame^] | 377 | public abstract ResolveInfo resolveService(Intent intent, String resolvedType, |
Todd Kennedy | 51b3aac | 2017-03-30 17:50:42 -0700 | [diff] [blame] | 378 | int flags, int userId, int callingUid); |
| 379 | |
Todd Kennedy | 82b0842 | 2017-09-28 13:32:05 -0700 | [diff] [blame^] | 380 | /** |
| 381 | * Resolves a content provider intent. |
| 382 | */ |
| 383 | public abstract ProviderInfo resolveContentProvider(String name, int flags, int userId); |
| 384 | |
Todd Kennedy | 51b3aac | 2017-03-30 17:50:42 -0700 | [diff] [blame] | 385 | /** |
Chad Brubaker | 0f28a80 | 2017-03-29 14:05:52 -0700 | [diff] [blame] | 386 | * Track the creator of a new isolated uid. |
| 387 | * @param isolatedUid The newly created isolated uid. |
| 388 | * @param ownerUid The uid of the app that created the isolated process. |
| 389 | */ |
| 390 | public abstract void addIsolatedUid(int isolatedUid, int ownerUid); |
| 391 | |
| 392 | /** |
| 393 | * Track removal of an isolated uid. |
| 394 | * @param isolatedUid isolated uid that is no longer being used. |
| 395 | */ |
| 396 | public abstract void removeIsolatedUid(int isolatedUid); |
Makoto Onuki | e92f794 | 2017-04-26 14:38:18 -0700 | [diff] [blame] | 397 | |
| 398 | /** |
| 399 | * Return the taget SDK version for the app with the given UID. |
| 400 | */ |
| 401 | public abstract int getUidTargetSdkVersion(int uid); |
Makoto Onuki | ad62301 | 2017-05-15 09:29:34 -0700 | [diff] [blame] | 402 | |
| 403 | /** Whether the binder caller can access instant apps. */ |
Todd Kennedy | 3051caa | 2017-05-23 15:54:18 -0700 | [diff] [blame] | 404 | public abstract boolean canAccessInstantApps(int callingUid, int userId); |
Svet Ganov | f935a70 | 2017-08-22 12:15:58 -0700 | [diff] [blame] | 405 | |
| 406 | /** |
| 407 | * Returns {@code true} if a given package has instant application meta-data. |
| 408 | * Otherwise, returns {@code false}. Meta-data is state (eg. cookie, app icon, etc) |
| 409 | * associated with an instant app. It may be kept after the instant app has been uninstalled. |
| 410 | */ |
| 411 | public abstract boolean hasInstantApplicationMetadata(String packageName, int userId); |
Todd Kennedy | df113c3 | 2017-08-31 16:10:29 -0700 | [diff] [blame] | 412 | |
| 413 | /** |
| 414 | * Updates a package last used time. |
| 415 | */ |
| 416 | public abstract void notifyPackageUse(String packageName, int reason); |
Todd Kennedy | 82b0842 | 2017-09-28 13:32:05 -0700 | [diff] [blame^] | 417 | |
| 418 | /** |
| 419 | * Returns a package object for the given package name. |
| 420 | */ |
| 421 | public abstract @Nullable PackageParser.Package getPackage(@NonNull String packageName); |
| 422 | |
| 423 | /** |
| 424 | * Returns a package object for the disabled system package name. |
| 425 | */ |
| 426 | public abstract @Nullable PackageParser.Package getDisabledPackage(@NonNull String packageName); |
| 427 | |
| 428 | /** |
| 429 | * Returns whether or not the component is the resolver activity. |
| 430 | */ |
| 431 | public abstract boolean isResolveActivityComponent(@NonNull ComponentInfo component); |
| 432 | |
| 433 | /** |
| 434 | * Returns the package name for a known package. |
| 435 | */ |
| 436 | public abstract @Nullable String getKnownPackageName( |
| 437 | @KnownPackage int knownPackage, int userId); |
| 438 | |
| 439 | /* |
| 440 | * NOTE: The following methods are temporary until permissions are extracted from |
| 441 | * the package manager into a component specifically for handling permissions. |
| 442 | */ |
| 443 | /** Returns a permission object for the given permission name. */ |
| 444 | public abstract @Nullable Object getPermissionTEMP(@NonNull String permName); |
| 445 | /** Returns the flags for the given permission. */ |
| 446 | public abstract @Nullable int getPermissionFlagsTEMP(@NonNull String permName, |
| 447 | @NonNull String packageName, int userId); |
| 448 | /** Updates the flags for the given permission. */ |
| 449 | public abstract void updatePermissionFlagsTEMP(@NonNull String permName, |
| 450 | @NonNull String packageName, int flagMask, int flagValues, int userId); |
Svet Ganov | adc1cf4 | 2015-06-15 16:36:24 -0700 | [diff] [blame] | 451 | } |