Merge "nfc(api): Mark some data types as formal API for mainline" into main am: 4eb41e2e89 am: 8febb9ddcd am: 48fd52ba24 am: 39f7bc6395
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2636313
Change-Id: I02ceab139d4109530f462d50e6e35b505aae2d12
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/AconfigFlags.bp b/AconfigFlags.bp
index 341047d..f0b7598 100644
--- a/AconfigFlags.bp
+++ b/AconfigFlags.bp
@@ -14,6 +14,7 @@
aconfig_srcjars = [
":android.hardware.biometrics.flags-aconfig-java{.generated_srcjars}",
+ ":android.nfc.flags-aconfig-java{.generated_srcjars}",
":android.os.flags-aconfig-java{.generated_srcjars}",
":android.security.flags-aconfig-java{.generated_srcjars}",
":com.android.hardware.camera2-aconfig-java{.generated_srcjars}",
@@ -110,6 +111,19 @@
defaults: ["framework-minus-apex-aconfig-java-defaults"],
}
+// NFC
+aconfig_declarations {
+ name: "android.nfc.flags-aconfig",
+ package: "android.nfc",
+ srcs: ["core/java/android/nfc/*.aconfig"],
+}
+
+java_aconfig_library {
+ name: "android.nfc.flags-aconfig-java",
+ aconfig_declarations: "android.nfc.flags-aconfig",
+ defaults: ["framework-minus-apex-aconfig-java-defaults"],
+}
+
// Security
aconfig_declarations {
name: "android.security.flags-aconfig",
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index 813674b..f89c188 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -10241,6 +10241,73 @@
}
+package android.nfc.cardemulation {
+
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public final class AidGroup implements android.os.Parcelable {
+ ctor @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public AidGroup(@NonNull java.util.List<java.lang.String>, @Nullable String);
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @Nullable public static android.nfc.cardemulation.AidGroup createFromXml(@NonNull org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public int describeContents();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public void dump(@NonNull android.util.proto.ProtoOutputStream);
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public java.util.List<java.lang.String> getAids();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public String getCategory();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public void writeAsXml(@NonNull org.xmlpull.v1.XmlSerializer) throws java.io.IOException;
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public void writeToParcel(@NonNull android.os.Parcel, int);
+ field @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public static final android.os.Parcelable.Creator<android.nfc.cardemulation.AidGroup> CREATOR;
+ }
+
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public final class ApduServiceInfo implements android.os.Parcelable {
+ ctor @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public ApduServiceInfo(@NonNull android.content.pm.PackageManager, @NonNull android.content.pm.ResolveInfo, boolean) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public int describeContents();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public void dump(@NonNull android.os.ParcelFileDescriptor, @NonNull java.io.PrintWriter, @NonNull String[]);
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public void dumpDebug(@NonNull android.util.proto.ProtoOutputStream);
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public java.util.List<android.nfc.cardemulation.AidGroup> getAidGroups();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public java.util.List<java.lang.String> getAids();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public String getCategoryForAid(@NonNull String);
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public android.content.ComponentName getComponent();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public String getDescription();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public android.nfc.cardemulation.AidGroup getDynamicAidGroupForCategory(@NonNull String);
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @Nullable public String getOffHostSecureElement();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public java.util.List<java.lang.String> getPrefixAids();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public String getSettingsActivityName();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public java.util.List<java.lang.String> getSubsetAids();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public int getUid();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public boolean hasCategory(@NonNull String);
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public boolean isOnHost();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public CharSequence loadAppLabel(@NonNull android.content.pm.PackageManager);
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public android.graphics.drawable.Drawable loadBanner(@NonNull android.content.pm.PackageManager);
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public android.graphics.drawable.Drawable loadIcon(@NonNull android.content.pm.PackageManager);
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public CharSequence loadLabel(@NonNull android.content.pm.PackageManager);
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public boolean removeDynamicAidGroupForCategory(@NonNull String);
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public boolean requiresScreenOn();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public boolean requiresUnlock();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public void resetOffHostSecureElement();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public void setDynamicAidGroup(@NonNull android.nfc.cardemulation.AidGroup);
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public void setOffHostSecureElement(@NonNull String);
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public void writeToParcel(@NonNull android.os.Parcel, int);
+ field @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public static final android.os.Parcelable.Creator<android.nfc.cardemulation.ApduServiceInfo> CREATOR;
+ }
+
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public final class NfcFServiceInfo implements android.os.Parcelable {
+ ctor @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public NfcFServiceInfo(@NonNull android.content.pm.PackageManager, @NonNull android.content.pm.ResolveInfo) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public int describeContents();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public void dump(@NonNull android.os.ParcelFileDescriptor, @NonNull java.io.PrintWriter, @NonNull String[]);
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public void dumpDebug(@NonNull android.util.proto.ProtoOutputStream);
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public android.content.ComponentName getComponent();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public String getDescription();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public String getNfcid2();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public String getSystemCode();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public String getT3tPmm();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public int getUid();
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public android.graphics.drawable.Drawable loadIcon(@NonNull android.content.pm.PackageManager);
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public CharSequence loadLabel(@NonNull android.content.pm.PackageManager);
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public void setDynamicNfcid2(@NonNull String);
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public void setDynamicSystemCode(@NonNull String);
+ method @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public void writeToParcel(@NonNull android.os.Parcel, int);
+ field @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public static final android.os.Parcelable.Creator<android.nfc.cardemulation.NfcFServiceInfo> CREATOR;
+ }
+
+}
+
package android.os {
public class BatteryManager {
diff --git a/core/api/system-lint-baseline.txt b/core/api/system-lint-baseline.txt
index 0100f0e..71c02dc 100644
--- a/core/api/system-lint-baseline.txt
+++ b/core/api/system-lint-baseline.txt
@@ -225,3 +225,16 @@
SAM-compatible parameters (such as parameter 1, "listener", in android.view.accessibility.AccessibilityManager.addTouchExplorationStateChangeListener) should be last to improve Kotlin interoperability; see https://kotlinlang.org/docs/reference/java-interop.html#sam-conversions
SamShouldBeLast: android.webkit.WebChromeClient#onShowFileChooser(android.webkit.WebView, android.webkit.ValueCallback<android.net.Uri[]>, android.webkit.WebChromeClient.FileChooserParams):
SAM-compatible parameters (such as parameter 2, "filePathCallback", in android.webkit.WebChromeClient.onShowFileChooser) should be last to improve Kotlin interoperability; see https://kotlinlang.org/docs/reference/java-interop.html#sam-conversions
+
+UnflaggedApi: android.nfc.cardemulation.AidGroup#CONTENTS_FILE_DESCRIPTOR:
+ New API must be flagged with @FlaggedApi: field android.nfc.cardemulation.AidGroup.CONTENTS_FILE_DESCRIPTOR
+UnflaggedApi: android.nfc.cardemulation.AidGroup#PARCELABLE_WRITE_RETURN_VALUE:
+ New API must be flagged with @FlaggedApi: field android.nfc.cardemulation.AidGroup.PARCELABLE_WRITE_RETURN_VALUE
+UnflaggedApi: android.nfc.cardemulation.ApduServiceInfo#CONTENTS_FILE_DESCRIPTOR:
+ New API must be flagged with @FlaggedApi: field android.nfc.cardemulation.ApduServiceInfo.CONTENTS_FILE_DESCRIPTOR
+UnflaggedApi: android.nfc.cardemulation.ApduServiceInfo#PARCELABLE_WRITE_RETURN_VALUE:
+ New API must be flagged with @FlaggedApi: field android.nfc.cardemulation.ApduServiceInfo.PARCELABLE_WRITE_RETURN_VALUE
+UnflaggedApi: android.nfc.cardemulation.NfcFServiceInfo#CONTENTS_FILE_DESCRIPTOR:
+ New API must be flagged with @FlaggedApi: field android.nfc.cardemulation.NfcFServiceInfo.CONTENTS_FILE_DESCRIPTOR
+UnflaggedApi: android.nfc.cardemulation.NfcFServiceInfo#PARCELABLE_WRITE_RETURN_VALUE:
+ New API must be flagged with @FlaggedApi: field android.nfc.cardemulation.NfcFServiceInfo.PARCELABLE_WRITE_RETURN_VALUE
diff --git a/core/java/android/nfc/cardemulation/AidGroup.java b/core/java/android/nfc/cardemulation/AidGroup.java
index 2436e57..958669e 100644
--- a/core/java/android/nfc/cardemulation/AidGroup.java
+++ b/core/java/android/nfc/cardemulation/AidGroup.java
@@ -16,7 +16,11 @@
package android.nfc.cardemulation;
-import android.compat.annotation.UnsupportedAppUsage;
+import android.annotation.FlaggedApi;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.annotation.SystemApi;
+import android.nfc.Flags;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
@@ -29,6 +33,11 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
+
+/**********************************************************************
+ * This file is not a part of the NFC mainline module *
+ * *******************************************************************/
/**
* The AidGroup class represents a group of Application Identifiers (AIDs).
@@ -39,28 +48,30 @@
*
* @hide
*/
+@SystemApi
+@FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
public final class AidGroup implements Parcelable {
/**
* The maximum number of AIDs that can be present in any one group.
*/
- public static final int MAX_NUM_AIDS = 256;
+ private static final int MAX_NUM_AIDS = 256;
- static final String TAG = "AidGroup";
+ private static final String TAG = "AidGroup";
- @UnsupportedAppUsage
- final List<String> aids;
- @UnsupportedAppUsage
- final String category;
- @UnsupportedAppUsage
- final String description;
+
+ private final List<String> mAids;
+ private final String mCategory;
+ @SuppressWarnings("unused") // Unused as of now, but part of the XML input.
+ private final String mDescription;
/**
* Creates a new AidGroup object.
*
- * @param aids The list of AIDs present in the group
- * @param category The category of this group, e.g. {@link CardEmulation#CATEGORY_PAYMENT}
+ * @param aids list of AIDs present in the group
+ * @param category category of this group, e.g. {@link CardEmulation#CATEGORY_PAYMENT}
*/
- public AidGroup(List<String> aids, String category) {
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ public AidGroup(@NonNull List<String> aids, @Nullable String category) {
if (aids == null || aids.size() == 0) {
throw new IllegalArgumentException("No AIDS in AID group.");
}
@@ -73,45 +84,55 @@
}
}
if (isValidCategory(category)) {
- this.category = category;
+ this.mCategory = category;
} else {
- this.category = CardEmulation.CATEGORY_OTHER;
+ this.mCategory = CardEmulation.CATEGORY_OTHER;
}
- this.aids = new ArrayList<String>(aids.size());
+ this.mAids = new ArrayList<String>(aids.size());
for (String aid : aids) {
- this.aids.add(aid.toUpperCase());
+ this.mAids.add(aid.toUpperCase(Locale.US));
}
- this.description = null;
- }
-
- @UnsupportedAppUsage
- AidGroup(String category, String description) {
- this.aids = new ArrayList<String>();
- this.category = category;
- this.description = description;
+ this.mDescription = null;
}
/**
+ * Creates a new AidGroup object.
+ *
+ * @param category category of this group, e.g. {@link CardEmulation#CATEGORY_PAYMENT}
+ * @param description description of this group
+ */
+ AidGroup(@NonNull String category, @NonNull String description) {
+ this.mAids = new ArrayList<String>();
+ this.mCategory = category;
+ this.mDescription = description;
+ }
+
+ /**
+ * Returns the category of this group.
* @return the category of this AID group
*/
- @UnsupportedAppUsage
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
public String getCategory() {
- return category;
+ return mCategory;
}
/**
+ * Returns the list of AIDs in this group.
+ *
* @return the list of AIDs in this group
*/
- @UnsupportedAppUsage
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
public List<String> getAids() {
- return aids;
+ return mAids;
}
@Override
public String toString() {
- StringBuilder out = new StringBuilder("Category: " + category +
- ", AIDs:");
- for (String aid : aids) {
+ StringBuilder out = new StringBuilder("Category: " + mCategory
+ + ", AIDs:");
+ for (String aid : mAids) {
out.append(aid);
out.append(", ");
}
@@ -119,41 +140,44 @@
}
/**
- * Dump debugging info as AidGroupProto
+ * Dump debugging info as AidGroupProto.
*
* If the output belongs to a sub message, the caller is responsible for wrapping this function
* between {@link ProtoOutputStream#start(long)} and {@link ProtoOutputStream#end(long)}.
*
* @param proto the ProtoOutputStream to write to
*/
- public void dump(ProtoOutputStream proto) {
- proto.write(AidGroupProto.CATEGORY, category);
- for (String aid : aids) {
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ public void dump(@NonNull ProtoOutputStream proto) {
+ proto.write(AidGroupProto.CATEGORY, mCategory);
+ for (String aid : mAids) {
proto.write(AidGroupProto.AIDS, aid);
}
}
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
@Override
public int describeContents() {
return 0;
}
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
@Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeString(category);
- dest.writeInt(aids.size());
- if (aids.size() > 0) {
- dest.writeStringList(aids);
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ dest.writeString8(mCategory);
+ dest.writeInt(mAids.size());
+ if (mAids.size() > 0) {
+ dest.writeStringList(mAids);
}
}
- @UnsupportedAppUsage
- public static final @android.annotation.NonNull Parcelable.Creator<AidGroup> CREATOR =
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ public static final @NonNull Parcelable.Creator<AidGroup> CREATOR =
new Parcelable.Creator<AidGroup>() {
@Override
public AidGroup createFromParcel(Parcel source) {
- String category = source.readString();
+ String category = source.readString8();
int listSize = source.readInt();
ArrayList<String> aidList = new ArrayList<String>();
if (listSize > 0) {
@@ -168,8 +192,17 @@
}
};
- @UnsupportedAppUsage
- static public AidGroup createFromXml(XmlPullParser parser) throws XmlPullParserException, IOException {
+ /**
+ * Create an instance of AID group from XML file.
+ *
+ * @param parser input xml parser stream
+ * @throws XmlPullParserException If an error occurs parsing the element.
+ * @throws IOException If an error occurs reading the element.
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @Nullable
+ public static AidGroup createFromXml(@NonNull XmlPullParser parser)
+ throws XmlPullParserException, IOException {
String category = null;
ArrayList<String> aids = new ArrayList<String>();
AidGroup group = null;
@@ -210,11 +243,16 @@
return group;
}
- @UnsupportedAppUsage
- public void writeAsXml(XmlSerializer out) throws IOException {
+ /**
+ * Serialize instance of AID group to XML file.
+ * @param out XML serializer stream
+ * @throws IOException If an error occurs reading the element.
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ public void writeAsXml(@NonNull XmlSerializer out) throws IOException {
out.startTag(null, "aid-group");
- out.attribute(null, "category", category);
- for (String aid : aids) {
+ out.attribute(null, "category", mCategory);
+ for (String aid : mAids) {
out.startTag(null, "aid");
out.attribute(null, "value", aid);
out.endTag(null, "aid");
@@ -222,7 +260,7 @@
out.endTag(null, "aid-group");
}
- static boolean isValidCategory(String category) {
+ private static boolean isValidCategory(String category) {
return CardEmulation.CATEGORY_PAYMENT.equals(category) ||
CardEmulation.CATEGORY_OTHER.equals(category);
}
diff --git a/core/java/android/nfc/cardemulation/ApduServiceInfo.java b/core/java/android/nfc/cardemulation/ApduServiceInfo.java
index 793a70e..18ec914 100644
--- a/core/java/android/nfc/cardemulation/ApduServiceInfo.java
+++ b/core/java/android/nfc/cardemulation/ApduServiceInfo.java
@@ -14,10 +14,16 @@
* limitations under the License.
*/
+/**********************************************************************
+ * This file is not a part of the NFC mainline module *
+ * *******************************************************************/
+
package android.nfc.cardemulation;
+import android.annotation.FlaggedApi;
+import android.annotation.NonNull;
import android.annotation.Nullable;
-import android.compat.annotation.UnsupportedAppUsage;
+import android.annotation.SystemApi;
import android.content.ComponentName;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
@@ -28,7 +34,9 @@
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.drawable.Drawable;
+import android.nfc.Flags;
import android.os.Parcel;
+import android.os.ParcelFileDescriptor;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.Log;
@@ -38,7 +46,6 @@
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
-import java.io.FileDescriptor;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -47,82 +54,82 @@
import java.util.Map;
/**
+ * Class holding APDU service info.
+ *
* @hide
*/
+@SystemApi
+@FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
public final class ApduServiceInfo implements Parcelable {
- static final String TAG = "ApduServiceInfo";
+ private static final String TAG = "ApduServiceInfo";
/**
* The service that implements this
*/
- @UnsupportedAppUsage
- final ResolveInfo mService;
+ private final ResolveInfo mService;
/**
* Description of the service
*/
- final String mDescription;
+ private final String mDescription;
/**
* Whether this service represents AIDs running on the host CPU
*/
- final boolean mOnHost;
+ private final boolean mOnHost;
/**
* Offhost reader name.
* eg: SIM, eSE etc
*/
- String mOffHostName;
+ private String mOffHostName;
/**
* Offhost reader name from manifest file.
- * Used for unsetOffHostSecureElement()
+ * Used for resetOffHostSecureElement()
*/
- final String mStaticOffHostName;
+ private final String mStaticOffHostName;
/**
* Mapping from category to static AID group
*/
- @UnsupportedAppUsage
- final HashMap<String, AidGroup> mStaticAidGroups;
+ private final HashMap<String, AidGroup> mStaticAidGroups;
/**
* Mapping from category to dynamic AID group
*/
- @UnsupportedAppUsage
- final HashMap<String, AidGroup> mDynamicAidGroups;
+ private final HashMap<String, AidGroup> mDynamicAidGroups;
/**
* Whether this service should only be started when the device is unlocked.
*/
- final boolean mRequiresDeviceUnlock;
+ private final boolean mRequiresDeviceUnlock;
/**
* Whether this service should only be started when the device is screen on.
*/
- final boolean mRequiresDeviceScreenOn;
+ private final boolean mRequiresDeviceScreenOn;
/**
* The id of the service banner specified in XML.
*/
- final int mBannerResourceId;
+ private final int mBannerResourceId;
/**
* The uid of the package the service belongs to
*/
- final int mUid;
+ private final int mUid;
/**
* Settings Activity for this service
*/
- final String mSettingsActivityName;
+ private final String mSettingsActivityName;
/**
* @hide
*/
- @UnsupportedAppUsage
public ApduServiceInfo(ResolveInfo info, boolean onHost, String description,
- ArrayList<AidGroup> staticAidGroups, ArrayList<AidGroup> dynamicAidGroups,
+ List<AidGroup> staticAidGroups, List<AidGroup> dynamicAidGroups,
boolean requiresUnlock, int bannerResource, int uid,
String settingsActivityName, String offHost, String staticOffHost) {
this(info, onHost, description, staticAidGroups, dynamicAidGroups,
@@ -134,7 +141,7 @@
* @hide
*/
public ApduServiceInfo(ResolveInfo info, boolean onHost, String description,
- ArrayList<AidGroup> staticAidGroups, ArrayList<AidGroup> dynamicAidGroups,
+ List<AidGroup> staticAidGroups, List<AidGroup> dynamicAidGroups,
boolean requiresUnlock, boolean requiresScreenOn, int bannerResource, int uid,
String settingsActivityName, String offHost, String staticOffHost) {
this.mService = info;
@@ -147,19 +154,28 @@
this.mRequiresDeviceUnlock = requiresUnlock;
this.mRequiresDeviceScreenOn = requiresScreenOn;
for (AidGroup aidGroup : staticAidGroups) {
- this.mStaticAidGroups.put(aidGroup.category, aidGroup);
+ this.mStaticAidGroups.put(aidGroup.getCategory(), aidGroup);
}
for (AidGroup aidGroup : dynamicAidGroups) {
- this.mDynamicAidGroups.put(aidGroup.category, aidGroup);
+ this.mDynamicAidGroups.put(aidGroup.getCategory(), aidGroup);
}
this.mBannerResourceId = bannerResource;
this.mUid = uid;
this.mSettingsActivityName = settingsActivityName;
}
- @UnsupportedAppUsage
- public ApduServiceInfo(PackageManager pm, ResolveInfo info, boolean onHost) throws
- XmlPullParserException, IOException {
+ /**
+ * Creates a new ApduServiceInfo object.
+ *
+ * @param pm packageManager instance
+ * @param info app component info
+ * @param onHost whether service is on host or not (secure element)
+ * @throws XmlPullParserException If an error occurs parsing the element.
+ * @throws IOException If an error occurs reading the element.
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ public ApduServiceInfo(@NonNull PackageManager pm, @NonNull ResolveInfo info, boolean onHost)
+ throws XmlPullParserException, IOException {
ServiceInfo si = info.serviceInfo;
XmlResourceParser parser = null;
try {
@@ -277,9 +293,9 @@
groupAttrs.recycle();
} else if (eventType == XmlPullParser.END_TAG && "aid-group".equals(tagName) &&
currentGroup != null) {
- if (currentGroup.aids.size() > 0) {
- if (!mStaticAidGroups.containsKey(currentGroup.category)) {
- mStaticAidGroups.put(currentGroup.category, currentGroup);
+ if (currentGroup.getAids().size() > 0) {
+ if (!mStaticAidGroups.containsKey(currentGroup.getCategory())) {
+ mStaticAidGroups.put(currentGroup.getCategory(), currentGroup);
}
} else {
Log.e(TAG, "Not adding <aid-group> with empty or invalid AIDs");
@@ -291,8 +307,8 @@
com.android.internal.R.styleable.AidFilter);
String aid = a.getString(com.android.internal.R.styleable.AidFilter_name).
toUpperCase();
- if (CardEmulation.isValidAid(aid) && !currentGroup.aids.contains(aid)) {
- currentGroup.aids.add(aid);
+ if (CardEmulation.isValidAid(aid) && !currentGroup.getAids().contains(aid)) {
+ currentGroup.getAids().add(aid);
} else {
Log.e(TAG, "Ignoring invalid or duplicate aid: " + aid);
}
@@ -305,8 +321,8 @@
toUpperCase();
// Add wildcard char to indicate prefix
aid = aid.concat("*");
- if (CardEmulation.isValidAid(aid) && !currentGroup.aids.contains(aid)) {
- currentGroup.aids.add(aid);
+ if (CardEmulation.isValidAid(aid) && !currentGroup.getAids().contains(aid)) {
+ currentGroup.getAids().add(aid);
} else {
Log.e(TAG, "Ignoring invalid or duplicate aid: " + aid);
}
@@ -319,8 +335,8 @@
toUpperCase();
// Add wildcard char to indicate suffix
aid = aid.concat("#");
- if (CardEmulation.isValidAid(aid) && !currentGroup.aids.contains(aid)) {
- currentGroup.aids.add(aid);
+ if (CardEmulation.isValidAid(aid) && !currentGroup.getAids().contains(aid)) {
+ currentGroup.getAids().add(aid);
} else {
Log.e(TAG, "Ignoring invalid or duplicate aid: " + aid);
}
@@ -336,11 +352,25 @@
mUid = si.applicationInfo.uid;
}
+ /**
+ * Returns the app component corresponding to this APDU service.
+ *
+ * @return app component for this service
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
public ComponentName getComponent() {
return new ComponentName(mService.serviceInfo.packageName,
mService.serviceInfo.name);
}
+ /**
+ * Returns the offhost secure element name (if the service is offhost).
+ *
+ * @return offhost secure element name for offhost services
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @Nullable
public String getOffHostSecureElement() {
return mOffHostName;
}
@@ -353,18 +383,30 @@
* for that category.
* @return List of AIDs registered by the service
*/
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
public List<String> getAids() {
final ArrayList<String> aids = new ArrayList<String>();
for (AidGroup group : getAidGroups()) {
- aids.addAll(group.aids);
+ aids.addAll(group.getAids());
}
return aids;
}
+ /**
+ * Returns a consolidated list of AIDs with prefixes from the AID groups
+ * registered by this service. Note that if a service has both
+ * a static (manifest-based) AID group for a category and a dynamic
+ * AID group, only the dynamically registered AIDs will be returned
+ * for that category.
+ * @return List of prefix AIDs registered by the service
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
public List<String> getPrefixAids() {
final ArrayList<String> prefixAids = new ArrayList<String>();
for (AidGroup group : getAidGroups()) {
- for (String aid : group.aids) {
+ for (String aid : group.getAids()) {
if (aid.endsWith("*")) {
prefixAids.add(aid);
}
@@ -373,10 +415,20 @@
return prefixAids;
}
+ /**
+ * Returns a consolidated list of AIDs with subsets from the AID groups
+ * registered by this service. Note that if a service has both
+ * a static (manifest-based) AID group for a category and a dynamic
+ * AID group, only the dynamically registered AIDs will be returned
+ * for that category.
+ * @return List of prefix AIDs registered by the service
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
public List<String> getSubsetAids() {
final ArrayList<String> subsetAids = new ArrayList<String>();
for (AidGroup group : getAidGroups()) {
- for (String aid : group.aids) {
+ for (String aid : group.getAids()) {
if (aid.endsWith("#")) {
subsetAids.add(aid);
}
@@ -384,14 +436,28 @@
}
return subsetAids;
}
+
/**
* Returns the registered AID group for this category.
+ *
+ * @param category category name
+ * @return {@link AidGroup} instance for the provided category
*/
- public AidGroup getDynamicAidGroupForCategory(String category) {
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
+ public AidGroup getDynamicAidGroupForCategory(@NonNull String category) {
return mDynamicAidGroups.get(category);
}
- public boolean removeDynamicAidGroupForCategory(String category) {
+ /**
+ * Removes the registered AID group for this category.
+ *
+ * @param category category name
+ * @return {@code true} if an AID group existed
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
+ public boolean removeDynamicAidGroupForCategory(@NonNull String category) {
return (mDynamicAidGroups.remove(category) != null);
}
@@ -403,7 +469,9 @@
* for that category.
* @return List of AIDs registered by the service
*/
- public ArrayList<AidGroup> getAidGroups() {
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
+ public List<AidGroup> getAidGroups() {
final ArrayList<AidGroup> groups = new ArrayList<AidGroup>();
for (Map.Entry<String, AidGroup> entry : mDynamicAidGroups.entrySet()) {
groups.add(entry.getValue());
@@ -421,49 +489,83 @@
/**
* Returns the category to which this service has attributed the AID that is passed in,
* or null if we don't know this AID.
+ * @param aid AID to lookup for
+ * @return category name corresponding to this AID
*/
- public String getCategoryForAid(String aid) {
- ArrayList<AidGroup> groups = getAidGroups();
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
+ public String getCategoryForAid(@NonNull String aid) {
+ List<AidGroup> groups = getAidGroups();
for (AidGroup group : groups) {
- if (group.aids.contains(aid.toUpperCase())) {
- return group.category;
+ if (group.getAids().contains(aid.toUpperCase())) {
+ return group.getCategory();
}
}
return null;
}
- public boolean hasCategory(String category) {
+ /**
+ * Returns whether there is any AID group for this category.
+ * @param category category name
+ * @return {@code true} if an AID group exists
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ public boolean hasCategory(@NonNull String category) {
return (mStaticAidGroups.containsKey(category) || mDynamicAidGroups.containsKey(category));
}
- @UnsupportedAppUsage
+ /**
+ * Returns whether the service is on host or not.
+ * @return true if the service is on host (not secure element)
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
public boolean isOnHost() {
return mOnHost;
}
- @UnsupportedAppUsage
+ /**
+ * Returns whether the service requires device unlock.
+ * @return whether the service requires device unlock
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
public boolean requiresUnlock() {
return mRequiresDeviceUnlock;
}
/**
* Returns whether this service should only be started when the device is screen on.
+ * @return whether the service requires screen on
*/
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
public boolean requiresScreenOn() {
return mRequiresDeviceScreenOn;
}
- @UnsupportedAppUsage
+ /**
+ * Returns description of service.
+ * @return user readable description of service
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
public String getDescription() {
return mDescription;
}
- @UnsupportedAppUsage
+ /**
+ * Returns uid of service.
+ * @return uid of the service
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
public int getUid() {
return mUid;
}
- public void setOrReplaceDynamicAidGroup(AidGroup aidGroup) {
+ /**
+ * Add or replace an AID group to this service.
+ * @param aidGroup instance of aid group to set or replace
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ public void setDynamicAidGroup(@NonNull AidGroup aidGroup) {
mDynamicAidGroups.put(aidGroup.getCategory(), aidGroup);
}
@@ -476,7 +578,8 @@
* TS26_NFC_REQ_070: For embedded SE, Secure Element Name SHALL be eSE[number]
* (e.g. eSE/eSE1, eSE2, etc.).
*/
- public void setOffHostSecureElement(String offHost) {
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ public void setOffHostSecureElement(@NonNull String offHost) {
mOffHostName = offHost;
}
@@ -484,15 +587,30 @@
* Resets the off host Secure Element to statically defined
* by the service in the manifest file.
*/
- public void unsetOffHostSecureElement() {
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ public void resetOffHostSecureElement() {
mOffHostName = mStaticOffHostName;
}
- public CharSequence loadLabel(PackageManager pm) {
+ /**
+ * Load label for this service.
+ * @param pm packagemanager instance
+ * @return label name corresponding to service
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
+ public CharSequence loadLabel(@NonNull PackageManager pm) {
return mService.loadLabel(pm);
}
- public CharSequence loadAppLabel(PackageManager pm) {
+ /**
+ * Load application label for this service.
+ * @param pm packagemanager instance
+ * @return app label name corresponding to service
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
+ public CharSequence loadAppLabel(@NonNull PackageManager pm) {
try {
return pm.getApplicationLabel(pm.getApplicationInfo(
mService.resolvePackageName, PackageManager.GET_META_DATA));
@@ -501,12 +619,25 @@
}
}
- public Drawable loadIcon(PackageManager pm) {
+ /**
+ * Load application icon for this service.
+ * @param pm packagemanager instance
+ * @return app icon corresponding to service
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
+ public Drawable loadIcon(@NonNull PackageManager pm) {
return mService.loadIcon(pm);
}
- @UnsupportedAppUsage
- public Drawable loadBanner(PackageManager pm) {
+ /**
+ * Load application banner for this service.
+ * @param pm packagemanager instance
+ * @return app banner corresponding to service
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
+ public Drawable loadBanner(@NonNull PackageManager pm) {
Resources res;
try {
res = pm.getResourcesForApplication(mService.serviceInfo.packageName);
@@ -521,7 +652,12 @@
}
}
- @UnsupportedAppUsage
+ /**
+ * Load activity name for this service.
+ * @return activity name for this service
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
public String getSettingsActivityName() { return mSettingsActivityName; }
@Override
@@ -556,14 +692,15 @@
return getComponent().hashCode();
}
-
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
@Override
public int describeContents() {
return 0;
}
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
@Override
- public void writeToParcel(Parcel dest, int flags) {
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
mService.writeToParcel(dest, flags);
dest.writeString(mDescription);
dest.writeInt(mOnHost ? 1 : 0);
@@ -584,8 +721,8 @@
dest.writeString(mSettingsActivityName);
};
- @UnsupportedAppUsage
- public static final @android.annotation.NonNull Parcelable.Creator<ApduServiceInfo> CREATOR =
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ public static final @NonNull Parcelable.Creator<ApduServiceInfo> CREATOR =
new Parcelable.Creator<ApduServiceInfo>() {
@Override
public ApduServiceInfo createFromParcel(Parcel source) {
@@ -620,7 +757,15 @@
}
};
- public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ /**
+ * Dump contents for debugging.
+ * @param fd parcelfiledescriptor instance
+ * @param pw printwriter instance
+ * @param args args for dumping
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ public void dump(@NonNull ParcelFileDescriptor fd, @NonNull PrintWriter pw,
+ @NonNull String[] args) {
pw.println(" " + getComponent()
+ " (Description: " + getDescription() + ")"
+ " (UID: " + getUid() + ")");
@@ -633,15 +778,15 @@
}
pw.println(" Static AID groups:");
for (AidGroup group : mStaticAidGroups.values()) {
- pw.println(" Category: " + group.category);
- for (String aid : group.aids) {
+ pw.println(" Category: " + group.getCategory());
+ for (String aid : group.getAids()) {
pw.println(" AID: " + aid);
}
}
pw.println(" Dynamic AID groups:");
for (AidGroup group : mDynamicAidGroups.values()) {
- pw.println(" Category: " + group.category);
- for (String aid : group.aids) {
+ pw.println(" Category: " + group.getCategory());
+ for (String aid : group.getAids()) {
pw.println(" AID: " + aid);
}
}
@@ -651,7 +796,7 @@
}
/**
- * Dump debugging info as ApduServiceInfoProto
+ * Dump debugging info as ApduServiceInfoProto.
*
* If the output belongs to a sub message, the caller is responsible for wrapping this function
* between {@link ProtoOutputStream#start(long)} and {@link ProtoOutputStream#end(long)}.
@@ -659,7 +804,8 @@
*
* @param proto the ProtoOutputStream to write to
*/
- public void dumpDebug(ProtoOutputStream proto) {
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ public void dumpDebug(@NonNull ProtoOutputStream proto) {
Utils.dumpDebugComponentName(getComponent(), proto, ApduServiceInfoProto.COMPONENT_NAME);
proto.write(ApduServiceInfoProto.DESCRIPTION, getDescription());
proto.write(ApduServiceInfoProto.ON_HOST, mOnHost);
diff --git a/core/java/android/nfc/cardemulation/NfcFServiceInfo.java b/core/java/android/nfc/cardemulation/NfcFServiceInfo.java
index 7a36b26..ec919e4 100644
--- a/core/java/android/nfc/cardemulation/NfcFServiceInfo.java
+++ b/core/java/android/nfc/cardemulation/NfcFServiceInfo.java
@@ -14,9 +14,16 @@
* limitations under the License.
*/
+/**********************************************************************
+ * This file is not a part of the NFC mainline module *
+ * *******************************************************************/
+
package android.nfc.cardemulation;
+import android.annotation.FlaggedApi;
+import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.SystemApi;
import android.content.ComponentName;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
@@ -26,7 +33,9 @@
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.drawable.Drawable;
+import android.nfc.Flags;
import android.os.Parcel;
+import android.os.ParcelFileDescriptor;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.Log;
@@ -36,13 +45,16 @@
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
-import java.io.FileDescriptor;
import java.io.IOException;
import java.io.PrintWriter;
/**
+ * Class to hold NfcF service info.
+ *
* @hide
*/
+@SystemApi
+@FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
public final class NfcFServiceInfo implements Parcelable {
static final String TAG = "NfcFServiceInfo";
@@ -51,42 +63,42 @@
/**
* The service that implements this
*/
- final ResolveInfo mService;
+ private final ResolveInfo mService;
/**
* Description of the service
*/
- final String mDescription;
+ private final String mDescription;
/**
* System Code of the service
*/
- final String mSystemCode;
+ private final String mSystemCode;
/**
* System Code of the service registered by API
*/
- String mDynamicSystemCode;
+ private String mDynamicSystemCode;
/**
* NFCID2 of the service
*/
- final String mNfcid2;
+ private final String mNfcid2;
/**
* NFCID2 of the service registered by API
*/
- String mDynamicNfcid2;
+ private String mDynamicNfcid2;
/**
* The uid of the package the service belongs to
*/
- final int mUid;
+ private final int mUid;
/**
* LF_T3T_PMM of the service
*/
- final String mT3tPmm;
+ private final String mT3tPmm;
/**
* @hide
@@ -104,7 +116,16 @@
this.mT3tPmm = t3tPmm;
}
- public NfcFServiceInfo(PackageManager pm, ResolveInfo info)
+ /**
+ * Creates a new NfcFServiceInfo object.
+ *
+ * @param pm packageManager instance
+ * @param info app component info
+ * @throws XmlPullParserException If an error occurs parsing the element.
+ * @throws IOException If an error occurs reading the element.
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ public NfcFServiceInfo(@NonNull PackageManager pm, @NonNull ResolveInfo info)
throws XmlPullParserException, IOException {
ServiceInfo si = info.serviceInfo;
XmlResourceParser parser = null;
@@ -192,44 +213,107 @@
mUid = si.applicationInfo.uid;
}
+ /**
+ * Returns the app component corresponding to this NFCF service.
+ *
+ * @return app component for this service
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
public ComponentName getComponent() {
return new ComponentName(mService.serviceInfo.packageName,
mService.serviceInfo.name);
}
+ /**
+ * Returns the system code corresponding to this service.
+ *
+ * @return system code for this service
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
public String getSystemCode() {
return (mDynamicSystemCode == null ? mSystemCode : mDynamicSystemCode);
}
- public void setOrReplaceDynamicSystemCode(String systemCode) {
+ /**
+ * Add or replace a system code to this service.
+ * @param systemCode system code to set or replace
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ public void setDynamicSystemCode(@NonNull String systemCode) {
mDynamicSystemCode = systemCode;
}
+ /**
+ * Returns NFC ID2.
+ *
+ * @return nfc id2 to return
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
public String getNfcid2() {
return (mDynamicNfcid2 == null ? mNfcid2 : mDynamicNfcid2);
}
- public void setOrReplaceDynamicNfcid2(String nfcid2) {
+ /**
+ * Set or replace NFC ID2
+ *
+ * @param nfcid2 NFC ID2 string
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ public void setDynamicNfcid2(@NonNull String nfcid2) {
mDynamicNfcid2 = nfcid2;
}
+ /**
+ * Returns description of service.
+ * @return user readable description of service
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
public String getDescription() {
return mDescription;
}
+ /**
+ * Returns uid of service.
+ * @return uid of the service
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
public int getUid() {
return mUid;
}
+ /**
+ * Returns LF_T3T_PMM of the service
+ * @return returns LF_T3T_PMM of the service
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
public String getT3tPmm() {
return mT3tPmm;
}
- public CharSequence loadLabel(PackageManager pm) {
+ /**
+ * Load application label for this service.
+ * @param pm packagemanager instance
+ * @return label name corresponding to service
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
+ public CharSequence loadLabel(@NonNull PackageManager pm) {
return mService.loadLabel(pm);
}
- public Drawable loadIcon(PackageManager pm) {
+ /**
+ * Load application icon for this service.
+ * @param pm packagemanager instance
+ * @return app icon corresponding to service
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ @NonNull
+ public Drawable loadIcon(@NonNull PackageManager pm) {
return mService.loadIcon(pm);
}
@@ -270,13 +354,15 @@
return getComponent().hashCode();
}
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
@Override
public int describeContents() {
return 0;
}
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
@Override
- public void writeToParcel(Parcel dest, int flags) {
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
mService.writeToParcel(dest, flags);
dest.writeString(mDescription);
dest.writeString(mSystemCode);
@@ -293,7 +379,8 @@
dest.writeString(mT3tPmm);
};
- public static final @android.annotation.NonNull Parcelable.Creator<NfcFServiceInfo> CREATOR =
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ public static final @NonNull Parcelable.Creator<NfcFServiceInfo> CREATOR =
new Parcelable.Creator<NfcFServiceInfo>() {
@Override
public NfcFServiceInfo createFromParcel(Parcel source) {
@@ -322,7 +409,15 @@
}
};
- public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ /**
+ * Dump contents of the service for debugging.
+ * @param fd parcelfiledescriptor instance
+ * @param pw printwriter instance
+ * @param args args for dumping
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ public void dump(@NonNull ParcelFileDescriptor fd, @NonNull PrintWriter pw,
+ @NonNull String[] args) {
pw.println(" " + getComponent()
+ " (Description: " + getDescription() + ")"
+ " (UID: " + getUid() + ")");
@@ -332,14 +427,15 @@
}
/**
- * Dump debugging info as NfcFServiceInfoProto
+ * Dump debugging info as NfcFServiceInfoProto.
*
* If the output belongs to a sub message, the caller is responsible for wrapping this function
* between {@link ProtoOutputStream#start(long)} and {@link ProtoOutputStream#end(long)}.
*
* @param proto the ProtoOutputStream to write to
*/
- public void dumpDebug(ProtoOutputStream proto) {
+ @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE)
+ public void dumpDebug(@NonNull ProtoOutputStream proto) {
Utils.dumpDebugComponentName(getComponent(), proto, NfcFServiceInfoProto.COMPONENT_NAME);
proto.write(NfcFServiceInfoProto.DESCRIPTION, getDescription());
proto.write(NfcFServiceInfoProto.SYSTEM_CODE, getSystemCode());
@@ -347,4 +443,3 @@
proto.write(NfcFServiceInfoProto.T3T_PMM, getT3tPmm());
}
}
-
diff --git a/core/java/android/nfc/flags.aconfig b/core/java/android/nfc/flags.aconfig
new file mode 100644
index 0000000..e3faf39
--- /dev/null
+++ b/core/java/android/nfc/flags.aconfig
@@ -0,0 +1,8 @@
+package: "android.nfc"
+
+flag {
+ name: "enable_nfc_mainline"
+ namespace: "nfc"
+ description: "Flag for NFC mainline changes"
+ bug: "292140387"
+}