Merge "Merge sleeping activities with visibility updates"
This commit is contained in:
committed by
Android (Google) Code Review
commit
8127bfcc43
@@ -926,10 +926,6 @@ public final class ActivityThread extends ClientTransactionHandler {
|
||||
private class ApplicationThread extends IApplicationThread.Stub {
|
||||
private static final String DB_INFO_FORMAT = " %8s %8s %14s %14s %s";
|
||||
|
||||
public final void scheduleSleeping(IBinder token, boolean sleeping) {
|
||||
sendMessage(H.SLEEPING, token, sleeping ? 1 : 0);
|
||||
}
|
||||
|
||||
public final void scheduleReceiver(Intent intent, ActivityInfo info,
|
||||
CompatibilityInfo compatInfo, int resultCode, String data, Bundle extras,
|
||||
boolean sync, int sendingUser, int processState) {
|
||||
@@ -1857,7 +1853,6 @@ public final class ActivityThread extends ClientTransactionHandler {
|
||||
case SCHEDULE_CRASH: return "SCHEDULE_CRASH";
|
||||
case DUMP_HEAP: return "DUMP_HEAP";
|
||||
case DUMP_ACTIVITY: return "DUMP_ACTIVITY";
|
||||
case SLEEPING: return "SLEEPING";
|
||||
case SET_CORE_SETTINGS: return "SET_CORE_SETTINGS";
|
||||
case UPDATE_PACKAGE_COMPATIBILITY_INFO: return "UPDATE_PACKAGE_COMPATIBILITY_INFO";
|
||||
case DUMP_PROVIDER: return "DUMP_PROVIDER";
|
||||
@@ -1987,11 +1982,6 @@ public final class ActivityThread extends ClientTransactionHandler {
|
||||
case DUMP_PROVIDER:
|
||||
handleDumpProvider((DumpComponentInfo)msg.obj);
|
||||
break;
|
||||
case SLEEPING:
|
||||
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "sleeping");
|
||||
handleSleeping((IBinder)msg.obj, msg.arg1 != 0);
|
||||
Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
|
||||
break;
|
||||
case SET_CORE_SETTINGS:
|
||||
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "setCoreSettings");
|
||||
handleSetCoreSettings((Bundle) msg.obj);
|
||||
@@ -4857,41 +4847,6 @@ public final class ActivityThread extends ClientTransactionHandler {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: This method should be changed to use {@link #performStopActivityInner} to perform to
|
||||
// stop operation on the activity to reduce code duplication and the chance of fixing a bug in
|
||||
// one place and missing the other.
|
||||
private void handleSleeping(IBinder token, boolean sleeping) {
|
||||
ActivityClientRecord r = mActivities.get(token);
|
||||
|
||||
if (r == null) {
|
||||
Log.w(TAG, "handleSleeping: no activity for token " + token);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sleeping) {
|
||||
if (!r.stopped && !r.isPreHoneycomb()) {
|
||||
callActivityOnStop(r, true /* saveState */, "sleeping");
|
||||
}
|
||||
|
||||
// Make sure any pending writes are now committed.
|
||||
if (!r.isPreHoneycomb()) {
|
||||
QueuedWork.waitToFinish();
|
||||
}
|
||||
|
||||
// Tell activity manager we slept.
|
||||
try {
|
||||
ActivityTaskManager.getService().activitySlept(r.token);
|
||||
} catch (RemoteException ex) {
|
||||
throw ex.rethrowFromSystemServer();
|
||||
}
|
||||
} else {
|
||||
if (r.stopped && r.activity.mVisibleFromServer) {
|
||||
r.activity.performRestart(true /* start */, "handleSleeping");
|
||||
r.setState(ON_START);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handleSetCoreSettings(Bundle coreSettings) {
|
||||
synchronized (mResourcesManager) {
|
||||
mCoreSettings = coreSettings;
|
||||
|
||||
@@ -141,7 +141,6 @@ interface IActivityTaskManager {
|
||||
in PersistableBundle persistentState, in CharSequence description);
|
||||
oneway void activityDestroyed(in IBinder token);
|
||||
void activityRelaunched(in IBinder token);
|
||||
oneway void activitySlept(in IBinder token);
|
||||
int getFrontActivityScreenCompatMode();
|
||||
void setFrontActivityScreenCompatMode(int mode);
|
||||
String getCallingPackage(in IBinder token);
|
||||
|
||||
@@ -91,7 +91,6 @@ oneway interface IApplicationThread {
|
||||
int resultCode, in String data, in Bundle extras, boolean ordered,
|
||||
boolean sticky, int sendingUser, int processState);
|
||||
void scheduleLowMemory();
|
||||
void scheduleSleeping(IBinder token, boolean sleeping);
|
||||
void profilerControl(boolean start, in ProfilerInfo profilerInfo, int profileType);
|
||||
void setSchedulingGroup(int group);
|
||||
void scheduleCreateBackupAgent(in ApplicationInfo app, in CompatibilityInfo compatInfo,
|
||||
|
||||
Reference in New Issue
Block a user