http://blog.youkuaiyun.com/huangyabin001/article/details/42914771
cient端发生异常:1.没有加catch处理,则异常会直接抛给client端,手机端会弹出XXX已经停止运行
2.加了catch处理,异常被catch住,手机端不会弹出XXX已经停止运行
server端发生异常:1.server端没有catch,则直接抛给client端,
1.1 如果clent端也没有catch,则client会弹出XXX已经停止运行
1.2 如果clent端catch,则client不会弹出XXX已经停止运行
2.server端catch,则不会抛给client端
注:如果是oneway调用,server端发生异常,不会抛到client端。服务端会打出如下log
01-18 15:06:51.070 8622 8641 W Binder : Caught a RuntimeException from the binder stub implementation.
01-18 15:06:51.070 8622 8641 W Binder : java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.toString()' on a null object reference
01-18 15:06:51.070 8622 8641 W Binder : at com.miui.securityspace.service.SecondSpaceService$SpaceBinder.createUser(SecondSpaceService.java:82)
01-18 15:06:51.070 8622 8641 W Binder : at com.miui.securityspace.service.ISpaceService$Stub.onTransact(ISpaceService.java:48)
01-18 15:06:51.070 8622 8641 W Binder : at android.os.Binder.execTransact(Binder.java:453)
12-07 20:01:19.931 7272 7272 E AndroidRuntime: FATAL EXCEPTION: main
12-07 20:01:19.931 7272 7272 E AndroidRuntime: Process: com.miui.whetstone, PID: 7272
12-07 20:01:19.931 7272 7272 E AndroidRuntime: java.lang.SecurityException: killPids only available to the system
12-07 20:01:19.931 7272 7272 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:1683)
12-07 20:01:19.931 7272 7272 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:1636)
12-07 20:01:19.931 7272 7272 E AndroidRuntime: at android.app.ActivityManagerProxy.killPids(ActivityManagerNative.java:5140)
12-07 20:01:19.931 7272 7272 E AndroidRuntime: at com.miui.whetstone.server.IActivityManagerWrapper.killPids()
12-07 20:01:19.931 7272 7272 E AndroidRuntime: at com.miui.whetstone.wtstrategy.WtProcessStrategy.doTrimMiddle()
12-07 20:01:19.931 7272 7272 E AndroidRuntime: at com.miui.whetstone.wtstrategy.WtProcessStrategy.dealProcessInBackground()
12-07 20:01:19.931 7272 7272 E AndroidRuntime: at com.miui.whetstone.wtstrategy.WtProcessStrategy.onHandleBackGroundProcess()
12-07 20:01:19.931 7272 7272 E AndroidRuntime: at com.miui.whetstone.process.WtProcessController.notifyHandleBackGroundProcess()
12-07 20:01:19.931 7272 7272 E AndroidRuntime: at com.miui.whetstone.process.WtProcessController.dispatchDealBackgroundProcess()
12-07 20:01:19.931 7272 7272 E AndroidRuntime: at com.miui.whetstone.process.WtProcessController.-wrap2()
12-07 20:01:19.931 7272 7272 E AndroidRuntime: at com.miui.whetstone.process.WtProcessController$WtProcessHandler.handleMessage()
12-07 20:01:19.931 7272 7272 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
12-07 20:01:19.931 7272 7272 E AndroidRuntime: at android.os.Looper.loop(Looper.java:163)
12-07 20:01:19.931 7272 7272 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6337)
12-07 20:01:19.931 7272 7272 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
12-07 20:01:19.931 7272 7272 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
12-07 20:01:19.931 7272 7272 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)
我们经常会进行跨进程通信,跨进程通信设计两个进进程,现记为client , server端cient端发生异常:1.没有加catch处理,则异常会直接抛给client端,手机端会弹出XXX已经停止运行
2.加了catch处理,异常被catch住,手机端不会弹出XXX已经停止运行
server端发生异常:1.server端没有catch,则直接抛给client端,
1.1 如果clent端也没有catch,则client会弹出XXX已经停止运行
1.2 如果clent端catch,则client不会弹出XXX已经停止运行
2.server端catch,则不会抛给client端
注:如果是oneway调用,server端发生异常,不会抛到client端。服务端会打出如下log
01-18 15:06:51.070 8622 8641 W Binder : Caught a RuntimeException from the binder stub implementation.
01-18 15:06:51.070 8622 8641 W Binder : java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.toString()' on a null object reference
01-18 15:06:51.070 8622 8641 W Binder : at com.miui.securityspace.service.SecondSpaceService$SpaceBinder.createUser(SecondSpaceService.java:82)
01-18 15:06:51.070 8622 8641 W Binder : at com.miui.securityspace.service.ISpaceService$Stub.onTransact(ISpaceService.java:48)
01-18 15:06:51.070 8622 8641 W Binder : at android.os.Binder.execTransact(Binder.java:453)