Merge "nfc: Migrate away from @hide getIntForUser"

This commit is contained in:
Treehugger Robot
2023-02-10 22:13:43 +00:00
committed by Gerrit Code Review

View File

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