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

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

Merge "Allow BAL from CredentialManager" into main

parents 81ccf309 a86a7bbf
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.IntentSender;
import android.os.Binder;
import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.IBinder;
import android.os.ICancellationSignal;
@@ -58,6 +59,9 @@ import java.util.concurrent.Executor;
@SystemService(Context.CREDENTIAL_SERVICE)
public final class CredentialManager {
    private static final String TAG = "CredentialManager";
    private static final Bundle OPTIONS_SENDER_BAL_OPTIN = ActivityOptions.makeBasic()
            .setPendingIntentBackgroundActivityStartMode(
                    ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED).toBundle();

    /** @hide */
    @IntDef(
@@ -757,9 +761,7 @@ public final class CredentialManager {
        public void onPendingIntent(PendingIntent pendingIntent) {
            try {
                mContext.startIntentSender(pendingIntent.getIntentSender(), null, 0, 0, 0,
                        ActivityOptions.makeBasic()
                            .setPendingIntentBackgroundActivityStartMode(
                                ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED).toBundle());
                        OPTIONS_SENDER_BAL_OPTIN);
            } catch (IntentSender.SendIntentException e) {
                Log.e(
                        TAG,
@@ -817,7 +819,8 @@ public final class CredentialManager {
        @Override
        public void onPendingIntent(PendingIntent pendingIntent) {
            try {
                mContext.startIntentSender(pendingIntent.getIntentSender(), null, 0, 0, 0);
                mContext.startIntentSender(pendingIntent.getIntentSender(), null, 0, 0, 0,
                        OPTIONS_SENDER_BAL_OPTIN);
            } catch (IntentSender.SendIntentException e) {
                Log.e(
                        TAG,
+10 −2
Original line number Diff line number Diff line
@@ -22,9 +22,11 @@ import android.annotation.CallbackExecutor;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.app.ActivityOptions;
import android.app.PendingIntent;
import android.content.Context;
import android.content.IntentSender;
import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.OutcomeReceiver;
import android.util.Log;
@@ -41,6 +43,10 @@ import java.util.concurrent.Executor;
 */
public final class PrepareGetCredentialResponse {

    private static final Bundle OPTIONS_SENDER_BAL_OPTIN = ActivityOptions.makeBasic()
            .setPendingIntentBackgroundActivityStartMode(
                    ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED).toBundle();

    /**
     * A handle that represents a pending get-credential operation. Pass this handle to {@link
     * CredentialManager#getCredential(Context, PendingGetCredentialHandle, CancellationSignal,
@@ -80,7 +86,8 @@ public final class PrepareGetCredentialResponse {
                @Override
                public void onPendingIntent(PendingIntent pendingIntent) {
                    try {
                        context.startIntentSender(pendingIntent.getIntentSender(), null, 0, 0, 0);
                        context.startIntentSender(pendingIntent.getIntentSender(), null, 0, 0, 0,
                                OPTIONS_SENDER_BAL_OPTIN);
                    } catch (IntentSender.SendIntentException e) {
                        Log.e(TAG, "startIntentSender() failed for intent for show()", e);
                        executor.execute(() -> callback.onError(
@@ -101,7 +108,8 @@ public final class PrepareGetCredentialResponse {
            });

            try {
                context.startIntentSender(mPendingIntent.getIntentSender(), null, 0, 0, 0);
                context.startIntentSender(mPendingIntent.getIntentSender(), null, 0, 0, 0,
                        OPTIONS_SENDER_BAL_OPTIN);
            } catch (IntentSender.SendIntentException e) {
                Log.e(TAG, "startIntentSender() failed for intent for show()", e);
                executor.execute(() -> callback.onError(