Merge "settings(payments): Use newly exposed formal API for CardEmulation.getServices()" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
418f3ef6b9
@@ -75,6 +75,7 @@ android_library {
|
||||
"android.hardware.dumpstate-V1-java",
|
||||
"android.hardware.dumpstate-V1.0-java",
|
||||
"android.hardware.dumpstate-V1.1-java",
|
||||
"android.nfc.flags-aconfig-java",
|
||||
"net-utils-framework-common",
|
||||
"notification_flags_lib",
|
||||
"securebox",
|
||||
|
@@ -17,8 +17,10 @@
|
||||
package com.android.settings.applications.specialaccess;
|
||||
|
||||
import android.content.Context;
|
||||
import android.nfc.Flags;
|
||||
import android.nfc.NfcAdapter;
|
||||
import android.nfc.cardemulation.CardEmulation;
|
||||
import android.os.UserHandle;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
@@ -64,12 +66,21 @@ public class PaymentSettingsEnabler extends BaseNfcEnabler {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasAnyServices() {
|
||||
if (Flags.enableNfcMainline()) {
|
||||
return mCardEmuManager.getServices(
|
||||
CardEmulation.CATEGORY_PAYMENT, UserHandle.myUserId()).isEmpty();
|
||||
} else {
|
||||
return mCardEmuManager.getServices(CardEmulation.CATEGORY_PAYMENT).isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resume() {
|
||||
if (!isNfcAvailable()) {
|
||||
return;
|
||||
}
|
||||
if (mCardEmuManager.getServices(CardEmulation.CATEGORY_PAYMENT).isEmpty()) {
|
||||
if (hasAnyServices()) {
|
||||
mIsPaymentAvailable = false;
|
||||
} else {
|
||||
mIsPaymentAvailable = true;
|
||||
|
Reference in New Issue
Block a user