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

Commit e79bdaef authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "settings(payments): Use newly exposed formal API for...

Merge "settings(payments): Use newly exposed formal API for CardEmulation.getServices()" into main am: 85ca373e am: 3521df9d

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/2810325



Change-Id: Ic739f9650dcfe638521dc0488c397ef9b8fa5ea7
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 20349c8e 3521df9d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ android_library {
        "res-product",
    ],
    static_libs: [
        "android.nfc.flags-aconfig-java",
        "androidx-constraintlayout_constraintlayout",
        "androidx.slice_slice-builders",
        "androidx.slice_slice-core",
+12 −1
Original line number Diff line number Diff line
@@ -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;