nfc(api): Add a event log to indicate data migration
Also, fix the sendVendorNciMEssage implementation to use the right
helper method.
Bug: 377358559
Test: Verified data migration on upgrade to a build with google package
name
Flag: com.android.nfc.RELEASE_NFC_MAINLINE_MODULE
Change-Id: Ibe5e15d29fa5f804cee42fb691361905bbeb0736
diff --git a/nfc/java/android/nfc/INfcAdapter.aidl b/nfc/java/android/nfc/INfcAdapter.aidl
index 1346bd34..40fd068 100644
--- a/nfc/java/android/nfc/INfcAdapter.aidl
+++ b/nfc/java/android/nfc/INfcAdapter.aidl
@@ -119,4 +119,5 @@
boolean getSettingStatus();
boolean isTagPresent();
List<Entry> getRoutingTableEntryList();
+ void indicateDataMigration(boolean inProgress, String pkg);
}
diff --git a/nfc/java/android/nfc/NfcAdapter.java b/nfc/java/android/nfc/NfcAdapter.java
index d9fd42f..c5d8191 100644
--- a/nfc/java/android/nfc/NfcAdapter.java
+++ b/nfc/java/android/nfc/NfcAdapter.java
@@ -2795,11 +2795,8 @@
@IntRange(from = 0, to = 15) int gid, @IntRange(from = 0) int oid,
@NonNull byte[] payload) {
Objects.requireNonNull(payload, "Payload must not be null");
- try {
- return sService.sendVendorNciMessage(mt, gid, oid, payload);
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
+ return callServiceReturn(() -> sService.sendVendorNciMessage(mt, gid, oid, payload),
+ SEND_VENDOR_NCI_STATUS_FAILED);
}
/**
@@ -2873,6 +2870,18 @@
}
/**
+ * Used by data migration to indicate data migration is in progrerss or not.
+ *
+ * Note: This is @hide intentionally since the client is inside the NFC apex.
+ * @param inProgress true if migration is in progress, false once done.
+ * @hide
+ */
+ @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)
+ public void indicateDataMigration(boolean inProgress) {
+ callService(() -> sService.indicateDataMigration(inProgress, mContext.getPackageName()));
+ }
+
+ /**
* Returns an instance of {@link NfcOemExtension} associated with {@link NfcAdapter} instance.
* @hide
*/