Core proto definition for "dumpsys nfc --proto"

Add NfcServiceProto for protobuf dumpsys of nfc service. Primarily used
by incident service to capture an incident report proto.

Command to invoke (any of the following after lunch and env setup):
$ adb shell dumpsys nfc --proto
$ adb shell incident 3052
$ incident_report 3052

Bug: 146086108
Exempt-From-Owner-Approval: Owners not reachable.
Test: Execute the above commands and compare the output against dumpsys
      nfc.

Change-Id: I024e148d64ccef5441a67efcbad95c622e5df12a
diff --git a/core/java/android/nfc/NdefRecord.java b/core/java/android/nfc/NdefRecord.java
index fe316c4..74f8cb4 100644
--- a/core/java/android/nfc/NdefRecord.java
+++ b/core/java/android/nfc/NdefRecord.java
@@ -21,6 +21,7 @@
 import android.net.Uri;
 import android.os.Parcel;
 import android.os.Parcelable;
+import android.util.proto.ProtoOutputStream;
 
 import java.nio.BufferUnderflowException;
 import java.nio.ByteBuffer;
@@ -1051,6 +1052,22 @@
         return b.toString();
     }
 
+    /**
+     * Dump debugging information as a NdefRecordProto
+     * @hide
+     *
+     * Note:
+     * See proto definition in frameworks/base/core/proto/android/nfc/ndef.proto
+     * When writing a nested message, must call {@link ProtoOutputStream#start(long)} before and
+     * {@link ProtoOutputStream#end(long)} after.
+     * Never reuse a proto field number. When removing a field, mark it as reserved.
+     */
+    public void dumpDebug(ProtoOutputStream proto) {
+        proto.write(NdefRecordProto.TYPE, mType);
+        proto.write(NdefRecordProto.ID, mId);
+        proto.write(NdefRecordProto.PAYLOAD_BYTES, mPayload.length);
+    }
+
     private static StringBuilder bytesToString(byte[] bs) {
         StringBuilder s = new StringBuilder();
         for (byte b : bs) {