12-09 17:35:54.870 7048 7067 E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: ActivityManager
12-09 17:35:54.870 7048 7067 E AndroidRuntime: java.lang.RuntimeException: Parcelable encounteredClassNotFoundException reading a Serializable object (name = com.facebook.zero.sdk.common.TokenRequestReason)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at android.os.Parcel.readSerializable(Parcel.java:2238)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at android.os.Parcel.readValue(Parcel.java:2065)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at android.os.Parcel.readArrayMapInternal(Parcel.java:2333)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at android.os.Bundle.unparcel(Bundle.java:249)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at android.os.Bundle.getInt(Bundle.java:994)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at android.content.Intent.getIntExtra(Intent.java:4558)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at com.android.server.am.BroadcastQueue.deliverToRegisteredReceiverLocked(BroadcastQueue.java:503)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at com.android.server.am.BroadcastQueue.processNextBroadcast(BroadcastQueue.java:555)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at com.android.server.am.BroadcastQueue$1.handleMessage(BroadcastQueue.java:141)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at android.os.Looper.loop(Looper.java:136)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at com.android.server.am.ActivityManagerService$AThread.run(ActivityManagerService.java:1870)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: com.facebook.zero.sdk.common.TokenRequestReason
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at java.lang.Class.classForName(Native Method)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at java.lang.Class.forName(Class.java:251)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:2262)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at android.os.Parcel$2.resolveClass(Parcel.java:2228)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at java.io.ObjectInputStream.readEnumDescInternal(ObjectInputStream.java:1553)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at java.io.ObjectInputStream.readEnumDesc(ObjectInputStream.java:1534)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at java.io.ObjectInputStream.readEnum(ObjectInputStream.java:1579)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:768)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1981)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1938)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at android.os.Parcel.readSerializable(Parcel.java:2232)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: ... 11 more
12-09 17:35:54.870 7048 7067 E AndroidRuntime: Caused by: java.lang.NoClassDefFoundError: com/facebook/zero/sdk/common/TokenRequestReason
12-09 17:35:54.870 7048 7067 E AndroidRuntime: ... 22 more
12-09 17:35:54.870 7048 7067 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.zero.sdk.common.TokenRequestReason" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/system/lib]]
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
12-09 17:35:54.870 7048 7067 E AndroidRuntime: ... 22 more
12-09 17:35:54.880 7048 7067 I am_crash: [7048,0,system_server,-1,java.lang.ClassNotFoundException,Didn't find class "com.facebook.zero.sdk.common.TokenRequestReason" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/system/lib]],BaseDexClassLoader.java,56]
12-09 17:35:54.920 184 184 D CRASHLOG: receive_inotify_events: Can't handle the event "drop16.tmp", no valid entry found, drop it...
这两天集中解决这个问题,搞的头都大了。不过最后还好,在和同事的努力下暂时解决了这个问题。
Root Cause: 从抓到的log以及复现的现象看到这个Exception 只会在第一次安装登陆facebook 或者是在Settings----apps-----facebook---clear data中清除了cache data后再次返回登陆facebook 就会发生。 因此,怀疑是facebook在用户第一次安装登陆时,会发送一个Action为com.facebook.zero.ACTION_ZERO_REFRESH_TOKEN 的广播,至于这个广播的作用就不是特别清楚了。
12-09 17:35:54.830 7048 7067 V BroadcastQueue: Processing parallel broadcast [background] BroadcastRecord{17024430 u0 com.facebook.zero.ACTION_ZERO_REFRESH_TOKEN}
每次在处理这个广播发送的serializable 的过程中就会发生上面异常,而这个异常发生在system server进程中,所以最终导致system server进程 killed ,android系统重启。
修改:
final void processNextBroadcast(boolean fromMsg) {
synchronized(mService) {
BroadcastRecord r;
......
// First, deliver any non-serialized broadcasts right away.
while (mParallelBroadcasts.size() > 0) {
r = mParallelBroadcasts.remove(0);
r.dispatchTime = SystemClock.uptimeMillis();
r.dispatchClockTime = System.currentTimeMillis();
final int N = r.receivers.size();
if (DEBUG_BROADCAST_LIGHT) Slog.v(TAG, "Processing parallel broadcast ["
+ mQueueName + "] " + r);
for (int i=0; i<N; i++) {
Object target = r.receivers.get(i);
if (DEBUG_BROADCAST) Slog.v(TAG,
"Delivering non-ordered on [" + mQueueName + "] to registered "
+ target + ": " + r);
//============= fix-facebook begin ps: do not deliver the broadcast .
if((null!=r) && r.intent.getAction().equalsIgnoreCase("com.facebook.zero.ACTION_ZERO_REFRESH_TOKEN")){
android.util.Log.d(TAG," test : facebook broadcast action is com.facebook.zero.ACTION_ZERO_REFRESH_TOKEN close it here .") ;
continue ;
}
//============fix-facebook end
deliverToRegisteredReceiverLocked(r, (BroadcastFilter)target, false);
}
addBroadcastToHistoryLocked(r);
if (DEBUG_BROADCAST_LIGHT) Slog.v(TAG, "Done with parallel broadcast ["
+ mQueueName + "] " + r);
} ......