nfc: Migrate away from @hide getIntForUser

Bug: 244264995
Test: Compiles
Change-Id: I50c79e4da929a431c91887278fbe42653c52c74f
This commit is contained in:
Roshan Pius
2023-02-09 11:16:46 -08:00
parent bff6b3b979
commit 8ef8e4ea24

View File

@@ -265,12 +265,16 @@ public final class CardEmulation {
* @return whether AIDs in the category can be handled by a service
* specified by the foreground app.
*/
@SuppressWarnings("NonUserGetterCalled")
public boolean categoryAllowsForegroundPreference(String category) {
if (CATEGORY_PAYMENT.equals(category)) {
boolean preferForeground = false;
Context contextAsUser = mContext.createContextAsUser(
UserHandle.of(UserHandle.myUserId()), 0);
try {
preferForeground = Settings.Secure.getIntForUser(mContext.getContentResolver(),
Settings.Secure.NFC_PAYMENT_FOREGROUND, UserHandle.myUserId()) != 0;
preferForeground = Settings.Secure.getInt(
contextAsUser.getContentResolver(),
Settings.Secure.NFC_PAYMENT_FOREGROUND) != 0;
} catch (SettingNotFoundException e) {
}
return preferForeground;