01-20 09:07:48.758 W/ActivityManager( 1743):
android.os.DeadObjectException
01-20 09:07:48.758 W/ActivityManager( 1743): at
android.os.BinderProxy.transact(Native Method)
01-20 09:07:48.758 W/ActivityManager( 1743): at
android.app.ApplicationThreadProxy.scheduleLaunchActivity
(ApplicationThreadNative.java:462)
01-20 09:07:48.758 W/ActivityManager( 1743): at
com.android.server.am.ActivityManagerService.realStartActivityLocked
(ActivityManagerService.java:1797)
01-20 09:07:48.758 W/ActivityManager( 1743): at
com.android.server.am.ActivityManagerService.startSpecificActivityLocked
(ActivityManagerService.java:1872)
01-20 09:07:48.758 W/ActivityManager( 1743): at
com.android.server.am.ActivityManagerService.resumeTopActivityLocked
(ActivityManagerService.java:2795)
01-20 09:07:48.758 W/ActivityManager( 1743): at
com.android.server.am.ActivityManagerService.completePauseLocked
(ActivityManagerService.java:2194)
01-20 09:07:48.758 W/ActivityManager( 1743): at
com.android.server.am.ActivityManagerService.activityPaused
(ActivityManagerService.java:5598)
01-20 09:07:48.758 W/ActivityManager( 1743): at
com.android.server.am.ActivityManagerService.activityPaused
(ActivityManagerService.java:5576)
01-20 09:07:48.758 W/ActivityManager( 1743): at
android.app.ActivityManagerNative.onTransact
(ActivityManagerNative.java:306)
01-20 09:07:48.758 W/ActivityManager( 1743): at
com.android.server.am.ActivityManagerService.onTransact
(ActivityManagerService.java:1535)
01-20 09:07:48.758 W/ActivityManager( 1743): at
android.os.Binder.execTransact(Binder.java:287)
01-20 09:07:48.758 W/ActivityManager( 1743): at
dalvik.system.NativeStart.run(Native Method)
01-20 09:07:48.778 I/ActivityManager( 1743): Start proc
com.android.camera for activity com.android.camera/.Camera: pid=26208
uid=10035 gids={1006, 1015}
01-20 09:07:48.778 I/ActivityManager( 1743): Process
com.android.camera (pid 2256) has died.
01-20 09:07:49.288 W/ActivityManager( 1743): No pending application
record for pid 26208 (IApplicationThread
android.app.ApplicationThreadProxy@2ea43f98); dropping process
01-20 09:07:49.288 I/Process ( 1743): Sending signal. PID: 26208 SIG:
9
Tracing through ActivityManangerService it seems that this could
happen when an application that is being resumed gets killed due to
memory pressure. There is some code in ActivityManagerService to
recover from this by restarting the process, which does successfully
restart it, but it does not find a pending application record for it
so it gets killed.
private final void startSpecificActivityLocked(HistoryRecord r,
boolean andResume, boolean checkConfig) {
// Is this activity's application already running?
ProcessRecord app = getProcessRecordLocked(r.processName,
r.info.applicationInfo.uid);
if (r.startTime == 0) {
r.startTime = SystemClock.uptimeMillis();
if (mInitialStartTime == 0) {
mInitialStartTime = r.startTime;
}
} else if (mInitialStartTime == 0) {
mInitialStartTime = SystemClock.uptimeMillis();
}
if (app != null && app.thread != null) {
try {
realStartActivityLocked(r, app, andResume,
checkConfig);
return;
} catch (RemoteException e) {
Log.w(TAG, "Exception when starting activity "
+ r.intent.getComponent().flattenToShortString
(), e);
}
// If a dead object exception was thrown -- fall through
to
// restart the application.
}
startProcessLocked(r.processName, r.info.applicationInfo,
true, 0,
"activity", r.intent.getComponent());
}
I am able to reproduce this scenario by doing the following:
1. Debug system_server in jdb
2. Open the camera application (which application does not really
matter)
3. Close the camera application
4. Put a breakpoint at ActivityManagerService:1872 (on the call to
realStartActivityLocked in startSpecificActivityLocked)
5. Open the camera application -- you will hit the breakpoint in
ActivityManagerService at this point
6. Kill the camera application (adb shell kill -9 <pid of camera>)
7. Continue from the breakpoint in system_server
8. In the logcat output you will see the camera process being started
but it won't get focus
I was able to workaround this by calling appDiedLocked and
startActivityLocked instead of calling startProcessLocked, but I was
not sure if this was the best solution. Below are the changes:
private final void startSpecificActivityLocked(HistoryRecord r,
boolean andResume, boolean checkConfig) {
// Is this activity's application already running?
ProcessRecord app = getProcessRecordLocked(r.processName,
r.info.applicationInfo.uid);
if (r.startTime == 0) {
r.startTime = SystemClock.uptimeMillis();
if (mInitialStartTime == 0) {
mInitialStartTime = r.startTime;
}
} else if (mInitialStartTime == 0) {
mInitialStartTime = SystemClock.uptimeMillis();
}
if (app != null && app.thread != null) {
try {
realStartActivityLocked(r, app, andResume,
checkConfig);
return;
} catch (RemoteException e) {
Log.w(TAG, "Exception when starting activity "
+ r.intent.getComponent().flattenToShortString
(), e);
appDiedLocked(app, app.pid, app.thread);
startActivityLocked(r, true, true);
return;
}
}
startProcessLocked(r.processName, r.info.applicationInfo,
true, 0,
"activity", r.intent.getComponent());
}
Does anyone more familiar with ActivityManager have any feedback on
whether this is the right solution to the problem or not?
thanks,
Josh
--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.