Loading core/java/android/content/pm/SharedLibraryInfo.java +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ public final class SharedLibraryInfo implements Parcelable { TYPE_SDK_PACKAGE, }) @Retention(RetentionPolicy.SOURCE) @interface Type{} public @interface Type{} /** * Shared library type: this library is a part of the OS Loading services/api/current.txt +72 −0 Original line number Diff line number Diff line Loading @@ -48,10 +48,82 @@ package com.android.server.pm { public interface PackageManagerLocal { method public void reconcileSdkData(@Nullable String, @NonNull String, @NonNull java.util.List<java.lang.String>, int, int, int, @NonNull String, int) throws java.io.IOException; method @NonNull public com.android.server.pm.PackageManagerLocal.FilteredSnapshot withFilteredSnapshot(); method @NonNull public com.android.server.pm.PackageManagerLocal.FilteredSnapshot withFilteredSnapshot(int, @NonNull android.os.UserHandle); method @NonNull public com.android.server.pm.PackageManagerLocal.UnfilteredSnapshot withUnfilteredSnapshot(); field public static final int FLAG_STORAGE_CE = 2; // 0x2 field public static final int FLAG_STORAGE_DE = 1; // 0x1 } public static interface PackageManagerLocal.FilteredSnapshot extends java.lang.AutoCloseable { method public void close(); method public void forAllPackageStates(@NonNull java.util.function.Consumer<com.android.server.pm.pkg.PackageState>); method @Nullable public com.android.server.pm.pkg.PackageState getPackageState(@NonNull String); } public static interface PackageManagerLocal.UnfilteredSnapshot extends java.lang.AutoCloseable { method public void close(); method @NonNull public com.android.server.pm.PackageManagerLocal.FilteredSnapshot filtered(int, @NonNull android.os.UserHandle); method @NonNull public java.util.Map<java.lang.String,com.android.server.pm.pkg.PackageState> getPackageStates(); } } package com.android.server.pm.pkg { public interface AndroidPackage { method @NonNull public java.util.List<java.lang.String> getLibraryNames(); method @Nullable public String getSdkLibraryName(); method @NonNull public java.util.List<com.android.server.pm.pkg.AndroidPackageSplit> getSplits(); method @Nullable public String getStaticSharedLibraryName(); method public int getTargetSdkVersion(); method public boolean isDebuggable(); method public boolean isIsolatedSplitLoading(); method public boolean isSignedWithPlatformKey(); method public boolean isUseEmbeddedDex(); method public boolean isUsesNonSdkApi(); method public boolean isVmSafeMode(); } public interface AndroidPackageSplit { method @Nullable public String getClassLoaderName(); method @NonNull public java.util.List<com.android.server.pm.pkg.AndroidPackageSplit> getDependencies(); method @Nullable public String getName(); method @NonNull public String getPath(); method public int getRevisionCode(); method public boolean isHasCode(); } public interface PackageState { method @Nullable public com.android.server.pm.pkg.AndroidPackage getAndroidPackage(); method public int getAppId(); method @NonNull public String getPackageName(); method @Nullable public String getPrimaryCpuAbi(); method @Nullable public String getSecondaryCpuAbi(); method @NonNull public com.android.server.pm.pkg.PackageUserState getStateForUser(@NonNull android.os.UserHandle); method @NonNull public java.util.List<com.android.server.pm.pkg.SharedLibrary> getUsesLibraries(); method public boolean isPrivileged(); method public boolean isSystem(); method public boolean isUpdatedSystemApp(); } public interface PackageUserState { method public boolean isInstalled(); } public interface SharedLibrary { method @NonNull public java.util.List<java.lang.String> getAllCodePaths(); method @NonNull public android.content.pm.VersionedPackage getDeclaringPackage(); method @NonNull public java.util.List<com.android.server.pm.pkg.SharedLibrary> getDependencies(); method @NonNull public java.util.List<android.content.pm.VersionedPackage> getDependentPackages(); method @Nullable public String getName(); method @Nullable public String getPackageName(); method @Nullable public String getPath(); method public int getType(); method public long getVersion(); method public boolean isNative(); } } package com.android.server.pm.snapshot { Loading services/core/java/com/android/server/pm/PackageManagerLocal.java +2 −4 Original line number Diff line number Diff line Loading @@ -95,8 +95,6 @@ public interface PackageManagerLocal { * <p/> * The snapshot assumes the caller is acting on behalf of the system and will not filter any * results. * * @hide */ @NonNull UnfilteredSnapshot withUnfilteredSnapshot(); Loading @@ -106,7 +104,6 @@ public interface PackageManagerLocal { * caller through {@link Binder#getCallingUid()} and {@link Binder#getCallingUserHandle()}. * * @see #withFilteredSnapshot(int, UserHandle) * @hide */ @NonNull FilteredSnapshot withFilteredSnapshot(); Loading @@ -121,7 +118,6 @@ public interface PackageManagerLocal { * and permissions, including cross-user enforcement. * @param user The user to query as, should usually be the user that the caller was * invoked from. * @hide */ @SuppressWarnings("UserHandleName") // Ignore naming convention, not invoking action as user @NonNull Loading @@ -130,6 +126,7 @@ public interface PackageManagerLocal { /** * @hide */ @SystemApi(client = SystemApi.Client.SYSTEM_SERVER) interface UnfilteredSnapshot extends AutoCloseable { /** Loading Loading @@ -160,6 +157,7 @@ public interface PackageManagerLocal { /** * @hide */ @SystemApi(client = SystemApi.Client.SYSTEM_SERVER) interface FilteredSnapshot extends AutoCloseable { /** Loading services/core/java/com/android/server/pm/local/PackageManagerLocalImpl.java +22 −2 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import com.android.server.pm.snapshot.PackageDataSnapshot; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.function.Consumer; Loading Loading @@ -82,6 +83,7 @@ public class PackageManagerLocalImpl implements PackageManagerLocal { mSnapshot = (Computer) snapshot; } @CallSuper @Override public void close() { mClosed = true; Loading @@ -100,6 +102,9 @@ public class PackageManagerLocalImpl implements PackageManagerLocal { private static class UnfilteredSnapshotImpl extends BaseSnapshotImpl implements UnfilteredSnapshot { @Nullable private Map<String, PackageState> mCachedUnmodifiablePackageStates; private UnfilteredSnapshotImpl(@NonNull PackageDataSnapshot snapshot) { super(snapshot); } Loading @@ -115,8 +120,17 @@ public class PackageManagerLocalImpl implements PackageManagerLocal { public Map<String, PackageState> getPackageStates() { checkClosed(); //noinspection unchecked, RedundantCast return (Map<String, PackageState>) (Map<?, ?>) mSnapshot.getPackageStates(); if (mCachedUnmodifiablePackageStates == null) { mCachedUnmodifiablePackageStates = Collections.unmodifiableMap(mSnapshot.getPackageStates()); } return mCachedUnmodifiablePackageStates; } @Override public void close() { super.close(); mCachedUnmodifiablePackageStates = null; } } Loading Loading @@ -152,6 +166,12 @@ public class PackageManagerLocalImpl implements PackageManagerLocal { super.checkClosed(); } @Override public void close() { super.close(); mFilteredPackageStates = null; } @Nullable @Override public PackageState getPackageState(@NonNull String packageName) { Loading services/core/java/com/android/server/pm/pkg/AndroidPackage.java +91 −5 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.server.pm.pkg; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.content.ComponentName; import android.content.Intent; import android.content.pm.ActivityInfo; Loading Loading @@ -58,8 +59,27 @@ import java.util.List; import java.util.Map; import java.util.Set; /** @hide */ //@SystemApi(client = SystemApi.Client.SYSTEM_SERVER) /** * The representation of an application on disk, as parsed from its split APKs' manifests. * * Metadata available here is mostly device-state independent and indicates what the application * author declared for their app. * * This is the system server in-process API equivalent of the public API {@link ApplicationInfo}. * Note that because {@link ApplicationInfo} is stateful, several methods that exist on it may not * be available here and need to be read through {@link PackageState} or {@link PackageUserState}. * * All instances of {@link AndroidPackage} are associated with a {@link PackageState}, and the * only way to retrieve one is through {@link PackageState}. Note that the inverse does not apply * and {@link AndroidPackage} may be null in several cases. See * {@link PackageState#getAndroidPackage()}. * * The data available here is immutable and will throw {@link UnsupportedOperationException} if any * collection type is mutated. * * @hide */ @SystemApi(client = SystemApi.Client.SYSTEM_SERVER) @Immutable public interface AndroidPackage { Loading Loading @@ -98,11 +118,13 @@ public interface AndroidPackage { /** * @see ApplicationInfo#FLAG_DEBUGGABLE * @see R.styleable#AndroidManifestApplication_debuggable */ boolean isDebuggable(); /** * @see ApplicationInfo#PRIVATE_FLAG_ISOLATED_SPLIT_LOADING * @see R.styleable#AndroidManifest_isolatedSplits */ boolean isIsolatedSplitLoading(); Loading @@ -113,16 +135,19 @@ public interface AndroidPackage { /** * @see ApplicationInfo#PRIVATE_FLAG_USE_EMBEDDED_DEX * @see R.styleable#AndroidManifestApplication_useEmbeddedDex */ boolean isUseEmbeddedDex(); /** * @see ApplicationInfo#PRIVATE_FLAG_USES_NON_SDK_API * @see R.styleable#AndroidManifestApplication_usesNonSdkApi */ boolean isUsesNonSdkApi(); /** * @see ApplicationInfo#FLAG_VM_SAFE_MODE * @see R.styleable#AndroidManifestApplication_vmSafeMode */ boolean isVmSafeMode(); Loading @@ -147,6 +172,7 @@ public interface AndroidPackage { * * @see ActivityInfo * @see PackageInfo#activities * @see R.styleable#AndroidManifestActivity * @hide */ @Immutable.Ignore Loading Loading @@ -179,7 +205,10 @@ public interface AndroidPackage { @Nullable String getAppComponentFactory(); /** @hide */ /** * @see R.styleable#AndroidManifestAttribution * @hide */ @Immutable.Ignore @NonNull List<ParsedAttribution> getAttributions(); Loading @@ -188,6 +217,7 @@ public interface AndroidPackage { * @see ApplicationInfo#AUTO_REVOKE_ALLOWED * @see ApplicationInfo#AUTO_REVOKE_DISCOURAGED * @see ApplicationInfo#AUTO_REVOKE_DISALLOWED * @see R.styleable#AndroidManifestApplication_autoRevokePermissions * @hide */ int getAutoRevokePermissions(); Loading Loading @@ -217,6 +247,7 @@ public interface AndroidPackage { /** * @see PackageInfo#baseRevisionCode * @see R.styleable#AndroidManifest_revisionCode * @hide */ int getBaseRevisionCode(); Loading Loading @@ -338,6 +369,7 @@ public interface AndroidPackage { /** * @see InstrumentationInfo * @see PackageInfo#instrumentation * @see R.styleable#AndroidManifestInstrumentation * @hide */ @Immutable.Ignore Loading Loading @@ -396,6 +428,8 @@ public interface AndroidPackage { /** * @see PackageInfo#getLongVersionCode() * @see R.styleable#AndroidManifest_versionCode * @see R.styleable#AndroidManifest_versionCodeMajor * @hide */ long getLongVersionCode(); Loading Loading @@ -439,13 +473,17 @@ public interface AndroidPackage { /** * TODO(b/135203078): Make all the Bundles immutable (and non-null by shared empty reference?) * @see R.styleable#AndroidManifestMetaData * @hide */ @Immutable.Ignore @Nullable Bundle getMetaData(); /** @hide */ /** * @see R.attr#mimeGroup * @hide */ @Nullable Set<String> getMimeGroups(); Loading Loading @@ -583,6 +621,7 @@ public interface AndroidPackage { /** * @see android.content.pm.PermissionGroupInfo * @see R.styleable#AndroidManifestPermissionGroup * @hide */ @Immutable.Ignore Loading Loading @@ -619,6 +658,7 @@ public interface AndroidPackage { /** * @see android.content.pm.ProcessInfo * @see R.styleable#AndroidManifestProcess * @hide */ @Immutable.Ignore Loading @@ -627,6 +667,7 @@ public interface AndroidPackage { /** * Returns the properties set on the application * @see R.styleable#AndroidManifestProperty * @hide */ @Immutable.Ignore Loading @@ -653,6 +694,7 @@ public interface AndroidPackage { * * @see ProviderInfo * @see PackageInfo#providers * @see R.styleable#AndroidManifestProvider * @hide */ @Immutable.Ignore Loading Loading @@ -703,6 +745,7 @@ public interface AndroidPackage { * * @see ActivityInfo * @see PackageInfo#receivers * @see R.styleable#AndroidManifestReceiver * @hide */ @Immutable.Ignore Loading Loading @@ -751,6 +794,7 @@ public interface AndroidPackage { * * @see ApplicationInfo#PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE * @see ApplicationInfo#PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_UNRESIZEABLE * @see R.styleable#AndroidManifestApplication_resizeableActivity * @hide */ @Nullable Loading Loading @@ -807,6 +851,7 @@ public interface AndroidPackage { * * @see ServiceInfo * @see PackageInfo#services * @see R.styleable#AndroidManifestService * @hide */ @Immutable.Ignore Loading Loading @@ -1050,7 +1095,11 @@ public interface AndroidPackage { @Nullable String getVolumeUuid(); /** @hide */ /** * @see ApplicationInfo#zygotePreloadName * @see R.styleable#AndroidManifestApplication_zygotePreloadName * @hide */ @Nullable String getZygotePreloadName(); Loading @@ -1073,36 +1122,42 @@ public interface AndroidPackage { /** * @see ApplicationInfo#PRIVATE_FLAG_ALLOW_AUDIO_PLAYBACK_CAPTURE * @see R.styleable#AndroidManifestApplication_allowAudioPlaybackCapture * @hide */ boolean isAllowAudioPlaybackCapture(); /** * @see ApplicationInfo#FLAG_ALLOW_BACKUP * @see R.styleable#AndroidManifestApplication_allowBackup * @hide */ boolean isAllowBackup(); /** * @see ApplicationInfo#FLAG_ALLOW_CLEAR_USER_DATA * @see R.styleable#AndroidManifestApplication_allowClearUserData * @hide */ boolean isAllowClearUserData(); /** * @see ApplicationInfo#PRIVATE_FLAG_ALLOW_CLEAR_USER_DATA_ON_FAILED_RESTORE * @see R.styleable#AndroidManifestApplication_allowClearUserDataOnFailedRestore * @hide */ boolean isAllowClearUserDataOnFailedRestore(); /** * @see ApplicationInfo#PRIVATE_FLAG_ALLOW_NATIVE_HEAP_POINTER_TAGGING * @see R.styleable#AndroidManifestApplication_allowNativeHeapPointerTagging * @hide */ boolean isAllowNativeHeapPointerTagging(); /** * @see ApplicationInfo#FLAG_ALLOW_TASK_REPARENTING * @see R.styleable#AndroidManifestApplication_allowTaskReparenting * @hide */ boolean isAllowTaskReparenting(); Loading @@ -1122,18 +1177,21 @@ public interface AndroidPackage { /** * @see ApplicationInfo#PRIVATE_FLAG_BACKUP_IN_FOREGROUND * @see R.styleable#AndroidManifestApplication_backupInForeground * @hide */ boolean isBackupInForeground(); /** * @see ApplicationInfo#FLAG_HARDWARE_ACCELERATED * @see R.styleable#AndroidManifestApplication_hardwareAccelerated * @hide */ boolean isBaseHardwareAccelerated(); /** * @see ApplicationInfo#PRIVATE_FLAG_CANT_SAVE_STATE * @see R.styleable#AndroidManifestApplication_cantSaveState * @hide */ boolean isCantSaveState(); Loading @@ -1146,18 +1204,21 @@ public interface AndroidPackage { /** * @see ApplicationInfo#crossProfile * @see R.styleable#AndroidManifestApplication_crossProfile * @hide */ boolean isCrossProfile(); /** * @see ApplicationInfo#PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE * @see R.styleable#AndroidManifestApplication_defaultToDeviceProtectedStorage * @hide */ boolean isDefaultToDeviceProtectedStorage(); /** * @see ApplicationInfo#PRIVATE_FLAG_DIRECT_BOOT_AWARE * @see R.styleable#AndroidManifestApplication_directBootAware * @hide */ boolean isDirectBootAware(); Loading @@ -1177,6 +1238,7 @@ public interface AndroidPackage { /** * @see ApplicationInfo#FLAG_EXTRACT_NATIVE_LIBS * @see R.styleable#AndroidManifestApplication_extractNativeLibs * @hide */ boolean isExtractNativeLibs(); Loading @@ -1195,12 +1257,14 @@ public interface AndroidPackage { /** * @see ApplicationInfo#FLAG_FULL_BACKUP_ONLY * @see R.styleable#AndroidManifestApplication_fullBackupOnly * @hide */ boolean isFullBackupOnly(); /** * @see ApplicationInfo#FLAG_IS_GAME * @see R.styleable#AndroidManifestApplication_isGame * @hide */ @Deprecated Loading @@ -1208,30 +1272,35 @@ public interface AndroidPackage { /** * @see ApplicationInfo#FLAG_HAS_CODE * @see R.styleable#AndroidManifestApplication_hasCode * @hide */ boolean isHasCode(); /** * @see ApplicationInfo#PRIVATE_FLAG_HAS_DOMAIN_URLS * @see R.styleable#AndroidManifestIntentFilter * @hide */ boolean isHasDomainUrls(); /** * @see ApplicationInfo#PRIVATE_FLAG_HAS_FRAGILE_USER_DATA * @see R.styleable#AndroidManifestApplication_hasFragileUserData * @hide */ boolean isHasFragileUserData(); /** * @see ApplicationInfo#FLAG_KILL_AFTER_RESTORE * @see R.styleable#AndroidManifestApplication_killAfterRestore * @hide */ boolean isKillAfterRestore(); /** * @see ApplicationInfo#FLAG_LARGE_HEAP * @see R.styleable#AndroidManifestApplication_largeHeap * @hide */ boolean isLargeHeap(); Loading @@ -1247,6 +1316,7 @@ public interface AndroidPackage { /** * @see ApplicationInfo#FLAG_MULTIARCH * @see R.styleable#AndroidManifestApplication_multiArch * @hide */ boolean isMultiArch(); Loading Loading @@ -1278,6 +1348,7 @@ public interface AndroidPackage { /** * @see ApplicationInfo#PRIVATE_FLAG_IS_RESOURCE_OVERLAY * @see ApplicationInfo#isResourceOverlay() * @see R.styleable#AndroidManifestResourceOverlay * @hide */ boolean isOverlay(); Loading @@ -1290,12 +1361,17 @@ public interface AndroidPackage { /** * @see ApplicationInfo#PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE * @see R.styleable#AndroidManifestActivity_directBootAware * @see R.styleable#AndroidManifestProvider_directBootAware * @see R.styleable#AndroidManifestReceiver_directBootAware * @see R.styleable#AndroidManifestService_directBootAware * @hide */ boolean isPartiallyDirectBootAware(); /** * @see ApplicationInfo#FLAG_PERSISTENT * @see R.styleable#AndroidManifestApplication_persistent * @hide */ boolean isPersistent(); Loading @@ -1314,18 +1390,21 @@ public interface AndroidPackage { /** * @see ApplicationInfo#PRIVATE_FLAG_EXT_PROFILEABLE * @see R.styleable#AndroidManifestProfileable * @hide */ boolean isProfileable(); /** * @see ApplicationInfo#PRIVATE_FLAG_PROFILEABLE_BY_SHELL * @see R.styleable#AndroidManifestProfileable_shell * @hide */ boolean isProfileableByShell(); /** * @see ApplicationInfo#PRIVATE_FLAG_REQUEST_LEGACY_EXTERNAL_STORAGE * @see R.styleable#AndroidManifestApplication_requestLegacyExternalStorage * @hide */ boolean isRequestLegacyExternalStorage(); Loading Loading @@ -1358,24 +1437,28 @@ public interface AndroidPackage { /** * @see ApplicationInfo#PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION * @see R.styleable#AppWidgetProviderInfo_resizeMode * @hide */ boolean isResizeableActivityViaSdkVersion(); /** * @see ApplicationInfo#FLAG_RESTORE_ANY_VERSION * @see R.styleable#AndroidManifestApplication_restoreAnyVersion * @hide */ boolean isRestoreAnyVersion(); /** * True means that this package/app contains an SDK library. * @see R.styleable#AndroidManifestSdkLibrary * @hide */ boolean isSdkLibrary(); /** * @see ApplicationInfo#PRIVATE_FLAG_STATIC_SHARED_LIBRARY * @see R.styleable#AndroidManifestStaticLibrary * @hide */ boolean isStaticSharedLibrary(); Loading Loading @@ -1417,6 +1500,7 @@ public interface AndroidPackage { /** * @see ApplicationInfo#FLAG_SUPPORTS_RTL * @see R.styleable#AndroidManifestApplication_supportsRtl * @hide */ boolean isSupportsRtl(); Loading Loading @@ -1445,6 +1529,7 @@ public interface AndroidPackage { /** * @see ApplicationInfo#FLAG_TEST_ONLY * @see R.styleable#AndroidManifestApplication_testOnly * @hide */ boolean isTestOnly(); Loading @@ -1461,6 +1546,7 @@ public interface AndroidPackage { /** * @see ApplicationInfo#FLAG_USES_CLEARTEXT_TRAFFIC * @see R.styleable#AndroidManifestApplication_usesCleartextTraffic * @hide */ boolean isUsesCleartextTraffic(); Loading Loading
core/java/android/content/pm/SharedLibraryInfo.java +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ public final class SharedLibraryInfo implements Parcelable { TYPE_SDK_PACKAGE, }) @Retention(RetentionPolicy.SOURCE) @interface Type{} public @interface Type{} /** * Shared library type: this library is a part of the OS Loading
services/api/current.txt +72 −0 Original line number Diff line number Diff line Loading @@ -48,10 +48,82 @@ package com.android.server.pm { public interface PackageManagerLocal { method public void reconcileSdkData(@Nullable String, @NonNull String, @NonNull java.util.List<java.lang.String>, int, int, int, @NonNull String, int) throws java.io.IOException; method @NonNull public com.android.server.pm.PackageManagerLocal.FilteredSnapshot withFilteredSnapshot(); method @NonNull public com.android.server.pm.PackageManagerLocal.FilteredSnapshot withFilteredSnapshot(int, @NonNull android.os.UserHandle); method @NonNull public com.android.server.pm.PackageManagerLocal.UnfilteredSnapshot withUnfilteredSnapshot(); field public static final int FLAG_STORAGE_CE = 2; // 0x2 field public static final int FLAG_STORAGE_DE = 1; // 0x1 } public static interface PackageManagerLocal.FilteredSnapshot extends java.lang.AutoCloseable { method public void close(); method public void forAllPackageStates(@NonNull java.util.function.Consumer<com.android.server.pm.pkg.PackageState>); method @Nullable public com.android.server.pm.pkg.PackageState getPackageState(@NonNull String); } public static interface PackageManagerLocal.UnfilteredSnapshot extends java.lang.AutoCloseable { method public void close(); method @NonNull public com.android.server.pm.PackageManagerLocal.FilteredSnapshot filtered(int, @NonNull android.os.UserHandle); method @NonNull public java.util.Map<java.lang.String,com.android.server.pm.pkg.PackageState> getPackageStates(); } } package com.android.server.pm.pkg { public interface AndroidPackage { method @NonNull public java.util.List<java.lang.String> getLibraryNames(); method @Nullable public String getSdkLibraryName(); method @NonNull public java.util.List<com.android.server.pm.pkg.AndroidPackageSplit> getSplits(); method @Nullable public String getStaticSharedLibraryName(); method public int getTargetSdkVersion(); method public boolean isDebuggable(); method public boolean isIsolatedSplitLoading(); method public boolean isSignedWithPlatformKey(); method public boolean isUseEmbeddedDex(); method public boolean isUsesNonSdkApi(); method public boolean isVmSafeMode(); } public interface AndroidPackageSplit { method @Nullable public String getClassLoaderName(); method @NonNull public java.util.List<com.android.server.pm.pkg.AndroidPackageSplit> getDependencies(); method @Nullable public String getName(); method @NonNull public String getPath(); method public int getRevisionCode(); method public boolean isHasCode(); } public interface PackageState { method @Nullable public com.android.server.pm.pkg.AndroidPackage getAndroidPackage(); method public int getAppId(); method @NonNull public String getPackageName(); method @Nullable public String getPrimaryCpuAbi(); method @Nullable public String getSecondaryCpuAbi(); method @NonNull public com.android.server.pm.pkg.PackageUserState getStateForUser(@NonNull android.os.UserHandle); method @NonNull public java.util.List<com.android.server.pm.pkg.SharedLibrary> getUsesLibraries(); method public boolean isPrivileged(); method public boolean isSystem(); method public boolean isUpdatedSystemApp(); } public interface PackageUserState { method public boolean isInstalled(); } public interface SharedLibrary { method @NonNull public java.util.List<java.lang.String> getAllCodePaths(); method @NonNull public android.content.pm.VersionedPackage getDeclaringPackage(); method @NonNull public java.util.List<com.android.server.pm.pkg.SharedLibrary> getDependencies(); method @NonNull public java.util.List<android.content.pm.VersionedPackage> getDependentPackages(); method @Nullable public String getName(); method @Nullable public String getPackageName(); method @Nullable public String getPath(); method public int getType(); method public long getVersion(); method public boolean isNative(); } } package com.android.server.pm.snapshot { Loading
services/core/java/com/android/server/pm/PackageManagerLocal.java +2 −4 Original line number Diff line number Diff line Loading @@ -95,8 +95,6 @@ public interface PackageManagerLocal { * <p/> * The snapshot assumes the caller is acting on behalf of the system and will not filter any * results. * * @hide */ @NonNull UnfilteredSnapshot withUnfilteredSnapshot(); Loading @@ -106,7 +104,6 @@ public interface PackageManagerLocal { * caller through {@link Binder#getCallingUid()} and {@link Binder#getCallingUserHandle()}. * * @see #withFilteredSnapshot(int, UserHandle) * @hide */ @NonNull FilteredSnapshot withFilteredSnapshot(); Loading @@ -121,7 +118,6 @@ public interface PackageManagerLocal { * and permissions, including cross-user enforcement. * @param user The user to query as, should usually be the user that the caller was * invoked from. * @hide */ @SuppressWarnings("UserHandleName") // Ignore naming convention, not invoking action as user @NonNull Loading @@ -130,6 +126,7 @@ public interface PackageManagerLocal { /** * @hide */ @SystemApi(client = SystemApi.Client.SYSTEM_SERVER) interface UnfilteredSnapshot extends AutoCloseable { /** Loading Loading @@ -160,6 +157,7 @@ public interface PackageManagerLocal { /** * @hide */ @SystemApi(client = SystemApi.Client.SYSTEM_SERVER) interface FilteredSnapshot extends AutoCloseable { /** Loading
services/core/java/com/android/server/pm/local/PackageManagerLocalImpl.java +22 −2 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import com.android.server.pm.snapshot.PackageDataSnapshot; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.function.Consumer; Loading Loading @@ -82,6 +83,7 @@ public class PackageManagerLocalImpl implements PackageManagerLocal { mSnapshot = (Computer) snapshot; } @CallSuper @Override public void close() { mClosed = true; Loading @@ -100,6 +102,9 @@ public class PackageManagerLocalImpl implements PackageManagerLocal { private static class UnfilteredSnapshotImpl extends BaseSnapshotImpl implements UnfilteredSnapshot { @Nullable private Map<String, PackageState> mCachedUnmodifiablePackageStates; private UnfilteredSnapshotImpl(@NonNull PackageDataSnapshot snapshot) { super(snapshot); } Loading @@ -115,8 +120,17 @@ public class PackageManagerLocalImpl implements PackageManagerLocal { public Map<String, PackageState> getPackageStates() { checkClosed(); //noinspection unchecked, RedundantCast return (Map<String, PackageState>) (Map<?, ?>) mSnapshot.getPackageStates(); if (mCachedUnmodifiablePackageStates == null) { mCachedUnmodifiablePackageStates = Collections.unmodifiableMap(mSnapshot.getPackageStates()); } return mCachedUnmodifiablePackageStates; } @Override public void close() { super.close(); mCachedUnmodifiablePackageStates = null; } } Loading Loading @@ -152,6 +166,12 @@ public class PackageManagerLocalImpl implements PackageManagerLocal { super.checkClosed(); } @Override public void close() { super.close(); mFilteredPackageStates = null; } @Nullable @Override public PackageState getPackageState(@NonNull String packageName) { Loading
services/core/java/com/android/server/pm/pkg/AndroidPackage.java +91 −5 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.server.pm.pkg; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.content.ComponentName; import android.content.Intent; import android.content.pm.ActivityInfo; Loading Loading @@ -58,8 +59,27 @@ import java.util.List; import java.util.Map; import java.util.Set; /** @hide */ //@SystemApi(client = SystemApi.Client.SYSTEM_SERVER) /** * The representation of an application on disk, as parsed from its split APKs' manifests. * * Metadata available here is mostly device-state independent and indicates what the application * author declared for their app. * * This is the system server in-process API equivalent of the public API {@link ApplicationInfo}. * Note that because {@link ApplicationInfo} is stateful, several methods that exist on it may not * be available here and need to be read through {@link PackageState} or {@link PackageUserState}. * * All instances of {@link AndroidPackage} are associated with a {@link PackageState}, and the * only way to retrieve one is through {@link PackageState}. Note that the inverse does not apply * and {@link AndroidPackage} may be null in several cases. See * {@link PackageState#getAndroidPackage()}. * * The data available here is immutable and will throw {@link UnsupportedOperationException} if any * collection type is mutated. * * @hide */ @SystemApi(client = SystemApi.Client.SYSTEM_SERVER) @Immutable public interface AndroidPackage { Loading Loading @@ -98,11 +118,13 @@ public interface AndroidPackage { /** * @see ApplicationInfo#FLAG_DEBUGGABLE * @see R.styleable#AndroidManifestApplication_debuggable */ boolean isDebuggable(); /** * @see ApplicationInfo#PRIVATE_FLAG_ISOLATED_SPLIT_LOADING * @see R.styleable#AndroidManifest_isolatedSplits */ boolean isIsolatedSplitLoading(); Loading @@ -113,16 +135,19 @@ public interface AndroidPackage { /** * @see ApplicationInfo#PRIVATE_FLAG_USE_EMBEDDED_DEX * @see R.styleable#AndroidManifestApplication_useEmbeddedDex */ boolean isUseEmbeddedDex(); /** * @see ApplicationInfo#PRIVATE_FLAG_USES_NON_SDK_API * @see R.styleable#AndroidManifestApplication_usesNonSdkApi */ boolean isUsesNonSdkApi(); /** * @see ApplicationInfo#FLAG_VM_SAFE_MODE * @see R.styleable#AndroidManifestApplication_vmSafeMode */ boolean isVmSafeMode(); Loading @@ -147,6 +172,7 @@ public interface AndroidPackage { * * @see ActivityInfo * @see PackageInfo#activities * @see R.styleable#AndroidManifestActivity * @hide */ @Immutable.Ignore Loading Loading @@ -179,7 +205,10 @@ public interface AndroidPackage { @Nullable String getAppComponentFactory(); /** @hide */ /** * @see R.styleable#AndroidManifestAttribution * @hide */ @Immutable.Ignore @NonNull List<ParsedAttribution> getAttributions(); Loading @@ -188,6 +217,7 @@ public interface AndroidPackage { * @see ApplicationInfo#AUTO_REVOKE_ALLOWED * @see ApplicationInfo#AUTO_REVOKE_DISCOURAGED * @see ApplicationInfo#AUTO_REVOKE_DISALLOWED * @see R.styleable#AndroidManifestApplication_autoRevokePermissions * @hide */ int getAutoRevokePermissions(); Loading Loading @@ -217,6 +247,7 @@ public interface AndroidPackage { /** * @see PackageInfo#baseRevisionCode * @see R.styleable#AndroidManifest_revisionCode * @hide */ int getBaseRevisionCode(); Loading Loading @@ -338,6 +369,7 @@ public interface AndroidPackage { /** * @see InstrumentationInfo * @see PackageInfo#instrumentation * @see R.styleable#AndroidManifestInstrumentation * @hide */ @Immutable.Ignore Loading Loading @@ -396,6 +428,8 @@ public interface AndroidPackage { /** * @see PackageInfo#getLongVersionCode() * @see R.styleable#AndroidManifest_versionCode * @see R.styleable#AndroidManifest_versionCodeMajor * @hide */ long getLongVersionCode(); Loading Loading @@ -439,13 +473,17 @@ public interface AndroidPackage { /** * TODO(b/135203078): Make all the Bundles immutable (and non-null by shared empty reference?) * @see R.styleable#AndroidManifestMetaData * @hide */ @Immutable.Ignore @Nullable Bundle getMetaData(); /** @hide */ /** * @see R.attr#mimeGroup * @hide */ @Nullable Set<String> getMimeGroups(); Loading Loading @@ -583,6 +621,7 @@ public interface AndroidPackage { /** * @see android.content.pm.PermissionGroupInfo * @see R.styleable#AndroidManifestPermissionGroup * @hide */ @Immutable.Ignore Loading Loading @@ -619,6 +658,7 @@ public interface AndroidPackage { /** * @see android.content.pm.ProcessInfo * @see R.styleable#AndroidManifestProcess * @hide */ @Immutable.Ignore Loading @@ -627,6 +667,7 @@ public interface AndroidPackage { /** * Returns the properties set on the application * @see R.styleable#AndroidManifestProperty * @hide */ @Immutable.Ignore Loading @@ -653,6 +694,7 @@ public interface AndroidPackage { * * @see ProviderInfo * @see PackageInfo#providers * @see R.styleable#AndroidManifestProvider * @hide */ @Immutable.Ignore Loading Loading @@ -703,6 +745,7 @@ public interface AndroidPackage { * * @see ActivityInfo * @see PackageInfo#receivers * @see R.styleable#AndroidManifestReceiver * @hide */ @Immutable.Ignore Loading Loading @@ -751,6 +794,7 @@ public interface AndroidPackage { * * @see ApplicationInfo#PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE * @see ApplicationInfo#PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_UNRESIZEABLE * @see R.styleable#AndroidManifestApplication_resizeableActivity * @hide */ @Nullable Loading Loading @@ -807,6 +851,7 @@ public interface AndroidPackage { * * @see ServiceInfo * @see PackageInfo#services * @see R.styleable#AndroidManifestService * @hide */ @Immutable.Ignore Loading Loading @@ -1050,7 +1095,11 @@ public interface AndroidPackage { @Nullable String getVolumeUuid(); /** @hide */ /** * @see ApplicationInfo#zygotePreloadName * @see R.styleable#AndroidManifestApplication_zygotePreloadName * @hide */ @Nullable String getZygotePreloadName(); Loading @@ -1073,36 +1122,42 @@ public interface AndroidPackage { /** * @see ApplicationInfo#PRIVATE_FLAG_ALLOW_AUDIO_PLAYBACK_CAPTURE * @see R.styleable#AndroidManifestApplication_allowAudioPlaybackCapture * @hide */ boolean isAllowAudioPlaybackCapture(); /** * @see ApplicationInfo#FLAG_ALLOW_BACKUP * @see R.styleable#AndroidManifestApplication_allowBackup * @hide */ boolean isAllowBackup(); /** * @see ApplicationInfo#FLAG_ALLOW_CLEAR_USER_DATA * @see R.styleable#AndroidManifestApplication_allowClearUserData * @hide */ boolean isAllowClearUserData(); /** * @see ApplicationInfo#PRIVATE_FLAG_ALLOW_CLEAR_USER_DATA_ON_FAILED_RESTORE * @see R.styleable#AndroidManifestApplication_allowClearUserDataOnFailedRestore * @hide */ boolean isAllowClearUserDataOnFailedRestore(); /** * @see ApplicationInfo#PRIVATE_FLAG_ALLOW_NATIVE_HEAP_POINTER_TAGGING * @see R.styleable#AndroidManifestApplication_allowNativeHeapPointerTagging * @hide */ boolean isAllowNativeHeapPointerTagging(); /** * @see ApplicationInfo#FLAG_ALLOW_TASK_REPARENTING * @see R.styleable#AndroidManifestApplication_allowTaskReparenting * @hide */ boolean isAllowTaskReparenting(); Loading @@ -1122,18 +1177,21 @@ public interface AndroidPackage { /** * @see ApplicationInfo#PRIVATE_FLAG_BACKUP_IN_FOREGROUND * @see R.styleable#AndroidManifestApplication_backupInForeground * @hide */ boolean isBackupInForeground(); /** * @see ApplicationInfo#FLAG_HARDWARE_ACCELERATED * @see R.styleable#AndroidManifestApplication_hardwareAccelerated * @hide */ boolean isBaseHardwareAccelerated(); /** * @see ApplicationInfo#PRIVATE_FLAG_CANT_SAVE_STATE * @see R.styleable#AndroidManifestApplication_cantSaveState * @hide */ boolean isCantSaveState(); Loading @@ -1146,18 +1204,21 @@ public interface AndroidPackage { /** * @see ApplicationInfo#crossProfile * @see R.styleable#AndroidManifestApplication_crossProfile * @hide */ boolean isCrossProfile(); /** * @see ApplicationInfo#PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE * @see R.styleable#AndroidManifestApplication_defaultToDeviceProtectedStorage * @hide */ boolean isDefaultToDeviceProtectedStorage(); /** * @see ApplicationInfo#PRIVATE_FLAG_DIRECT_BOOT_AWARE * @see R.styleable#AndroidManifestApplication_directBootAware * @hide */ boolean isDirectBootAware(); Loading @@ -1177,6 +1238,7 @@ public interface AndroidPackage { /** * @see ApplicationInfo#FLAG_EXTRACT_NATIVE_LIBS * @see R.styleable#AndroidManifestApplication_extractNativeLibs * @hide */ boolean isExtractNativeLibs(); Loading @@ -1195,12 +1257,14 @@ public interface AndroidPackage { /** * @see ApplicationInfo#FLAG_FULL_BACKUP_ONLY * @see R.styleable#AndroidManifestApplication_fullBackupOnly * @hide */ boolean isFullBackupOnly(); /** * @see ApplicationInfo#FLAG_IS_GAME * @see R.styleable#AndroidManifestApplication_isGame * @hide */ @Deprecated Loading @@ -1208,30 +1272,35 @@ public interface AndroidPackage { /** * @see ApplicationInfo#FLAG_HAS_CODE * @see R.styleable#AndroidManifestApplication_hasCode * @hide */ boolean isHasCode(); /** * @see ApplicationInfo#PRIVATE_FLAG_HAS_DOMAIN_URLS * @see R.styleable#AndroidManifestIntentFilter * @hide */ boolean isHasDomainUrls(); /** * @see ApplicationInfo#PRIVATE_FLAG_HAS_FRAGILE_USER_DATA * @see R.styleable#AndroidManifestApplication_hasFragileUserData * @hide */ boolean isHasFragileUserData(); /** * @see ApplicationInfo#FLAG_KILL_AFTER_RESTORE * @see R.styleable#AndroidManifestApplication_killAfterRestore * @hide */ boolean isKillAfterRestore(); /** * @see ApplicationInfo#FLAG_LARGE_HEAP * @see R.styleable#AndroidManifestApplication_largeHeap * @hide */ boolean isLargeHeap(); Loading @@ -1247,6 +1316,7 @@ public interface AndroidPackage { /** * @see ApplicationInfo#FLAG_MULTIARCH * @see R.styleable#AndroidManifestApplication_multiArch * @hide */ boolean isMultiArch(); Loading Loading @@ -1278,6 +1348,7 @@ public interface AndroidPackage { /** * @see ApplicationInfo#PRIVATE_FLAG_IS_RESOURCE_OVERLAY * @see ApplicationInfo#isResourceOverlay() * @see R.styleable#AndroidManifestResourceOverlay * @hide */ boolean isOverlay(); Loading @@ -1290,12 +1361,17 @@ public interface AndroidPackage { /** * @see ApplicationInfo#PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE * @see R.styleable#AndroidManifestActivity_directBootAware * @see R.styleable#AndroidManifestProvider_directBootAware * @see R.styleable#AndroidManifestReceiver_directBootAware * @see R.styleable#AndroidManifestService_directBootAware * @hide */ boolean isPartiallyDirectBootAware(); /** * @see ApplicationInfo#FLAG_PERSISTENT * @see R.styleable#AndroidManifestApplication_persistent * @hide */ boolean isPersistent(); Loading @@ -1314,18 +1390,21 @@ public interface AndroidPackage { /** * @see ApplicationInfo#PRIVATE_FLAG_EXT_PROFILEABLE * @see R.styleable#AndroidManifestProfileable * @hide */ boolean isProfileable(); /** * @see ApplicationInfo#PRIVATE_FLAG_PROFILEABLE_BY_SHELL * @see R.styleable#AndroidManifestProfileable_shell * @hide */ boolean isProfileableByShell(); /** * @see ApplicationInfo#PRIVATE_FLAG_REQUEST_LEGACY_EXTERNAL_STORAGE * @see R.styleable#AndroidManifestApplication_requestLegacyExternalStorage * @hide */ boolean isRequestLegacyExternalStorage(); Loading Loading @@ -1358,24 +1437,28 @@ public interface AndroidPackage { /** * @see ApplicationInfo#PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION * @see R.styleable#AppWidgetProviderInfo_resizeMode * @hide */ boolean isResizeableActivityViaSdkVersion(); /** * @see ApplicationInfo#FLAG_RESTORE_ANY_VERSION * @see R.styleable#AndroidManifestApplication_restoreAnyVersion * @hide */ boolean isRestoreAnyVersion(); /** * True means that this package/app contains an SDK library. * @see R.styleable#AndroidManifestSdkLibrary * @hide */ boolean isSdkLibrary(); /** * @see ApplicationInfo#PRIVATE_FLAG_STATIC_SHARED_LIBRARY * @see R.styleable#AndroidManifestStaticLibrary * @hide */ boolean isStaticSharedLibrary(); Loading Loading @@ -1417,6 +1500,7 @@ public interface AndroidPackage { /** * @see ApplicationInfo#FLAG_SUPPORTS_RTL * @see R.styleable#AndroidManifestApplication_supportsRtl * @hide */ boolean isSupportsRtl(); Loading Loading @@ -1445,6 +1529,7 @@ public interface AndroidPackage { /** * @see ApplicationInfo#FLAG_TEST_ONLY * @see R.styleable#AndroidManifestApplication_testOnly * @hide */ boolean isTestOnly(); Loading @@ -1461,6 +1546,7 @@ public interface AndroidPackage { /** * @see ApplicationInfo#FLAG_USES_CLEARTEXT_TRAFFIC * @see R.styleable#AndroidManifestApplication_usesCleartextTraffic * @hide */ boolean isUsesCleartextTraffic(); Loading