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
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
} } 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)); }
版权声明:本文标题:Android7.1WebView实现方式选择 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1705465698a140197.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论