Parcel.readException

本文记录了在Android系统中遇到的一个关于Wi-Fi开关设置时出现的崩溃问题及其解决方案。问题表现为当尝试关闭Wi-Fi时应用程序抛出空指针异常并崩溃。通过调试发现是在远程进程的stub函数中操作了一个空指针对象。

http://10.125.33.60:801/show_bug.cgi?id=7860197

02-22 15:08:15.339 D/WifiService(  482): setWifiEnabled: false pid=5488, uid=1000
02-22 15:08:15.339 E/WifiService(  482): Invoking mWifiStateMachine.setWifiEnabled
02-22 15:08:15.399 E/AndroidRuntime( 5488): FATAL EXCEPTION: main
02-22 15:08:15.399 E/AndroidRuntime( 5488): java.lang.NullPointerException
02-22 15:08:15.399 E/AndroidRuntime( 5488):  at android.os.Parcel.readException(Parcel.java:1431)
02-22 15:08:15.399 E/AndroidRuntime( 5488):  at android.os.Parcel.readException(Parcel.java:1379)
02-22 15:08:15.399 E/AndroidRuntime( 5488):  at android.net.wifi.IWifiManager$Stub$Proxy.setWifiEnabled(IWifiManager.java:677)
02-22 15:08:15.399 E/AndroidRuntime( 5488):  at android.net.wifi.WifiManager.setWifiEnabled(WifiManager.java:981)
02-22 15:08:15.399 E/AndroidRuntime( 5488):  at com.android.settings.wifi.WifiEnabler.onCheckedChanged(WifiEnabler.java:131)
02-22 15:08:15.399 E/AndroidRuntime( 5488):  at android.widget.CompoundButton.setChecked(CompoundButton.java:170)
02-22 15:08:15.399 E/AndroidRuntime( 5488):  at android.widget.Switch.setChecked(Switch.java:707)
02-22 15:08:15.399 E/AndroidRuntime( 5488):  at android.widget.CompoundButton.toggle(CompoundButton.java:131)
02-22 15:08:15.399 E/AndroidRuntime( 5488):  at android.widget.CompoundButton.performClick(CompoundButton.java:143)
02-22 15:08:15.399 E/AndroidRuntime( 5488):  at android.view.View$PerformClick.run(View.java:16988)
02-22 15:08:15.399 E/AndroidRuntime( 5488):  at android.os.Handler.handleCallback(Handler.java:615)
02-22 15:08:15.399 E/AndroidRuntime( 5488):  at android.os.Handler.dispatchMessage(Handler.java:92)
02-22 15:08:15.399 E/AndroidRuntime( 5488):  at android.os.Looper.loop(Looper.java:137)
02-22 15:08:15.399 E/AndroidRuntime( 5488):  at android.app.ActivityThread.main(ActivityThread.java:4800)
02-22 15:08:15.399 E/AndroidRuntime( 5488):  at java.lang.reflect.Method.invokeNative(Native Method)
02-22 15:08:15.399 E/AndroidRuntime( 5488):  at java.lang.reflect.Method.invoke(Method.java:511)
02-22 15:08:15.399 E/AndroidRuntime( 5488):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
02-22 15:08:15.399 E/AndroidRuntime( 5488):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
02-22 15:08:15.399 E/AndroidRuntime( 5488):  at dalvik.system.NativeStart.main(Native Method)
02-22 15:08:15.429 I/ActivityManager(  482): Notify an ApplicationCrash
02-22 15:08:15.469 W/ActivityManager(  482):   Force finishing activity com.android.settings/.SubSettings
02-22 15:08:16.009 W/ActivityManager(  482): Activity pause timeout for ActivityRecord{41f65f98 com.android.settings/.SubSettings}
02-22 15:08:17.569 D/StatusBar.NetworkController(  599): in updateWifiIcons, mWifiConnected: true, mDataAndWifiStacked: false
02-22 15:08:17.569 D/StatusBar.NetworkController(  599): in updateWifiIcons, mFmcState: 0
02-22 15:08:20.569 D/StatusBar.NetworkController(  599): in updateWifiIcons, mWifiConnected: true, mDataAndWifiStacked: false
02-22 15:08:20.569 D/StatusBar.NetworkController(  599): in updateWifiIcons, mFmcState: 0
02-22 15:08:25.519 W/ActivityManager(  482): Launch timeout has expired, giving up wake lock!
02-22 15:08:26.029 W/ActivityManager(  482): Activity idle timeout for ActivityRecord{41f4f3b8 com.android.settings/.Settings}
02-22 15:08:26.229 D/WifiService(  482): ACTION_BATTERY_CHANGED pluggedType: 1
02-22 15:08:27.359 I/WindowState(  482): WIN DEATH: Window{4267abc0 com.android.settings/com.android.settings.Settings paused=false}
02-22 15:08:27.359 I/ActivityManager(  482): Process com.android.settings (pid 5488) has died.
02-22 15:08:27.359 W/ActivityManager(  482): Scheduling restart of crashed service com.android.settings/.schpwronoff.AlarmReceiverService in 5000ms
02-22 15:08:27.359 W/ActivityManager(  482): Scheduling restart of crashed service com.android.settings/.schpwronoff.SchPwrOnOffService in 5000ms
02-22 15:08:27.359 I/WindowState(  482): WIN DEATH: Window{4227e798 com.android.settings/com.android.settings.SubSettings paused=false}
02-22 15:08:27.369 W/ActivityManager(  482): Force removing ActivityRecord{41f4f3b8 com.android.settings/.Settings}: app died, no saved state
02-22 15:08:27.669 W/InputMethodManagerService(  482): Got RemoteException sending setActive(false) notification to pid 5488 uid 1000
02-22 15:08:27.889 W/BackupManagerService(  482): dataChanged but no participant pkg='com.android.providers.settings' uid=10024
02-22 15:08:27.889 D/PowerManagerService(  482): lincl1+++smart backlight  mJsonData is null
02-22 15:08:32.379 I/ActivityManager(  482): Start proc com.android.settings for service com.android.settings/.schpwronoff.SchPwrOnOffService: pid=9811 uid=1000 gids={1015, 1023, 3002, 3001, 3003, 1028, 1006, 1004, 2002}
02-22 15:08:35.909 I/ActivityManager(  482): Start proc com.lenovo.smart for broadcast com.lenovo.smart/.receiver.SmartReceiver: pid=9823 uid=10030 gids={3003, 1015, 1023, 1028}
02-22 15:08:35.909 I/ActivityManager(  482): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.settings/.Settings u=0} from pid 759
02-22 15:08:35.959 I/UsageStats(  482): addRunApplicationLog(com.android.settings) mLastDuration = 743785
02-22 15:08:36.529 D/ConnectivityService(  482): getMobileDataEnabled returning true
02-22 15:08:36.809 D/WifiService(  482): setWifiEnabled: true pid=9811, uid=1000
02-22 15:08:36.809 E/WifiService(  482): Invoking mWifiStateMachine.setWifiEnabled
 

 

 

 From there I found my problem was actually I was trying to operate on a null pointer object in my stub function in the remote processwhich in turn injected a parcel exception for nullpointerexception in the result it was returning and looks like what this original question is asking about.

My solution was simply to test the object wasn't null before using it :)

08-06 15:57:27.375 17358 17452 D VRI[ImageFragmentActivity]: Received frameCommittedCallback lastAttemptedDrawFrameNum=2 didProduceBuffer=true syncBuffer=false 08-06 15:57:27.376 17358 17358 D VRI[ImageFragmentActivity]: draw finished. seqId=0 08-06 15:57:27.407 17358 18634 I MID : >>> queryMatchContentProviders size:0 08-06 15:57:27.411 17358 17406 E MtaSDK : get device id error 08-06 15:57:27.411 17358 17406 E MtaSDK : java.lang.SecurityException: null: The uid 10456 does not meet the requirements to access device identifiers. 08-06 15:57:27.411 17358 17406 E MtaSDK : at android.os.Parcel.createExceptionOrNull(Parcel.java:3272) 08-06 15:57:27.411 17358 17406 E MtaSDK : at android.os.Parcel.createException(Parcel.java:3256) 08-06 15:57:27.411 17358 17406 E MtaSDK : at android.os.Parcel.readException(Parcel.java:3239) 08-06 15:57:27.411 17358 17406 E MtaSDK : at android.os.Parcel.readException(Parcel.java:3181) 08-06 15:57:27.411 17358 17406 E MtaSDK : at com.android.internal.telephony.ITelephony$Stub$Proxy.getDeviceIdWithFeature(ITelephony.java:12073) 08-06 15:57:27.411 17358 17406 E MtaSDK : at android.telephony.TelephonyManager.getDeviceId(TelephonyManager.java:2353) 08-06 15:57:27.411 17358 17406 E MtaSDK : at com.tencent.stat.common.Util.getDeviceID(SourceFile:174) 08-06 15:57:27.411 17358 17406 E MtaSDK : at com.tencent.stat.event.Event.init(SourceFile:178) 08-06 15:57:27.411 17358 17406 E MtaSDK : at com.tencent.stat.event.Event.<init>(SourceFile:125) 08-06 15:57:27.411 17358 17406 E MtaSDK : at com.tencent.stat.event.k.<init>(SourceFile:29) 08-06 15:57:27.411 17358 17406 E MtaSDK : at com.tencent.stat.StatServiceImpl$34.run(SourceFile:706) 08-06 15:57:27.411 17358 17406 E MtaSDK : at android.os.Handler.handleCallback(Handler.java:959) 08-06 15:57:27.411 17358 17406 E MtaSDK : at android.os.Handler.dispatchMessage(Handler.java:100) 08-06 15:57:27.411 17358 17406 E MtaSDK : at android.os.Looper.loopOnce(Looper.java:282) 08-06 15:57:27.411 17358 17406 E MtaSDK : at android.os.Looper.loop(Looper.java:387) 08-06 15:57:27.411 17358 17406 E MtaSDK : at android.os.HandlerThread.run(HandlerThread.java:85) 08-06 15:57:27.411 17358 17406 W MtaSDK : [StatService(27): SourceFile:709] - Invalid invocation since previous onResume on diff page. 08-06 15:57:27.417 17358 17469 E MtaSDK : get device id error 08-06 15:57:27.417 17358 17469 E MtaSDK : java.lang.SecurityException: null: The uid 10456 does not meet the requirements to access device identifiers. 08-06 15:57:27.417 17358 17469 E MtaSDK : at android.os.Parcel.createExceptionOrNull(Parcel.java:3272) 08-06 15:57:27.417 17358 17469 E MtaSDK : at android.os.Parcel.createException(Parcel.java:3256) 08-06 15:57:27.417 17358 17469 E MtaSDK : at android.os.Parcel.readException(Parcel.java:3239) 08-06 15:57:27.417 17358 17469 E MtaSDK : at android.os.Parcel.readException(Parcel.java:3181) 08-06 15:57:27.417 17358 17469 E MtaSDK : at com.android.internal.telephony.ITelephony$Stub$Proxy.getDeviceIdWithFeature(ITelephony.java:12073) 08-06 15:57:27.417 17358 17469 E MtaSDK : at android.telephony.TelephonyManager.getDeviceId(TelephonyManager.java:2353) 08-06 15:57:27.417 17358 17469 E MtaSDK : at com.tencent.stat.common.Util.getDeviceID(SourceFile:174) 08-06 15:57:27.417 17358 17469 E MtaSDK : at com.tencent.stat.common.Util.getNewUi(SourceFile:200) 08-06 15:57:27.417 17358 17469 E MtaSDK : at com.tencent.stat.event.Event.encode(SourceFile:206) 08-06 15:57:27.417 17358 17469 E MtaSDK : at com.tencent.stat.event.Event.toJsonString(SourceFile:320) 08-06 15:57:27.417 17358 17469 E MtaSDK : at com.tencent.stat.e.a(SourceFile:980) 08-06 15:57:27.417 17358 17469 E MtaSDK : at com.tencent.stat.e.b(SourceFile:1036) 08-06 15:57:27.417 17358 17469 E MtaSDK : at com.tencent.stat.e.a(SourceFile:42) 08-06 15:57:27.417 17358 17469 E MtaSDK : at com.tencent.stat.e$4.run(SourceFile:1066) 08-06 15:57:27.417 17358 17469 E MtaSDK : at android.os.Handler.handleCallback(Handler.java:959) 08-06 15:57:27.417 17358 17469 E MtaSDK : at android.os.Handler.dispatchMessage(Handler.java:100) 08-06 15:57:27.417 17358 17469 E MtaSDK : at android.os.Looper.loopOnce(Looper.java:282) 08-06 15:57:27.417 17358 17469 E MtaSDK : at android.os.Looper.loop(Looper.java:387) 08-06 15:57:27.417 17358 17469 E MtaSDK : at android.os.HandlerThread.run(HandlerThread.java:85) 08-06 15:57:27.469 17358 17358 D InsetsController: hide(ime(), fromIme=true) 08-06 15:57:27.469 17358 17358 I ImeTracker: com.baidu.input_oppo:59ded396: onCancelled at PHASE_CLIENT_APPLY_ANIMATION 08-06 15:57:27.476 17358 18656 I MID : >>> queryMatchContentProviders size:0 08-06 15:57:27.480 17358 17406 E MtaSDK : get device id error 08-06 15:57:27.480 17358 17406 E MtaSDK : java.lang.SecurityException: null: The uid 10456 does not meet the requirements to access device identifiers. 08-06 15:57:27.480 17358 17406 E MtaSDK : at android.os.Parcel.createExceptionOrNull(Parcel.java:3272) 08-06 15:57:27.480 17358 17406 E MtaSDK : at android.os.Parcel.createException(Parcel.java:3256) 08-06 15:57:27.480 17358 17406 E MtaSDK : at android.os.Parcel.readException(Parcel.java:3239) 08-06 15:57:27.480 17358 17406 E MtaSDK : at android.os.Parcel.readException(Parcel.java:3181) 08-06 15:57:27.480 17358 17406 E MtaSDK : at com.android.internal.telephony.ITelephony$Stub$Proxy.getDeviceIdWithFeature(ITelephony.java:12073) 08-06 15:57:27.480 17358 17406 E MtaSDK : at android.telephony.TelephonyManager.getDeviceId(TelephonyManager.java:2353) 08-06 15:57:27.480 17358 17406 E MtaSDK : at com.tencent.stat.common.Util.getDeviceID(SourceFile:174) 08-06 15:57:27.480 17358 17406 E MtaSDK : at com.tencent.stat.event.Event.init(SourceFile:178) 08-06 15:57:27.480 17358 17406 E MtaSDK : at com.tencent.stat.event.Event.<init>(SourceFile:125) 08-06 15:57:27.480 17358 17406 E MtaSDK : at com.tencent.stat.event.k.<init>(SourceFile:29) 08-06 15:57:27.480 17358 17406 E MtaSDK : at com.tencent.stat.StatServiceImpl$34.run(SourceFile:706) 08-06 15:57:27.480 17358 17406 E MtaSDK : at android.os.Handler.handleCallback(Handler.java:959) 08-06 15:57:27.480 17358 17406 E MtaSDK : at android.os.Handler.dispatchMessage(Handler.java:100) 08-06 15:57:27.480 17358 17406 E MtaSDK : at android.os.Looper.loopOnce(Looper.java:282) 08-06 15:57:27.480 17358 17406 E MtaSDK : at android.os.Looper.loop(Looper.java:387) 08-06 15:57:27.480 17358 17406 E MtaSDK : at android.os.HandlerThread.run(HandlerThread.java:85) 08-06 15:57:27.480 17358 17406 W MtaSDK : [StatService(27): SourceFile:709] - Invalid invocation since previous onResume on diff page. 08-06 15:57:27.485 17358 17469 E MtaSDK : get device id error 08-06 15:57:27.485 17358 17469 E MtaSDK : java.lang.SecurityException: null: The uid 10456 does not meet the requirements to access device identifiers. 08-06 15:57:27.485 17358 17469 E MtaSDK : at android.os.Parcel.createExceptionOrNull(Parcel.java:3272) 08-06 15:57:27.485 17358 17469 E MtaSDK : at android.os.Parcel.createException(Parcel.java:3256) 08-06 15:57:27.485 17358 17469 E MtaSDK : at android.os.Parcel.readException(Parcel.java:3239) 08-06 15:57:27.485 17358 17469 E MtaSDK : at android.os.Parcel.readException(Parcel.java:3181)
08-07
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值