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

Commit 6d4329cf authored by Omer Ozer's avatar Omer Ozer
Browse files

Add config flag for wallet role and

make nfc default component a system api
so that it's accessible in the permissions
module. Deprecate CardEmulation:Action_CHANGE_DEFAULT.

API-Coverage-Bug: 316635253
Bug: 283989236
Bug: 315194263
Test: local
Change-Id: I6661d6098eb122e54101e8e161f591516d4f2510
parent a5813cbe
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -28956,7 +28956,7 @@ package android.nfc.cardemulation {
    method public boolean supportsAidPrefixRegistration();
    method @NonNull @RequiresPermission(android.Manifest.permission.NFC) public boolean unsetOffHostForService(@NonNull android.content.ComponentName);
    method public boolean unsetPreferredService(android.app.Activity);
    field public static final String ACTION_CHANGE_DEFAULT = "android.nfc.cardemulation.action.ACTION_CHANGE_DEFAULT";
    field @Deprecated public static final String ACTION_CHANGE_DEFAULT = "android.nfc.cardemulation.action.ACTION_CHANGE_DEFAULT";
    field public static final String CATEGORY_OTHER = "other";
    field public static final String CATEGORY_PAYMENT = "payment";
    field public static final String EXTRA_CATEGORY = "category";
+2 −0
Original line number Diff line number Diff line
@@ -475,6 +475,7 @@ package android {
    field public static final int config_defaultNotes = 17039429; // 0x1040045
    field @FlaggedApi("android.permission.flags.retail_demo_role_enabled") public static final int config_defaultRetailDemo;
    field public static final int config_defaultSms = 17039396; // 0x1040024
    field @FlaggedApi("android.permission.flags.wallet_role_enabled") public static final int config_defaultWallet;
    field public static final int config_devicePolicyManagement = 17039421; // 0x104003d
    field public static final int config_feedbackIntentExtraKey = 17039391; // 0x104001f
    field public static final int config_feedbackIntentNameKey = 17039392; // 0x1040020
@@ -9967,6 +9968,7 @@ package android.nfc.cardemulation {
  }
  public final class CardEmulation {
    method @FlaggedApi("android.permission.flags.wallet_role_enabled") @Nullable @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) public android.nfc.cardemulation.ApduServiceInfo getPreferredPaymentService();
    method @FlaggedApi("android.nfc.enable_nfc_mainline") @NonNull public java.util.List<android.nfc.cardemulation.ApduServiceInfo> getServices(@NonNull String, int);
  }
+2 −2
Original line number Diff line number Diff line
@@ -812,8 +812,8 @@ public final class NfcAdapter {
        if (context == null) {
            throw new IllegalArgumentException("context cannot be null");
        }
        context = context.getApplicationContext();
        if (context == null) {
        Context applicationContext = context.getApplicationContext();
        if (applicationContext == null) {
            throw new IllegalArgumentException(
                    "context not associated with any application (using a mock context?)");
        }
+33 −0
Original line number Diff line number Diff line
@@ -69,7 +69,12 @@ public final class CardEmulation {
     * specified in {@link #EXTRA_CATEGORY}. There is an optional
     * extra field using {@link Intent#EXTRA_USER} to specify
     * the {@link UserHandle} of the user that owns the app.
     *
     * @deprecated Please use {@link android.app.role.RoleManager#createRequestRoleIntent(String)}
     * with {@link android.app.role.RoleManager#ROLE_WALLET} parameter
     * and {@link Activity#startActivityForResult(Intent, int)} instead.
     */
    @Deprecated
    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    public static final String ACTION_CHANGE_DEFAULT =
            "android.nfc.cardemulation.action.ACTION_CHANGE_DEFAULT";
@@ -1084,4 +1089,32 @@ public final class CardEmulation {
        sService = adapter.getCardEmulationService();
    }

    /**
     * Returns the {@link Settings.Secure#NFC_PAYMENT_DEFAULT_COMPONENT} for the given user.
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO)
    @FlaggedApi(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
    @Nullable
    public ApduServiceInfo getPreferredPaymentService() {
        try {
            return sService.getPreferredPaymentService(mContext.getUser().getIdentifier());
        } catch (RemoteException e) {
            // Try one more time
            recoverService();
            if (sService == null) {
                Log.e(TAG, "Failed to recover CardEmulationService.");
                return null;
            }
            try {
                return sService.getPreferredPaymentService(mContext.getUser().getIdentifier());
            } catch (RemoteException ee) {
                Log.e(TAG, "Failed to reach CardEmulationService.");
                return null;
            }
        }
    }

}
+7 −0
Original line number Diff line number Diff line
@@ -71,3 +71,10 @@ flag {
    description: "default retail demo role holder"
    bug: "274132354"
}

flag {
    name: "wallet_role_enabled"
    namespace: "wallet_integration"
    description: "This flag is used to enabled the Wallet Role for all users on the device"
    bug: "283989236"
}
Loading