Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5e1705c5 authored by Sumedh Sen's avatar Sumedh Sen
Browse files

Update conditions for updates without user action for Android T

-For Android T, updates without user action are permitted for apps
targetting API 30+
-Updated the conditions for SDK version check in PackageInstallerSession  and associated
documentation in PackageInstaller.SesionParams

Bug: b/215349058

Test: atest com.android.tests.hostside.silentupdate.SilentUpdateHostsideTests
Change-Id: Iafd03b75ecf246a9651572becf6158316ecd8100
parent 8b5fd8d3
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -2302,8 +2302,14 @@ public class PackageInstaller {
         *
         * <ul>
         *     <li>{@code requireUserAction} is set to {@link #USER_ACTION_NOT_REQUIRED}.</li>
         *     <li>The app being installed targets {@link android.os.Build.VERSION_CODES#Q API 29}
         *     or higher.</li>
         *     <li>The app being installed targets:
         *          <ul>
         *              <li>{@link android.os.Build.VERSION_CODES#Q API 29} or higher on
         *              Android S ({@link android.os.Build.VERSION_CODES#S API 31})</li>
         *              <li>{@link android.os.Build.VERSION_CODES#R API 30} or higher after
         *              Android S ({@link android.os.Build.VERSION_CODES#S API 31})</li>
         *          </ul>
         *     </li>
         *     <li>The installer is the {@link InstallSourceInfo#getInstallingPackageName()
         *     installer of record} of an existing version of the app (in other words, this install
         *     session is an app update) or the installer is updating itself.</li>
+2 −2
Original line number Diff line number Diff line
@@ -273,7 +273,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {

    /**
     * The default value of {@link #mValidatedTargetSdk} is {@link Integer#MAX_VALUE}. If {@link
     * #mValidatedTargetSdk} is compared with {@link Build.VERSION_CODES#Q} before getting the
     * #mValidatedTargetSdk} is compared with {@link Build.VERSION_CODES#R} before getting the
     * target sdk version from a validated apk in {@link #validateApkInstallLocked()}, the compared
     * result will not trigger any user action in
     * {@link #checkUserActionRequirement(PackageInstallerSession)}.
@@ -2073,7 +2073,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
            }

            if (validatedTargetSdk != INVALID_TARGET_SDK_VERSION
                    && validatedTargetSdk < Build.VERSION_CODES.Q) {
                    && validatedTargetSdk < Build.VERSION_CODES.R) {
                session.sendPendingUserActionIntent(target);
                return true;
            }