Loading api/current.txt +3 −13 Original line number Original line Diff line number Diff line Loading @@ -17647,25 +17647,15 @@ package android.nfc { package android.nfc.cardemulation { package android.nfc.cardemulation { public final class AidGroup implements android.os.Parcelable { ctor public AidGroup(java.util.ArrayList<java.lang.String>, java.lang.String); method public int describeContents(); method public java.util.ArrayList<java.lang.String> getAids(); method public java.lang.String getCategory(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator CREATOR; field public static final int MAX_NUM_AIDS = 256; // 0x100 } public final class CardEmulation { public final class CardEmulation { method public boolean categoryAllowsForegroundPreference(java.lang.String); method public boolean categoryAllowsForegroundPreference(java.lang.String); method public android.nfc.cardemulation.AidGroup getAidGroupForService(android.content.ComponentName, java.lang.String); method public java.util.List<java.lang.String> getAidsForService(android.content.ComponentName, java.lang.String); method public static synchronized android.nfc.cardemulation.CardEmulation getInstance(android.nfc.NfcAdapter); method public static synchronized android.nfc.cardemulation.CardEmulation getInstance(android.nfc.NfcAdapter); method public int getSelectionModeForCategory(java.lang.String); method public int getSelectionModeForCategory(java.lang.String); method public boolean isDefaultServiceForAid(android.content.ComponentName, java.lang.String); method public boolean isDefaultServiceForAid(android.content.ComponentName, java.lang.String); method public boolean isDefaultServiceForCategory(android.content.ComponentName, java.lang.String); method public boolean isDefaultServiceForCategory(android.content.ComponentName, java.lang.String); method public boolean registerAidGroupForService(android.content.ComponentName, android.nfc.cardemulation.AidGroup); method public boolean registerAidsForService(android.content.ComponentName, java.lang.String, java.util.List<java.lang.String>); method public boolean removeAidGroupForService(android.content.ComponentName, java.lang.String); method public boolean removeAidsForService(android.content.ComponentName, java.lang.String); method public boolean setPreferredService(android.app.Activity, android.content.ComponentName); method public boolean setPreferredService(android.app.Activity, android.content.ComponentName); method public boolean unsetPreferredService(android.app.Activity); method public boolean unsetPreferredService(android.app.Activity); field public static final java.lang.String ACTION_CHANGE_DEFAULT = "android.nfc.cardemulation.action.ACTION_CHANGE_DEFAULT"; field public static final java.lang.String ACTION_CHANGE_DEFAULT = "android.nfc.cardemulation.action.ACTION_CHANGE_DEFAULT"; core/java/android/nfc/cardemulation/AidGroup.java +6 −11 Original line number Original line Diff line number Diff line Loading @@ -2,6 +2,7 @@ package android.nfc.cardemulation; import java.io.IOException; import java.io.IOException; import java.util.ArrayList; import java.util.ArrayList; import java.util.List; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException; Loading @@ -21,6 +22,8 @@ import android.util.Log; * <p>The format of AIDs is defined in the ISO/IEC 7816-4 specification. This class * <p>The format of AIDs is defined in the ISO/IEC 7816-4 specification. This class * requires the AIDs to be input as a hexadecimal string, with an even amount of * requires the AIDs to be input as a hexadecimal string, with an even amount of * hexadecimal characters, e.g. "F014811481". * hexadecimal characters, e.g. "F014811481". * * @hide */ */ public final class AidGroup implements Parcelable { public final class AidGroup implements Parcelable { /** /** Loading @@ -30,7 +33,7 @@ public final class AidGroup implements Parcelable { static final String TAG = "AidGroup"; static final String TAG = "AidGroup"; final ArrayList<String> aids; final List<String> aids; final String category; final String category; final String description; final String description; Loading @@ -40,7 +43,7 @@ public final class AidGroup implements Parcelable { * @param aids The list of AIDs present in the group * @param aids The list of AIDs present in the group * @param category The category of this group, e.g. {@link CardEmulation#CATEGORY_PAYMENT} * @param category The category of this group, e.g. {@link CardEmulation#CATEGORY_PAYMENT} */ */ public AidGroup(ArrayList<String> aids, String category) { public AidGroup(List<String> aids, String category) { if (aids == null || aids.size() == 0) { if (aids == null || aids.size() == 0) { throw new IllegalArgumentException("No AIDS in AID group."); throw new IllegalArgumentException("No AIDS in AID group."); } } Loading Loading @@ -72,7 +75,7 @@ public final class AidGroup implements Parcelable { /** /** * @return the list of AIDs in this group * @return the list of AIDs in this group */ */ public ArrayList<String> getAids() { public List<String> getAids() { return aids; return aids; } } Loading Loading @@ -121,11 +124,6 @@ public final class AidGroup implements Parcelable { } } }; }; /** * @hide * Note: description is not serialized, since it's not localized * and resource identifiers don't make sense to persist. */ static public AidGroup createFromXml(XmlPullParser parser) throws XmlPullParserException, IOException { static public AidGroup createFromXml(XmlPullParser parser) throws XmlPullParserException, IOException { String category = parser.getAttributeValue(null, "category"); String category = parser.getAttributeValue(null, "category"); ArrayList<String> aids = new ArrayList<String>(); ArrayList<String> aids = new ArrayList<String>(); Loading @@ -152,9 +150,6 @@ public final class AidGroup implements Parcelable { } } } } /** * @hide */ public void writeAsXml(XmlSerializer out) throws IOException { public void writeAsXml(XmlSerializer out) throws IOException { out.attribute(null, "category", category); out.attribute(null, "category", category); for (String aid : aids) { for (String aid : aids) { Loading core/java/android/nfc/cardemulation/CardEmulation.java +30 −21 Original line number Original line Diff line number Diff line Loading @@ -303,12 +303,13 @@ public final class CardEmulation { } } /** /** * Registers a group of AIDs for the specified service. * Registers a list of AIDs for a specific category for the * specified service. * * * <p>If an AID group for that category was previously * <p>If a list of AIDs for that category was previously * registered for this service (either statically * registered for this service (either statically * through the manifest, or dynamically by using this API), * through the manifest, or dynamically by using this API), * that AID group will be replaced with this one. * that list of AIDs will be replaced with this one. * * * <p>Note that you can only register AIDs for a service that * <p>Note that you can only register AIDs for a service that * is running under the same UID as the caller of this API. Typically * is running under the same UID as the caller of this API. Typically Loading @@ -317,10 +318,13 @@ public final class CardEmulation { * be shared between packages using shared UIDs. * be shared between packages using shared UIDs. * * * @param service The component name of the service * @param service The component name of the service * @param aidGroup The group of AIDs to be registered * @param category The category of AIDs to be registered * @param aids A list containing the AIDs to be registered * @return whether the registration was successful. * @return whether the registration was successful. */ */ public boolean registerAidGroupForService(ComponentName service, AidGroup aidGroup) { public boolean registerAidsForService(ComponentName service, String category, List<String> aids) { AidGroup aidGroup = new AidGroup(aids, category); try { try { return sService.registerAidGroupForService(UserHandle.myUserId(), service, aidGroup); return sService.registerAidGroupForService(UserHandle.myUserId(), service, aidGroup); } catch (RemoteException e) { } catch (RemoteException e) { Loading @@ -341,21 +345,24 @@ public final class CardEmulation { } } /** /** * Retrieves the currently registered AID group for the specified * Retrieves the currently registered AIDs for the specified * category for a service. * category for a service. * * * <p>Note that this will only return AID groups that were dynamically * <p>Note that this will only return AIDs that were dynamically * registered using {@link #registerAidGroupForService(ComponentName, AidGroup)} * registered using {@link #registerAidsForService(ComponentName, String, List)} * method. It will *not* return AID groups that were statically registered * method. It will *not* return AIDs that were statically registered * in the manifest. * in the manifest. * * * @param service The component name of the service * @param service The component name of the service * @param category The category of the AID group to be returned, e.g. {@link #CATEGORY_PAYMENT} * @param category The category for which the AIDs were registered, * @return The AID group, or null if it couldn't be found * e.g. {@link #CATEGORY_PAYMENT} * @return The list of AIDs registered for this category, or null if it couldn't be found. */ */ public AidGroup getAidGroupForService(ComponentName service, String category) { public List<String> getAidsForService(ComponentName service, String category) { try { try { return sService.getAidGroupForService(UserHandle.myUserId(), service, category); AidGroup group = sService.getAidGroupForService(UserHandle.myUserId(), service, category); return (group != null ? group.getAids() : null); } catch (RemoteException e) { } catch (RemoteException e) { recoverService(); recoverService(); if (sService == null) { if (sService == null) { Loading @@ -363,7 +370,9 @@ public final class CardEmulation { return null; return null; } } try { try { return sService.getAidGroupForService(UserHandle.myUserId(), service, category); AidGroup group = sService.getAidGroupForService(UserHandle.myUserId(), service, category); return (group != null ? group.getAids() : null); } catch (RemoteException ee) { } catch (RemoteException ee) { Log.e(TAG, "Failed to recover CardEmulationService."); Log.e(TAG, "Failed to recover CardEmulationService."); return null; return null; Loading @@ -372,21 +381,21 @@ public final class CardEmulation { } } /** /** * Removes a registered AID group for the specified category for the * Removes a previously registered list of AIDs for the specified category for the * service provided. * service provided. * * * <p>Note that this will only remove AID groups that were dynamically * <p>Note that this will only remove AIDs that were dynamically * registered using the {@link #registerAidGroupForService(ComponentName, AidGroup)} * registered using the {@link #registerAidsForService(ComponentName, String, List)} * method. It will *not* remove AID groups that were statically registered in * method. It will *not* remove AIDs that were statically registered in * the manifest. If a dynamically registered AID group is removed using * the manifest. If dynamically registered AIDs are removed using * this method, and a statically registered AID group for the same category * this method, and a statically registered AID group for the same category * exists in the manifest, the static AID group will become active again. * exists in the manifest, the static AID group will become active again. * * * @param service The component name of the service * @param service The component name of the service * @param category The category of the AID group to be removed, e.g. {@link #CATEGORY_PAYMENT} * @param category The category of the AIDs to be removed, e.g. {@link #CATEGORY_PAYMENT} * @return whether the group was successfully removed. * @return whether the group was successfully removed. */ */ public boolean removeAidGroupForService(ComponentName service, String category) { public boolean removeAidsForService(ComponentName service, String category) { try { try { return sService.removeAidGroupForService(UserHandle.myUserId(), service, category); return sService.removeAidGroupForService(UserHandle.myUserId(), service, category); } catch (RemoteException e) { } catch (RemoteException e) { Loading Loading
api/current.txt +3 −13 Original line number Original line Diff line number Diff line Loading @@ -17647,25 +17647,15 @@ package android.nfc { package android.nfc.cardemulation { package android.nfc.cardemulation { public final class AidGroup implements android.os.Parcelable { ctor public AidGroup(java.util.ArrayList<java.lang.String>, java.lang.String); method public int describeContents(); method public java.util.ArrayList<java.lang.String> getAids(); method public java.lang.String getCategory(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator CREATOR; field public static final int MAX_NUM_AIDS = 256; // 0x100 } public final class CardEmulation { public final class CardEmulation { method public boolean categoryAllowsForegroundPreference(java.lang.String); method public boolean categoryAllowsForegroundPreference(java.lang.String); method public android.nfc.cardemulation.AidGroup getAidGroupForService(android.content.ComponentName, java.lang.String); method public java.util.List<java.lang.String> getAidsForService(android.content.ComponentName, java.lang.String); method public static synchronized android.nfc.cardemulation.CardEmulation getInstance(android.nfc.NfcAdapter); method public static synchronized android.nfc.cardemulation.CardEmulation getInstance(android.nfc.NfcAdapter); method public int getSelectionModeForCategory(java.lang.String); method public int getSelectionModeForCategory(java.lang.String); method public boolean isDefaultServiceForAid(android.content.ComponentName, java.lang.String); method public boolean isDefaultServiceForAid(android.content.ComponentName, java.lang.String); method public boolean isDefaultServiceForCategory(android.content.ComponentName, java.lang.String); method public boolean isDefaultServiceForCategory(android.content.ComponentName, java.lang.String); method public boolean registerAidGroupForService(android.content.ComponentName, android.nfc.cardemulation.AidGroup); method public boolean registerAidsForService(android.content.ComponentName, java.lang.String, java.util.List<java.lang.String>); method public boolean removeAidGroupForService(android.content.ComponentName, java.lang.String); method public boolean removeAidsForService(android.content.ComponentName, java.lang.String); method public boolean setPreferredService(android.app.Activity, android.content.ComponentName); method public boolean setPreferredService(android.app.Activity, android.content.ComponentName); method public boolean unsetPreferredService(android.app.Activity); method public boolean unsetPreferredService(android.app.Activity); field public static final java.lang.String ACTION_CHANGE_DEFAULT = "android.nfc.cardemulation.action.ACTION_CHANGE_DEFAULT"; field public static final java.lang.String ACTION_CHANGE_DEFAULT = "android.nfc.cardemulation.action.ACTION_CHANGE_DEFAULT";
core/java/android/nfc/cardemulation/AidGroup.java +6 −11 Original line number Original line Diff line number Diff line Loading @@ -2,6 +2,7 @@ package android.nfc.cardemulation; import java.io.IOException; import java.io.IOException; import java.util.ArrayList; import java.util.ArrayList; import java.util.List; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException; Loading @@ -21,6 +22,8 @@ import android.util.Log; * <p>The format of AIDs is defined in the ISO/IEC 7816-4 specification. This class * <p>The format of AIDs is defined in the ISO/IEC 7816-4 specification. This class * requires the AIDs to be input as a hexadecimal string, with an even amount of * requires the AIDs to be input as a hexadecimal string, with an even amount of * hexadecimal characters, e.g. "F014811481". * hexadecimal characters, e.g. "F014811481". * * @hide */ */ public final class AidGroup implements Parcelable { public final class AidGroup implements Parcelable { /** /** Loading @@ -30,7 +33,7 @@ public final class AidGroup implements Parcelable { static final String TAG = "AidGroup"; static final String TAG = "AidGroup"; final ArrayList<String> aids; final List<String> aids; final String category; final String category; final String description; final String description; Loading @@ -40,7 +43,7 @@ public final class AidGroup implements Parcelable { * @param aids The list of AIDs present in the group * @param aids The list of AIDs present in the group * @param category The category of this group, e.g. {@link CardEmulation#CATEGORY_PAYMENT} * @param category The category of this group, e.g. {@link CardEmulation#CATEGORY_PAYMENT} */ */ public AidGroup(ArrayList<String> aids, String category) { public AidGroup(List<String> aids, String category) { if (aids == null || aids.size() == 0) { if (aids == null || aids.size() == 0) { throw new IllegalArgumentException("No AIDS in AID group."); throw new IllegalArgumentException("No AIDS in AID group."); } } Loading Loading @@ -72,7 +75,7 @@ public final class AidGroup implements Parcelable { /** /** * @return the list of AIDs in this group * @return the list of AIDs in this group */ */ public ArrayList<String> getAids() { public List<String> getAids() { return aids; return aids; } } Loading Loading @@ -121,11 +124,6 @@ public final class AidGroup implements Parcelable { } } }; }; /** * @hide * Note: description is not serialized, since it's not localized * and resource identifiers don't make sense to persist. */ static public AidGroup createFromXml(XmlPullParser parser) throws XmlPullParserException, IOException { static public AidGroup createFromXml(XmlPullParser parser) throws XmlPullParserException, IOException { String category = parser.getAttributeValue(null, "category"); String category = parser.getAttributeValue(null, "category"); ArrayList<String> aids = new ArrayList<String>(); ArrayList<String> aids = new ArrayList<String>(); Loading @@ -152,9 +150,6 @@ public final class AidGroup implements Parcelable { } } } } /** * @hide */ public void writeAsXml(XmlSerializer out) throws IOException { public void writeAsXml(XmlSerializer out) throws IOException { out.attribute(null, "category", category); out.attribute(null, "category", category); for (String aid : aids) { for (String aid : aids) { Loading
core/java/android/nfc/cardemulation/CardEmulation.java +30 −21 Original line number Original line Diff line number Diff line Loading @@ -303,12 +303,13 @@ public final class CardEmulation { } } /** /** * Registers a group of AIDs for the specified service. * Registers a list of AIDs for a specific category for the * specified service. * * * <p>If an AID group for that category was previously * <p>If a list of AIDs for that category was previously * registered for this service (either statically * registered for this service (either statically * through the manifest, or dynamically by using this API), * through the manifest, or dynamically by using this API), * that AID group will be replaced with this one. * that list of AIDs will be replaced with this one. * * * <p>Note that you can only register AIDs for a service that * <p>Note that you can only register AIDs for a service that * is running under the same UID as the caller of this API. Typically * is running under the same UID as the caller of this API. Typically Loading @@ -317,10 +318,13 @@ public final class CardEmulation { * be shared between packages using shared UIDs. * be shared between packages using shared UIDs. * * * @param service The component name of the service * @param service The component name of the service * @param aidGroup The group of AIDs to be registered * @param category The category of AIDs to be registered * @param aids A list containing the AIDs to be registered * @return whether the registration was successful. * @return whether the registration was successful. */ */ public boolean registerAidGroupForService(ComponentName service, AidGroup aidGroup) { public boolean registerAidsForService(ComponentName service, String category, List<String> aids) { AidGroup aidGroup = new AidGroup(aids, category); try { try { return sService.registerAidGroupForService(UserHandle.myUserId(), service, aidGroup); return sService.registerAidGroupForService(UserHandle.myUserId(), service, aidGroup); } catch (RemoteException e) { } catch (RemoteException e) { Loading @@ -341,21 +345,24 @@ public final class CardEmulation { } } /** /** * Retrieves the currently registered AID group for the specified * Retrieves the currently registered AIDs for the specified * category for a service. * category for a service. * * * <p>Note that this will only return AID groups that were dynamically * <p>Note that this will only return AIDs that were dynamically * registered using {@link #registerAidGroupForService(ComponentName, AidGroup)} * registered using {@link #registerAidsForService(ComponentName, String, List)} * method. It will *not* return AID groups that were statically registered * method. It will *not* return AIDs that were statically registered * in the manifest. * in the manifest. * * * @param service The component name of the service * @param service The component name of the service * @param category The category of the AID group to be returned, e.g. {@link #CATEGORY_PAYMENT} * @param category The category for which the AIDs were registered, * @return The AID group, or null if it couldn't be found * e.g. {@link #CATEGORY_PAYMENT} * @return The list of AIDs registered for this category, or null if it couldn't be found. */ */ public AidGroup getAidGroupForService(ComponentName service, String category) { public List<String> getAidsForService(ComponentName service, String category) { try { try { return sService.getAidGroupForService(UserHandle.myUserId(), service, category); AidGroup group = sService.getAidGroupForService(UserHandle.myUserId(), service, category); return (group != null ? group.getAids() : null); } catch (RemoteException e) { } catch (RemoteException e) { recoverService(); recoverService(); if (sService == null) { if (sService == null) { Loading @@ -363,7 +370,9 @@ public final class CardEmulation { return null; return null; } } try { try { return sService.getAidGroupForService(UserHandle.myUserId(), service, category); AidGroup group = sService.getAidGroupForService(UserHandle.myUserId(), service, category); return (group != null ? group.getAids() : null); } catch (RemoteException ee) { } catch (RemoteException ee) { Log.e(TAG, "Failed to recover CardEmulationService."); Log.e(TAG, "Failed to recover CardEmulationService."); return null; return null; Loading @@ -372,21 +381,21 @@ public final class CardEmulation { } } /** /** * Removes a registered AID group for the specified category for the * Removes a previously registered list of AIDs for the specified category for the * service provided. * service provided. * * * <p>Note that this will only remove AID groups that were dynamically * <p>Note that this will only remove AIDs that were dynamically * registered using the {@link #registerAidGroupForService(ComponentName, AidGroup)} * registered using the {@link #registerAidsForService(ComponentName, String, List)} * method. It will *not* remove AID groups that were statically registered in * method. It will *not* remove AIDs that were statically registered in * the manifest. If a dynamically registered AID group is removed using * the manifest. If dynamically registered AIDs are removed using * this method, and a statically registered AID group for the same category * this method, and a statically registered AID group for the same category * exists in the manifest, the static AID group will become active again. * exists in the manifest, the static AID group will become active again. * * * @param service The component name of the service * @param service The component name of the service * @param category The category of the AID group to be removed, e.g. {@link #CATEGORY_PAYMENT} * @param category The category of the AIDs to be removed, e.g. {@link #CATEGORY_PAYMENT} * @return whether the group was successfully removed. * @return whether the group was successfully removed. */ */ public boolean removeAidGroupForService(ComponentName service, String category) { public boolean removeAidsForService(ComponentName service, String category) { try { try { return sService.removeAidGroupForService(UserHandle.myUserId(), service, category); return sService.removeAidGroupForService(UserHandle.myUserId(), service, category); } catch (RemoteException e) { } catch (RemoteException e) { Loading