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

Commit 62dc622f authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12104175 from 8b46d3e8 to 24Q4-release

Change-Id: I3f25ee8d2d6f4ccec7b643841b4a31243d27b250
parents 018f990e 8b46d3e8
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.content.pm.PackageInstaller;
import android.content.pm.PackageManager;
import android.perftests.utils.BenchmarkState;
import android.perftests.utils.PerfStatusReporter;
import android.permission.PermissionManager;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
@@ -107,6 +108,8 @@ public class PackageManagerPerfTest {
    public void setup() {
        PackageManager.disableApplicationInfoCache();
        PackageManager.disablePackageInfoCache();
        PermissionManager.disablePermissionCache();
        PermissionManager.disablePackageNamePermissionCache();
    }

    @Test
+3 −1
Original line number Diff line number Diff line
@@ -3702,7 +3702,9 @@ public class Activity extends ContextThemeWrapper
     * @see View#findViewById(int)
     * @see Activity#requireViewById(int)
     */
    /* TODO(b/347672184): Re-add @Nullable */
    // Strictly speaking this should be marked as @Nullable but the nullability of the return value
    // is deliberately left unspecified as idiomatically correct code can make assumptions either
    // way based on local context, e.g. layout specification.
    public <T extends View> T findViewById(@IdRes int id) {
        return getWindow().findViewById(id);
    }
+17 −1
Original line number Diff line number Diff line
@@ -104,7 +104,9 @@ public class ActivityOptions extends ComponentOptions {
            MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED,
            MODE_BACKGROUND_ACTIVITY_START_ALLOWED,
            MODE_BACKGROUND_ACTIVITY_START_DENIED,
            MODE_BACKGROUND_ACTIVITY_START_COMPAT})
            MODE_BACKGROUND_ACTIVITY_START_COMPAT,
            MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS,
            MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE})
    public @interface BackgroundActivityStartMode {}
    /**
     * No explicit value chosen. The system will decide whether to grant privileges.
@@ -118,6 +120,20 @@ public class ActivityOptions extends ComponentOptions {
     * Deny the {@link PendingIntent} to use the background activity start privileges.
     */
    public static final int MODE_BACKGROUND_ACTIVITY_START_DENIED = 2;
    /**
     * Allow the {@link PendingIntent} to use ALL background activity start privileges, including
     * special permissions that will allow starts at any time.
     *
     * @hide
     */
    public static final int MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS = 3;
    /**
     * Allow the {@link PendingIntent} to use background activity start privileges based on
     * visibility of the app.
     *
     * @hide
     */
    public static final int MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE = 4;
    /**
     * Special behavior for compatibility.
     * Similar to {@link #MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED}
+31 −23
Original line number Diff line number Diff line
@@ -18,9 +18,11 @@ package android.app;

import static android.app.ActivityOptions.BackgroundActivityStartMode;
import static android.app.ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED;
import static android.app.ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS;
import static android.app.ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_COMPAT;
import static android.app.ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_DENIED;
import static android.app.ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED;
import static android.app.ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE;

import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -48,15 +50,7 @@ public class ComponentOptions {
    public static final String KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED =
            "android.pendingIntent.backgroundActivityAllowed";

    /**
     * PendingIntent caller allows activity to be started if caller has BAL permission.
     * @hide
     */
    public static final String KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED_BY_PERMISSION =
            "android.pendingIntent.backgroundActivityAllowedByPermission";

    private Integer mPendingIntentBalAllowed = MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED;
    private boolean mPendingIntentBalAllowedByPermission = false;

    ComponentOptions() {
    }
@@ -69,9 +63,6 @@ public class ComponentOptions {
        mPendingIntentBalAllowed =
                opts.getInt(KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED,
                        MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED);
        setPendingIntentBackgroundActivityLaunchAllowedByPermission(
                opts.getBoolean(
                        KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED_BY_PERMISSION, false));
    }

    /**
@@ -114,10 +105,19 @@ public class ComponentOptions {
    public @NonNull ComponentOptions setPendingIntentBackgroundActivityStartMode(
            @BackgroundActivityStartMode int state) {
        switch (state) {
            case MODE_BACKGROUND_ACTIVITY_START_ALLOWED:
                if (mPendingIntentBalAllowed != MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS) {
                    // do not overwrite ALWAYS with ALLOWED for backwards compatibility,
                    // if setPendingIntentBackgroundActivityLaunchAllowedByPermission is used
                    // before this method.
                    mPendingIntentBalAllowed = state;
                }
                break;
            case MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED:
            case MODE_BACKGROUND_ACTIVITY_START_DENIED:
            case MODE_BACKGROUND_ACTIVITY_START_COMPAT:
            case MODE_BACKGROUND_ACTIVITY_START_ALLOWED:
            case MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS:
            case MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE:
                mPendingIntentBalAllowed = state;
                break;
            default:
@@ -140,20 +140,32 @@ public class ComponentOptions {
    }

    /**
     * Set PendingIntent activity can be launched from background if caller has BAL permission.
     * Get PendingIntent activity is allowed to be started in the background if the caller
     * has BAL permission.
     * @hide
     * @deprecated check for #MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS
     */
    public void setPendingIntentBackgroundActivityLaunchAllowedByPermission(boolean allowed) {
        mPendingIntentBalAllowedByPermission = allowed;
    @Deprecated
    public boolean isPendingIntentBackgroundActivityLaunchAllowedByPermission() {
        return mPendingIntentBalAllowed == MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS;
    }

    /**
     * Get PendingIntent activity is allowed to be started in the background if the caller
     * has BAL permission.
     * Set PendingIntent activity can be launched from background if caller has BAL permission.
     * @hide
     * @deprecated use #MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS
     */
    public boolean isPendingIntentBackgroundActivityLaunchAllowedByPermission() {
        return mPendingIntentBalAllowedByPermission;
    @Deprecated
    public void setPendingIntentBackgroundActivityLaunchAllowedByPermission(boolean allowed) {
        if (allowed) {
            setPendingIntentBackgroundActivityStartMode(
                    MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS);
        } else {
            if (getPendingIntentBackgroundActivityStartMode()
                    == MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS) {
                setPendingIntentBackgroundActivityStartMode(MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
            }
        }
    }

    /** @hide */
@@ -162,10 +174,6 @@ public class ComponentOptions {
        if (mPendingIntentBalAllowed != MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED) {
            b.putInt(KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED, mPendingIntentBalAllowed);
        }
        if (mPendingIntentBalAllowedByPermission) {
            b.putBoolean(KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED_BY_PERMISSION,
                    mPendingIntentBalAllowedByPermission);
        }
        return b;
    }

+3 −1
Original line number Diff line number Diff line
@@ -565,7 +565,9 @@ public class Dialog implements DialogInterface, Window.Callback,
     * @see View#findViewById(int)
     * @see Dialog#requireViewById(int)
     */
    /* TODO(b/347672184): Re-add @Nullable */
    // Strictly speaking this should be marked as @Nullable but the nullability of the return value
    // is deliberately left unspecified as idiomatically correct code can make assumptions either
    // way based on local context, e.g. layout specification.
    public <T extends View> T findViewById(@IdRes int id) {
        return mWindow.findViewById(id);
    }
Loading