Merge "settings(payments): Use newly exposed formal API for CardEmulation.getServices()" into main am: 85ca373e75
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/2810325 Change-Id: I0ac76dbfb034e1a9856b231aa59b3ec0197914d8 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -61,6 +61,7 @@ android_library {
|
|||||||
"res-product",
|
"res-product",
|
||||||
],
|
],
|
||||||
static_libs: [
|
static_libs: [
|
||||||
|
"android.nfc.flags-aconfig-java",
|
||||||
"androidx-constraintlayout_constraintlayout",
|
"androidx-constraintlayout_constraintlayout",
|
||||||
"androidx.slice_slice-builders",
|
"androidx.slice_slice-builders",
|
||||||
"androidx.slice_slice-core",
|
"androidx.slice_slice-core",
|
||||||
|
@@ -17,8 +17,10 @@
|
|||||||
package com.android.settings.applications.specialaccess;
|
package com.android.settings.applications.specialaccess;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.nfc.Flags;
|
||||||
import android.nfc.NfcAdapter;
|
import android.nfc.NfcAdapter;
|
||||||
import android.nfc.cardemulation.CardEmulation;
|
import android.nfc.cardemulation.CardEmulation;
|
||||||
|
import android.os.UserHandle;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
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
|
@Override
|
||||||
public void resume() {
|
public void resume() {
|
||||||
if (!isNfcAvailable()) {
|
if (!isNfcAvailable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mCardEmuManager.getServices(CardEmulation.CATEGORY_PAYMENT).isEmpty()) {
|
if (hasAnyServices()) {
|
||||||
mIsPaymentAvailable = false;
|
mIsPaymentAvailable = false;
|
||||||
} else {
|
} else {
|
||||||
mIsPaymentAvailable = true;
|
mIsPaymentAvailable = true;
|
||||||
|
Reference in New Issue
Block a user