SysUtils单元:ApplicationContext就是空的ApplicationStatus(web视图)视图、单元、SysUtils、ApplicationContext

2023-09-06 01:51:17 作者:远方远

我可以看到一些奇怪的WebView基于应用程序的开始。它不会影响到所有的应用程序,但我很好奇,为什么会出现错误。没有崩溃,一切都似乎是确定的,但错误...

I can see something strange at WebView based app start. It doesn't affect the app at all but I'm curious why the error appears. Nothing crashes, everything seems to be ok, but the error...

下面是logcat的

Loading com.google.android.webview version 42.0.2311.137 (code 2311137)
I/LibraryLoader﹕ Time to load native libraries: 2 ms (timestamps 3347-3349)
I/LibraryLoader﹕ Expected native library version number "",actual native library version number ""
V/WebViewChromiumFactoryProvider﹕ Binding Chromium to main looper Looper (main, tid 1) {2d3b4b2c}
I/LibraryLoader﹕ Expected native library version number "",actual native library version number ""
I/chromium﹕ [INFO:library_loader_hooks.cc(112)] Chromium logging enabled: level = 0, default verbosity = 0
I/BrowserStartupController﹕ Initializing chromium process, singleProcess=true
W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
E/SysUtils﹕ ApplicationContext is null in ApplicationStatus
W/chromium﹕ [WARNING:resource_bundle.cc(286)] locale_file_path.empty()
I/chromium﹕ [INFO:aw_browser_main_parts.cc(63)] Load from apk succesful, fd=34 off=6850672 len=3697
I/chromium﹕ [INFO:aw_browser_main_parts.cc(76)] Loading webviewchromium.pak from, fd:35 off:7953036 len:1161174
I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 01/15/15, ab0075f, Id3510ff6dc
W/AudioManagerAndroid﹕ Requires BLUETOOTH permission
W/chromium﹕ [WARNING:data_reduction_proxy_config.cc(150)] SPDY proxy OFF at startup
W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
W/AwContents﹕ onDetachedFromWindow called when already detached. Ignoring
I/GAv4﹕ Google Analytics 4.5.0/7327 is starting up. To enable debug logging on a device run:
    adb shell setprop log.tag.GAv4 DEBUG
    adb logcat -s GAv4

我想误差来自这里: https://chromium.googlesource.com/chromium/src/base/+/master/android/java/src/org/chromium/base/SysUtils.java

I suppose the error comes from here: https://chromium.googlesource.com/chromium/src/base/+/master/android/java/src/org/chromium/base/SysUtils.java

的WebView初始化的几行

A few lines of WebView initialisation

...
// load url in webView
webView.loadUrl(webViewUrl);
webView.setWebViewClient(new MyAppWebViewClient());

// implement WebChromeClient inner class
// we will define openFileChooser for select file from camera
webView.setWebChromeClient(new WebChromeClient() {
...

这是怎么回事?

What's going on?

推荐答案

这是怎么发生的事情是:

What is happening here is:

的ApplicationStatus尚未初始化,所以上下文不能从它获得。这是一个完全自然的情况,所以应该提高没有错误。登录这是一个错误的codeR夸张。

The ApplicationStatus is not initialized yet, so the context cannot be obtained from it. This is a completely natural situation, so no error should be raised. Logging this as an error was an exaggeration from the coder.

但是:

:此不会引起任何实际问题下,因为函数试图获得上下文对象只进行又一检查,以评定该装置的性能能力。因为它有时不能称之为isLowRamDevice(),它只会继续执行检查的其余部分。因此最坏的情况是不能够检测一个低端电话在这一点上,和随后的检查将作出

This does not cause any real problem, because the function tries to get a context object only to perform yet another check to assess the performance capabilities of the device. Since it sometimes fails to call the "isLowRamDevice()", it will just carry on performing the rest of the checks. So worst case scenario is not being able to detect a low-end phone at this point, and subsequent checks will be made.

此外,它是完全正常的, 我看到一个棒棒糖设备此错误(Nexus的10),而不是在一个软糖设备,因为该函数有一个早期的回报,如果它检测到低于奇巧什么。 ( //任何pre-奇巧设备不能被视为'低端'

Also it is completely normal that "I see this error in a Lollipop device (Nexus 10) but not in a JellyBean device", because the function has an early return if it detects anything below KitKat. (// Any pre-KitKat device cannot be considered 'low-end')