Merge changes from topic "nfc_workprofile" am: 2740c2f009
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1856335 Change-Id: If86eaccf96acc4b1135b8795ec1b2d86c28fa148
This commit is contained in:
@@ -27413,6 +27413,7 @@ package android.nfc.cardemulation {
|
|||||||
field public static final String CATEGORY_PAYMENT = "payment";
|
field public static final String CATEGORY_PAYMENT = "payment";
|
||||||
field public static final String EXTRA_CATEGORY = "category";
|
field public static final String EXTRA_CATEGORY = "category";
|
||||||
field public static final String EXTRA_SERVICE_COMPONENT = "component";
|
field public static final String EXTRA_SERVICE_COMPONENT = "component";
|
||||||
|
field public static final String EXTRA_USERID = "android.nfc.cardemulation.extra.USERID";
|
||||||
field public static final int SELECTION_MODE_ALWAYS_ASK = 1; // 0x1
|
field public static final int SELECTION_MODE_ALWAYS_ASK = 1; // 0x1
|
||||||
field public static final int SELECTION_MODE_ASK_IF_CONFLICT = 2; // 0x2
|
field public static final int SELECTION_MODE_ASK_IF_CONFLICT = 2; // 0x2
|
||||||
field public static final int SELECTION_MODE_PREFER_DEFAULT = 0; // 0x0
|
field public static final int SELECTION_MODE_PREFER_DEFAULT = 0; // 0x0
|
||||||
|
|||||||
@@ -528,6 +528,7 @@ public final class ApduServiceInfo implements Parcelable {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder out = new StringBuilder("ApduService: ");
|
StringBuilder out = new StringBuilder("ApduService: ");
|
||||||
out.append(getComponent());
|
out.append(getComponent());
|
||||||
|
out.append(", UID: " + mUid);
|
||||||
out.append(", description: " + mDescription);
|
out.append(", description: " + mDescription);
|
||||||
out.append(", Static AID Groups: ");
|
out.append(", Static AID Groups: ");
|
||||||
for (AidGroup aidGroup : mStaticAidGroups.values()) {
|
for (AidGroup aidGroup : mStaticAidGroups.values()) {
|
||||||
@@ -546,7 +547,8 @@ public final class ApduServiceInfo implements Parcelable {
|
|||||||
if (!(o instanceof ApduServiceInfo)) return false;
|
if (!(o instanceof ApduServiceInfo)) return false;
|
||||||
ApduServiceInfo thatService = (ApduServiceInfo) o;
|
ApduServiceInfo thatService = (ApduServiceInfo) o;
|
||||||
|
|
||||||
return thatService.getComponent().equals(this.getComponent());
|
return thatService.getComponent().equals(this.getComponent())
|
||||||
|
&& thatService.getUid() == this.getUid();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -619,8 +621,9 @@ public final class ApduServiceInfo implements Parcelable {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||||
pw.println(" " + getComponent() +
|
pw.println(" " + getComponent()
|
||||||
" (Description: " + getDescription() + ")");
|
+ " (Description: " + getDescription() + ")"
|
||||||
|
+ " (UID: " + getUid() + ")");
|
||||||
if (mOnHost) {
|
if (mOnHost) {
|
||||||
pw.println(" On Host Service");
|
pw.println(" On Host Service");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import android.content.pm.PackageManager;
|
|||||||
import android.nfc.INfcCardEmulation;
|
import android.nfc.INfcCardEmulation;
|
||||||
import android.nfc.NfcAdapter;
|
import android.nfc.NfcAdapter;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.provider.Settings.SettingNotFoundException;
|
import android.provider.Settings.SettingNotFoundException;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -82,6 +83,13 @@ public final class CardEmulation {
|
|||||||
*/
|
*/
|
||||||
public static final String EXTRA_SERVICE_COMPONENT = "component";
|
public static final String EXTRA_SERVICE_COMPONENT = "component";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The caller userId extra for {@link #ACTION_CHANGE_DEFAULT}.
|
||||||
|
*
|
||||||
|
* @see #ACTION_CHANGE_DEFAULT
|
||||||
|
*/
|
||||||
|
public static final String EXTRA_USERID = "android.nfc.cardemulation.extra.USERID";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Category used for NFC payment services.
|
* Category used for NFC payment services.
|
||||||
*/
|
*/
|
||||||
@@ -269,8 +277,8 @@ public final class CardEmulation {
|
|||||||
if (CATEGORY_PAYMENT.equals(category)) {
|
if (CATEGORY_PAYMENT.equals(category)) {
|
||||||
boolean preferForeground = false;
|
boolean preferForeground = false;
|
||||||
try {
|
try {
|
||||||
preferForeground = Settings.Secure.getInt(mContext.getContentResolver(),
|
preferForeground = Settings.Secure.getIntForUser(mContext.getContentResolver(),
|
||||||
Settings.Secure.NFC_PAYMENT_FOREGROUND) != 0;
|
Settings.Secure.NFC_PAYMENT_FOREGROUND, UserHandle.myUserId()) != 0;
|
||||||
} catch (SettingNotFoundException e) {
|
} catch (SettingNotFoundException e) {
|
||||||
}
|
}
|
||||||
return preferForeground;
|
return preferForeground;
|
||||||
@@ -826,6 +834,28 @@ public final class CardEmulation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public boolean setDefaultForNextTap(int userId, ComponentName service) {
|
||||||
|
try {
|
||||||
|
return sService.setDefaultForNextTap(userId, service);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
// Try one more time
|
||||||
|
recoverService();
|
||||||
|
if (sService == null) {
|
||||||
|
Log.e(TAG, "Failed to recover CardEmulationService.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return sService.setDefaultForNextTap(userId, service);
|
||||||
|
} catch (RemoteException ee) {
|
||||||
|
Log.e(TAG, "Failed to reach CardEmulationService.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@@ -848,6 +878,28 @@ public final class CardEmulation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public List<ApduServiceInfo> getServices(String category, int userId) {
|
||||||
|
try {
|
||||||
|
return sService.getServices(userId, category);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
// Try one more time
|
||||||
|
recoverService();
|
||||||
|
if (sService == null) {
|
||||||
|
Log.e(TAG, "Failed to recover CardEmulationService.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return sService.getServices(userId, category);
|
||||||
|
} catch (RemoteException ee) {
|
||||||
|
Log.e(TAG, "Failed to reach CardEmulationService.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A valid AID according to ISO/IEC 7816-4:
|
* A valid AID according to ISO/IEC 7816-4:
|
||||||
* <ul>
|
* <ul>
|
||||||
|
|||||||
Reference in New Issue
Block a user