Loading core/java/android/content/pm/IPackageManager.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -770,6 +770,11 @@ interface IPackageManager { void setSplashScreenTheme(String packageName, String themeName, int userId); int getUserMinAspectRatio(String packageName, int userId); @EnforcePermission("INSTALL_PACKAGES") void setUserMinAspectRatio(String packageName, int userId, int aspectRatio); List<String> getMimeGroup(String packageName, String group); boolean isAutoRevokeWhitelisted(String packageName); Loading core/java/android/content/pm/PackageManager.java +58 −0 Original line number Diff line number Diff line Loading @@ -2342,6 +2342,64 @@ public abstract class PackageManager { */ public static final int INSTALL_FAILED_SHARED_LIBRARY_BAD_CERTIFICATE_DIGEST = -130; /** * App minimum aspect ratio set by the user which will override app-defined aspect ratio. * * @hide */ @IntDef(prefix = { "USER_MIN_ASPECT_RATIO_" }, value = { USER_MIN_ASPECT_RATIO_UNSET, USER_MIN_ASPECT_RATIO_SPLIT_SCREEN, USER_MIN_ASPECT_RATIO_DISPLAY_SIZE, USER_MIN_ASPECT_RATIO_4_3, USER_MIN_ASPECT_RATIO_16_9, USER_MIN_ASPECT_RATIO_3_2, }) @Retention(RetentionPolicy.SOURCE) public @interface UserMinAspectRatio {} /** * No aspect ratio override has been set by user. * * @hide */ public static final int USER_MIN_ASPECT_RATIO_UNSET = 0; /** * Aspect ratio override code: user forces app to split screen aspect ratio. This is adjusted to * half of the screen without the split screen divider. * * @hide */ public static final int USER_MIN_ASPECT_RATIO_SPLIT_SCREEN = 1; /** * Aspect ratio override code: user forces app to the aspect ratio of the device display size. * This will be the portrait aspect ratio of the device if the app is portrait or the landscape * aspect ratio of the device if the app is landscape. * * @hide */ public static final int USER_MIN_ASPECT_RATIO_DISPLAY_SIZE = 2; /** * Aspect ratio override code: user forces app to 4:3 min aspect ratio * @hide */ public static final int USER_MIN_ASPECT_RATIO_4_3 = 3; /** * Aspect ratio override code: user forces app to 16:9 min aspect ratio * @hide */ public static final int USER_MIN_ASPECT_RATIO_16_9 = 4; /** * Aspect ratio override code: user forces app to 3:2 min aspect ratio * @hide */ public static final int USER_MIN_ASPECT_RATIO_3_2 = 5; /** @hide */ @IntDef(flag = true, prefix = { "DELETE_" }, value = { DELETE_KEEP_DATA, Loading services/core/java/com/android/server/pm/DeletePackageHelper.java +2 −1 Original line number Diff line number Diff line Loading @@ -610,7 +610,8 @@ final class DeletePackageHelper { PackageManager.UNINSTALL_REASON_UNKNOWN, null /*harmfulAppWarning*/, null /*splashScreenTheme*/, 0 /*firstInstallTime*/); 0 /*firstInstallTime*/, PackageManager.USER_MIN_ASPECT_RATIO_UNSET); } mPm.mSettings.writeKernelMappingLPr(ps); } Loading services/core/java/com/android/server/pm/PackageManagerService.java +41 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import static android.content.pm.PackageManager.MATCH_DISABLED_COMPONENTS; import static android.content.pm.PackageManager.MATCH_FACTORY_ONLY; import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY; import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static android.content.pm.PackageManager.USER_MIN_ASPECT_RATIO_UNSET; import static android.os.Process.INVALID_UID; import static android.os.Trace.TRACE_TAG_PACKAGE_MANAGER; import static android.os.storage.StorageManager.FLAG_STORAGE_CE; Loading Loading @@ -5238,6 +5239,20 @@ public class PackageManagerService implements PackageSender, TestUtilityService : packageState.getUserStateOrDefault(userId).getSplashScreenTheme(); } @Override @PackageManager.UserMinAspectRatio public int getUserMinAspectRatio(@NonNull String packageName, int userId) { final Computer snapshot = snapshotComputer(); final int callingUid = Binder.getCallingUid(); snapshot.enforceCrossUserPermission( callingUid, userId, false /* requireFullPermission */, false /* checkShell */, "getUserMinAspectRatio"); final PackageStateInternal packageState = snapshot .getPackageStateForInstalledAndFiltered(packageName, callingUid, userId); return packageState == null ? USER_MIN_ASPECT_RATIO_UNSET : packageState.getUserStateOrDefault(userId).getMinAspectRatio(); } @Override public Bundle getSuspendedPackageAppExtras(String packageName, int userId) { final int callingUid = Binder.getCallingUid(); Loading Loading @@ -6201,6 +6216,32 @@ public class PackageManagerService implements PackageSender, TestUtilityService return true; } @android.annotation.EnforcePermission(android.Manifest.permission.INSTALL_PACKAGES) @Override public void setUserMinAspectRatio(@NonNull String packageName, int userId, @PackageManager.UserMinAspectRatio int aspectRatio) { setUserMinAspectRatio_enforcePermission(); final int callingUid = Binder.getCallingUid(); final Computer snapshot = snapshotComputer(); snapshot.enforceCrossUserPermission(callingUid, userId, false /* requireFullPermission */, false /* checkShell */, "setUserMinAspectRatio"); enforceOwnerRights(snapshot, packageName, callingUid); final PackageStateInternal packageState = snapshot .getPackageStateForInstalledAndFiltered(packageName, callingUid, userId); if (packageState == null) { return; } if (packageState.getUserStateOrDefault(userId).getMinAspectRatio() == aspectRatio) { return; } commitPackageStateMutation(null, packageName, state -> state.userState(userId).setMinAspectRatio(aspectRatio)); } @Override @SuppressWarnings("GuardedBy") public void setRuntimePermissionsVersion(int version, @UserIdInt int userId) { Loading services/core/java/com/android/server/pm/PackageSetting.java +4 −3 Original line number Diff line number Diff line Loading @@ -875,7 +875,7 @@ public class PackageSetting extends SettingBase implements PackageStateInternal ArraySet<String> enabledComponents, ArraySet<String> disabledComponents, int installReason, int uninstallReason, String harmfulAppWarning, String splashScreenTheme, long firstInstallTime) { long firstInstallTime, int aspectRatio) { modifyUserState(userId) .setSuspendParams(suspendParams) .setCeDataInode(ceDataInode) Loading @@ -894,7 +894,8 @@ public class PackageSetting extends SettingBase implements PackageStateInternal .setVirtualPreload(virtualPreload) .setHarmfulAppWarning(harmfulAppWarning) .setSplashScreenTheme(splashScreenTheme) .setFirstInstallTimeMillis(firstInstallTime); .setFirstInstallTimeMillis(firstInstallTime) .setMinAspectRatio(aspectRatio); onChanged(); } Loading @@ -912,7 +913,7 @@ public class PackageSetting extends SettingBase implements PackageStateInternal ? null : otherState.getDisabledComponentsNoCopy().untrackedStorage(), otherState.getInstallReason(), otherState.getUninstallReason(), otherState.getHarmfulAppWarning(), otherState.getSplashScreenTheme(), otherState.getFirstInstallTimeMillis()); otherState.getFirstInstallTimeMillis(), otherState.getMinAspectRatio()); } WatchedArraySet<String> getEnabledComponents(int userId) { Loading Loading
core/java/android/content/pm/IPackageManager.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -770,6 +770,11 @@ interface IPackageManager { void setSplashScreenTheme(String packageName, String themeName, int userId); int getUserMinAspectRatio(String packageName, int userId); @EnforcePermission("INSTALL_PACKAGES") void setUserMinAspectRatio(String packageName, int userId, int aspectRatio); List<String> getMimeGroup(String packageName, String group); boolean isAutoRevokeWhitelisted(String packageName); Loading
core/java/android/content/pm/PackageManager.java +58 −0 Original line number Diff line number Diff line Loading @@ -2342,6 +2342,64 @@ public abstract class PackageManager { */ public static final int INSTALL_FAILED_SHARED_LIBRARY_BAD_CERTIFICATE_DIGEST = -130; /** * App minimum aspect ratio set by the user which will override app-defined aspect ratio. * * @hide */ @IntDef(prefix = { "USER_MIN_ASPECT_RATIO_" }, value = { USER_MIN_ASPECT_RATIO_UNSET, USER_MIN_ASPECT_RATIO_SPLIT_SCREEN, USER_MIN_ASPECT_RATIO_DISPLAY_SIZE, USER_MIN_ASPECT_RATIO_4_3, USER_MIN_ASPECT_RATIO_16_9, USER_MIN_ASPECT_RATIO_3_2, }) @Retention(RetentionPolicy.SOURCE) public @interface UserMinAspectRatio {} /** * No aspect ratio override has been set by user. * * @hide */ public static final int USER_MIN_ASPECT_RATIO_UNSET = 0; /** * Aspect ratio override code: user forces app to split screen aspect ratio. This is adjusted to * half of the screen without the split screen divider. * * @hide */ public static final int USER_MIN_ASPECT_RATIO_SPLIT_SCREEN = 1; /** * Aspect ratio override code: user forces app to the aspect ratio of the device display size. * This will be the portrait aspect ratio of the device if the app is portrait or the landscape * aspect ratio of the device if the app is landscape. * * @hide */ public static final int USER_MIN_ASPECT_RATIO_DISPLAY_SIZE = 2; /** * Aspect ratio override code: user forces app to 4:3 min aspect ratio * @hide */ public static final int USER_MIN_ASPECT_RATIO_4_3 = 3; /** * Aspect ratio override code: user forces app to 16:9 min aspect ratio * @hide */ public static final int USER_MIN_ASPECT_RATIO_16_9 = 4; /** * Aspect ratio override code: user forces app to 3:2 min aspect ratio * @hide */ public static final int USER_MIN_ASPECT_RATIO_3_2 = 5; /** @hide */ @IntDef(flag = true, prefix = { "DELETE_" }, value = { DELETE_KEEP_DATA, Loading
services/core/java/com/android/server/pm/DeletePackageHelper.java +2 −1 Original line number Diff line number Diff line Loading @@ -610,7 +610,8 @@ final class DeletePackageHelper { PackageManager.UNINSTALL_REASON_UNKNOWN, null /*harmfulAppWarning*/, null /*splashScreenTheme*/, 0 /*firstInstallTime*/); 0 /*firstInstallTime*/, PackageManager.USER_MIN_ASPECT_RATIO_UNSET); } mPm.mSettings.writeKernelMappingLPr(ps); } Loading
services/core/java/com/android/server/pm/PackageManagerService.java +41 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import static android.content.pm.PackageManager.MATCH_DISABLED_COMPONENTS; import static android.content.pm.PackageManager.MATCH_FACTORY_ONLY; import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY; import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static android.content.pm.PackageManager.USER_MIN_ASPECT_RATIO_UNSET; import static android.os.Process.INVALID_UID; import static android.os.Trace.TRACE_TAG_PACKAGE_MANAGER; import static android.os.storage.StorageManager.FLAG_STORAGE_CE; Loading Loading @@ -5238,6 +5239,20 @@ public class PackageManagerService implements PackageSender, TestUtilityService : packageState.getUserStateOrDefault(userId).getSplashScreenTheme(); } @Override @PackageManager.UserMinAspectRatio public int getUserMinAspectRatio(@NonNull String packageName, int userId) { final Computer snapshot = snapshotComputer(); final int callingUid = Binder.getCallingUid(); snapshot.enforceCrossUserPermission( callingUid, userId, false /* requireFullPermission */, false /* checkShell */, "getUserMinAspectRatio"); final PackageStateInternal packageState = snapshot .getPackageStateForInstalledAndFiltered(packageName, callingUid, userId); return packageState == null ? USER_MIN_ASPECT_RATIO_UNSET : packageState.getUserStateOrDefault(userId).getMinAspectRatio(); } @Override public Bundle getSuspendedPackageAppExtras(String packageName, int userId) { final int callingUid = Binder.getCallingUid(); Loading Loading @@ -6201,6 +6216,32 @@ public class PackageManagerService implements PackageSender, TestUtilityService return true; } @android.annotation.EnforcePermission(android.Manifest.permission.INSTALL_PACKAGES) @Override public void setUserMinAspectRatio(@NonNull String packageName, int userId, @PackageManager.UserMinAspectRatio int aspectRatio) { setUserMinAspectRatio_enforcePermission(); final int callingUid = Binder.getCallingUid(); final Computer snapshot = snapshotComputer(); snapshot.enforceCrossUserPermission(callingUid, userId, false /* requireFullPermission */, false /* checkShell */, "setUserMinAspectRatio"); enforceOwnerRights(snapshot, packageName, callingUid); final PackageStateInternal packageState = snapshot .getPackageStateForInstalledAndFiltered(packageName, callingUid, userId); if (packageState == null) { return; } if (packageState.getUserStateOrDefault(userId).getMinAspectRatio() == aspectRatio) { return; } commitPackageStateMutation(null, packageName, state -> state.userState(userId).setMinAspectRatio(aspectRatio)); } @Override @SuppressWarnings("GuardedBy") public void setRuntimePermissionsVersion(int version, @UserIdInt int userId) { Loading
services/core/java/com/android/server/pm/PackageSetting.java +4 −3 Original line number Diff line number Diff line Loading @@ -875,7 +875,7 @@ public class PackageSetting extends SettingBase implements PackageStateInternal ArraySet<String> enabledComponents, ArraySet<String> disabledComponents, int installReason, int uninstallReason, String harmfulAppWarning, String splashScreenTheme, long firstInstallTime) { long firstInstallTime, int aspectRatio) { modifyUserState(userId) .setSuspendParams(suspendParams) .setCeDataInode(ceDataInode) Loading @@ -894,7 +894,8 @@ public class PackageSetting extends SettingBase implements PackageStateInternal .setVirtualPreload(virtualPreload) .setHarmfulAppWarning(harmfulAppWarning) .setSplashScreenTheme(splashScreenTheme) .setFirstInstallTimeMillis(firstInstallTime); .setFirstInstallTimeMillis(firstInstallTime) .setMinAspectRatio(aspectRatio); onChanged(); } Loading @@ -912,7 +913,7 @@ public class PackageSetting extends SettingBase implements PackageStateInternal ? null : otherState.getDisabledComponentsNoCopy().untrackedStorage(), otherState.getInstallReason(), otherState.getUninstallReason(), otherState.getHarmfulAppWarning(), otherState.getSplashScreenTheme(), otherState.getFirstInstallTimeMillis()); otherState.getFirstInstallTimeMillis(), otherState.getMinAspectRatio()); } WatchedArraySet<String> getEnabledComponents(int userId) { Loading