Run comparison code if the data migration finished with fallback

If the data migration process runs finished with fallback,
that means we might get some unknown data that cannot be handled
by importing code.

If that happens, the CL runs the problematic code whenever device
boot-up but doesn't do the actual import process. This improves the
debuggability since the current log disappears after device reboot,
which will show up in every boot-up log after this CL.

Test: manual
Bug: 230289468
Change-Id: I6d117032d47f21c7cb49bbab916668058060f2f8
Merged-In: I6d117032d47f21c7cb49bbab916668058060f2f8
  (cherry-picked from ag/18491259)
diff --git a/service-t/src/com/android/server/net/NetworkStatsService.java b/service-t/src/com/android/server/net/NetworkStatsService.java
index 9bf0d81..168fc56 100644
--- a/service-t/src/com/android/server/net/NetworkStatsService.java
+++ b/service-t/src/com/android/server/net/NetworkStatsService.java
@@ -942,15 +942,23 @@
 
         final int targetAttempts = mDeps.getImportLegacyTargetAttempts();
         final int attempts;
+        final int fallbacks;
         try {
             attempts = mImportLegacyAttemptsCounter.get();
+            fallbacks = mImportLegacyFallbacksCounter.get();
         } catch (IOException e) {
-            Log.wtf(TAG, "Failed to read attempts counter, skip.", e);
+            Log.wtf(TAG, "Failed to read counters, skip.", e);
             return;
         }
-        if (attempts >= targetAttempts) return;
+        // If fallbacks is not zero, proceed with reading only to give signals from dogfooders.
+        // TODO: Remove fallbacks counter check before T formal release.
+        if (attempts >= targetAttempts && fallbacks == 0) return;
 
-        Log.i(TAG, "Starting import : attempts " + attempts + "/" + targetAttempts);
+        if (attempts >= targetAttempts) {
+            Log.i(TAG, "Starting import : only perform read");
+        } else{
+            Log.i(TAG, "Starting import : attempts " + attempts + "/" + targetAttempts);
+        }
 
         final MigrationInfo[] migrations = new MigrationInfo[]{
                 new MigrationInfo(mDevRecorder), new MigrationInfo(mXtRecorder),
@@ -1020,6 +1028,10 @@
                 }
             }
 
+            // For cases where the fallbacks is not zero but target attempts counts reached,
+            // only perform reads above and return here.
+            if (attempts >= targetAttempts) return;
+
             // Find the latest end time.
             for (final MigrationInfo migration : migrations) {
                 final long migrationEnd = migration.collection.getEndMillis();