Loading services/java/com/android/server/am/ActivityManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -2871,7 +2871,7 @@ public final class ActivityManagerService extends ActivityManagerNative if (config != null) { r.frozenBeforeDestroy = true; if (!updateConfigurationLocked(config, r, false, false)) { r.task.stack.resumeTopActivityLocked(null); mStackSupervisor.resumeTopActivitiesLocked(); } } Binder.restoreCallingIdentity(origId); Loading services/java/com/android/server/am/ActivityStack.java +15 −20 Original line number Diff line number Diff line Loading @@ -244,10 +244,9 @@ final class ActivityStack { static final int PAUSE_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 1; static final int LAUNCH_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 2; static final int DESTROY_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 3; static final int RESUME_TOP_ACTIVITY_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 4; static final int LAUNCH_TICK_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 5; static final int STOP_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 6; static final int DESTROY_ACTIVITIES_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 7; static final int LAUNCH_TICK_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 4; static final int STOP_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 5; static final int DESTROY_ACTIVITIES_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 6; static class ScheduleDestroyArgs { final ProcessRecord mOwner; Loading Loading @@ -328,11 +327,6 @@ final class ActivityStack { } } } break; case RESUME_TOP_ACTIVITY_MSG: { synchronized (mService) { mStackSupervisor.getFocusedStack().resumeTopActivityLocked(null); } } break; case STOP_TIMEOUT_MSG: { ActivityRecord r = (ActivityRecord)msg.obj; // We don't at this point know if the activity is fullscreen, Loading Loading @@ -774,7 +768,7 @@ final class ActivityStack { if (prev == null) { Slog.e(TAG, "Trying to pause when nothing is resumed", new RuntimeException("here").fillInStackTrace()); mStackSupervisor.getFocusedStack().resumeTopActivityLocked(null); mStackSupervisor.resumeTopActivitiesLocked(); return; } if (DEBUG_STATES) Slog.v(TAG, "Moving to PAUSING: " + prev); Loading Loading @@ -900,7 +894,7 @@ final class ActivityStack { } else { if (r.configDestroy) { destroyActivityLocked(r, true, false, "stop-config"); mStackSupervisor.getFocusedStack().resumeTopActivityLocked(null); mStackSupervisor.resumeTopActivitiesLocked(); } else { // Now that this process has stopped, we may want to consider // it to be the previous app to try to keep around in case Loading Loading @@ -969,7 +963,7 @@ final class ActivityStack { final ActivityStack topStack = mStackSupervisor.getFocusedStack(); if (!mService.isSleepingOrShuttingDown()) { topStack.resumeTopActivityLocked(prev); mStackSupervisor.resumeTopActivitiesLocked(topStack, prev, null); } else { checkReadyForSleepLocked(); ActivityRecord top = topStack.topRunningActivityLocked(null); Loading @@ -979,7 +973,7 @@ final class ActivityStack { // activity on the stack is not the just paused activity, // we need to go ahead and resume it to ensure we complete // an in-flight app switch. topStack.resumeTopActivityLocked(null); mStackSupervisor.resumeTopActivitiesLocked(topStack, null, null); } } Loading Loading @@ -1495,7 +1489,7 @@ final class ActivityStack { + ", new next: " + nextNext); if (nextNext != next) { // Do over! mHandler.sendEmptyMessage(RESUME_TOP_ACTIVITY_MSG); mStackSupervisor.scheduleResumeTopActivities(); } if (mStackSupervisor.reportResumedActivityLocked(next)) { mNoAnimActivities.clear(); Loading Loading @@ -2465,7 +2459,7 @@ final class ActivityStack { boolean activityRemoved = destroyActivityLocked(r, true, oomAdj, "finish-imm"); if (activityRemoved) { mStackSupervisor.getFocusedStack().resumeTopActivityLocked(null); mStackSupervisor.resumeTopActivitiesLocked(); } return activityRemoved ? null : r; } Loading Loading @@ -2707,7 +2701,8 @@ final class ActivityStack { } } if (activityRemoved) { mStackSupervisor.getFocusedStack().resumeTopActivityLocked(null); mStackSupervisor.resumeTopActivitiesLocked(); } } Loading Loading @@ -2824,7 +2819,7 @@ final class ActivityStack { removeActivityFromHistoryLocked(r); } } mStackSupervisor.getFocusedStack().resumeTopActivityLocked(null); mStackSupervisor.resumeTopActivitiesLocked(); } finally { Binder.restoreCallingIdentity(origId); } Loading Loading @@ -3000,7 +2995,7 @@ final class ActivityStack { mWindowManager.moveTaskToTop(tr.taskId); mStackSupervisor.getFocusedStack().resumeTopActivityLocked(null); mStackSupervisor.resumeTopActivitiesLocked(); EventLog.writeEvent(EventLogTags.AM_TASK_TO_FRONT, tr.userId, tr.taskId); if (VALIDATE_TOKENS) { Loading Loading @@ -3078,7 +3073,7 @@ final class ActivityStack { return mStackSupervisor.resumeHomeActivity(null); } mStackSupervisor.getFocusedStack().resumeTopActivityLocked(null); mStackSupervisor.resumeTopActivitiesLocked(); return true; } Loading Loading @@ -3426,7 +3421,7 @@ final class ActivityStack { ActivityStack stack = mStackSupervisor.getFocusedStack(); if (stack == null) { mStackSupervisor.resumeHomeActivity(null); } else if (!stack.resumeTopActivityLocked(null)) { } else if (!mStackSupervisor.resumeTopActivitiesLocked(stack, null, null)) { // If there was nothing to resume, and we are not already // restarting this process, but there is a visible activity that // is hosted by the process... then make sure all visible Loading services/java/com/android/server/am/ActivityStackSupervisor.java +36 −11 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import static com.android.server.am.ActivityManagerService.DEBUG_RESULTS; import static com.android.server.am.ActivityManagerService.DEBUG_SWITCH; import static com.android.server.am.ActivityManagerService.DEBUG_TASKS; import static com.android.server.am.ActivityManagerService.DEBUG_USER_LEAVING; import static com.android.server.am.ActivityManagerService.FIRST_SUPERVISOR_STACK_MSG; import static com.android.server.am.ActivityManagerService.TAG; import android.app.Activity; Loading Loading @@ -89,8 +90,9 @@ public class ActivityStackSupervisor { /** How long we wait until giving up on the last activity telling us it is idle. */ static final int IDLE_TIMEOUT = 10*1000; static final int IDLE_TIMEOUT_MSG = ActivityManagerService.FIRST_SUPERVISOR_STACK_MSG; static final int IDLE_NOW_MSG = ActivityManagerService.FIRST_SUPERVISOR_STACK_MSG + 1; static final int IDLE_TIMEOUT_MSG = FIRST_SUPERVISOR_STACK_MSG; static final int IDLE_NOW_MSG = FIRST_SUPERVISOR_STACK_MSG + 1; static final int RESUME_TOP_ACTIVITY_MSG = FIRST_SUPERVISOR_STACK_MSG + 2; final ActivityManagerService mService; final Context mContext; Loading Loading @@ -236,7 +238,7 @@ public class ActivityStackSupervisor { prev.mLaunchHomeTaskNext = false; } if (mHomeStack.topRunningActivityLocked(null) != null) { return mHomeStack.resumeTopActivityLocked(prev); return resumeTopActivitiesLocked(mHomeStack, prev, null); } return mService.startHomeActivityLocked(mCurrentUser); } Loading Loading @@ -1341,7 +1343,7 @@ public class ActivityStackSupervisor { // sure we have correctly resumed the top activity. if (doResume) { setLaunchHomeTaskNextFlag(sourceRecord, null, targetStack); targetStack.resumeTopActivityLocked(null, options); resumeTopActivitiesLocked(targetStack, null, options); } else { ActivityOptions.abort(options); } Loading Loading @@ -1474,7 +1476,7 @@ public class ActivityStackSupervisor { // resumed the top activity. if (doResume) { setLaunchHomeTaskNextFlag(sourceRecord, null, topStack); topStack.resumeTopActivityLocked(null); resumeTopActivitiesLocked(); } ActivityOptions.abort(options); if ((startFlags&ActivityManager.START_FLAG_ONLY_IF_NEEDED) != 0) { Loading Loading @@ -1758,7 +1760,7 @@ public class ActivityStackSupervisor { } if (activityRemoved) { getFocusedStack().resumeTopActivityLocked(null); resumeTopActivitiesLocked(); } return res; Loading Loading @@ -1795,14 +1797,28 @@ public class ActivityStackSupervisor { return didSomething; } void resumeTopActivitiesLocked() { boolean resumeTopActivitiesLocked() { return resumeTopActivitiesLocked(null, null, null); } boolean resumeTopActivitiesLocked(ActivityStack targetStack, ActivityRecord target, Bundle targetOptions) { if (targetStack == null) { targetStack = getFocusedStack(); } boolean result = false; for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) { final ActivityStack stack = mStacks.get(stackNdx); if (isFrontStack(stack)) { if (stack == targetStack) { result = stack.resumeTopActivityLocked(target, targetOptions); } else { stack.resumeTopActivityLocked(null); } } } return result; } void finishTopRunningActivityLocked(ProcessRecord app) { final int numStacks = mStacks.size(); Loading Loading @@ -1854,7 +1870,7 @@ public class ActivityStackSupervisor { return; } stack.moveTask(taskId, toTop); stack.resumeTopActivityLocked(null); resumeTopActivitiesLocked(); } ActivityRecord findTaskLocked(Intent intent, ActivityInfo info) { Loading Loading @@ -1913,7 +1929,7 @@ public class ActivityStackSupervisor { final ActivityStack stack = mStacks.get(stackNdx); stack.awakeFromSleepingLocked(); if (isFrontStack(stack)) { stack.resumeTopActivityLocked(null); resumeTopActivitiesLocked(); } } } Loading Loading @@ -2200,13 +2216,17 @@ public class ActivityStackSupervisor { } final void scheduleIdleLocked() { mHandler.obtainMessage(IDLE_NOW_MSG).sendToTarget(); mHandler.sendEmptyMessage(IDLE_NOW_MSG); } void removeTimeoutsForActivityLocked(ActivityRecord r) { mHandler.removeMessages(IDLE_TIMEOUT_MSG, r); } final void scheduleResumeTopActivities() { mHandler.sendEmptyMessage(RESUME_TOP_ACTIVITY_MSG); } private final class ActivityStackSupervisorHandler extends Handler { public ActivityStackSupervisorHandler(Looper looper) { Loading Loading @@ -2237,6 +2257,11 @@ public class ActivityStackSupervisor { case IDLE_NOW_MSG: { activityIdleInternal((ActivityRecord)msg.obj); } break; case RESUME_TOP_ACTIVITY_MSG: { synchronized (mService) { resumeTopActivitiesLocked(); } } break; } } } Loading services/java/com/android/server/wm/DimLayer.java +18 −9 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ package com.android.server.wm; import android.graphics.PixelFormat; import android.graphics.Rect; import android.os.SystemClock; import android.util.Slog; import android.view.DisplayInfo; Loading @@ -26,8 +27,11 @@ public class DimLayer { /** Last value passed to mDimSurface.setLayer() */ int mLayer = -1; /** Last values passed to mDimSurface.setSize() */ int mLastDimWidth, mLastDimHeight; /** Next values to pass to mDimSurface.setPosition() and mDimSurface.setSize() */ Rect mBounds = new Rect(); /** Last values passed to mDimSurface.setPosition() and mDimSurface.setSize() */ Rect mLastBounds = new Rect(); /** True after mDimSurface.show() has been called, false after mDimSurface.hide(). */ private boolean mShowing = false; Loading Loading @@ -116,6 +120,10 @@ public class DimLayer { } } void setBounds(Rect bounds) { mBounds.set(bounds); } /** * @param duration The time to test. * @return True if the duration would lead to an earlier end to the current animation. Loading Loading @@ -151,6 +159,7 @@ public class DimLayer { return; } /* // Set surface size to screen size. final DisplayInfo info = mDisplayContent.getDisplayInfo(); // Multiply by 1.5 so that rotating a frozen surface that includes this does not expose a Loading @@ -160,17 +169,17 @@ public class DimLayer { // back off position so 1/4 of Surface is before and 1/4 is after. final float xPos = -1 * dw / 6; final float yPos = -1 * dh / 6; */ if (mLastDimWidth != dw || mLastDimHeight != dh || mLayer != layer) { if (!mLastBounds.equals(mBounds) || mLayer != layer) { try { mDimSurface.setPosition(xPos, yPos); mDimSurface.setSize(dw, dh); mDimSurface.setPosition(mBounds.left, mBounds.top); mDimSurface.setSize(mBounds.width(), mBounds.height()); mDimSurface.setLayer(layer); } catch (RuntimeException e) { Slog.w(TAG, "Failure setting size or layer", e); } mLastDimWidth = dw; mLastDimHeight = dh; mLastBounds.set(mBounds); mLayer = layer; } Loading Loading @@ -257,8 +266,8 @@ public class DimLayer { pw.print(prefix); pw.print("mDimSurface="); pw.print(mDimSurface); pw.print(" mLayer="); pw.print(mLayer); pw.print(" mAlpha="); pw.println(mAlpha); pw.print(prefix); pw.print("mLastDimWidth="); pw.print(mLastDimWidth); pw.print(" mLastDimHeight="); pw.println(mLastDimHeight); pw.print(prefix); pw.print("mLastBounds="); pw.print(mLastBounds.toShortString()); pw.print(" mBounds="); pw.println(mBounds.toShortString()); pw.print(prefix); pw.print("Last animation: "); pw.print(" mDuration="); pw.print(mDuration); pw.print(" mStartTime="); pw.print(mStartTime); Loading services/java/com/android/server/wm/DisplayContent.java +40 −5 Original line number Diff line number Diff line Loading @@ -202,7 +202,8 @@ class DisplayContent { } /** Refer to {@link WindowManagerService#createStack(int, int, int, float)} */ TaskStack createStack(int stackId, int relativeStackId, int position, float weight) { TaskStack createStack(WindowManagerService service, int stackId, int relativeStackId, int position, float weight) { TaskStack newStack = null; if (DEBUG_STACK) Slog.d(TAG, "createStack: stackId=" + stackId + " relativeStackId=" + relativeStackId + " position=" + position + " weight=" + weight); Loading @@ -211,9 +212,9 @@ class DisplayContent { throw new IllegalArgumentException("createStack: First stackId not " + HOME_STACK_ID); } StackBox newBox = new StackBox(this, null); StackBox newBox = new StackBox(service, this, null); mStackBoxes.add(newBox); newStack = new TaskStack(stackId, this); newStack = new TaskStack(service, stackId, this); newStack.mStackBox = newBox; newBox.mStack = newStack; mHomeStack = newStack; Loading @@ -225,8 +226,8 @@ class DisplayContent { || position == StackBox.TASK_STACK_GOES_UNDER) { // Position indicates a new box is added at top level only. if (box.contains(relativeStackId)) { StackBox newBox = new StackBox(this, null); newStack = new TaskStack(stackId, this); StackBox newBox = new StackBox(service, this, null); newStack = new TaskStack(service, stackId, this); newStack.mStackBox = newBox; newBox.mStack = newStack; final int offset = position == StackBox.TASK_STACK_GOES_OVER ? 1 : 0; Loading Loading @@ -371,6 +372,40 @@ class DisplayContent { } } void resetAnimationBackgroundAnimator() { for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) { mStackBoxes.get(stackBoxNdx).resetAnimationBackgroundAnimator(); } } boolean animateDimLayers() { boolean result = false; for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) { result |= mStackBoxes.get(stackBoxNdx).animateDimLayers(); } return result; } void resetDimming() { for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) { mStackBoxes.get(stackBoxNdx).resetDimming(); } } boolean isDimming() { boolean result = false; for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) { result |= mStackBoxes.get(stackBoxNdx).isDimming(); } return result; } void stopDimmingIfNeeded() { for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) { mStackBoxes.get(stackBoxNdx).stopDimmingIfNeeded(); } } public void dump(String prefix, PrintWriter pw) { pw.print(prefix); pw.print("Display: mDisplayId="); pw.println(mDisplayId); final String subPrefix = " " + prefix; Loading Loading
services/java/com/android/server/am/ActivityManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -2871,7 +2871,7 @@ public final class ActivityManagerService extends ActivityManagerNative if (config != null) { r.frozenBeforeDestroy = true; if (!updateConfigurationLocked(config, r, false, false)) { r.task.stack.resumeTopActivityLocked(null); mStackSupervisor.resumeTopActivitiesLocked(); } } Binder.restoreCallingIdentity(origId); Loading
services/java/com/android/server/am/ActivityStack.java +15 −20 Original line number Diff line number Diff line Loading @@ -244,10 +244,9 @@ final class ActivityStack { static final int PAUSE_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 1; static final int LAUNCH_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 2; static final int DESTROY_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 3; static final int RESUME_TOP_ACTIVITY_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 4; static final int LAUNCH_TICK_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 5; static final int STOP_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 6; static final int DESTROY_ACTIVITIES_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 7; static final int LAUNCH_TICK_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 4; static final int STOP_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 5; static final int DESTROY_ACTIVITIES_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 6; static class ScheduleDestroyArgs { final ProcessRecord mOwner; Loading Loading @@ -328,11 +327,6 @@ final class ActivityStack { } } } break; case RESUME_TOP_ACTIVITY_MSG: { synchronized (mService) { mStackSupervisor.getFocusedStack().resumeTopActivityLocked(null); } } break; case STOP_TIMEOUT_MSG: { ActivityRecord r = (ActivityRecord)msg.obj; // We don't at this point know if the activity is fullscreen, Loading Loading @@ -774,7 +768,7 @@ final class ActivityStack { if (prev == null) { Slog.e(TAG, "Trying to pause when nothing is resumed", new RuntimeException("here").fillInStackTrace()); mStackSupervisor.getFocusedStack().resumeTopActivityLocked(null); mStackSupervisor.resumeTopActivitiesLocked(); return; } if (DEBUG_STATES) Slog.v(TAG, "Moving to PAUSING: " + prev); Loading Loading @@ -900,7 +894,7 @@ final class ActivityStack { } else { if (r.configDestroy) { destroyActivityLocked(r, true, false, "stop-config"); mStackSupervisor.getFocusedStack().resumeTopActivityLocked(null); mStackSupervisor.resumeTopActivitiesLocked(); } else { // Now that this process has stopped, we may want to consider // it to be the previous app to try to keep around in case Loading Loading @@ -969,7 +963,7 @@ final class ActivityStack { final ActivityStack topStack = mStackSupervisor.getFocusedStack(); if (!mService.isSleepingOrShuttingDown()) { topStack.resumeTopActivityLocked(prev); mStackSupervisor.resumeTopActivitiesLocked(topStack, prev, null); } else { checkReadyForSleepLocked(); ActivityRecord top = topStack.topRunningActivityLocked(null); Loading @@ -979,7 +973,7 @@ final class ActivityStack { // activity on the stack is not the just paused activity, // we need to go ahead and resume it to ensure we complete // an in-flight app switch. topStack.resumeTopActivityLocked(null); mStackSupervisor.resumeTopActivitiesLocked(topStack, null, null); } } Loading Loading @@ -1495,7 +1489,7 @@ final class ActivityStack { + ", new next: " + nextNext); if (nextNext != next) { // Do over! mHandler.sendEmptyMessage(RESUME_TOP_ACTIVITY_MSG); mStackSupervisor.scheduleResumeTopActivities(); } if (mStackSupervisor.reportResumedActivityLocked(next)) { mNoAnimActivities.clear(); Loading Loading @@ -2465,7 +2459,7 @@ final class ActivityStack { boolean activityRemoved = destroyActivityLocked(r, true, oomAdj, "finish-imm"); if (activityRemoved) { mStackSupervisor.getFocusedStack().resumeTopActivityLocked(null); mStackSupervisor.resumeTopActivitiesLocked(); } return activityRemoved ? null : r; } Loading Loading @@ -2707,7 +2701,8 @@ final class ActivityStack { } } if (activityRemoved) { mStackSupervisor.getFocusedStack().resumeTopActivityLocked(null); mStackSupervisor.resumeTopActivitiesLocked(); } } Loading Loading @@ -2824,7 +2819,7 @@ final class ActivityStack { removeActivityFromHistoryLocked(r); } } mStackSupervisor.getFocusedStack().resumeTopActivityLocked(null); mStackSupervisor.resumeTopActivitiesLocked(); } finally { Binder.restoreCallingIdentity(origId); } Loading Loading @@ -3000,7 +2995,7 @@ final class ActivityStack { mWindowManager.moveTaskToTop(tr.taskId); mStackSupervisor.getFocusedStack().resumeTopActivityLocked(null); mStackSupervisor.resumeTopActivitiesLocked(); EventLog.writeEvent(EventLogTags.AM_TASK_TO_FRONT, tr.userId, tr.taskId); if (VALIDATE_TOKENS) { Loading Loading @@ -3078,7 +3073,7 @@ final class ActivityStack { return mStackSupervisor.resumeHomeActivity(null); } mStackSupervisor.getFocusedStack().resumeTopActivityLocked(null); mStackSupervisor.resumeTopActivitiesLocked(); return true; } Loading Loading @@ -3426,7 +3421,7 @@ final class ActivityStack { ActivityStack stack = mStackSupervisor.getFocusedStack(); if (stack == null) { mStackSupervisor.resumeHomeActivity(null); } else if (!stack.resumeTopActivityLocked(null)) { } else if (!mStackSupervisor.resumeTopActivitiesLocked(stack, null, null)) { // If there was nothing to resume, and we are not already // restarting this process, but there is a visible activity that // is hosted by the process... then make sure all visible Loading
services/java/com/android/server/am/ActivityStackSupervisor.java +36 −11 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import static com.android.server.am.ActivityManagerService.DEBUG_RESULTS; import static com.android.server.am.ActivityManagerService.DEBUG_SWITCH; import static com.android.server.am.ActivityManagerService.DEBUG_TASKS; import static com.android.server.am.ActivityManagerService.DEBUG_USER_LEAVING; import static com.android.server.am.ActivityManagerService.FIRST_SUPERVISOR_STACK_MSG; import static com.android.server.am.ActivityManagerService.TAG; import android.app.Activity; Loading Loading @@ -89,8 +90,9 @@ public class ActivityStackSupervisor { /** How long we wait until giving up on the last activity telling us it is idle. */ static final int IDLE_TIMEOUT = 10*1000; static final int IDLE_TIMEOUT_MSG = ActivityManagerService.FIRST_SUPERVISOR_STACK_MSG; static final int IDLE_NOW_MSG = ActivityManagerService.FIRST_SUPERVISOR_STACK_MSG + 1; static final int IDLE_TIMEOUT_MSG = FIRST_SUPERVISOR_STACK_MSG; static final int IDLE_NOW_MSG = FIRST_SUPERVISOR_STACK_MSG + 1; static final int RESUME_TOP_ACTIVITY_MSG = FIRST_SUPERVISOR_STACK_MSG + 2; final ActivityManagerService mService; final Context mContext; Loading Loading @@ -236,7 +238,7 @@ public class ActivityStackSupervisor { prev.mLaunchHomeTaskNext = false; } if (mHomeStack.topRunningActivityLocked(null) != null) { return mHomeStack.resumeTopActivityLocked(prev); return resumeTopActivitiesLocked(mHomeStack, prev, null); } return mService.startHomeActivityLocked(mCurrentUser); } Loading Loading @@ -1341,7 +1343,7 @@ public class ActivityStackSupervisor { // sure we have correctly resumed the top activity. if (doResume) { setLaunchHomeTaskNextFlag(sourceRecord, null, targetStack); targetStack.resumeTopActivityLocked(null, options); resumeTopActivitiesLocked(targetStack, null, options); } else { ActivityOptions.abort(options); } Loading Loading @@ -1474,7 +1476,7 @@ public class ActivityStackSupervisor { // resumed the top activity. if (doResume) { setLaunchHomeTaskNextFlag(sourceRecord, null, topStack); topStack.resumeTopActivityLocked(null); resumeTopActivitiesLocked(); } ActivityOptions.abort(options); if ((startFlags&ActivityManager.START_FLAG_ONLY_IF_NEEDED) != 0) { Loading Loading @@ -1758,7 +1760,7 @@ public class ActivityStackSupervisor { } if (activityRemoved) { getFocusedStack().resumeTopActivityLocked(null); resumeTopActivitiesLocked(); } return res; Loading Loading @@ -1795,14 +1797,28 @@ public class ActivityStackSupervisor { return didSomething; } void resumeTopActivitiesLocked() { boolean resumeTopActivitiesLocked() { return resumeTopActivitiesLocked(null, null, null); } boolean resumeTopActivitiesLocked(ActivityStack targetStack, ActivityRecord target, Bundle targetOptions) { if (targetStack == null) { targetStack = getFocusedStack(); } boolean result = false; for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) { final ActivityStack stack = mStacks.get(stackNdx); if (isFrontStack(stack)) { if (stack == targetStack) { result = stack.resumeTopActivityLocked(target, targetOptions); } else { stack.resumeTopActivityLocked(null); } } } return result; } void finishTopRunningActivityLocked(ProcessRecord app) { final int numStacks = mStacks.size(); Loading Loading @@ -1854,7 +1870,7 @@ public class ActivityStackSupervisor { return; } stack.moveTask(taskId, toTop); stack.resumeTopActivityLocked(null); resumeTopActivitiesLocked(); } ActivityRecord findTaskLocked(Intent intent, ActivityInfo info) { Loading Loading @@ -1913,7 +1929,7 @@ public class ActivityStackSupervisor { final ActivityStack stack = mStacks.get(stackNdx); stack.awakeFromSleepingLocked(); if (isFrontStack(stack)) { stack.resumeTopActivityLocked(null); resumeTopActivitiesLocked(); } } } Loading Loading @@ -2200,13 +2216,17 @@ public class ActivityStackSupervisor { } final void scheduleIdleLocked() { mHandler.obtainMessage(IDLE_NOW_MSG).sendToTarget(); mHandler.sendEmptyMessage(IDLE_NOW_MSG); } void removeTimeoutsForActivityLocked(ActivityRecord r) { mHandler.removeMessages(IDLE_TIMEOUT_MSG, r); } final void scheduleResumeTopActivities() { mHandler.sendEmptyMessage(RESUME_TOP_ACTIVITY_MSG); } private final class ActivityStackSupervisorHandler extends Handler { public ActivityStackSupervisorHandler(Looper looper) { Loading Loading @@ -2237,6 +2257,11 @@ public class ActivityStackSupervisor { case IDLE_NOW_MSG: { activityIdleInternal((ActivityRecord)msg.obj); } break; case RESUME_TOP_ACTIVITY_MSG: { synchronized (mService) { resumeTopActivitiesLocked(); } } break; } } } Loading
services/java/com/android/server/wm/DimLayer.java +18 −9 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ package com.android.server.wm; import android.graphics.PixelFormat; import android.graphics.Rect; import android.os.SystemClock; import android.util.Slog; import android.view.DisplayInfo; Loading @@ -26,8 +27,11 @@ public class DimLayer { /** Last value passed to mDimSurface.setLayer() */ int mLayer = -1; /** Last values passed to mDimSurface.setSize() */ int mLastDimWidth, mLastDimHeight; /** Next values to pass to mDimSurface.setPosition() and mDimSurface.setSize() */ Rect mBounds = new Rect(); /** Last values passed to mDimSurface.setPosition() and mDimSurface.setSize() */ Rect mLastBounds = new Rect(); /** True after mDimSurface.show() has been called, false after mDimSurface.hide(). */ private boolean mShowing = false; Loading Loading @@ -116,6 +120,10 @@ public class DimLayer { } } void setBounds(Rect bounds) { mBounds.set(bounds); } /** * @param duration The time to test. * @return True if the duration would lead to an earlier end to the current animation. Loading Loading @@ -151,6 +159,7 @@ public class DimLayer { return; } /* // Set surface size to screen size. final DisplayInfo info = mDisplayContent.getDisplayInfo(); // Multiply by 1.5 so that rotating a frozen surface that includes this does not expose a Loading @@ -160,17 +169,17 @@ public class DimLayer { // back off position so 1/4 of Surface is before and 1/4 is after. final float xPos = -1 * dw / 6; final float yPos = -1 * dh / 6; */ if (mLastDimWidth != dw || mLastDimHeight != dh || mLayer != layer) { if (!mLastBounds.equals(mBounds) || mLayer != layer) { try { mDimSurface.setPosition(xPos, yPos); mDimSurface.setSize(dw, dh); mDimSurface.setPosition(mBounds.left, mBounds.top); mDimSurface.setSize(mBounds.width(), mBounds.height()); mDimSurface.setLayer(layer); } catch (RuntimeException e) { Slog.w(TAG, "Failure setting size or layer", e); } mLastDimWidth = dw; mLastDimHeight = dh; mLastBounds.set(mBounds); mLayer = layer; } Loading Loading @@ -257,8 +266,8 @@ public class DimLayer { pw.print(prefix); pw.print("mDimSurface="); pw.print(mDimSurface); pw.print(" mLayer="); pw.print(mLayer); pw.print(" mAlpha="); pw.println(mAlpha); pw.print(prefix); pw.print("mLastDimWidth="); pw.print(mLastDimWidth); pw.print(" mLastDimHeight="); pw.println(mLastDimHeight); pw.print(prefix); pw.print("mLastBounds="); pw.print(mLastBounds.toShortString()); pw.print(" mBounds="); pw.println(mBounds.toShortString()); pw.print(prefix); pw.print("Last animation: "); pw.print(" mDuration="); pw.print(mDuration); pw.print(" mStartTime="); pw.print(mStartTime); Loading
services/java/com/android/server/wm/DisplayContent.java +40 −5 Original line number Diff line number Diff line Loading @@ -202,7 +202,8 @@ class DisplayContent { } /** Refer to {@link WindowManagerService#createStack(int, int, int, float)} */ TaskStack createStack(int stackId, int relativeStackId, int position, float weight) { TaskStack createStack(WindowManagerService service, int stackId, int relativeStackId, int position, float weight) { TaskStack newStack = null; if (DEBUG_STACK) Slog.d(TAG, "createStack: stackId=" + stackId + " relativeStackId=" + relativeStackId + " position=" + position + " weight=" + weight); Loading @@ -211,9 +212,9 @@ class DisplayContent { throw new IllegalArgumentException("createStack: First stackId not " + HOME_STACK_ID); } StackBox newBox = new StackBox(this, null); StackBox newBox = new StackBox(service, this, null); mStackBoxes.add(newBox); newStack = new TaskStack(stackId, this); newStack = new TaskStack(service, stackId, this); newStack.mStackBox = newBox; newBox.mStack = newStack; mHomeStack = newStack; Loading @@ -225,8 +226,8 @@ class DisplayContent { || position == StackBox.TASK_STACK_GOES_UNDER) { // Position indicates a new box is added at top level only. if (box.contains(relativeStackId)) { StackBox newBox = new StackBox(this, null); newStack = new TaskStack(stackId, this); StackBox newBox = new StackBox(service, this, null); newStack = new TaskStack(service, stackId, this); newStack.mStackBox = newBox; newBox.mStack = newStack; final int offset = position == StackBox.TASK_STACK_GOES_OVER ? 1 : 0; Loading Loading @@ -371,6 +372,40 @@ class DisplayContent { } } void resetAnimationBackgroundAnimator() { for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) { mStackBoxes.get(stackBoxNdx).resetAnimationBackgroundAnimator(); } } boolean animateDimLayers() { boolean result = false; for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) { result |= mStackBoxes.get(stackBoxNdx).animateDimLayers(); } return result; } void resetDimming() { for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) { mStackBoxes.get(stackBoxNdx).resetDimming(); } } boolean isDimming() { boolean result = false; for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) { result |= mStackBoxes.get(stackBoxNdx).isDimming(); } return result; } void stopDimmingIfNeeded() { for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) { mStackBoxes.get(stackBoxNdx).stopDimmingIfNeeded(); } } public void dump(String prefix, PrintWriter pw) { pw.print(prefix); pw.print("Display: mDisplayId="); pw.println(mDisplayId); final String subPrefix = " " + prefix; Loading