Loading core/java/android/content/pm/ApplicationInfo.java +6 −0 Original line number Diff line number Diff line Loading @@ -1120,6 +1120,9 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { /** @hide */ public String[] splitClassLoaderNames; /** @hide */ public boolean hiddenUntilInstalled; /** * Represents the default policy. The actual policy used will depend on other properties of * the application, e.g. the target SDK version. Loading Loading @@ -1460,6 +1463,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { compileSdkVersion = orig.compileSdkVersion; compileSdkVersionCodename = orig.compileSdkVersionCodename; mHiddenApiPolicy = orig.mHiddenApiPolicy; hiddenUntilInstalled = orig.hiddenUntilInstalled; } public String toString() { Loading Loading @@ -1534,6 +1538,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { dest.writeString(compileSdkVersionCodename); dest.writeString(appComponentFactory); dest.writeInt(mHiddenApiPolicy); dest.writeInt(hiddenUntilInstalled ? 1 : 0); } public static final Parcelable.Creator<ApplicationInfo> CREATOR Loading Loading @@ -1605,6 +1610,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { compileSdkVersionCodename = source.readString(); appComponentFactory = source.readString(); mHiddenApiPolicy = source.readInt(); hiddenUntilInstalled = source.readInt() != 0; } /** Loading core/java/android/content/pm/IPackageManager.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -598,6 +598,9 @@ interface IPackageManager { boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, int userId); boolean getApplicationHiddenSettingAsUser(String packageName, int userId); void setSystemAppHiddenUntilInstalled(String packageName, boolean hidden); boolean setSystemAppInstallState(String packageName, boolean installed, int userId); IPackageInstaller getPackageInstaller(); boolean setBlockUninstallForUser(String packageName, boolean blockUninstall, int userId); Loading core/java/android/content/pm/PackageManager.java +10 −1 Original line number Diff line number Diff line Loading @@ -147,6 +147,7 @@ public abstract class PackageManager { GET_DISABLED_COMPONENTS, GET_DISABLED_UNTIL_USED_COMPONENTS, GET_UNINSTALLED_PACKAGES, MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS, }) @Retention(RetentionPolicy.SOURCE) public @interface PackageInfoFlags {} Loading @@ -164,6 +165,7 @@ public abstract class PackageManager { MATCH_STATIC_SHARED_LIBRARIES, GET_DISABLED_UNTIL_USED_COMPONENTS, GET_UNINSTALLED_PACKAGES, MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS, }) @Retention(RetentionPolicy.SOURCE) public @interface ApplicationInfoFlags {} Loading Loading @@ -521,6 +523,12 @@ public abstract class PackageManager { */ public static final int MATCH_DEBUG_TRIAGED_MISSING = 0x10000000; /** * Internal flag used to indicate that a package is a hidden system app. * @hide */ public static final int MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS = 0x20000000; /** * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set: when * resolving an intent that matches the {@code CrossProfileIntentFilter}, Loading Loading @@ -4842,6 +4850,7 @@ public abstract class PackageManager { * @hide */ @RequiresPermission(anyOf = { Manifest.permission.INSTALL_EXISTING_PACKAGES, Manifest.permission.INSTALL_PACKAGES, Manifest.permission.INTERACT_ACROSS_USERS_FULL}) public abstract int installExistingPackageAsUser(String packageName, @UserIdInt int userId) Loading core/java/android/content/pm/PackageParser.java +9 −1 Original line number Diff line number Diff line Loading @@ -639,11 +639,19 @@ public class PackageParser { */ private static boolean checkUseInstalledOrHidden(int flags, PackageUserState state, ApplicationInfo appInfo) { // Returns false if the package is hidden system app until installed. if ((flags & PackageManager.MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS) == 0 && !state.installed && appInfo != null && appInfo.hiddenUntilInstalled) { return false; } // If available for the target user, or trying to match uninstalled packages and it's // a system app. return state.isAvailable(flags) || (appInfo != null && appInfo.isSystemApp() && (flags & PackageManager.MATCH_KNOWN_PACKAGES) != 0); && ((flags & PackageManager.MATCH_KNOWN_PACKAGES) != 0 || (flags & PackageManager.MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS) != 0)); } public static boolean isAvailable(PackageUserState state) { Loading core/res/AndroidManifest.xml +9 −0 Original line number Diff line number Diff line Loading @@ -3025,6 +3025,15 @@ <permission android:name="android.permission.INSTALL_PACKAGE_UPDATES" android:protectionLevel="signature|privileged" /> <!-- Allows an application to install existing system packages. This is a limited version of {@link android.Manifest.permission#INSTALL_PACKAGES}. <p>Not for use by third-party applications. TODO(b/80204953): remove this permission once we have a long-term solution. @hide --> <permission android:name="com.android.permission.INSTALL_EXISTING_PACKAGES" android:protectionLevel="signature|privileged" /> <!-- @SystemApi Allows an application to clear user data. <p>Not for use by third-party applications @hide Loading Loading
core/java/android/content/pm/ApplicationInfo.java +6 −0 Original line number Diff line number Diff line Loading @@ -1120,6 +1120,9 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { /** @hide */ public String[] splitClassLoaderNames; /** @hide */ public boolean hiddenUntilInstalled; /** * Represents the default policy. The actual policy used will depend on other properties of * the application, e.g. the target SDK version. Loading Loading @@ -1460,6 +1463,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { compileSdkVersion = orig.compileSdkVersion; compileSdkVersionCodename = orig.compileSdkVersionCodename; mHiddenApiPolicy = orig.mHiddenApiPolicy; hiddenUntilInstalled = orig.hiddenUntilInstalled; } public String toString() { Loading Loading @@ -1534,6 +1538,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { dest.writeString(compileSdkVersionCodename); dest.writeString(appComponentFactory); dest.writeInt(mHiddenApiPolicy); dest.writeInt(hiddenUntilInstalled ? 1 : 0); } public static final Parcelable.Creator<ApplicationInfo> CREATOR Loading Loading @@ -1605,6 +1610,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { compileSdkVersionCodename = source.readString(); appComponentFactory = source.readString(); mHiddenApiPolicy = source.readInt(); hiddenUntilInstalled = source.readInt() != 0; } /** Loading
core/java/android/content/pm/IPackageManager.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -598,6 +598,9 @@ interface IPackageManager { boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, int userId); boolean getApplicationHiddenSettingAsUser(String packageName, int userId); void setSystemAppHiddenUntilInstalled(String packageName, boolean hidden); boolean setSystemAppInstallState(String packageName, boolean installed, int userId); IPackageInstaller getPackageInstaller(); boolean setBlockUninstallForUser(String packageName, boolean blockUninstall, int userId); Loading
core/java/android/content/pm/PackageManager.java +10 −1 Original line number Diff line number Diff line Loading @@ -147,6 +147,7 @@ public abstract class PackageManager { GET_DISABLED_COMPONENTS, GET_DISABLED_UNTIL_USED_COMPONENTS, GET_UNINSTALLED_PACKAGES, MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS, }) @Retention(RetentionPolicy.SOURCE) public @interface PackageInfoFlags {} Loading @@ -164,6 +165,7 @@ public abstract class PackageManager { MATCH_STATIC_SHARED_LIBRARIES, GET_DISABLED_UNTIL_USED_COMPONENTS, GET_UNINSTALLED_PACKAGES, MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS, }) @Retention(RetentionPolicy.SOURCE) public @interface ApplicationInfoFlags {} Loading Loading @@ -521,6 +523,12 @@ public abstract class PackageManager { */ public static final int MATCH_DEBUG_TRIAGED_MISSING = 0x10000000; /** * Internal flag used to indicate that a package is a hidden system app. * @hide */ public static final int MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS = 0x20000000; /** * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set: when * resolving an intent that matches the {@code CrossProfileIntentFilter}, Loading Loading @@ -4842,6 +4850,7 @@ public abstract class PackageManager { * @hide */ @RequiresPermission(anyOf = { Manifest.permission.INSTALL_EXISTING_PACKAGES, Manifest.permission.INSTALL_PACKAGES, Manifest.permission.INTERACT_ACROSS_USERS_FULL}) public abstract int installExistingPackageAsUser(String packageName, @UserIdInt int userId) Loading
core/java/android/content/pm/PackageParser.java +9 −1 Original line number Diff line number Diff line Loading @@ -639,11 +639,19 @@ public class PackageParser { */ private static boolean checkUseInstalledOrHidden(int flags, PackageUserState state, ApplicationInfo appInfo) { // Returns false if the package is hidden system app until installed. if ((flags & PackageManager.MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS) == 0 && !state.installed && appInfo != null && appInfo.hiddenUntilInstalled) { return false; } // If available for the target user, or trying to match uninstalled packages and it's // a system app. return state.isAvailable(flags) || (appInfo != null && appInfo.isSystemApp() && (flags & PackageManager.MATCH_KNOWN_PACKAGES) != 0); && ((flags & PackageManager.MATCH_KNOWN_PACKAGES) != 0 || (flags & PackageManager.MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS) != 0)); } public static boolean isAvailable(PackageUserState state) { Loading
core/res/AndroidManifest.xml +9 −0 Original line number Diff line number Diff line Loading @@ -3025,6 +3025,15 @@ <permission android:name="android.permission.INSTALL_PACKAGE_UPDATES" android:protectionLevel="signature|privileged" /> <!-- Allows an application to install existing system packages. This is a limited version of {@link android.Manifest.permission#INSTALL_PACKAGES}. <p>Not for use by third-party applications. TODO(b/80204953): remove this permission once we have a long-term solution. @hide --> <permission android:name="com.android.permission.INSTALL_EXISTING_PACKAGES" android:protectionLevel="signature|privileged" /> <!-- @SystemApi Allows an application to clear user data. <p>Not for use by third-party applications @hide Loading