NFC support in work profile
Configure NFC payment settings based on userId. Bug: 202367033 Test: mauanl tests Change-Id: I97e275f374d34618b64188d5de185ec6c527e0fd
This commit is contained in:
@@ -20,6 +20,7 @@ import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.nfc.NfcAdapter;
|
||||
import android.os.UserManager;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -127,7 +128,10 @@ public class NfcPaymentPreferenceController extends BasePreferenceController imp
|
||||
public CharSequence getSummary() {
|
||||
final PaymentAppInfo defaultApp = mPaymentBackend.getDefaultApp();
|
||||
if (defaultApp != null) {
|
||||
return defaultApp.label;
|
||||
UserManager um = mContext.createContextAsUser(
|
||||
defaultApp.userHandle, /*flags=*/0).getSystemService(UserManager.class);
|
||||
|
||||
return defaultApp.label + " (" + um.getUserName() + ")";
|
||||
} else {
|
||||
return mContext.getText(R.string.nfc_payment_default_not_set);
|
||||
}
|
||||
@@ -218,12 +222,15 @@ public class NfcPaymentPreferenceController extends BasePreferenceController imp
|
||||
}
|
||||
|
||||
// Prevent checked callback getting called on recycled views
|
||||
UserManager um = mContext.createContextAsUser(
|
||||
appInfo.userHandle, /*flags=*/0).getSystemService(UserManager.class);
|
||||
|
||||
holder.radioButton.setOnCheckedChangeListener(null);
|
||||
holder.radioButton.setChecked(appInfo.isDefault);
|
||||
holder.radioButton.setContentDescription(appInfo.label);
|
||||
holder.radioButton.setContentDescription(appInfo.label + " (" + um.getUserName() + ")");
|
||||
holder.radioButton.setOnCheckedChangeListener(this);
|
||||
holder.radioButton.setTag(appInfo);
|
||||
holder.radioButton.setText(appInfo.label);
|
||||
holder.radioButton.setText(appInfo.label + " (" + um.getUserName() + ")");
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@@ -245,7 +252,8 @@ public class NfcPaymentPreferenceController extends BasePreferenceController imp
|
||||
|
||||
private void makeDefault(PaymentAppInfo appInfo) {
|
||||
if (!appInfo.isDefault) {
|
||||
mPaymentBackend.setDefaultPaymentApp(appInfo.componentName);
|
||||
mPaymentBackend.setDefaultPaymentApp(appInfo.componentName,
|
||||
appInfo.userHandle.getIdentifier());
|
||||
}
|
||||
final Dialog dialog = mPreference.getDialog();
|
||||
if (dialog != null) {
|
||||
|
Reference in New Issue
Block a user