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

Commit 4ba7833e authored by Charles Wang's avatar Charles Wang
Browse files

Add new APIs for launching Wallet on power double tap.

Adds a new API method to QuickAccessWalletService: the method returns a
PendingIntent which can be sent when double tap gesture is detected.

Test: atest QuickAccessWalletClientTest
Bug: 378469025
Flag: android.service.quickaccesswallet.launch_wallet_option_on_power_double_tap

Change-Id: I2777f0e9e16fc7ab7e7c216cdeaa4a74db95dbaf
parent 113037ed
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -41973,6 +41973,7 @@ package android.service.quickaccesswallet {
  public abstract class QuickAccessWalletService extends android.app.Service {
    ctor public QuickAccessWalletService();
    method @FlaggedApi("android.service.quickaccesswallet.launch_wallet_option_on_power_double_tap") @Nullable public android.app.PendingIntent getGestureTargetActivityPendingIntent();
    method @Nullable public android.app.PendingIntent getTargetActivityPendingIntent();
    method @Nullable public android.os.IBinder onBind(@NonNull android.content.Intent);
    method public abstract void onWalletCardSelected(@NonNull android.service.quickaccesswallet.SelectWalletCardRequest);
+5 −0
Original line number Diff line number Diff line
@@ -3217,6 +3217,7 @@ package android.service.quickaccesswallet {
    method @Nullable public android.content.Intent createWalletIntent();
    method @Nullable public android.content.Intent createWalletSettingsIntent();
    method public void disconnect();
    method @FlaggedApi("android.service.quickaccesswallet.launch_wallet_option_on_power_double_tap") public void getGestureTargetActivityPendingIntent(@NonNull java.util.concurrent.Executor, @NonNull android.service.quickaccesswallet.QuickAccessWalletClient.GesturePendingIntentCallback);
    method public void getWalletCards(@NonNull android.service.quickaccesswallet.GetWalletCardsRequest, @NonNull android.service.quickaccesswallet.QuickAccessWalletClient.OnWalletCardsRetrievedCallback);
    method public void getWalletCards(@NonNull java.util.concurrent.Executor, @NonNull android.service.quickaccesswallet.GetWalletCardsRequest, @NonNull android.service.quickaccesswallet.QuickAccessWalletClient.OnWalletCardsRetrievedCallback);
    method public void getWalletPendingIntent(@NonNull java.util.concurrent.Executor, @NonNull android.service.quickaccesswallet.QuickAccessWalletClient.WalletPendingIntentCallback);
@@ -3228,6 +3229,10 @@ package android.service.quickaccesswallet {
    method public void selectWalletCard(@NonNull android.service.quickaccesswallet.SelectWalletCardRequest);
  }

  @FlaggedApi("android.service.quickaccesswallet.launch_wallet_option_on_power_double_tap") public static interface QuickAccessWalletClient.GesturePendingIntentCallback {
    method @FlaggedApi("android.service.quickaccesswallet.launch_wallet_option_on_power_double_tap") public void onGesturePendingIntentRetrieved(@Nullable android.app.PendingIntent);
  }

  public static interface QuickAccessWalletClient.OnWalletCardsRetrievedCallback {
    method public void onWalletCardRetrievalError(@NonNull android.service.quickaccesswallet.GetWalletCardsError);
    method public void onWalletCardsRetrieved(@NonNull android.service.quickaccesswallet.GetWalletCardsResponse);
+2 −0
Original line number Diff line number Diff line
@@ -43,4 +43,6 @@ interface IQuickAccessWalletService {
    oneway void unregisterWalletServiceEventListener(in WalletServiceEventListenerRequest request);
    // Request to get a PendingIntent to launch an activity from which the user can manage their cards.
    oneway void onTargetActivityIntentRequested(in IQuickAccessWalletServiceCallbacks callbacks);
    // Request to get a PendingIntent to launch an activity, triggered when the user performs a gesture.
    oneway void onGestureTargetActivityIntentRequested(in IQuickAccessWalletServiceCallbacks callbacks);
   }
 No newline at end of file
+2 −0
Original line number Diff line number Diff line
@@ -37,4 +37,6 @@ interface IQuickAccessWalletServiceCallbacks {
    oneway void onWalletServiceEvent(in WalletServiceEvent event);
    // Called in response to onTargetActivityIntentRequested. May only be called once per request.
    oneway void onTargetActivityPendingIntentReceived(in PendingIntent pendingIntent);
    //Called in response to onGesturePendingIntent
    oneway void onGestureTargetActivityPendingIntentReceived(in PendingIntent pendingIntent);
}
 No newline at end of file
+18 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.service.quickaccesswallet;

import android.annotation.CallbackExecutor;
import android.annotation.FlaggedApi;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.TestApi;
@@ -180,6 +181,23 @@ public interface QuickAccessWalletClient extends Closeable {
        void onWalletPendingIntentRetrieved(@Nullable PendingIntent walletPendingIntent);
    }

    /**
     * Gets the {@link PendingIntent} provided by QuickAccessWalletService to be sent when the user
     * launches Wallet via gesture.
     */
    @FlaggedApi(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP)
    void getGestureTargetActivityPendingIntent(
            @NonNull @CallbackExecutor Executor executor,
            @NonNull GesturePendingIntentCallback gesturePendingIntentCallback);

    /** Callback interface for getGesturePendingIntent. */
    @FlaggedApi(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP)
    interface GesturePendingIntentCallback {
        /** Callback method for getGesturePendingIntent */
        @FlaggedApi(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP)
        void onGesturePendingIntentRetrieved(@Nullable PendingIntent pendingIntent);
    }

    /**
     * The manifest entry for the QuickAccessWalletService may also publish information about the
     * activity that hosts the Wallet view. This is typically the home screen of the Wallet
Loading