1 /*
2  * Copyright (C) 2020 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.parsing;
18 
19 import android.annotation.NonNull;
20 import android.annotation.Nullable;
21 import android.content.Intent;
22 import android.content.pm.ActivityInfo;
23 import android.content.pm.ApplicationInfo;
24 import android.content.pm.ConfigurationInfo;
25 import android.content.pm.FeatureGroupInfo;
26 import android.content.pm.FeatureInfo;
27 import android.content.pm.PackageInfo;
28 import android.content.pm.PackageParser;
29 import android.content.pm.ServiceInfo;
30 import android.content.pm.parsing.component.ParsedActivity;
31 import android.content.pm.parsing.component.ParsedAttribution;
32 import android.content.pm.parsing.component.ParsedInstrumentation;
33 import android.content.pm.parsing.component.ParsedIntentInfo;
34 import android.content.pm.parsing.component.ParsedPermission;
35 import android.content.pm.parsing.component.ParsedPermissionGroup;
36 import android.content.pm.parsing.component.ParsedProcess;
37 import android.content.pm.parsing.component.ParsedProvider;
38 import android.content.pm.parsing.component.ParsedService;
39 import android.os.Bundle;
40 import android.os.Parcelable;
41 import android.util.ArraySet;
42 import android.util.Pair;
43 import android.util.SparseArray;
44 import android.util.SparseIntArray;
45 
46 import com.android.internal.R;
47 
48 import java.security.PublicKey;
49 import java.util.List;
50 import java.util.Map;
51 import java.util.Set;
52 
53 /**
54  * Everything written by {@link ParsingPackage} and readable back.
55  *
56  * @hide
57  */
58 @SuppressWarnings("UnusedReturnValue")
59 public interface ParsingPackageRead extends Parcelable {
60 
61     /**
62      * @see ActivityInfo
63      * @see PackageInfo#activities
64      */
65     @NonNull
getActivities()66     List<ParsedActivity> getActivities();
67 
68     /**
69      * The names of packages to adopt ownership of permissions from, parsed under
70      * {@link PackageParser#TAG_ADOPT_PERMISSIONS}.
71      * @see R.styleable#AndroidManifestOriginalPackage_name
72      */
73     @NonNull
getAdoptPermissions()74     List<String> getAdoptPermissions();
75 
76     /**
77      * @see PackageInfo#configPreferences
78      * @see R.styleable#AndroidManifestUsesConfiguration
79      */
80     @NonNull
getConfigPreferences()81     List<ConfigurationInfo> getConfigPreferences();
82 
83     @NonNull
getAttributions()84     List<ParsedAttribution> getAttributions();
85 
86     /**
87      * @see PackageInfo#featureGroups
88      * @see R.styleable#AndroidManifestUsesFeature
89      */
90     @NonNull
getFeatureGroups()91     List<FeatureGroupInfo> getFeatureGroups();
92 
93     /**
94      * Permissions requested but not in the manifest. These may have been split or migrated from
95      * previous versions/definitions.
96      */
97     @NonNull
getImplicitPermissions()98     List<String> getImplicitPermissions();
99 
100     /**
101      * @see android.content.pm.InstrumentationInfo
102      * @see PackageInfo#instrumentation
103      */
104     @NonNull
getInstrumentations()105     List<ParsedInstrumentation> getInstrumentations();
106 
107     /**
108      * For use with {@link com.android.server.pm.KeySetManagerService}. Parsed in
109      * {@link PackageParser#TAG_KEY_SETS}.
110      * @see R.styleable#AndroidManifestKeySet
111      * @see R.styleable#AndroidManifestPublicKey
112      */
113     @NonNull
getKeySetMapping()114     Map<String, ArraySet<PublicKey>> getKeySetMapping();
115 
116     /**
117      * Library names this package is declared as, for use by other packages with "uses-library".
118      * @see R.styleable#AndroidManifestLibrary
119      */
120     @NonNull
getLibraryNames()121     List<String> getLibraryNames();
122 
123     /**
124      * For system use to migrate from an old package name to a new one, moving over data
125      * if available.
126      * @see R.styleable#AndroidManifestOriginalPackage}
127      */
128     @NonNull
getOriginalPackages()129     List<String> getOriginalPackages();
130 
131     /**
132      * Map of overlayable name to actor name.
133      */
134     @NonNull
getOverlayables()135     Map<String, String> getOverlayables();
136 
137     /**
138      * @see android.content.pm.PermissionInfo
139      * @see PackageInfo#permissions
140      */
141     @NonNull
getPermissions()142     List<ParsedPermission> getPermissions();
143 
144     /**
145      * @see android.content.pm.PermissionGroupInfo
146      */
147     @NonNull
getPermissionGroups()148     List<ParsedPermissionGroup> getPermissionGroups();
149 
150     /**
151      * Used to determine the default preferred handler of an {@link Intent}.
152      *
153      * Map of component className to intent info inside that component.
154      * TODO(b/135203078): Is this actually used/working?
155      */
156     @NonNull
getPreferredActivityFilters()157     List<Pair<String, ParsedIntentInfo>> getPreferredActivityFilters();
158 
159     /**
160      * System protected broadcasts.
161      * @see R.styleable#AndroidManifestProtectedBroadcast
162      */
163     @NonNull
getProtectedBroadcasts()164     List<String> getProtectedBroadcasts();
165 
166     /**
167      * @see android.content.pm.ProviderInfo
168      * @see PackageInfo#providers
169      */
170     @NonNull
getProviders()171     List<ParsedProvider> getProviders();
172 
173     /**
174      * @see android.content.pm.ProcessInfo
175      */
176     @NonNull
getProcesses()177     Map<String, ParsedProcess> getProcesses();
178 
179     /**
180      * Since they share several attributes, receivers are parsed as {@link ParsedActivity}, even
181      * though they represent different functionality.
182      * TODO(b/135203078): Reconsider this and maybe make ParsedReceiver so it's not so confusing
183      * @see ActivityInfo
184      * @see PackageInfo#receivers
185      */
186     @NonNull
getReceivers()187     List<ParsedActivity> getReceivers();
188 
189     /**
190      * @see PackageInfo#reqFeatures
191      * @see R.styleable#AndroidManifestUsesFeature
192      */
193     @NonNull
getReqFeatures()194     List<FeatureInfo> getReqFeatures();
195 
196     /**
197      * All the permissions declared. This is an effective set, and may include permissions
198      * transformed from split/migrated permissions from previous versions, so may not be exactly
199      * what the package declares in its manifest.
200      * @see PackageInfo#requestedPermissions
201      * @see R.styleable#AndroidManifestUsesPermission
202      */
203     @NonNull
getRequestedPermissions()204     List<String> getRequestedPermissions();
205 
206     /**
207      * Whether or not the app requested explicitly resizeable Activities.
208      * A null value means nothing was explicitly requested.
209      */
210     @Nullable
getResizeableActivity()211     Boolean getResizeableActivity();
212 
213     /**
214      * @see ServiceInfo
215      * @see PackageInfo#services
216      */
217     @NonNull
getServices()218     List<ParsedService> getServices();
219 
220     /** @see R.styleable#AndroidManifestUsesLibrary */
221     @NonNull
getUsesLibraries()222     List<String> getUsesLibraries();
223 
224     /**
225      * Like {@link #getUsesLibraries()}, but marked optional by setting
226      * {@link R.styleable#AndroidManifestUsesLibrary_required} to false . Application is expected
227      * to handle absence manually.
228      * @see R.styleable#AndroidManifestUsesLibrary
229      */
230     @NonNull
getUsesOptionalLibraries()231     List<String> getUsesOptionalLibraries();
232 
233     /**
234      * TODO(b/135203078): Move static library stuff to an inner data class
235      * @see R.styleable#AndroidManifestUsesStaticLibrary
236      */
237     @NonNull
getUsesStaticLibraries()238     List<String> getUsesStaticLibraries();
239 
240     /** @see R.styleable#AndroidManifestUsesStaticLibrary_certDigest */
241     @Nullable
getUsesStaticLibrariesCertDigests()242     String[][] getUsesStaticLibrariesCertDigests();
243 
244     /** @see R.styleable#AndroidManifestUsesStaticLibrary_version */
245     @Nullable
getUsesStaticLibrariesVersions()246     long[] getUsesStaticLibrariesVersions();
247 
248     /**
249      * Intents that this package may query or require and thus requires visibility into.
250      * @see R.styleable#AndroidManifestQueriesIntent
251      */
252     @NonNull
getQueriesIntents()253     List<Intent> getQueriesIntents();
254 
255     /**
256      * Other packages that this package may query or require and thus requires visibility into.
257      * @see R.styleable#AndroidManifestQueriesPackage
258      */
259     @NonNull
getQueriesPackages()260     List<String> getQueriesPackages();
261 
262     /**
263      * Authorities that this package may query or require and thus requires visibility into.
264      * @see R.styleable#AndroidManifestQueriesProvider
265      */
266     @NonNull
getQueriesProviders()267     Set<String> getQueriesProviders();
268 
269     /**
270      * We store the application meta-data independently to avoid multiple unwanted references
271      * TODO(b/135203078): What does this comment mean?
272      * TODO(b/135203078): Make all the Bundles immutable (and non-null by shared empty reference?)
273      */
274     @Nullable
getMetaData()275     Bundle getMetaData();
276 
277     /** @see R.styleable#AndroidManifestApplication_forceQueryable */
isForceQueryable()278     boolean isForceQueryable();
279 
280     /**
281      * @see ApplicationInfo#maxAspectRatio
282      * @see R.styleable#AndroidManifestApplication_maxAspectRatio
283      */
getMaxAspectRatio()284     float getMaxAspectRatio();
285 
286     /**
287      * @see ApplicationInfo#minAspectRatio
288      * @see R.styleable#AndroidManifestApplication_minAspectRatio
289      */
getMinAspectRatio()290     float getMinAspectRatio();
291 
292     /**
293      * @see ApplicationInfo#permission
294      * @see R.styleable#AndroidManifestApplication_permission
295      */
296     @Nullable
getPermission()297     String getPermission();
298 
299     /**
300      * @see ApplicationInfo#processName
301      * @see R.styleable#AndroidManifestApplication_process
302      */
303     @NonNull
getProcessName()304     String getProcessName();
305 
306     /**
307      * @see PackageInfo#sharedUserId
308      * @see R.styleable#AndroidManifest_sharedUserId
309      */
310     @Deprecated
311     @Nullable
getSharedUserId()312     String getSharedUserId();
313 
314     /** @see R.styleable#AndroidManifestStaticLibrary_name */
315     @Nullable
getStaticSharedLibName()316     String getStaticSharedLibName();
317 
318     /**
319      * @see ApplicationInfo#taskAffinity
320      * @see R.styleable#AndroidManifestApplication_taskAffinity
321      */
322     @Nullable
getTaskAffinity()323     String getTaskAffinity();
324 
325     /**
326      * @see ApplicationInfo#targetSdkVersion
327      * @see R.styleable#AndroidManifestUsesSdk_targetSdkVersion
328      */
getTargetSdkVersion()329     int getTargetSdkVersion();
330 
331     /**
332      * @see ApplicationInfo#uiOptions
333      * @see R.styleable#AndroidManifestApplication_uiOptions
334      */
getUiOptions()335     int getUiOptions();
336 
isCrossProfile()337     boolean isCrossProfile();
338 
isResizeableActivityViaSdkVersion()339     boolean isResizeableActivityViaSdkVersion();
340 
341     /** @see ApplicationInfo#FLAG_HARDWARE_ACCELERATED */
isBaseHardwareAccelerated()342     boolean isBaseHardwareAccelerated();
343 
344     /**
345      * If omitted from manifest, returns true if {@link #getTargetSdkVersion()} >=
346      * {@link android.os.Build.VERSION_CODES#DONUT}.
347      * @see R.styleable#AndroidManifestSupportsScreens_resizeable
348      * @see ApplicationInfo#FLAG_RESIZEABLE_FOR_SCREENS
349      */
isResizeable()350     boolean isResizeable();
351 
352     /** @see ApplicationInfo#PRIVATE_FLAG_ALLOW_AUDIO_PLAYBACK_CAPTURE */
isAllowAudioPlaybackCapture()353     boolean isAllowAudioPlaybackCapture();
354 
355     /** @see ApplicationInfo#FLAG_ALLOW_BACKUP */
isAllowBackup()356     boolean isAllowBackup();
357 
358     /** @see ApplicationInfo#FLAG_ALLOW_CLEAR_USER_DATA */
isAllowClearUserData()359     boolean isAllowClearUserData();
360 
361     /** @see ApplicationInfo#PRIVATE_FLAG_ALLOW_CLEAR_USER_DATA_ON_FAILED_RESTORE */
isAllowClearUserDataOnFailedRestore()362     boolean isAllowClearUserDataOnFailedRestore();
363 
364     /** @see ApplicationInfo#FLAG_ALLOW_TASK_REPARENTING */
isAllowTaskReparenting()365     boolean isAllowTaskReparenting();
366 
367     /**
368      * @see ApplicationInfo#PRIVATE_FLAG_IS_RESOURCE_OVERLAY
369      * @see ApplicationInfo#isResourceOverlay()
370      */
isOverlay()371     boolean isOverlay();
372 
373     /** @see ApplicationInfo#PRIVATE_FLAG_BACKUP_IN_FOREGROUND */
isBackupInForeground()374     boolean isBackupInForeground();
375 
376     /** @see ApplicationInfo#PRIVATE_FLAG_CANT_SAVE_STATE */
isCantSaveState()377     boolean isCantSaveState();
378 
379     /** @see ApplicationInfo#FLAG_DEBUGGABLE */
isDebuggable()380     boolean isDebuggable();
381 
382     /** @see ApplicationInfo#PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE */
isDefaultToDeviceProtectedStorage()383     boolean isDefaultToDeviceProtectedStorage();
384 
385     /** @see ApplicationInfo#PRIVATE_FLAG_DIRECT_BOOT_AWARE */
isDirectBootAware()386     boolean isDirectBootAware();
387 
388     /** @see ApplicationInfo#FLAG_EXTERNAL_STORAGE */
isExternalStorage()389     boolean isExternalStorage();
390 
391     /** @see ApplicationInfo#FLAG_EXTRACT_NATIVE_LIBS */
isExtractNativeLibs()392     boolean isExtractNativeLibs();
393 
394     /** @see ApplicationInfo#FLAG_FULL_BACKUP_ONLY */
isFullBackupOnly()395     boolean isFullBackupOnly();
396 
397     /** @see ApplicationInfo#FLAG_HAS_CODE */
isHasCode()398     boolean isHasCode();
399 
400     /** @see ApplicationInfo#PRIVATE_FLAG_HAS_FRAGILE_USER_DATA */
isHasFragileUserData()401     boolean isHasFragileUserData();
402 
403     /** @see ApplicationInfo#FLAG_IS_GAME */
404     @Deprecated
isGame()405     boolean isGame();
406 
407     /** @see ApplicationInfo#PRIVATE_FLAG_ISOLATED_SPLIT_LOADING */
isIsolatedSplitLoading()408     boolean isIsolatedSplitLoading();
409 
410     /** @see ApplicationInfo#FLAG_KILL_AFTER_RESTORE */
isKillAfterRestore()411     boolean isKillAfterRestore();
412 
413     /** @see ApplicationInfo#FLAG_LARGE_HEAP */
isLargeHeap()414     boolean isLargeHeap();
415 
416     /** @see ApplicationInfo#FLAG_MULTIARCH */
isMultiArch()417     boolean isMultiArch();
418 
419     /** @see ApplicationInfo#PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE */
isPartiallyDirectBootAware()420     boolean isPartiallyDirectBootAware();
421 
422     /** @see ApplicationInfo#FLAG_PERSISTENT */
isPersistent()423     boolean isPersistent();
424 
425     /** @see ApplicationInfo#PRIVATE_FLAG_PROFILEABLE_BY_SHELL */
isProfileableByShell()426     boolean isProfileableByShell();
427 
428     /** @see ApplicationInfo#PRIVATE_FLAG_REQUEST_LEGACY_EXTERNAL_STORAGE */
isRequestLegacyExternalStorage()429     boolean isRequestLegacyExternalStorage();
430 
431     /** @see ApplicationInfo#FLAG_RESTORE_ANY_VERSION */
isRestoreAnyVersion()432     boolean isRestoreAnyVersion();
433 
434     // ParsingPackageRead setSplitHasCode(int splitIndex, boolean splitHasCode);
435 
436     /** Flags of any split APKs; ordered by parsed splitName */
437     @Nullable
getSplitFlags()438     int[] getSplitFlags();
439 
440     /** @see ApplicationInfo#splitSourceDirs */
441     @Nullable
getSplitCodePaths()442     String[] getSplitCodePaths();
443 
444     /** @see ApplicationInfo#splitDependencies */
445     @Nullable
getSplitDependencies()446     SparseArray<int[]> getSplitDependencies();
447 
448     /**
449      * @see ApplicationInfo#splitNames
450      * @see PackageInfo#splitNames
451      */
452     @Nullable
getSplitNames()453     String[] getSplitNames();
454 
455     /** @see PackageInfo#splitRevisionCodes */
getSplitRevisionCodes()456     int[] getSplitRevisionCodes();
457 
458     /** @see ApplicationInfo#PRIVATE_FLAG_STATIC_SHARED_LIBRARY */
isStaticSharedLibrary()459     boolean isStaticSharedLibrary();
460 
461     /** @see ApplicationInfo#FLAG_SUPPORTS_RTL */
isSupportsRtl()462     boolean isSupportsRtl();
463 
464     /** @see ApplicationInfo#FLAG_TEST_ONLY */
isTestOnly()465     boolean isTestOnly();
466 
467     /** @see ApplicationInfo#PRIVATE_FLAG_USE_EMBEDDED_DEX */
isUseEmbeddedDex()468     boolean isUseEmbeddedDex();
469 
470     /** @see ApplicationInfo#FLAG_USES_CLEARTEXT_TRAFFIC */
isUsesCleartextTraffic()471     boolean isUsesCleartextTraffic();
472 
473     /** @see ApplicationInfo#PRIVATE_FLAG_USES_NON_SDK_API */
isUsesNonSdkApi()474     boolean isUsesNonSdkApi();
475 
476     /**
477      * Set if the any of components are visible to instant applications.
478      * @see R.styleable#AndroidManifestActivity_visibleToInstantApps
479      * @see R.styleable#AndroidManifestProvider_visibleToInstantApps
480      * @see R.styleable#AndroidManifestService_visibleToInstantApps
481      */
isVisibleToInstantApps()482     boolean isVisibleToInstantApps();
483 
484     /** @see ApplicationInfo#FLAG_VM_SAFE_MODE */
isVmSafeMode()485     boolean isVmSafeMode();
486 
487     /**
488      * If omitted from manifest, returns true if {@link #getTargetSdkVersion()} >=
489      * {@link android.os.Build.VERSION_CODES#DONUT}.
490      * @see R.styleable#AndroidManifestSupportsScreens_anyDensity
491      * @see ApplicationInfo#FLAG_SUPPORTS_SCREEN_DENSITIES
492      */
isAnyDensity()493     boolean isAnyDensity();
494 
495     /**
496      * @see ApplicationInfo#appComponentFactory
497      * @see R.styleable#AndroidManifestApplication_appComponentFactory
498      */
499     @Nullable
getAppComponentFactory()500     String getAppComponentFactory();
501 
502     /**
503      * @see ApplicationInfo#backupAgentName
504      * @see R.styleable#AndroidManifestApplication_backupAgent
505      */
506     @Nullable
getBackupAgentName()507     String getBackupAgentName();
508 
509     /**
510      * @see ApplicationInfo#banner
511      * @see R.styleable#AndroidManifestApplication_banner
512      */
getBanner()513     int getBanner();
514 
515     /**
516      * @see ApplicationInfo#category
517      * @see R.styleable#AndroidManifestApplication_appCategory
518      */
getCategory()519     int getCategory();
520 
521     /**
522      * @see ApplicationInfo#classLoaderName
523      * @see R.styleable#AndroidManifestApplication_classLoader
524      */
525     @Nullable
getClassLoaderName()526     String getClassLoaderName();
527 
528     /**
529      * @see ApplicationInfo#className
530      * @see R.styleable#AndroidManifestApplication_name
531      */
532     @Nullable
getClassName()533     String getClassName();
534 
getPackageName()535     String getPackageName();
536 
537     /** Path of base APK */
getBaseCodePath()538     String getBaseCodePath();
539 
540     /**
541      * Path where this package was found on disk. For monolithic packages
542      * this is path to single base APK file; for cluster packages this is
543      * path to the cluster directory.
544      */
545     @NonNull
getCodePath()546     String getCodePath();
547 
548     /**
549      * @see ApplicationInfo#compatibleWidthLimitDp
550      * @see R.styleable#AndroidManifestSupportsScreens_compatibleWidthLimitDp
551      */
getCompatibleWidthLimitDp()552     int getCompatibleWidthLimitDp();
553 
554     /**
555      * @see ApplicationInfo#descriptionRes
556      * @see R.styleable#AndroidManifestApplication_description
557      */
getDescriptionRes()558     int getDescriptionRes();
559 
560     /**
561      * @see ApplicationInfo#enabled
562      * @see R.styleable#AndroidManifestApplication_enabled
563      */
isEnabled()564     boolean isEnabled();
565 
566     /**
567      * @see ApplicationInfo#fullBackupContent
568      * @see R.styleable#AndroidManifestApplication_fullBackupContent
569      */
getFullBackupContent()570     int getFullBackupContent();
571 
572     /** @see ApplicationInfo#PRIVATE_FLAG_HAS_DOMAIN_URLS */
isHasDomainUrls()573     boolean isHasDomainUrls();
574 
575     /**
576      * @see ApplicationInfo#iconRes
577      * @see R.styleable#AndroidManifestApplication_icon
578      */
getIconRes()579     int getIconRes();
580 
581     /**
582      * @see ApplicationInfo#installLocation
583      * @see R.styleable#AndroidManifest_installLocation
584      */
getInstallLocation()585     int getInstallLocation();
586 
587     /**
588      * @see ApplicationInfo#labelRes
589      * @see R.styleable#AndroidManifestApplication_label
590      */
getLabelRes()591     int getLabelRes();
592 
593     /**
594      * @see ApplicationInfo#largestWidthLimitDp
595      * @see R.styleable#AndroidManifestSupportsScreens_largestWidthLimitDp
596      */
getLargestWidthLimitDp()597     int getLargestWidthLimitDp();
598 
599     /**
600      * @see ApplicationInfo#logo
601      * @see R.styleable#AndroidManifestApplication_logo
602      */
getLogo()603     int getLogo();
604 
605     /**
606      * @see ApplicationInfo#manageSpaceActivityName
607      * @see R.styleable#AndroidManifestApplication_manageSpaceActivity
608      */
609     @Nullable
getManageSpaceActivityName()610     String getManageSpaceActivityName();
611 
612     /**
613      * @see ApplicationInfo#minExtensionVersions
614      * @see R.styleable#AndroidManifestExtensionSdk
615      */
616     @Nullable
getMinExtensionVersions()617     SparseIntArray getMinExtensionVersions();
618 
619     /**
620      * @see ApplicationInfo#minSdkVersion
621      * @see R.styleable#AndroidManifestUsesSdk_minSdkVersion
622      */
getMinSdkVersion()623     int getMinSdkVersion();
624 
625     /**
626      * @see ApplicationInfo#networkSecurityConfigRes
627      * @see R.styleable#AndroidManifestApplication_networkSecurityConfig
628      */
getNetworkSecurityConfigRes()629     int getNetworkSecurityConfigRes();
630 
631     /**
632      * If {@link R.styleable#AndroidManifestApplication_label} is a string literal, this is it.
633      * Otherwise, it's stored as {@link #getLabelRes()}.
634      * @see ApplicationInfo#nonLocalizedLabel
635      * @see R.styleable#AndroidManifestApplication_label
636      */
637     @Nullable
getNonLocalizedLabel()638     CharSequence getNonLocalizedLabel();
639 
640     /**
641      * @see PackageInfo#overlayCategory
642      * @see R.styleable#AndroidManifestResourceOverlay_category
643      */
644     @Nullable
getOverlayCategory()645     String getOverlayCategory();
646 
647     /** @see PackageInfo#mOverlayIsStatic */
isOverlayIsStatic()648     boolean isOverlayIsStatic();
649 
650     /**
651      * @see PackageInfo#overlayPriority
652      * @see R.styleable#AndroidManifestResourceOverlay_priority
653      */
getOverlayPriority()654     int getOverlayPriority();
655 
656     /**
657      * @see PackageInfo#overlayTarget
658      * @see R.styleable#AndroidManifestResourceOverlay_targetPackage
659      */
660     @Nullable
getOverlayTarget()661     String getOverlayTarget();
662 
663     /**
664      * @see PackageInfo#targetOverlayableName
665      * @see R.styleable#AndroidManifestResourceOverlay_targetName
666      */
667     @Nullable
getOverlayTargetName()668     String getOverlayTargetName();
669 
670     /**
671      * If a system app declares {@link #getOriginalPackages()}, and the app was previously installed
672      * under one of those original package names, the {@link #getPackageName()} system identifier
673      * will be changed to that previously installed name. This will then be non-null, set to the
674      * manifest package name, for tracking the package under its true name.
675      *
676      * TODO(b/135203078): Remove this in favor of checking originalPackages.isEmpty and
677      *  getManifestPackageName
678      */
679     @Nullable
getRealPackage()680     String getRealPackage();
681 
682     /**
683      * The required account type without which this application will not function.
684      *
685      * @see PackageInfo#requiredAccountType
686      * @see R.styleable#AndroidManifestApplication_requiredAccountType
687      */
688     @Nullable
getRequiredAccountType()689     String getRequiredAccountType();
690 
691     /**
692      * @see PackageInfo#requiredForAllUsers
693      * @see R.styleable#AndroidManifestApplication_requiredForAllUsers
694      */
isRequiredForAllUsers()695     boolean isRequiredForAllUsers();
696 
697     /**
698      * @see ApplicationInfo#requiresSmallestWidthDp
699      * @see R.styleable#AndroidManifestSupportsScreens_requiresSmallestWidthDp
700      */
getRequiresSmallestWidthDp()701     int getRequiresSmallestWidthDp();
702 
703     /**
704      * SHA-512 hash of the only APK that can be used to update a system package.
705      * @see R.styleable#AndroidManifestRestrictUpdate
706      */
707     @Nullable
getRestrictUpdateHash()708     byte[] getRestrictUpdateHash();
709 
710     /**
711      * The restricted account authenticator type that is used by this application
712      *
713      * @see PackageInfo#restrictedAccountType
714      * @see R.styleable#AndroidManifestApplication_restrictedAccountType
715      */
716     @Nullable
getRestrictedAccountType()717     String getRestrictedAccountType();
718 
719     /**
720      * @see ApplicationInfo#roundIconRes
721      * @see R.styleable#AndroidManifestApplication_roundIcon
722      */
getRoundIconRes()723     int getRoundIconRes();
724 
725     /**
726      * @see PackageInfo#sharedUserLabel
727      * @see R.styleable#AndroidManifest_sharedUserLabel
728      */
729     @Deprecated
getSharedUserLabel()730     int getSharedUserLabel();
731 
732     /**
733      * The signature data of all APKs in this package, which must be exactly the same across the
734      * base and splits.
735      */
getSigningDetails()736     PackageParser.SigningDetails getSigningDetails();
737 
738     /**
739      * @see ApplicationInfo#splitClassLoaderNames
740      * @see R.styleable#AndroidManifestApplication_classLoader
741      */
742     @Nullable
getSplitClassLoaderNames()743     String[] getSplitClassLoaderNames();
744 
745     /** @see R.styleable#AndroidManifestStaticLibrary_version */
getStaticSharedLibVersion()746     long getStaticSharedLibVersion();
747 
748     /**
749      * If omitted from manifest, returns true if {@link #getTargetSdkVersion()} >=
750      * {@link android.os.Build.VERSION_CODES#DONUT}.
751      * @see R.styleable#AndroidManifestSupportsScreens_largeScreens
752      * @see ApplicationInfo#FLAG_SUPPORTS_LARGE_SCREENS
753      */
isSupportsLargeScreens()754     boolean isSupportsLargeScreens();
755 
756     /**
757      * If omitted from manifest, returns true.
758      * @see R.styleable#AndroidManifestSupportsScreens_normalScreens
759      * @see ApplicationInfo#FLAG_SUPPORTS_NORMAL_SCREENS
760      */
isSupportsNormalScreens()761     boolean isSupportsNormalScreens();
762 
763     /**
764      * If omitted from manifest, returns true if {@link #getTargetSdkVersion()} >=
765      * {@link android.os.Build.VERSION_CODES#DONUT}.
766      * @see R.styleable#AndroidManifestSupportsScreens_smallScreens
767      * @see ApplicationInfo#FLAG_SUPPORTS_SMALL_SCREENS
768      */
isSupportsSmallScreens()769     boolean isSupportsSmallScreens();
770 
771     /**
772      * If omitted from manifest, returns true if {@link #getTargetSdkVersion()} >=
773      * {@link android.os.Build.VERSION_CODES#GINGERBREAD}.
774      * @see R.styleable#AndroidManifestSupportsScreens_xlargeScreens
775      * @see ApplicationInfo#FLAG_SUPPORTS_XLARGE_SCREENS
776      */
isSupportsExtraLargeScreens()777     boolean isSupportsExtraLargeScreens();
778 
779     /** @see ApplicationInfo#PRIVATE_FLAG_ALLOW_NATIVE_HEAP_POINTER_TAGGING */
isAllowNativeHeapPointerTagging()780     boolean isAllowNativeHeapPointerTagging();
781 
getAutoRevokePermissions()782     int getAutoRevokePermissions();
783 
hasPreserveLegacyExternalStorage()784     boolean hasPreserveLegacyExternalStorage();
785 
786     /**
787      * @see ApplicationInfo#targetSandboxVersion
788      * @see R.styleable#AndroidManifest_targetSandboxVersion
789      */
790     @Deprecated
getTargetSandboxVersion()791     int getTargetSandboxVersion();
792 
793     /**
794      * @see ApplicationInfo#theme
795      * @see R.styleable#AndroidManifestApplication_theme
796      */
getTheme()797     int getTheme();
798 
799     /**
800      * For use with {@link com.android.server.pm.KeySetManagerService}. Parsed in
801      * {@link PackageParser#TAG_KEY_SETS}.
802      * @see R.styleable#AndroidManifestUpgradeKeySet
803      */
804     @NonNull
getUpgradeKeySets()805     Set<String> getUpgradeKeySets();
806 
807     /**
808      * The install time abi override to choose 32bit abi's when multiple abi's
809      * are present. This is only meaningfull for multiarch applications.
810      * The use32bitAbi attribute is ignored if cpuAbiOverride is also set.
811      */
isUse32BitAbi()812     boolean isUse32BitAbi();
813 
814     /** @see ApplicationInfo#volumeUuid */
815     @Nullable
getVolumeUuid()816     String getVolumeUuid();
817 
818     /** @see ApplicationInfo#zygotePreloadName */
819     @Nullable
getZygotePreloadName()820     String getZygotePreloadName();
821 
822     /** Revision code of base APK */
getBaseRevisionCode()823     int getBaseRevisionCode();
824 
825     /** @see PackageInfo#versionName */
826     @Nullable
getVersionName()827     String getVersionName();
828 
829     /** @see PackageInfo#versionCodeMajor */
830     @Nullable
getVersionCode()831     int getVersionCode();
832 
833     /** @see PackageInfo#versionCodeMajor */
834     @Nullable
getVersionCodeMajor()835     int getVersionCodeMajor();
836 
837     /**
838      * @see ApplicationInfo#compileSdkVersion
839      * @see R.styleable#AndroidManifest_compileSdkVersion
840      */
getCompileSdkVersion()841     int getCompileSdkVersion();
842 
843     /**
844      * @see ApplicationInfo#compileSdkVersionCodename
845      * @see R.styleable#AndroidManifest_compileSdkVersionCodename
846      */
847     @Nullable
getCompileSdkVersionCodeName()848     String getCompileSdkVersionCodeName();
849 
850     @Nullable
getMimeGroups()851     Set<String> getMimeGroups();
852 
853     /**
854      * @see ApplicationInfo#gwpAsanMode
855      * @see R.styleable#AndroidManifest_gwpAsanMode
856      */
getGwpAsanMode()857     public int getGwpAsanMode();
858 
859     // TODO(b/135203078): Hide and enforce going through PackageInfoUtils
toAppInfoWithoutState()860     ApplicationInfo toAppInfoWithoutState();
861 
862     /**
863      * same as toAppInfoWithoutState except without flag computation.
864      */
toAppInfoWithoutStateWithoutFlags()865     ApplicationInfo toAppInfoWithoutStateWithoutFlags();
866 }
867