我知道这听起来很懒散......但我真的不知道这种情况是如何发生的,我也无法在Google上找到关于它的更多信息。
背景
它是IPC的应用程序:我在不同的流程中运行服务。有时候,服务被杀了......但它并没有真正地死掉#34;相反,我从ActivityManager
中得到了一个名为" 虚假死亡的术语&#34 ;.发生这种情况时,服务的行为就像一个僵尸。它还活着,但它并没有真正发挥作用。
04-12 10:03:37.935 728 830 I ActivityManager:强制完成 活动ActivityRecord {11eee41f u0 com.android.staging / com.android.activities.MainActivity t8210} 04-12 10:03:37.937 728 830 I ActivityManager:强制停止服务ServiceRecord {291a4c9b u0 com.android.staging / com.android.services.CallService} 04-12 10:03:37.969 728 2563 W ActivityManager:ProcessRecord的虚假死亡{27ecf545 11057:com.android.staging / u0a268},curProc 对于11057:null
答案 0 :(得分:3)
可在此处找到违规行: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.0.0_r1/com/android/server/am/ActivityManagerService.java/#4858 (不同版本的Android L的不同行)
我假设您使用的是某种形式的Android L,因为直到那时才添加了特定的错误消息。
如果您在流程中运行ContentProvider,那么ActivityManagerService中的这两条注释可能会有所帮助:
9303 // NOTE: there is still a race here where a signal could be
9304 // pending on the process even though we managed to update its
9305 // adj level. Not sure what to do about this, but at least
9306 // the race is now smaller.
9307 if (!success) {
9308 // Uh oh... it looks like the provider's process
9309 // has been killed on us. We need to wait for a new
9310 // process to be started, and make sure its death
9311 // doesn't kill our process.
然后......
9317 appDiedLocked(cpr.proc);
也可以从其他一些源文件中调用appDiedLocked:ActiveServices.java和ActivityStackSupervisor.java,一个依赖于抛出的DeadObjectException,另一个依赖于RemoteException。
appDiedLocked看起来像这样
4853 final void appDiedLocked(ProcessRecord app, int pid, IApplicationThread thread) {
4854 // First check if this ProcessRecord is actually active for the pid.
4855 synchronized (mPidsSelfLocked) {
4856 ProcessRecord curProc = mPidsSelfLocked.get(pid);
4857 if (curProc != app) {
4858 Slog.w(TAG, "Spurious death for " + app + ", curProc for " + pid + ": " + curProc);
4859 return;
4860 }
4861 }
出于某种原因,curProc与app ProcessRecord不同,并且appDiedLocked方法被缩短了。在你的情况下,由于某种原因,curProc为null。
长话短说:您的进程已经死亡或被杀死,某些状态或条件阻止appDiedLocked继续运行killProcess命令。你需要做更多的调查/记录才能找出发生这种情况的原因。
如果你有一个想要保持活着的服务,除非你已经这样做,我建议你附上一个状态栏通知,这样就可以降低被杀的可能性。