Skip to content
Snippets Groups Projects
Commit 517e8a3f authored by Roshan Pius's avatar Roshan Pius Committed by Android Build Cherrypicker Worker
Browse files

nfc(api): Use settings key and feature string since the API is @hide

Temporary change for creating framework-nfc.jar, need to formalize the
API.

Bug: 303286040
Test: Compiles
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:34eab749beb70d56cf87da73426240586ebc1ec3)
Merged-In: Iecbf1b58ee2305c509da9c90cd421ee0cb91d379
Change-Id: Iecbf1b58ee2305c509da9c90cd421ee0cb91d379
parent d93418c1
No related branches found
No related tags found
No related merge requests found
/*
* Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.nfc;
/**
* @hide
* TODO(b/303286040): Holds @hide API constants. Formalize these APIs.
*/
public final class Constants {
private Constants() { }
public static final String SETTINGS_SECURE_NFC_PAYMENT_FOREGROUND = "nfc_payment_foreground";
public static final String SETTINGS_SECURE_NFC_PAYMENT_DEFAULT_COMPONENT = "nfc_payment_default_component";
public static final String FEATURE_NFC_ANY = "android.hardware.nfc.any";
}
......@@ -26,6 +26,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.nfc.Constants;
import android.nfc.INfcCardEmulation;
import android.nfc.NfcAdapter;
import android.os.RemoteException;
......@@ -274,7 +275,7 @@ public final class CardEmulation {
try {
preferForeground = Settings.Secure.getInt(
contextAsUser.getContentResolver(),
Settings.Secure.NFC_PAYMENT_FOREGROUND) != 0;
Constants.SETTINGS_SECURE_NFC_PAYMENT_FOREGROUND) != 0;
} catch (SettingNotFoundException e) {
}
return preferForeground;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment