RK onConfigurationChanged ConfigChanges 设备状态的改变
“mcc“ 移动国家号码,由三位数字组成,每个国家都有自己独立的MCC,可以识别手机用户所属国家。
“mnc“ 移动网号,在一个国家或者地区中,用于区分手机用户的服务商。
“locale“ 所在地区发生变化。
“touchscreen“ 触摸屏已经改变
“keyboard“ 键盘模式发生变化,例如:用户接入外部键盘输入。
“keyboardHidden“ 用户打开手机硬件键盘
“navigation“ 导航型发生了变化
“orientation“ 设备旋转,横向显示和竖向显示模式切换。
“fontScale“ 全局字体大小缩放发生改变
一.插拔触摸导致浏览器刷新页面
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | 09 - 07 09 : 23 : 49.442 V/UsbDeviceManager( 557 ): USB UEVENT: {DEVNAME=input/event4, SUBSYSTEM=input, SEQNUM= 2116 , MAJOR= 13 , ACTION=remove, MINOR= 68 , DEVPATH=/devices/platform/ff500000.usb/usb2/ 2 - 1 / 2 - 1.1 / 2 - 1.1 : 1.0 / 0003 :202E: 0006.0009 /input/input16/event4} --------- beginning of main 09 - 07 09 : 23 : 49.443 I/EventHub( 557 ): Removing device Multi Touch Vendor Infrared Multi Touch Screen Product due to epoll hang-up event. 09 - 07 09 : 23 : 49.444 I/EventHub( 557 ): Removed device: path=/dev/input/event4 name=Multi Touch Vendor Infrared Multi Touch Screen Product id= 12 fd= 236 classes= 0x80000014 09 - 07 09 : 23 : 49.460 I/InputReader( 557 ): Device removed: id= 12 , name= 'Multi Touch Vendor Infrared Multi Touch Screen Product' , sources= 0x00001002 09 - 07 09 : 23 : 49.460 D/InputReader( 557 ): Could not retrieve current multitouch slot index. status=- 1 09 - 07 09 : 23 : 49.463 I/ActivityManager( 557 ): Config changes= 8 { 1.0 dualscreenflag=DISABLE ?mcc?mnc [zh_CN] ldltr sw1080dp w1920dp h1000dp 160dpi xlrg long land -touch qwerty/v/h dpad/v s. 22 } 09 - 07 09 : 23 : 49.470 I/EventHub( 557 ): Removing device '/dev/input/event4' due to inotify event 09 - 07 09 : 23 : 49.491 V/UsbDeviceManager( 557 ): USB UEVENT: {PROP= 2 , SUBSYSTEM=input, PRODUCT= 3 /202e/ 6 / 100 , SEQNUM= 2117 , EV=b, ACTION=remove, ABS= 2738000 3 , DEVPATH=/devices/platform/ff500000.usb/usb2/ 2 - 1 / 2 - 1.1 / 2 - 1.1 : 1.0 / 0003 :202E: 0006.0009 /input/input16, PHYS= "usb-ff500000.usb-1.1/input0" , KEY= 400 0 0 0 0 0 0 0 0 0 0 , NAME= "Multi Touch Vendor Infrared Multi Touch Screen Product" , MODALIAS=input:b0003v202Ep0006e0100-e0, 1 , 3 ,k14A,ra0, 1 ,2F, 30 , 31 , 34 , 35 , 36 , 39 ,mlsfw, UNIQ= "3" } 09 - 07 09 : 23 : 49.499 V/UsbDeviceManager( 557 ): USB UEVENT: {DEVNAME=usb/hiddev0, SUBSYSTEM=usbmisc, SEQNUM= 2118 , MAJOR= 180 , ACTION=remove, MINOR= 96 , DEVPATH=/devices/platform/ff500000.usb/usb2/ 2 - 1 / 2 - 1.1 / 2 - 1.1 : 1.0 /usbmisc/hiddev0} 09 - 07 09 : 23 : 49.500 V/UsbDeviceManager( 557 ): USB UEVENT: {DEVNAME=hidraw1, SUBSYSTEM=hidraw, SEQNUM= 2120 , MAJOR= 239 , ACTION=remove, MINOR= 1 , DEVPATH=/devices/platform/ff500000.usb/usb2/ 2 - 1 / 2 - 1.1 / 2 - 1.1 : 1.0 / 0003 :202E: 0006.0009 /hidraw/hidraw1} 09 - 07 09 : 23 : 49.500 V/UsbDeviceManager( 557 ): USB UEVENT: {SUBSYSTEM=hid, SEQNUM= 2121 , HID_ID= 0003 :0000202E: 00000006 , HID_UNIQ= 3 , ACTION=remove, DEVPATH=/devices/platform/ff500000.usb/usb2/ 2 - 1 / 2 - 1.1 / 2 - 1.1 : 1.0 / 0003 :202E: 0006.0009 , MODALIAS=hid:b0003g0002v0000202Ep00000006, HID_NAME=Multi Touch Vendor Infrared Multi Touch Screen Product, HID_PHYS=usb-ff500000.usb- 1.1 /input0} 09 - 07 09 : 23 : 49.501 V/UsbDeviceManager( 557 ): USB UEVENT: {SUBSYSTEM=usb, DEVTYPE=usb_interface, PRODUCT=202e/ 6 / 200 , SEQNUM= 2122 , ACTION=remove, DEVPATH=/devices/platform/ff500000.usb/usb2/ 2 - 1 / 2 - 1.1 / 2 - 1.1 : 1.0 , TYPE= 0 / 0 / 0 , MODALIAS=usb:v202Ep0006d0200dc00dsc00dp00ic03isc01ip00in00, INTERFACE= 3 / 1 / 0 } 09 - 07 09 : 23 : 49.502 V/UsbDeviceManager( 557 ): USB UEVENT: {SUBSYSTEM=leds, SEQNUM= 2123 , ACTION=remove, DEVPATH=/devices/platform/ff500000.usb/usb2/ 2 - 1 / 2 - 1.1 / 2 - 1.1 : 1.1 / 0003 :202E: 0006 .000A/input/input18/input18::numlock} 09 - 07 09 : 23 : 49.502 W/Vold ( 191 ): subsystem found in netlink event 09 - 07 09 : 23 : 49.502 D/Vold ( 191 ): usb, 2 09 - 07 09 : 23 : 49.502 V/UsbDeviceManager( 557 ): USB UEVENT: {SUBSYSTEM=leds, SEQNUM= 2124 , ACTION=remove, DEVPATH=/devices/platform/ff500000.usb/usb2/ 2 - 1 / 2 - 1.1 / 2 - 1.1 : 1.1 / 0003 :202E: 0006 .000A/input/input18/input18::capslock} 09 - 07 09 : 23 : 49.502 V/UsbDeviceManager( 557 ): USB UEVENT: {SUBSYSTEM=leds, SEQNUM= 2125 , ACTION=remove, DEVPATH=/devices/platform/ff500000.usb/usb2/ 2 - 1 / 2 - 1.1 / 2 - 1.1 : 1.1 / 0003 :202E: 0006 .000A/input/input18/input18::scrolllock} 09 - 07 09 : 23 : 49.516 V/UsbDeviceManager( 557 ): USB UEVENT: {DEVNAME=input/event5, SUBSYSTEM=input, SEQNUM= 2126 , MAJOR= 13 , ACTION=remove, MINOR= 69 , DEVPATH=/devices/platform/ff500000.usb/usb2/ 2 - 1 / 2 - 1.1 / 2 - 1.1 : 1.1 / 0003 :202E: 0006 .000A/input/input18/event5} 09 - 07 09 : 23 : 49.517 I/EventHub( 557 ): Removing device Multi Touch Vendor Infrared Multi Touch Screen Product due to epoll hang-up event. 09 - 07 09 : 23 : 49.517 I/EventHub( 557 ): Removed device: path=/dev/input/event5 name=Multi Touch Vendor Infrared Multi Touch Screen Product id= 13 fd= 264 classes= 0x403 09 - 07 09 : 23 : 49.522 D/BrowserActivity( 1822 ): onPause //重新加载了 09 - 07 09 : 23 : 49.522 D/LightningView( 1822 ): Pausing JS timers 09 - 07 09 : 23 : 49.523 D/LightningView( 1822 ): WebView onPause: 13 09 - 07 09 : 23 : 49.528 D/Lightning( 1822 ): Saving tab state 09 - 07 09 : 23 : 49.533 I/EventHub( 557 ): Removing device '/dev/input/event5' due to inotify event 09 - 07 09 : 23 : 49.533 I/InputReader( 557 ): Device removed: id= 13 , name= 'Multi Touch Vendor Infrared Multi Touch Screen Product' , sources= 0x00002103 09 - 07 09 : 23 : 49.536 W/TelecomManager( 557 ): Telecom Service not found. 09 - 07 09 : 23 : 49.541 D/BrowserActivity( 1822 ): onDestroy 09 - 07 09 : 23 : 49.541 D/BrowserPresenter( 1822 ): On tab changed 09 - 07 09 : 23 : 49.542 D/BrowserActivity( 1822 ): Remove the tab view 09 - 07 09 : 23 : 49.551 D/LightningView( 1822 ): Pausing JS timers 09 - 07 09 : 23 : 49.552 D/BrowserApp( 1822 ): Cleaning up after the Android framework 09 - 07 09 : 23 : 49.553 E/BrowserActivity( 1822 ): mSearchBackground onFocusChange hasFocus 09 - 07 09 : 23 : 49.553 E/BrowserActivity( 1822 ): mSearchBackground onFocusChange not Focus 09 - 07 09 : 23 : 49.554 E/BrowserActivity( 1822 ): onFocusChange hasFocus 09 - 07 09 : 23 : 49.555 I/art ( 1822 ): Starting a blocking GC Explicit 09 - 07 09 : 23 : 49.582 I/art ( 1822 ): Explicit concurrent mark sweep GC freed 3352 (191KB) AllocSpace objects, 5 (108KB) LOS objects, 39 % free, 3MB/5MB, paused 622us total 26 .017ms 09 - 07 09 : 23 : 49.590 I/art ( 1822 ): Starting a blocking GC Explicit 09 - 07 09 : 23 : 49.606 V/UsbDeviceManager( 557 ): USB UEVENT: {MSC= 10 , PROP= 0 , SUBSYSTEM=input, PRODUCT= 3 /202e/ 6 / 110 , SEQNUM= 2127 , EV= 120013 , ACTION=remove, DEVPATH=/devices/platform/ff500000.usb/usb2/ 2 - 1 / 2 - 1.1 / 2 - 1.1 : 1.1 / 0003 :202E: 0006 .000A/input/input18, PHYS= "usb-ff500000.usb-1.1/input1" , KEY= 10000 7 ff9f207a c14057ff febeffdf ffefffff ffffffff fffffffe, NAME= "Multi Touch Vendor Infrared Multi Touch Screen Product" , MODALIAS=input:b0003v202Ep0006e0110-e0, 1 , 4 , 11 , 14 ,k71, 72 , 73 , 74 , 75 , 77 , 79 ,7A,7B,7C,7D,7E,7F, 80 , 81 , 82 , 83 , 84 , 85 , 86 , 87 , 88 , 89 ,8A,8C,8E, 96 , 98 ,9E,9F,A1,A3,A4,A5,A6,AD,B0,B1,B2,B3,B4,B7,B8,B9,BA,BB,BC,BD,BE,BF,C0,C1,C2,F0,ram4,l0, 1 , 2 ,sfw, UNIQ= "3" , LED= 7 } 09 - 07 09 : 23 : 49.607 V/UsbDeviceManager( 557 ): USB UEVENT: {DEVNAME=hidraw2, SUBSYSTEM=hidraw, SEQNUM= 2128 , MAJOR= 239 , ACTION=remove, MINOR= 2 , DEVPATH=/devices/platform/ff500000.usb/usb2/ 2 - 1 / 2 - 1.1 / 2 - 1.1 : 1.1 / 0003 :202E: 0006 .000A/hidraw/hidraw2} 09 - 07 09 : 23 : 49.607 V/UsbDeviceManager( 557 ): USB UEVENT: {SUBSYSTEM=hid, SEQNUM= 2129 , HID_ID= 0003 :0000202E: 00000006 , HID_UNIQ= 3 , ACTION=remove, DEVPATH=/devices/platform/ff500000.usb/usb2/ 2 - 1 / 2 - 1.1 / 2 - 1.1 : 1.1 / 0003 :202E: 0006 .000A, MODALIAS=hid:b0003g0001v0000202Ep00000006, HID_NAME=Multi Touch Vendor Infrared Multi Touch Screen Product, HID_PHYS=usb-ff500000.usb- 1.1 /input1} 09 - 07 09 : 23 : 49.608 V/UsbDeviceManager( 557 ): USB UEVENT: {SUBSYSTEM=usb, DEVTYPE=usb_interface, PRODUCT=202e/ 6 / 200 , SEQNUM= 2130 , ACTION=remove, DEVPATH=/devices/platform/ff500000.usb/usb2/ 2 - 1 / 2 - 1.1 / 2 - 1.1 : 1.1 , TYPE= 0 / 0 / 0 , MODALIAS=usb:v202Ep0006d0200dc00dsc00dp00ic03isc01ip01in01, INTERFACE= 3 / 1 / 1 } 09 - 07 09 : 23 : 49.608 W/Vold ( 191 ): subsystem found in netlink event 09 - 07 09 : 23 : 49.608 D/Vold ( 191 ): usb, 2 09 - 07 09 : 23 : 49.609 W/Vold ( 191 ): subsystem found in netlink event 09 - 07 09 : 23 : 49.609 I/UsbAlsaManager( 557 ): USB Audio Device Removed: null 09 - 07 09 : 23 : 49.609 D/Vold ( 191 ): usb, 2 09 - 07 09 : 23 : 49.609 V/UsbDeviceManager( 557 ): USB UEVENT: {PRODUCT=202e/ 6 / 200 , DEVTYPE=usb_device, SUBSYSTEM=usb, DEVNAME=bus/usb/ 002 / 009 , SEQNUM= 2131 , MAJOR= 189 , ACTION=remove, DEVPATH=/devices/platform/ff500000.usb/usb2/ 2 - 1 / 2 - 1.1 , MINOR= 136 , TYPE= 0 / 0 / 0 , DEVNUM= 009 , BUSNUM= 002 } 09 - 07 09 : 23 : 49.612 I/art ( 1822 ): Explicit concurrent mark sweep GC freed 9305 (615KB) AllocSpace objects, 7 (164KB) LOS objects, 39 % free, 2MB/4MB, paused 681us total 21 .843ms 09 - 07 09 : 23 : 49.688 E/AndroidIME( 1106 ): dV: Undefined Keyboard State: LANG_ZH_CN 09 - 07 09 : 23 : 49.752 D/mali_winsys( 1106 ): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000 09 - 07 09 : 23 : 49.760 W/PhoneWindow( 1822 ): Previously focused view reported id 13 during save, but can't be found during restore. 09 - 07 09 : 23 : 49.762 D/BrowserActivity( 1822 ): onResume 09 - 07 09 : 23 : 49.765 E/ProxyChangeListener( 1822 ): Using no proxy configuration due to exception:java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.os.BaseBundle.get(java.lang.String)' on a null object reference 09 - 07 09 : 23 : 49.766 E/ native ( 1106 ): hmm_engine.cc: 1482 Unable to get language model data setting 09 - 07 09 : 23 : 49.777 W/cr_ScreenOrientation( 1822 ): Removing an inexistent observer! 09 - 07 09 : 23 : 49.848 D/mali_winsys( 1822 ): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000 09 - 07 09 : 23 : 49.853 D/TabsManager( 1822 ): URL from intent: null 09 - 07 09 : 23 : 49.856 D/BrowserActivity( 1822 ): Network Connected: true 09 - 07 09 : 23 : 49.859 D/Lightning( 1822 ): Restoring previous WebView state now 09 - 07 09 : 23 : 49.866 E/AndroidIME( 1106 ): dV: Undefined Keyboard State: LANG_ZH_CN 09 - 07 09 : 23 : 49.933 D/BrowserActivity( 1822 ): onWindowFocusChanged 09 - 07 09 : 23 : 49.939 D/TabsManager( 1822 ): New tab 09 - 07 09 : 23 : 49.946 W/cr_AwContents( 1822 ): onDetachedFromWindow called when already detached. Ignoring 09 - 07 09 : 23 : 49.955 I/cr_Ime ( 1822 ): ImeThread is not enabled. 09 - 07 09 : 23 : 49.961 D/BrowserActivity( 1822 ): Notify Tab Changed: 0 09 - 07 09 : 23 : 49.992 W/IInputConnectionWrapper( 1822 ): getTextBeforeCursor on inactive InputConnection 09 - 07 09 : 23 : 49.997 D/BrowserActivity( 1822 ): Notify Tab Changed: 0 09 - 07 09 : 23 : 49.997 D/BrowserActivity( 1822 ): Notify Tabs Initialized 09 - 07 09 : 23 : 49.997 D/BrowserPresenter( 1822 ): tabChanged: 0 09 - 07 09 : 23 : 49.997 D/TabsManager( 1822 ): switch to tab: 0 09 - 07 09 : 23 : 49.998 D/BrowserPresenter( 1822 ): On tab changed 09 - 07 09 : 23 : 49.998 D/LightningView( 1822 ): Resuming JS timers 09 - 07 09 : 23 : 49.998 D/LightningView( 1822 ): WebView onResume: 14 09 - 07 09 : 23 : 49.998 D/BrowserActivity( 1822 ): Notify Tab Changed: 0 09 - 07 09 : 23 : 50.001 D/BrowserActivity( 1822 ): Setting the tab view 09 - 07 09 : 23 : 50.008 I/WindowManager( 557 ): Screen frozen for +524ms due to Window{b4202dc u0 acr.browser.barebones/acr.browser.lightning.activity.MainActivity} 09 - 07 09 : 23 : 50.013 I/ActivityManager( 557 ): Config changes= 10 { 1.0 dualscreenflag=DISABLE ?mcc?mnc [zh_CN] ldltr sw1080dp w1920dp h1000dp 160dpi xlrg long land -touch -keyb/v/h dpad/v s. 23 } 09 - 07 09 : 23 : 50.018 D/BrowserActivity( 1822 ): Notify Tab Changed: 0 09 - 07 09 : 23 : 50.104 D/BrowserActivity( 1822 ): onConfigurationChanged 09 - 07 09 : 23 : 50.112 D/BrowserActivity( 1822 ): Notify Tab Changed: 0 09 - 07 09 : 23 : 50.152 W/InputMethodService( 1106 ): Window size has been changed. This may cause jankiness of resizing window: - 1 -> - 2 09 - 07 09 : 23 : 50.158 W/IInputConnectionWrapper( 1822 ): finishComposingText on inactive InputConnection 09 - 07 09 : 23 : 50.158 W/IInputConnectionWrapper( 1822 ): finishComposingText on inactive InputConnection 09 - 07 09 : 23 : 50.159 W/IInputConnectionWrapper( 1822 ): finishComposingText on inactive InputConnection 09 - 07 09 : 23 : 50.279 I/art ( 1822 ): Do full code cache collection, code=206KB, data=244KB 09 - 07 09 : 23 : 50.281 I/art ( 1822 ): Starting a blocking GC JitCodeCache 09 - 07 09 : 23 : 50.282 I/art ( 1822 ): After code cache collection, code=201KB, data=210KB 09 - 07 09 : 23 : 50.591 W/cr_BindingManager( 1822 ): Cannot call determinedVisibility() - never saw a connection for the pid: 1822 09 - 07 09 : 23 : 50.897 I/chromium( 1822 ): [INFO:CONSOLE( 1 )] "'webkitIndexedDB' is deprecated. Please use 'indexedDB' instead." , source: https: //hectorstatic.baidu.com/a27e7df71036d80c.js (1) 09 - 07 09 : 23 : 52.013 I/art ( 557 ): Starting a blocking GC Explicit 09 - 07 09 : 23 : 52.065 I/art ( 557 ): Explicit concurrent mark sweep GC freed 13043 (690KB) AllocSpace objects, 0 (0B) LOS objects, 33 % free, 5MB/7MB, paused 884us total 51 .625ms 09 - 07 09 : 23 : 52.605 D/BrowserActivity( 1822 ): Notify Tab Changed: 0 09 - 07 09 : 23 : 52.662 D/BrowserActivity( 1822 ): Notify Tab Changed: 0 09 - 07 09 : 23 : 52.663 D/Lightning( 1822 ): Caching icon for m.baidu.com |
解决方法
1 2 3 4 5 6 7 | <activity android:name= "BrowserActivity" android:label= "@string/application_name" android:launchMode= "singleTask" android:alwaysRetainTaskState= "true" android:configChanges= "orientation|keyboardHidden|keyboard|screenSize|locale|touchscreen" android:theme= "@style/BrowserTheme" android:windowSoftInputMode= "adjustResize" > |
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|fontScale"
二.在解决客户自启APK,会运行两次OnCreate生命周期
分析结果:是由于使用了4G通讯模块,加载模块的使用会导致 Activity关闭并重启自身
1 | 在main Activity中添加 android:configChanges = "mnc|mcc" 即可 |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】