Proper IPC wrapper for WebViewUpdateService.

Introduce a proper IPC client wrapper class for WebViewUpdateService
that can be used instead of directly consuming the AIDL interface.

The existing android.webkit.WebViewUpdateService wrapper has a bad API
and will be deprecated in future; in the meantime it will forward calls
to the new wrapper.

Bug: 319292658
Test: with flag enabled, atest CtsWebkitTestCases
Change-Id: I682a75a43eeebec26aa2d08b620b2f69bcfe0667
diff --git a/core/api/module-lib-current.txt b/core/api/module-lib-current.txt
index af8b708..7ba7835 100644
--- a/core/api/module-lib-current.txt
+++ b/core/api/module-lib-current.txt
@@ -102,6 +102,7 @@
     method @NonNull public android.os.UserHandle getUser();
     field public static final String PAC_PROXY_SERVICE = "pac_proxy";
     field public static final String TEST_NETWORK_SERVICE = "test_network";
+    field @FlaggedApi("android.webkit.update_service_ipc_wrapper") public static final String WEBVIEW_UPDATE_SERVICE = "webviewupdate";
   }
 
   public class Intent implements java.lang.Cloneable android.os.Parcelable {
@@ -650,3 +651,34 @@
 
 }
 
+package android.webkit {
+
+  @FlaggedApi("android.webkit.update_service_ipc_wrapper") public class WebViewBootstrapFrameworkInitializer {
+    method public static void registerServiceWrappers();
+  }
+
+  @FlaggedApi("android.webkit.update_service_ipc_wrapper") public final class WebViewProviderResponse implements android.os.Parcelable {
+    ctor public WebViewProviderResponse(@Nullable android.content.pm.PackageInfo, int);
+    method public int describeContents();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.webkit.WebViewProviderResponse> CREATOR;
+    field public static final int STATUS_FAILED_LISTING_WEBVIEW_PACKAGES = 4; // 0x4
+    field public static final int STATUS_FAILED_WAITING_FOR_RELRO = 3; // 0x3
+    field public static final int STATUS_SUCCESS = 0; // 0x0
+    field @Nullable public final android.content.pm.PackageInfo packageInfo;
+    field public final int status;
+  }
+
+  @FlaggedApi("android.webkit.update_service_ipc_wrapper") public final class WebViewUpdateManager {
+    method @Nullable @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public String changeProviderAndSetting(@NonNull String);
+    method @NonNull public android.webkit.WebViewProviderInfo[] getAllWebViewPackages();
+    method @Nullable public android.content.pm.PackageInfo getCurrentWebViewPackage();
+    method @Nullable public String getCurrentWebViewPackageName();
+    method @FlaggedApi("android.webkit.update_service_v2") @NonNull public android.webkit.WebViewProviderInfo getDefaultWebViewPackage();
+    method @Nullable public static android.webkit.WebViewUpdateManager getInstance();
+    method @NonNull public android.webkit.WebViewProviderInfo[] getValidWebViewPackages();
+    method @NonNull public android.webkit.WebViewProviderResponse waitForAndGetProvider();
+  }
+
+}
+