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

Commit ba28968f authored by Achim Thesmann's avatar Achim Thesmann Committed by Android (Google) Code Review
Browse files

Merge "Move BackgroundActivityStartMode to ActivityOptions" into main

parents 0eb290d6 255ed845
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -317,9 +317,6 @@ package android.app {
  }

  public class ComponentOptions {
    field public static final int MODE_BACKGROUND_ACTIVITY_START_ALLOWED = 1; // 0x1
    field public static final int MODE_BACKGROUND_ACTIVITY_START_DENIED = 2; // 0x2
    field public static final int MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED = 0; // 0x0
  }

  public class DownloadManager {
+24 −9
Original line number Diff line number Diff line
@@ -93,15 +93,30 @@ public class ActivityOptions extends ComponentOptions {
     */
    public static final String EXTRA_USAGE_TIME_REPORT_PACKAGES = "android.usage_time_packages";

    /** No explicit value chosen. The system will decide whether to grant privileges. */
    public static final int MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED =
            ComponentOptions.MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED;
    /** Allow the {@link PendingIntent} to use the background activity start privileges. */
    public static final int MODE_BACKGROUND_ACTIVITY_START_ALLOWED =
            ComponentOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED;
    /** Deny the {@link PendingIntent} to use the background activity start privileges. */
    public static final int MODE_BACKGROUND_ACTIVITY_START_DENIED =
            ComponentOptions.MODE_BACKGROUND_ACTIVITY_START_DENIED;
    /** Enumeration of background activity start modes.
     *
     * These define if an app wants to grant it's background activity start privileges to a
     * {@link PendingIntent}.
     * @hide
     */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(prefix = {"MODE_BACKGROUND_ACTIVITY_START_"}, value = {
            MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED,
            MODE_BACKGROUND_ACTIVITY_START_ALLOWED,
            MODE_BACKGROUND_ACTIVITY_START_DENIED})
    public @interface BackgroundActivityStartMode {}
    /**
     * No explicit value chosen. The system will decide whether to grant privileges.
     */
    public static final int MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED = 0;
    /**
     * Allow the {@link PendingIntent} to use the background activity start privileges.
     */
    public static final int MODE_BACKGROUND_ACTIVITY_START_ALLOWED = 1;
    /**
     * Deny the {@link PendingIntent} to use the background activity start privileges.
     */
    public static final int MODE_BACKGROUND_ACTIVITY_START_DENIED = 2;

    /**
     * The package name that created the options.
+4 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package android.app;

import static android.app.ActivityOptions.BackgroundActivityStartMode;

import android.annotation.CurrentTimeMillisLong;
import android.annotation.FlaggedApi;
import android.annotation.IntDef;
@@ -1132,7 +1134,8 @@ public class BroadcastOptions extends ComponentOptions {
    @SystemApi
    @NonNull
    @Override // to narrow down the return type
    public BroadcastOptions setPendingIntentBackgroundActivityStartMode(int state) {
    public BroadcastOptions setPendingIntentBackgroundActivityStartMode(
            @BackgroundActivityStartMode int state) {
        super.setPendingIntentBackgroundActivityStartMode(state);
        return this;
    }
+5 −30
Original line number Diff line number Diff line
@@ -16,16 +16,17 @@

package android.app;

import android.annotation.IntDef;
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_DENIED;
import static android.app.ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.TestApi;
import android.os.Bundle;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * Base class for {@link ActivityOptions} and {@link BroadcastOptions}.
 * @hide
@@ -56,32 +57,6 @@ public class ComponentOptions {
    private @Nullable Boolean mPendingIntentBalAllowed = null;
    private boolean mPendingIntentBalAllowedByPermission = false;

    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(prefix = {"MODE_BACKGROUND_ACTIVITY_START_"}, value = {
            MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED,
            MODE_BACKGROUND_ACTIVITY_START_ALLOWED,
            MODE_BACKGROUND_ACTIVITY_START_DENIED})
    public @interface BackgroundActivityStartMode {}
    /**
     * No explicit value chosen. The system will decide whether to grant privileges.
     * @hide
     */
    @TestApi
    public static final int MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED = 0;
    /**
     * Allow the {@link PendingIntent} to use the background activity start privileges.
     * @hide
     */
    @TestApi
    public static final int MODE_BACKGROUND_ACTIVITY_START_ALLOWED = 1;
    /**
     * Deny the {@link PendingIntent} to use the background activity start privileges.
     * @hide
     */
    @TestApi
    public static final int MODE_BACKGROUND_ACTIVITY_START_DENIED = 2;

    ComponentOptions() {
    }

+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ package com.android.systemui.controls.ui

import android.app.Activity
import android.app.ActivityOptions
import android.app.ComponentOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED
import android.app.ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED
import android.app.Dialog
import android.app.PendingIntent
import android.content.ComponentName
Loading