Loading nfc/api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ package android.nfc { 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.permission.flags.wallet_role_enabled") @Nullable @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) public static android.content.ComponentName getPreferredPaymentService(@NonNull android.content.Context); method @FlaggedApi("android.nfc.enable_nfc_mainline") @NonNull public java.util.List<android.nfc.cardemulation.ApduServiceInfo> getServices(@NonNull String, int); } Loading nfc/java/android/nfc/cardemulation/CardEmulation.java +17 −18 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.nfc.cardemulation; import android.Manifest; import android.annotation.FlaggedApi; import android.annotation.NonNull; import android.annotation.Nullable; Loading @@ -23,6 +24,7 @@ import android.annotation.RequiresPermission; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SystemApi; import android.annotation.UserHandleAware; import android.annotation.UserIdInt; import android.app.Activity; import android.content.ComponentName; Loading Loading @@ -1138,31 +1140,28 @@ public final class CardEmulation { } /** * Returns the {@link Settings.Secure#NFC_PAYMENT_DEFAULT_COMPONENT} for the given user. * Returns the value of {@link Settings.Secure#NFC_PAYMENT_DEFAULT_COMPONENT}. * * @param context A context * @return A ComponentName for the setting value, or null. * * @hide */ @SystemApi @UserHandleAware @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) @SuppressWarnings("AndroidFrameworkClientSidePermissionCheck") @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."); public static ComponentName getPreferredPaymentService(@NonNull Context context) { context.checkCallingOrSelfPermission(Manifest.permission.NFC_PREFERRED_PAYMENT_INFO); String defaultPaymentComponent = Settings.Secure.getString(context.getContentResolver(), Constants.SETTINGS_SECURE_NFC_PAYMENT_DEFAULT_COMPONENT); if (defaultPaymentComponent == null) { return null; } } } return ComponentName.unflattenFromString(defaultPaymentComponent); } } Loading
nfc/api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ package android.nfc { 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.permission.flags.wallet_role_enabled") @Nullable @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) public static android.content.ComponentName getPreferredPaymentService(@NonNull android.content.Context); method @FlaggedApi("android.nfc.enable_nfc_mainline") @NonNull public java.util.List<android.nfc.cardemulation.ApduServiceInfo> getServices(@NonNull String, int); } Loading
nfc/java/android/nfc/cardemulation/CardEmulation.java +17 −18 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.nfc.cardemulation; import android.Manifest; import android.annotation.FlaggedApi; import android.annotation.NonNull; import android.annotation.Nullable; Loading @@ -23,6 +24,7 @@ import android.annotation.RequiresPermission; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SystemApi; import android.annotation.UserHandleAware; import android.annotation.UserIdInt; import android.app.Activity; import android.content.ComponentName; Loading Loading @@ -1138,31 +1140,28 @@ public final class CardEmulation { } /** * Returns the {@link Settings.Secure#NFC_PAYMENT_DEFAULT_COMPONENT} for the given user. * Returns the value of {@link Settings.Secure#NFC_PAYMENT_DEFAULT_COMPONENT}. * * @param context A context * @return A ComponentName for the setting value, or null. * * @hide */ @SystemApi @UserHandleAware @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) @SuppressWarnings("AndroidFrameworkClientSidePermissionCheck") @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."); public static ComponentName getPreferredPaymentService(@NonNull Context context) { context.checkCallingOrSelfPermission(Manifest.permission.NFC_PREFERRED_PAYMENT_INFO); String defaultPaymentComponent = Settings.Secure.getString(context.getContentResolver(), Constants.SETTINGS_SECURE_NFC_PAYMENT_DEFAULT_COMPONENT); if (defaultPaymentComponent == null) { return null; } } } return ComponentName.unflattenFromString(defaultPaymentComponent); } }