Caused by: java.lang.IllegalArgumentException android.os.Parcel.readException(Parcel.java:1687)
java.lang.RuntimeException: Unable to resume activity {com.android.soundrecorder/com.android.soundrecorder.SoundRecorder}: java.lang.IllegalArgumentException
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3523)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3563)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1587)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6294)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
Caused by: java.lang.IllegalArgumentException
at android.os.Parcel.readException(Parcel.java:1687)
at android.os.Parcel.readException(Parcel.java:1636)
at android.app.ActivityManagerProxy.isTopOfTask(ActivityManagerNative.java:5663)
at android.app.Activity.isTopOfTask(Activity.java:5963)
at android.app.Activity.onResume(Activity.java:1254)
at com.android.soundrecorder.SoundRecorder.onResume(SoundRecorder.java:516)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1269)
at android.app.Activity.performResume(Activity.java:6770)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3494)
... 8 more
異常堆疊
public final void readException() { int code = readExceptionCode(); if (code != 0) { String msg = readString(); readException(code, msg); } }
public final void readException(int code, String msg) { switch (code) { case EX_SECURITY: throw newframeworks\base\core\java\android\app\ActivityManagerNative.javaSecurityException(msg); case EX_BAD_PARCELABLE: throw new BadParcelableException(msg); case EX_ILLEGAL_ARGUMENT: throw new IllegalArgumentException(msg); case EX_NULL_POINTER:
public booleanframeworks\base\services\core\java\com\android\server\am\ActivityManagerService.javaisTopOfTask(IBinder token) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeStrongBinder(token); mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0); reply.readException(); boolean res = reply.readInt() == 1; data.recycle(); reply.recycle(); return res; }
public boolean isTopOfTask(IBinder token) { synchronized (this) { ActivityRecord r = ActivityRecord.isInStackLocked(token); if (r == null) { throw new IllegalArgumentException(); } return r.task.getTopActivity() == r; } }
是由於r == null 導致遠端返回丟擲異常。
01-03 16:40:10.696 1160 1177 W ActivityManager: Activity stop timeout for ActivityRecord{8e16bb5 u0 com.android.soundrecorder/.SoundRecorder t12}
01-03 16:40:22.073 1160 1177 W ActivityManager: Activity destroy timeout for ActivityRecord{8e16bb5 u0 com.android.soundrecorder/.SoundRecorder t12 f}
activity stop timeout 會移除record 導致r == null
這裡需要找出為什麼 activity stop timeout