SystemUI app cant use Textview autoLinked feature?
Reported by
a32824...@gmail.com,
Jan 10
|
|||
Issue description
Steps to reproduce the problem:
android os version 8.1
I develop the systemui app at work.
some crash about systemui app on user phone but not offen happen.
it's occur crash when use Textview in some time(maybe reboot and unlock screen?)
What is the expected behavior?
What went wrong?
the crash trace look like this:
Caused by: android.util.AndroidRuntimeException: java.lang.reflect.InvocationTargetException
at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:213)
at android.webkit.WebView.getFactory(WebView.java:2530)
at android.webkit.WebView.findAddress(WebView.java:1802)
at android.text.util.Linkify.gatherMapLinks(Linkify.java:609)
at android.text.util.Linkify.addLinks(Linkify.java:261)
at android.text.util.Linkify.addLinks(Linkify.java:227)
at android.widget.TextView.setText(TextView.java:5367)
at android.widget.TextView.setText(TextView.java:5287)
at android.widget.TextView.setText(TextView.java:5244)
at android.widget.TextView.setMovementMethod(TextView.java:2475)
at android.widget.TextView.setTextIsSelectable(TextView.java:6684)
at android.widget.TextView.<init>(TextView.java:1351)
at android.widget.TextView.<init>(TextView.java:835)
at android.widget.TextView.<init>(TextView.java:831)
... 61 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:208)
... 74 more
Caused by: java.lang.IllegalArgumentException: WebView cannot be used with device protected storage
at com.android.webview.chromium.WebViewChromiumFactoryProvider.checkStorageIsNotDeviceProtected(WebViewChromiumFactoryProvider.java:291)
at com.android.webview.chromium.WebViewChromiumFactoryProvider.initialize(WebViewChromiumFactoryProvider.java:223)
at com.android.webview.chromium.WebViewChromiumFactoryProvider.<init>(WebViewChromiumFactoryProvider.java:207)
at com.android.webview.chromium.WebViewChromiumFactoryProviderForOMR1.<init>(WebViewChromiumFactoryProviderForOMR1.java:13)
at com.android.webview.chromium.WebViewChromiumFactoryProviderForOMR1.create(WebViewChromiumFactoryProviderForOMR1.java:9)
... 76 more
when use textview's auto linked feature, it occur cash.
Did this work before? N/A
Chrome version: 65.0.3325.162 Channel: n/a
OS Version:
Flash Version:
I have other issue.
some system app use webview,so our framework code disable SYSTEM_UID check like this:
if (uid == android.os.Process.ROOT_UID /*|| uid == android.os.Process.SYSTEM_UID*/
|| uid == android.os.Process.PHONE_UID || uid == android.os.Process.NFC_UID
|| uid == android.os.Process.BLUETOOTH_UID) {
throw new UnsupportedOperationException(
"For security reasons, WebView is not allowed in privileged processes");
}
and my problem is other phone, like nexus phone.When their system app which share on SYSTEM_UID, use Textview and use autolinked feature,will their app crash on it?
Is webview bug?Or system app bug?
,
Jan 10
,
Jan 10
Several things: 1) Disabling the SYSTEM_UID check in the framework is a security risk. Apps running with the system UID should not be using WebView, because WebView is dynamically loaded from an updatable source and so is not as strongly guaranteed to be unmodified as the things build into the system image. Devices should not make this change and system apps need to work in some other way, for example by having the UI for the app be in a separate package that runs with a regular application UID and communicates with the system process via an API that's protected by a system permission. You should ideally be doing this anyway, even if you don't need to use WebView - you should be minimising the amount of code that runs under SYSTEM_UID due to the security risk associated with the high level of privilege. 2) TextView uses Linkify, which in turn depends on WebView (on Android versions older than 9.0) to turn street addresses into map links. You can disable linkifying street addresses to avoid both the cost and compatibility issues of loading WebView: see https://developer.android.com/reference/android/text/util/Linkify where it explains that MAP_ADDRESSES is deprecated. The algorithm used to recognise street addresses is, and has always been, of very poor quality and only matches a subset of addresses in the USA - it does not work for any other country, and has a high false positive rate, so applications should avoid it in all cases, even if they aren't encountering WebView-related issues. 3) Your application probably has "defaultToDeviceProtectedStorage" set to true in its manifest. WebView is not compatible with device protected storage, and cannot be used when the device has not yet been unlocked by the user. This setting was only intended to be used when the Direct Boot feature was first introduced to help system apps quickly update, and is not expected to be used any more for applications that are being kept up to date. Your app should instead use the regular Direct Boot APIs (such as Context.createDeviceProtectedStorageContext() when it wants to access device protected storage), and not rely on this setting to change the default - but even then, you will not be able to use WebView in the app (including for linkifying street addresses) until after the device has been unlocked for the first time and credential-protected storage is available. There is no bug here, everything is working as intended.
,
Jan 11
thanks torne,it is helpful for me. |
|||
►
Sign in to add a comment |
|||
Comment 1 by a32824...@gmail.com
, Jan 10