WebView: Adding back WebView load time calculation with updated API.

Due to API council feedback in b/184026615, the way Android recorded
some load times was through an array and the way to retrieve
them was through indices of the array. There was a change which transformed the array into a group of getter methods.

WeBview now uses one of the get methods to record when WebView began loading into memory and subtracts the time at the end of loading WebView to get the total load time.

Bug: 1208089
Test: See the associated bug for testing details.
Change-Id: I47d453f69496f303c1c945d11a44abd9e24d8a27
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3803354
Commit-Queue: Adam Walls <avvall@google.com>
Reviewed-by: Richard Coles <torne@chromium.org>
Reviewed-by: Michael Bai <michaelbai@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1030219}
NOKEYCHECK=True
GitOrigin-RevId: 723ca35b4cecc3ffb79ed74542fe663c1171cd75
diff --git a/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java b/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
index 5da6351..3a4aa9f 100644
--- a/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
+++ b/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
@@ -509,15 +509,13 @@
                 "Android.WebView.Startup.CreationTime.Stage1.FactoryInit",
                 SystemClock.uptimeMillis() - startTime);
 
-        /* TODO(torne): re-enable this once the API change is sorted out
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
-            // TODO: Use the framework constants as indices in timestamps array.
-            startTime = mWebViewDelegate.getTimestamps()[0];
+            final long webviewLoadStart =
+                    mWebViewDelegate.getStartupTimestamps().getWebViewLoadStart();
             RecordHistogram.recordTimesHistogram(
                     "Android.WebView.Startup.CreationTime.TotalFactoryInitTime",
-                    SystemClock.uptimeMillis() - startTime);
+                    SystemClock.uptimeMillis() - webviewLoadStart);
         }
-        */
     }
 
     // These values are persisted to logs. Entries should not be renumbered and