admin管理员组

文章数量:1539727

2024年1月17日发(作者:)

String element = e(); if (element == null) { break; } if ((TAG_WEBVIEW_PROVIDER)) { String packageName = ributeValue(null, TAG_PACKAGE_NAME); if (packageName == null) { throw new AndroidRuntimeException( "WebView provider in framework resources missing package name"); } String description = ributeValue(null, TAG_DESCRIPTION); if (description == null) { throw new AndroidRuntimeException( "WebView provider in framework resources missing description"); } boolean availableByDefault = "true".equals( ributeValue(null, TAG_AVAILABILITY)); boolean isFallback = "true".equals( ributeValue(null, TAG_FALLBACK)); WebViewProviderInfo currentProvider = new WebViewProviderInfo( packageName, description, availableByDefault, isFallback, readSignatures(parser)); if (back) { numFallbackPackages++; if (!bleByDefault) { throw new AndroidRuntimeException( "Each WebView fallback package must be available by default."); } if (numFallbackPackages > 1) { throw new AndroidRuntimeException( "There can be at most one WebView fallback package."); } } if (bleByDefault) { numAvailableByDefaultPackages++; if (!back) { numAvByDefaultAndNotFallback++; } } (currentProvider); } else { Log.e(TAG, "Found an element that is not a WebView provider"); } } } catch (XmlPullParserException | IOException e) { throw new AndroidRuntimeException("Error when parsing WebView config " + e); } finally { if (parser != null) (); } if (numAvailableByDefaultPackages == 0) { throw new AndroidRuntimeException("There must be at least one WebView package " + "that is available by default"); } if (numAvByDefaultAndNotFallback == 0) { throw new AndroidRuntimeException("There must be at least one WebView package " + "that is available by default and not a fallback"); } mWebViewProviderPackages = y(new WebViewProviderInfo[()]); }|-- frameworks/base/core/res/res/xml/config_webview_

Class providerClass = getProviderClass(); try { sProviderInstance = structor() .newInstance(new WebViewDelegate()); if (DEBUG) Log.v(LOGTAG, "Loaded provider: " + sProviderInstance); return sProviderInstance; } catch (Exception e) { ... } } finally { nd(_TAG_WEBVIEW); eadPolicy(oldPolicy); } } } private static Class getProviderClass() { Context webViewContext = null; Application initialApplication = tialApplication(); try {

try { webViewContext = getWebViewContextAndSetProvider(); } finally { nd(_TAG_WEBVIEW); } Log.i(LOGTAG, "Loading " + eName + " version " + nName + " (code " + nCode + ")"); egin(_TAG_WEBVIEW, "omiumProviderClass()"); try { ets().addAssetPathAsSharedLibrary( licationInfo().sourceDir); ClassLoader clazzLoader = ssLoader(); egin(_TAG_WEBVIEW, "tiveLibrary()"); loadNativeLibrary(clazzLoader); nd(_TAG_WEBVIEW); egin(_TAG_WEBVIEW, "e()"); try { return (Class) e(CHROMIUM_WEBVIEW_FACTORY, true, clazzLoader); } finally { nd(_TAG_WEBVIEW); } } catch (ClassNotFoundException e) { Log.e(LOGTAG, "error loading provider", e); throw new AndroidRuntimeException(e); } finally { nd(_TAG_WEBVIEW); } } catch (MissingWebViewPackageException e) { // If the package doesn't exist, then try loading the null WebView instead. // If that succeeds, then this is a device without WebView support; if it fails then // swallow the failure, complain that the real WebView is missing and rethrow the // original exception. try { return (Class) e(NULL_WEBVIEW_FACTORY); } catch (ClassNotFoundException e2) { // Ignore. } Log.e(LOGTAG, "Chromium WebView package does not exist", e); throw new AndroidRuntimeException(e); }

} } private static Context getWebViewContextAndSetProvider() { Application initialApplication = tialApplication(); try { WebViewProviderResponse response = null; try {//IWebViewUpdateService

response = getUpdateService().waitForAndGetProvider(); } finally { nd(_TAG_WEBVIEW); } ... try { ault().addPackageDependency( eName); } finally { nd(_TAG_WEBVIEW); } // Fetch package info and verify it against the chosen package PackageInfo newPackageInfo = null; try { newPackageInfo = kageManager().getPackageInfo( eName, _SHARED_LIBRARY_FILES | _DEBUG_TRIAGED_MISSING // Make sure that we fetch the current provider even if its not // installed for the current user | _UNINSTALLED_PACKAGES // Fetch signatures for verification | _SIGNATURES // Get meta-data for meta data flag verification | _META_DATA); } finally { nd(_TAG_WEBVIEW); } // Validate the newly fetched package info, throws MissingWebViewPackageException on // failure verifyPackageInfo(eInfo, newPackageInfo); egin(_TAG_WEBVIEW, "ApplicationContext"); try { // Construct an app context to load the Java code into the current app. Context webViewContext = ApplicationContext( ationInfo, T_INCLUDE_CODE | T_IGNORE_SECURITY); sPackageInfo = newPackageInfo; return webViewContext; } finally { nd(_TAG_WEBVIEW); } } catch (RemoteException | tFoundException e) { throw new MissingWebViewPackageException("Failed to load WebView provider: " + e); } } /** @hide */ public static IWebViewUpdateService getUpdateService() { return rface( vice(WEBVIEW_UPDATE_SERVICE_NAME)); }

本文标签: 选择方式实现