blob: 5b3d3e595a91c8d670af0aef4813558e4114f223 [file] [log] [blame]
Svet Ganovadc1cf42015-06-15 16:36:24 -07001/*
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
17package android.content.pm;
18
Todd Kennedy82b08422017-09-28 13:32:05 -070019import android.annotation.IntDef;
20import android.annotation.NonNull;
21import android.annotation.Nullable;
Makoto Onuki2d5b4652016-03-11 16:09:54 -080022import android.content.ComponentName;
Todd Kennedy01ad0c72016-11-11 15:33:12 -080023import android.content.Intent;
Todd Kennedy18211fd2017-06-06 09:15:46 -070024import android.content.pm.PackageManager.ApplicationInfoFlags;
25import android.content.pm.PackageManager.ComponentInfoFlags;
Todd Kennedy18211fd2017-06-06 09:15:46 -070026import android.content.pm.PackageManager.PackageInfoFlags;
27import android.content.pm.PackageManager.ResolveInfoFlags;
Chad Brubaker06068612017-04-06 09:43:47 -070028import android.os.Bundle;
Makoto Onukic29f62c2016-06-07 12:19:46 -070029import android.util.SparseArray;
Todd Kennedy39bfee52016-02-24 10:28:21 -080030
Todd Kennedy82b08422017-09-28 13:32:05 -070031import java.lang.annotation.Retention;
32import java.lang.annotation.RetentionPolicy;
Fyodor Kupolovcb6fd802015-11-05 14:27:06 -080033import java.util.List;
Svet Ganovadc1cf42015-06-15 16:36:24 -070034
35/**
36 * Package manager local system service interface.
37 *
38 * @hide Only for use within the system server.
39 */
40public abstract class PackageManagerInternal {
Todd Kennedy82b08422017-09-28 13:32:05 -070041 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;
Makoto Onuki700feef2018-02-15 10:59:41 -080046 public static final int PACKAGE_SYSTEM_TEXT_CLASSIFIER = 5;
Todd Kennedy82b08422017-09-28 13:32:05 -070047 @IntDef(value = {
48 PACKAGE_SYSTEM,
49 PACKAGE_SETUP_WIZARD,
50 PACKAGE_INSTALLER,
51 PACKAGE_VERIFIER,
52 PACKAGE_BROWSER,
Makoto Onuki700feef2018-02-15 10:59:41 -080053 PACKAGE_SYSTEM_TEXT_CLASSIFIER,
Todd Kennedy82b08422017-09-28 13:32:05 -070054 })
55 @Retention(RetentionPolicy.SOURCE)
56 public @interface KnownPackage {}
Svet Ganovadc1cf42015-06-15 16:36:24 -070057
Todd Kennedy42d61602017-12-12 14:44:19 -080058 /** Observer called whenever the list of packages changes */
59 public interface PackageListObserver {
60 /** A package was added to the system. */
61 void onPackageAdded(@NonNull String packageName);
62 /** A package was removed from the system. */
63 void onPackageRemoved(@NonNull String packageName);
64 }
65
Svet Ganovadc1cf42015-06-15 16:36:24 -070066 /**
67 * Provider for package names.
68 */
69 public interface PackagesProvider {
70
71 /**
72 * Gets the packages for a given user.
73 * @param userId The user id.
74 * @return The package names.
75 */
76 public String[] getPackages(int userId);
77 }
78
79 /**
Svetoslav0010b702015-06-30 18:05:26 -070080 * Provider for package names.
81 */
82 public interface SyncAdapterPackagesProvider {
83
84 /**
85 * Gets the sync adapter packages for given authority and user.
86 * @param authority The authority.
87 * @param userId The user id.
88 * @return The package names.
89 */
90 public String[] getPackages(String authority, int userId);
91 }
92
93 /**
Svet Ganovadc1cf42015-06-15 16:36:24 -070094 * Sets the location provider packages provider.
95 * @param provider The packages provider.
96 */
97 public abstract void setLocationPackagesProvider(PackagesProvider provider);
98
99 /**
Svet Ganovadc1cf42015-06-15 16:36:24 -0700100 * Sets the voice interaction packages provider.
101 * @param provider The packages provider.
102 */
103 public abstract void setVoiceInteractionPackagesProvider(PackagesProvider provider);
Svetoslavcdfd2302015-06-25 19:07:31 -0700104
105 /**
106 * Sets the SMS packages provider.
107 * @param provider The packages provider.
108 */
109 public abstract void setSmsAppPackagesProvider(PackagesProvider provider);
110
111 /**
112 * Sets the dialer packages provider.
113 * @param provider The packages provider.
114 */
115 public abstract void setDialerAppPackagesProvider(PackagesProvider provider);
116
117 /**
Sailesh Nepalcf855622015-07-28 19:22:14 -0700118 * Sets the sim call manager packages provider.
119 * @param provider The packages provider.
120 */
121 public abstract void setSimCallManagerPackagesProvider(PackagesProvider provider);
122
123 /**
Eric Enslen1e423b92017-12-18 11:30:21 -0800124 * Sets the Use Open Wifi packages provider.
125 * @param provider The packages provider.
126 */
127 public abstract void setUseOpenWifiAppPackagesProvider(PackagesProvider provider);
128
129 /**
Svetoslav0010b702015-06-30 18:05:26 -0700130 * Sets the sync adapter packages provider.
131 * @param provider The provider.
132 */
133 public abstract void setSyncAdapterPackagesprovider(SyncAdapterPackagesProvider provider);
134
135 /**
Svetoslavcdfd2302015-06-25 19:07:31 -0700136 * Requests granting of the default permissions to the current default SMS app.
137 * @param packageName The default SMS package name.
138 * @param userId The user for which to grant the permissions.
139 */
140 public abstract void grantDefaultPermissionsToDefaultSmsApp(String packageName, int userId);
141
142 /**
143 * Requests granting of the default permissions to the current default dialer app.
144 * @param packageName The default dialer package name.
145 * @param userId The user for which to grant the permissions.
146 */
147 public abstract void grantDefaultPermissionsToDefaultDialerApp(String packageName, int userId);
Sailesh Nepalcf855622015-07-28 19:22:14 -0700148
149 /**
150 * Requests granting of the default permissions to the current default sim call manager.
151 * @param packageName The default sim call manager package name.
152 * @param userId The user for which to grant the permissions.
153 */
154 public abstract void grantDefaultPermissionsToDefaultSimCallManager(String packageName,
155 int userId);
Fyodor Kupolovcb6fd802015-11-05 14:27:06 -0800156
157 /**
Eric Enslen1e423b92017-12-18 11:30:21 -0800158 * Requests granting of the default permissions to the current default Use Open Wifi app.
159 * @param packageName The default use open wifi package name.
160 * @param userId The user for which to grant the permissions.
161 */
162 public abstract void grantDefaultPermissionsToDefaultUseOpenWifiApp(String packageName,
163 int userId);
164
165 /**
Fyodor Kupolovcb6fd802015-11-05 14:27:06 -0800166 * Sets a list of apps to keep in PM's internal data structures and as APKs even if no user has
167 * currently installed it. The apps are not preloaded.
168 * @param packageList List of package names to keep cached.
169 */
170 public abstract void setKeepUninstalledPackages(List<String> packageList);
Svet Ganov9c165d72015-12-01 19:52:26 -0800171
172 /**
173 * Gets whether some of the permissions used by this package require a user
174 * review before any of the app components can run.
175 * @param packageName The package name for which to check.
176 * @param userId The user under which to check.
177 * @return True a permissions review is required.
178 */
179 public abstract boolean isPermissionsReviewRequired(String packageName, int userId);
Todd Kennedy39bfee52016-02-24 10:28:21 -0800180
181 /**
Todd Kennedy18211fd2017-06-06 09:15:46 -0700182 * Retrieve all of the information we know about a particular package/application.
183 * @param filterCallingUid The results will be filtered in the context of this UID instead
184 * of the calling UID.
185 * @see PackageManager#getPackageInfo(String, int)
Todd Kennedy39bfee52016-02-24 10:28:21 -0800186 */
Todd Kennedy18211fd2017-06-06 09:15:46 -0700187 public abstract PackageInfo getPackageInfo(String packageName,
188 @PackageInfoFlags int flags, int filterCallingUid, int userId);
189
190 /**
Christopher Tatea732f012017-10-26 17:26:53 -0700191 * Do a straight uid lookup for the given package/application in the given user.
192 * @see PackageManager#getPackageUidAsUser(String, int, int)
193 * @return The app's uid, or < 0 if the package was not found in that user
194 */
195 public abstract int getPackageUid(String packageName,
196 @PackageInfoFlags int flags, int userId);
197
198 /**
Todd Kennedy18211fd2017-06-06 09:15:46 -0700199 * Retrieve all of the information we know about a particular package/application.
200 * @param filterCallingUid The results will be filtered in the context of this UID instead
201 * of the calling UID.
202 * @see PackageManager#getApplicationInfo(String, int)
203 */
204 public abstract ApplicationInfo getApplicationInfo(String packageName,
205 @ApplicationInfoFlags int flags, int filterCallingUid, int userId);
206
207 /**
208 * Retrieve all of the information we know about a particular activity class.
209 * @param filterCallingUid The results will be filtered in the context of this UID instead
210 * of the calling UID.
211 * @see PackageManager#getActivityInfo(ComponentName, int)
212 */
213 public abstract ActivityInfo getActivityInfo(ComponentName component,
214 @ComponentInfoFlags int flags, int filterCallingUid, int userId);
215
216 /**
217 * Retrieve all activities that can be performed for the given intent.
218 * @param filterCallingUid The results will be filtered in the context of this UID instead
219 * of the calling UID.
220 * @see PackageManager#queryIntentActivities(Intent, int)
221 */
222 public abstract List<ResolveInfo> queryIntentActivities(Intent intent,
223 @ResolveInfoFlags int flags, int filterCallingUid, int userId);
Makoto Onuki2d5b4652016-03-11 16:09:54 -0800224
225 /**
Todd Kennedy82b08422017-09-28 13:32:05 -0700226 * Retrieve all services that can be performed for the given intent.
227 * @see PackageManager#queryIntentServices(Intent, int)
228 */
229 public abstract List<ResolveInfo> queryIntentServices(
230 Intent intent, int flags, int callingUid, int userId);
231
232 /**
Makoto Onuki2d5b4652016-03-11 16:09:54 -0800233 * Interface to {@link com.android.server.pm.PackageManagerService#getHomeActivitiesAsUser}.
234 */
235 public abstract ComponentName getHomeActivitiesAsUser(List<ResolveInfo> allHomeCandidates,
236 int userId);
Makoto Onukic29f62c2016-06-07 12:19:46 -0700237
238 /**
Winson Chungc1674272018-02-21 10:15:17 -0800239 * @return The default home activity component name.
240 */
241 public abstract ComponentName getDefaultHomeActivity(int userId);
242
243 /**
Makoto Onukic29f62c2016-06-07 12:19:46 -0700244 * Called by DeviceOwnerManagerService to set the package names of device owner and profile
245 * owners.
246 */
247 public abstract void setDeviceAndProfileOwnerPackages(
248 int deviceOwnerUserId, String deviceOwner, SparseArray<String> profileOwners);
249
250 /**
Steven Ng9d48a732016-06-24 19:04:14 +0100251 * Returns {@code true} if a given package can't be wiped. Otherwise, returns {@code false}.
Makoto Onukic29f62c2016-06-07 12:19:46 -0700252 */
Steven Ng9d48a732016-06-24 19:04:14 +0100253 public abstract boolean isPackageDataProtected(int userId, String packageName);
Svet Ganov973edd192016-09-08 20:15:55 -0700254
255 /**
Dianne Hackborne07641d2016-11-09 15:07:23 -0800256 * Returns {@code true} if a given package is installed as ephemeral. Otherwise, returns
257 * {@code false}.
258 */
259 public abstract boolean isPackageEphemeral(int userId, String packageName);
260
261 /**
Svet Ganov973edd192016-09-08 20:15:55 -0700262 * Gets whether the package was ever launched.
263 * @param packageName The package name.
264 * @param userId The user for which to check.
265 * @return Whether was launched.
Amith Yamasani2cbfa1e2017-03-28 10:34:01 -0700266 * @throws IllegalArgumentException if the package is not found
Svet Ganov973edd192016-09-08 20:15:55 -0700267 */
268 public abstract boolean wasPackageEverLaunched(String packageName, int userId);
Nicolas Prevot700e1e72016-09-28 15:17:18 +0100269
270 /**
271 * Grants a runtime permission
272 * @param packageName The package name.
273 * @param name The name of the permission.
274 * @param userId The userId for which to grant the permission.
275 * @param overridePolicy If true, grant this permission even if it is fixed by policy.
276 */
277 public abstract void grantRuntimePermission(String packageName, String name, int userId,
278 boolean overridePolicy);
279
280 /**
281 * Revokes a runtime permission
282 * @param packageName The package name.
283 * @param name The name of the permission.
284 * @param userId The userId for which to revoke the permission.
285 * @param overridePolicy If true, revoke this permission even if it is fixed by policy.
286 */
287 public abstract void revokeRuntimePermission(String packageName, String name, int userId,
288 boolean overridePolicy);
289
Michal Karpinskif77ee4f2016-10-12 16:40:06 +0100290 /**
Michal Karpinskicb67dc92016-12-13 18:20:23 +0000291 * Retrieve the official name associated with a uid. This name is
Michal Karpinskif77ee4f2016-10-12 16:40:06 +0100292 * guaranteed to never change, though it is possible for the underlying
Michal Karpinskicb67dc92016-12-13 18:20:23 +0000293 * uid to be changed. That is, if you are storing information about
294 * uids in persistent storage, you should use the string returned
295 * by this function instead of the raw uid.
Michal Karpinskif77ee4f2016-10-12 16:40:06 +0100296 *
Michal Karpinskicb67dc92016-12-13 18:20:23 +0000297 * @param uid The uid for which you would like to retrieve a name.
298 * @return Returns a unique name for the given uid, or null if the
299 * uid is not currently assigned.
Michal Karpinskif77ee4f2016-10-12 16:40:06 +0100300 */
301 public abstract String getNameForUid(int uid);
302
Todd Kennedy01ad0c72016-11-11 15:33:12 -0800303 /**
304 * Request to perform the second phase of ephemeral resolution.
305 * @param responseObj The response of the first phase of ephemeral resolution
306 * @param origIntent The original intent that triggered ephemeral resolution
307 * @param resolvedType The resolved type of the intent
Todd Kennedy01ad0c72016-11-11 15:33:12 -0800308 * @param callingPackage The name of the package requesting the ephemeral application
Chad Brubaker06068612017-04-06 09:43:47 -0700309 * @param verificationBundle Optional bundle to pass to the installer for additional
310 * verification
Todd Kennedy01ad0c72016-11-11 15:33:12 -0800311 * @param userId The ID of the user that triggered ephemeral resolution
312 */
Todd Kennedye9910222017-02-21 16:00:11 -0800313 public abstract void requestInstantAppResolutionPhaseTwo(AuxiliaryResolveInfo responseObj,
314 Intent origIntent, String resolvedType, String callingPackage,
Chad Brubaker06068612017-04-06 09:43:47 -0700315 Bundle verificationBundle, int userId);
Svetoslav Ganove080da92016-12-21 17:10:35 -0800316
317 /**
Todd Kennedy0e989d02017-01-13 14:15:36 -0800318 * Grants access to the package metadata for an ephemeral application.
319 * <p>
320 * When an ephemeral application explicitly tries to interact with a full
321 * install application [via an activity, service or provider that has been
322 * exposed using the {@code visibleToInstantApp} attribute], the normal
323 * application must be able to see metadata about the connecting ephemeral
324 * app. If the ephemeral application uses an implicit intent [ie action VIEW,
325 * category BROWSABLE], it remains hidden from the launched activity.
326 * <p>
327 * If the {@code sourceUid} is not for an ephemeral app or {@code targetUid}
328 * is not for a fully installed app, this method will be a no-op.
329 *
330 * @param userId the user
331 * @param intent the intent that triggered the grant
332 * @param targetAppId The app ID of the fully installed application
333 * @param ephemeralAppId The app ID of the ephemeral application
334 */
335 public abstract void grantEphemeralAccess(int userId, Intent intent,
336 int targetAppId, int ephemeralAppId);
337
Todd Kennedyb21be122017-03-24 14:10:01 -0700338 public abstract boolean isInstantAppInstallerComponent(ComponentName component);
Todd Kennedy0e989d02017-01-13 14:15:36 -0800339 /**
Svetoslav Ganov096d3042017-01-30 16:34:13 -0800340 * Prunes instant apps and state associated with uninstalled
341 * instant apps according to the current platform policy.
342 */
343 public abstract void pruneInstantApps();
344
345 /**
Svetoslav Ganove080da92016-12-21 17:10:35 -0800346 * @return The SetupWizard package name.
347 */
348 public abstract String getSetupWizardPackageName();
Suprabh Shuklaaef25132017-01-23 18:09:03 -0800349
350 public interface ExternalSourcesPolicy {
351
352 int USER_TRUSTED = 0; // User has trusted the package to install apps
353 int USER_BLOCKED = 1; // User has blocked the package to install apps
354 int USER_DEFAULT = 2; // Default code to use when user response is unavailable
355
356 /**
357 * Checks the user preference for whether a package is trusted to request installs through
358 * package installer
359 *
360 * @param packageName The package to check for
361 * @param uid the uid in which the package is running
362 * @return {@link USER_TRUSTED} if the user has trusted the package, {@link USER_BLOCKED}
363 * if user has blocked requests from the package, {@link USER_DEFAULT} if the user response
364 * is not yet available
365 */
366 int getPackageTrustedToInstallApps(String packageName, int uid);
367 }
368
369 public abstract void setExternalSourcesPolicy(ExternalSourcesPolicy policy);
MÃ¥rten Kongstadeabc9e92015-12-15 16:40:23 +0100370
371 /**
Dianne Hackbornb1e77762017-02-13 11:42:18 -0800372 * Return true if the given package is a persistent app process.
373 */
374 public abstract boolean isPackagePersistent(String packageName);
375
376 /**
Todd Kennedyc29b11a2017-10-23 15:55:59 -0700377 * Returns whether or not the given package represents a legacy system application released
378 * prior to runtime permissions.
379 */
380 public abstract boolean isLegacySystemApp(PackageParser.Package pkg);
381
382 /**
MÃ¥rten Kongstadeabc9e92015-12-15 16:40:23 +0100383 * Get all overlay packages for a user.
384 * @param userId The user for which to get the overlays.
385 * @return A list of overlay packages. An empty list is returned if the
386 * user has no installed overlay packages.
387 */
388 public abstract List<PackageInfo> getOverlayPackages(int userId);
389
390 /**
391 * Get the names of all target packages for a user.
392 * @param userId The user for which to get the package names.
393 * @return A list of target package names. This list includes the "android" package.
394 */
395 public abstract List<String> getTargetPackageNames(int userId);
396
397 /**
398 * Set which overlay to use for a package.
399 * @param userId The user for which to update the overlays.
400 * @param targetPackageName The package name of the package for which to update the overlays.
401 * @param overlayPackageNames The complete list of overlay packages that should be enabled for
402 * the target. Previously enabled overlays not specified in the list
403 * will be disabled. Pass in null or an empty list to disable
404 * all overlays. The order of the items is significant if several
405 * overlays modify the same resource.
406 * @return true if all packages names were known by the package manager, false otherwise
407 */
408 public abstract boolean setEnabledOverlayPackages(int userId, String targetPackageName,
409 List<String> overlayPackageNames);
Todd Kennedy4d1de7d2017-02-23 10:32:18 -0800410
411 /**
Todd Kennedy51b3aac2017-03-30 17:50:42 -0700412 * Resolves an activity intent, allowing instant apps to be resolved.
Todd Kennedy4d1de7d2017-02-23 10:32:18 -0800413 */
414 public abstract ResolveInfo resolveIntent(Intent intent, String resolvedType,
Todd Kennedy82b08422017-09-28 13:32:05 -0700415 int flags, int userId, boolean resolveForStart);
Chad Brubaker0f28a802017-03-29 14:05:52 -0700416
417 /**
Todd Kennedy51b3aac2017-03-30 17:50:42 -0700418 * Resolves a service intent, allowing instant apps to be resolved.
419 */
Todd Kennedy82b08422017-09-28 13:32:05 -0700420 public abstract ResolveInfo resolveService(Intent intent, String resolvedType,
Todd Kennedy51b3aac2017-03-30 17:50:42 -0700421 int flags, int userId, int callingUid);
422
Todd Kennedy82b08422017-09-28 13:32:05 -0700423 /**
424 * Resolves a content provider intent.
425 */
426 public abstract ProviderInfo resolveContentProvider(String name, int flags, int userId);
427
Todd Kennedy51b3aac2017-03-30 17:50:42 -0700428 /**
Chad Brubaker0f28a802017-03-29 14:05:52 -0700429 * Track the creator of a new isolated uid.
430 * @param isolatedUid The newly created isolated uid.
431 * @param ownerUid The uid of the app that created the isolated process.
432 */
433 public abstract void addIsolatedUid(int isolatedUid, int ownerUid);
434
435 /**
436 * Track removal of an isolated uid.
437 * @param isolatedUid isolated uid that is no longer being used.
438 */
439 public abstract void removeIsolatedUid(int isolatedUid);
Makoto Onukie92f7942017-04-26 14:38:18 -0700440
441 /**
442 * Return the taget SDK version for the app with the given UID.
443 */
444 public abstract int getUidTargetSdkVersion(int uid);
Makoto Onukiad623012017-05-15 09:29:34 -0700445
Jeff Sharkey9252b342018-01-19 07:58:35 +0900446 /**
447 * Return the taget SDK version for the app with the given package name.
448 */
449 public abstract int getPackageTargetSdkVersion(String packageName);
450
Makoto Onukiad623012017-05-15 09:29:34 -0700451 /** Whether the binder caller can access instant apps. */
Todd Kennedy3051caa2017-05-23 15:54:18 -0700452 public abstract boolean canAccessInstantApps(int callingUid, int userId);
Svet Ganovf935a702017-08-22 12:15:58 -0700453
454 /**
455 * Returns {@code true} if a given package has instant application meta-data.
456 * Otherwise, returns {@code false}. Meta-data is state (eg. cookie, app icon, etc)
457 * associated with an instant app. It may be kept after the instant app has been uninstalled.
458 */
459 public abstract boolean hasInstantApplicationMetadata(String packageName, int userId);
Todd Kennedydf113c32017-08-31 16:10:29 -0700460
461 /**
462 * Updates a package last used time.
463 */
464 public abstract void notifyPackageUse(String packageName, int reason);
Todd Kennedy82b08422017-09-28 13:32:05 -0700465
466 /**
467 * Returns a package object for the given package name.
468 */
469 public abstract @Nullable PackageParser.Package getPackage(@NonNull String packageName);
470
471 /**
Todd Kennedy42d61602017-12-12 14:44:19 -0800472 * Returns a list without a change observer.
473 *
474 * {@see #getPackageList(PackageListObserver)}
475 */
476 public @NonNull PackageList getPackageList() {
477 return getPackageList(null);
478 }
479
480 /**
481 * Returns the list of packages installed at the time of the method call.
482 * <p>The given observer is notified when the list of installed packages
483 * changes [eg. a package was installed or uninstalled]. It will not be
484 * notified if a package is updated.
485 * <p>The package list will not be updated automatically as packages are
486 * installed / uninstalled. Any changes must be handled within the observer.
487 */
488 public abstract @NonNull PackageList getPackageList(@Nullable PackageListObserver observer);
489
490 /**
491 * Removes the observer.
492 * <p>Generally not needed. {@link #getPackageList(PackageListObserver)} will automatically
493 * remove the observer.
494 * <p>Does nothing if the observer isn't currently registered.
495 * <p>Observers are notified asynchronously and it's possible for an observer to be
496 * invoked after its been removed.
497 */
498 public abstract void removePackageListObserver(@NonNull PackageListObserver observer);
499
500 /**
Todd Kennedy82b08422017-09-28 13:32:05 -0700501 * Returns a package object for the disabled system package name.
502 */
503 public abstract @Nullable PackageParser.Package getDisabledPackage(@NonNull String packageName);
504
505 /**
506 * Returns whether or not the component is the resolver activity.
507 */
508 public abstract boolean isResolveActivityComponent(@NonNull ComponentInfo component);
509
510 /**
511 * Returns the package name for a known package.
512 */
513 public abstract @Nullable String getKnownPackageName(
514 @KnownPackage int knownPackage, int userId);
515
Todd Kennedy0eb97382017-10-03 16:57:22 -0700516 /**
517 * Returns whether the package is an instant app.
518 */
519 public abstract boolean isInstantApp(String packageName, int userId);
520
521 /**
522 * Returns whether the package is an instant app.
523 */
524 public abstract @Nullable String getInstantAppPackageName(int uid);
525
526 /**
527 * Returns whether or not access to the application should be filtered.
528 * <p>
529 * Access may be limited based upon whether the calling or target applications
530 * are instant applications.
531 *
532 * @see #canAccessInstantApps(int)
533 */
534 public abstract boolean filterAppAccess(
535 @Nullable PackageParser.Package pkg, int callingUid, int userId);
536
Todd Kennedy82b08422017-09-28 13:32:05 -0700537 /*
538 * NOTE: The following methods are temporary until permissions are extracted from
539 * the package manager into a component specifically for handling permissions.
540 */
Todd Kennedy82b08422017-09-28 13:32:05 -0700541 /** Returns the flags for the given permission. */
542 public abstract @Nullable int getPermissionFlagsTEMP(@NonNull String permName,
543 @NonNull String packageName, int userId);
544 /** Updates the flags for the given permission. */
545 public abstract void updatePermissionFlagsTEMP(@NonNull String permName,
546 @NonNull String packageName, int flagMask, int flagValues, int userId);
Svet Ganovadc1cf42015-06-15 16:36:24 -0700547}