diff options
| author | Andrii Kulian <akulian@google.com> | 2019-10-17 16:26:17 -0700 |
|---|---|---|
| committer | Andrii Kulian <akulian@google.com> | 2020-01-24 09:59:36 -0800 |
| commit | 4679918cdfa4939b3d74373a2f77af78d701259d (patch) | |
| tree | 118c96b7be345df095139bf345c3cd28eced739f /core/java/android/app/ActivityThread.java | |
| parent | c8e17b66f313fd2777876b20a09f61f0c7fa0f79 (diff) | |
Merge sleeping activities with visibility updates
Previously we were using a separate SLEEP message to communicate
with the client. The sleeping implementation on the client though
simply transitioned it between STARTED and STOPPED states.
This CL relies on visibility updates to communicate the sleeping
state. The "sleeping" status field is still used in the server-side
to record when device started going to sleep, and prevents any
activity that was launched before to influence the power state of
the device.
Bug: 137329632
Test: AM/WM CTS and unit tests
Change-Id: Idd7f5bf6730d3372168d862ef713a44f700430f1
Diffstat (limited to 'core/java/android/app/ActivityThread.java')
| -rw-r--r-- | core/java/android/app/ActivityThread.java | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 2ca5b1d5c76f..c52bdc01860c 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -924,10 +924,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) { @@ -1855,7 +1851,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"; @@ -1985,11 +1980,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); @@ -4855,41 +4845,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; |
