History log of /frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
692dcd64146786ce15c96cf054fb7808dd625667 20-Jun-2017 Wale Ogunwale <ogunwale@google.com> Added dumsys activity starter

Dumps the last state of ActivityStarter to help debug ANR issue.
Also log reason for starting an activity.

Bug: 38121026
Test: adb shell dumpsys activity starter
Change-Id: Ib77ff974b1122946fac96f8835ab3fdfc732cf7b
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
56d8d16ce61af340f4d6af641e1d784794a42464 30-May-2017 Wale Ogunwale <ogunwale@google.com> Set correct task remove mode when reparenting

If we are reparenting a task to a stack and the stack is at the front or will
be at the front, then set the the remove mode to REMOVE_TASK_MODE_MOVING_TO_TOP
so we don't try to move the focus to another stack and resume another activity.

Change-Id: Iddd7464dfff128544f2f70394ccd538b567fe58d
Fixes: 62088341
Test: ActivityManagerAppConfigurationTests
Test: go/wm-smoke
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d6d2675d676b1afb2e44f42b7021a50690032a64 25-May-2017 Bryce Lee <brycelee@google.com> Update ActivityStack#removeActivityFromHistoryLocked documentation.

Followup to ag/2187696

Test: Documentation only
Bug: 37752430
Change-Id: I6e6a1e6727793037b398ef5b2da58d9efad4ada0
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f18c5862e86b6fc0a9b5b060633151eab3decc35 25-May-2017 Bryce Lee <brycelee@google.com> Merge "Do not remove task until all activities have been destroyed." into oc-dev
8b9963abb8d536d38ed317376c67c8e134acef57 18-May-2017 Makoto Onuki <omakoto@google.com> Fix "launcher starting on work profile"

Test: Repeat "adb install -r Velvet.apk" on 5x
Fix 37893215

Change-Id: I1a932fdc7c168542e8b71ca8daffbca9ee534b30
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d334a0518236d99458dec739b0351958eb0f0277 12-May-2017 Wale Ogunwale <ogunwale@google.com> Prevent premature display of starting window.

- When starting an activity, don't tell window manager to make the
windows visible is the keygaurd visibility for the activity is false.
Instead let the activity windows be made visible once the keygaurd
visibility transitions to true.
- Don't send duplicate visibility change request to window manger if we
are not changing state.

Fixes: 34545029
Test: Open a hangouts notification message on the lock-screen
and make sure the starting window doesn't flash.

Change-Id: I745e985766a1af97203e1d22b6443dabdd0c0363
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
943ebe705cece8f643d9d7ace005322ddf114d86 04-May-2017 Bryce Lee <brycelee@google.com> Prevent NPE in ActivityStack#shouldbeVisible.

If there is a visibleBehind activity, we check to see if the top
activity in the top stack is not fullscreen. However, it is possible
for the top stack to be empty. This can happen if the previously top
activity is being re-installed.

This changelist addresses the issue by checking if the top activity is
null before referencing it.

Change-Id: I6de904bed1c7035ed1e112c9cacc1b6c2bac4e8f
Fixes: 32180256
Test: bit FrameworksServicesTests:com.android.server.am.ActivityStackTests#testShouldBeVisibleWithVisibleBehindActivity
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6875d472092a4f40865f590e68a24be18727d4c3 01-May-2017 Matthew Ng <ngmatthew@google.com> Stack is visible if behind docked which is behind pinned stack (1/2)

Handles the case if pip is shown with splitscreen when the stack order
is pinned, docked, current stack, etc (top to bottom). Added a condition
to check to make sure that this order of stacks allows the current stack
to be visible. Also added a condition to not hide docked stack when pip
appears (this only occurs with command line or cts tests); added TODO
for refactor.

Change-Id: I53bd55014c08c60f360b95ed7100ef49778f891b
Fixes: 37294521
Test: run-test CtsServicesHostTestCases
android.server.cts.ActivityManagerPinnedStackTests#
testPinnedStackWithDockedStack
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
42f07d9fd4723bcdf1c024f94da4e0bde1451e4f 02-May-2017 Wale Ogunwale <ogunwale@google.com> Skip Pip animation to fullscreen if orientation is going to change

Having this kind of animation look good is extremely difficult.
The best we can do is skip the animation and just go to fullscreen
if we know the device orientation is going to change because the
current screen configuration isn't compatible with the fixed
orientation requested by the app going fullscreen.

Change-Id: I97b14723a0d678c05efedc93fe692ad3b3212a72
Fixes: 37722472
Test: manual
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
5b895b730f90eca27e4f06347f9b1c51aab5c2a8 01-May-2017 Winson Chung <winsonc@google.com> Removing check preventing pinned stack tasks from matching by affinity.

- As of ag/1892768, we prefer matching non-affinity matching tasks,
followed by affinity matching tasks as long as they are on the same
display (priority from the bottom stack up). As a result, we don't need
to exclude the pinned stack when attempting to match by affinity, as it
can be used later when determining the match.

Bug: 37640324
Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testLaunchTaskByComponentMatchMultipleTasks
Test: #testLaunchTaskByAffinityMatchMultipleTasks
Test: #testLaunchTaskByAffinityMatchSingleTask

Change-Id: Idfe797cd51bf827876f3f0ba8ea35e1f4fcd8655
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
1d93058432445e2d63e7e1a467207fcc187c90a1 01-May-2017 Bryce Lee <brycelee@google.com> Do not remove task until all activities have been destroyed.

Previously we were removing a task from its stack when the last
activity was removed from history or when there was only task
overlays present. This can lead to the situation where there is only
overlay activities present, meaning that we'll try to remove the
task again when those activities are removed from history.

This changelist addresses this issue by only removing the activity
when the last task is removed.

Change-Id: I2cc74b439934444d0694cd0d8bb611d4f9a6f5b3
Fixes: 37752430
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test CtsServicesHostTestCases android.server.cts.ActivityManagerPinnedStackTests#testFinishPipActivityWithTaskOverlay
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
3345c4ea9687bb35a8c419ec21ec90b49616b2c9 25-Apr-2017 Bryce Lee <brycelee@google.com> Don't call adjustFocusedActivityStackLocked on finished activity.

When an activity is finished, adjustFocusedActivityStackLocked is
already called on the associated record and the task association is
lost. Calling it again is redundant and leads to a crash as we
assume the task is still associated with the activity.

Change-Id: Ie7cc9ad8b1542d7415b7409e539c88d3b4ec8dcd
Fixes: 37329424
Test: bit FrameworksServicesTests:com.android.server.am.ActivityStackTests#testStopActivityWhenActivityDestroyed
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
ec95064ded280616277be44cd5460f07c43631ef 25-Apr-2017 Wale Ogunwale <ogunwale@google.com> Fixed issue with turn-screen-on activities

Regression introduced by ag/2147938 where we set the visibility of an
app to false after pausing because it might have been previously
defered. However, the change did it for all activities regardless of if
it was previously deferred or not. We now only do the visibility change
to false if we previouly deferred.

Change-Id: Ifde46587e1ddf38304b73cec45c56f0acd955f37
Fixes: 37657105
Test: cts.ActivityManagerActivityVisibilityTests#testTurnScreenOnActivity
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
3fc176913a947fae8df28d19d896216a07491a8f 24-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fixed transition animation from pipable activities" into oc-dev
8997322ed3c8014e1833323b71e5a8d34e6a9e14 24-Apr-2017 Wale Ogunwale <ogunwale@google.com> Fixed transition animation from pipable activities

- Defer telling the client it is hidden if it can enter Pip and isn't
current stopped or stopping. This gives it a chance to enter Pip in
onPause().
- Once pause is complete set the visiblity to false to stop deferring
hiding client.
- Don't allow FLAG_RESUME_WHILE_PAUSING activity to resume until the
currently resumed activity is puased if the currently resumed activity
can enter Pip.
- Detach child surfaces added by the client process in
WindowState.sendAppVisibilityToClients() right before we notify the
client.

Test: manual
Change-Id: I3848f2b93f4f1d3ceec5a1ccd2e127c614f70fe4
Fixes: 37370508
Fixes: 37622341
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
91e5c886c88cc8c55ba452f692e8117627a3f822 21-Apr-2017 Winson Chung <winsonc@google.com> Fix check when finding tasks to reuse.

- Since we added a new assistant activity type, we need to update the check
for which stack to match the activity to.

Bug: 37526597
Test: android.server.cts.ActivityManagerAssistantStackTests
Test: #testLaunchIntoSameTask
Change-Id: I2d77ba8b026ee1ae692b026d20703fa56c061704
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
5daa3121a92f5e3124b8db469aeddea269a4c1df 19-Apr-2017 Bryce Lee <brycelee@google.com> Do not pause resumed activity in resumeTopActivityUncheckedLocked.

A number of operations occur between setting the resumed activity and
notifying the activity to resume. One of these steps is updating the
configuration, which can cause the device to pause the resumed
activity. Since the activity has not been told to resume, this leads
to a pause before resume.

This changelist addresses the issue by checking whether we are in the
middle of resuming the top activity before attempting to stop the
currently set resumed activity.

Change-Id: I3b5b61de6b1b5a35b7773912b4e63d6c69096c04
Fixes: 35637717
Test: bit FrameworksServicesTests:com.android.server.am.ActivityStackTests#testNoPauseDuringResumeTopActivity
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b9a0c991af1aa4812d62daec43305ca224d8d84e 18-Apr-2017 Wale Ogunwale <ogunwale@google.com> Fixed some pip state acitvity accounting.

- Corrected ActivityRecord.checkEnterPictureInPictureState() to return
false if the activity doesn't support Pip.
- Wait for previous activity that supports pip to pause before resuming
the next activity with FLAG_RESUME_WHILE_PAUSING so that the activity
has a chance to enter Pip before we resume the next activity. Currently
disabled until we figure-out if callers are passing in the right value
for prev.
- Changed stopActivityLocked() to call setVisible() instead of
setVisibility()...yeah this isn't confusing...

Change-Id: If2336ece4fe5b7104c9b301a4ded5cadc2c2f7cb
Bug: 37370508
Test: manual
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
8bca9e47c17c86a3092d5384b14713c5b50dd78c 17-Apr-2017 Winson Chung <winsonc@google.com> Schedule PIP mode changes at the beginning/end of the transitions.

- When transitioning from fullscreen to PiP, ensure all PiP/MW/Config
changes come after the transition completes, and inversely, from PiP to
fullscreen, ensure that all changes come before the transition up starts
- Add a series of tests to verify the callback state when the animation
is canceled
- Also fixes an issue where the surface is preserved when we don't want

Bug: 37169080
Bug: 37103000
Test: bit FrameworksServicesTests:com.android.server.wm.BoundsAnimationControllerTests
Test: android.server.cts.ActivityManagerPinnedStackTests
Change-Id: I6425c95df358358ed76d9cc8a130606c2124062e
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
61bce9ab13ac3783720ab6e5a1fda939bea23977 13-Apr-2017 Bryce Lee <brycelee@google.com> Merge "Remove window container from empty task when destroying." into oc-dev
840c566d13b8c84ad5edb37006176d6731bad250 13-Apr-2017 Bryce Lee <brycelee@google.com> Remove window container from empty task when destroying.

Previously, the window container was being removed whenever we were
removing the task in a destroy mode. However, this caused issues
where an activity may still be present in the task record, leading to
a subequent change to limit this to tasks with overlays. This led to
the situation where the window container would not be destroyed when
it was supposed to, such as moving an activity to recents, but
otherwise destroying.

This changelist addresses the issue by always removing the window
container from tasks when removed from their parent stack in a
destroy mode and empty. In the recents flow, this will fire and
cleanup when the activity is destroyed.

Change-Id: I87548d6ff8e4d77b6294504d7cc78370cd5d31fa
Fixes: 37301159
Test: bit FrameworksServicesTests:com.android.server.am.ActivityStackTests
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
68cf1b88488dbee4762e141e5c0a234eb750c47b 13-Apr-2017 Winson Chung <winsonc@google.com> Merge "Fix issue with non-focusable PiP activities being resumed." into oc-dev
3f103eb4300b20a7339ac157b0d95009e8d531ac 13-Apr-2017 Winson Chung <winsonc@google.com> Fix issue with non-focusable PiP activities being resumed.

- When the change to finish activities was made in ag/2067154, it exposed
an issue in pinned stacks where we would resume the next top activity
once the top activity finished pausing. Normally, the pinned stack is
not focusable, but since it has an alwaysFocusable menu activity it
becomes the focused stack and falls into this case.

Instead of finding the next top activity, we need to find the next top
focusable activity to resume, and fall through to focusing the top
activity in the next focusable stack if there is none.

Bug: 37199067
Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testNoResumeAfterTaskOverlayFinishes
Change-Id: Ib79826ff38bb3beb38a40183ddc6819e5040bb27
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
efbcb0d2ccb6f971876ba4733d1a4177c7b2728d 13-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix regression when removing task." into oc-dev
343cf6e9207291d09e3f023b0cce63ed50f716f7 13-Apr-2017 Wale Ogunwale <ogunwale@google.com> Merge "Revert "Ensure visible activities when device is unlocked."" into oc-dev
919a05d4a38d7af7c4fcd3ae5bc90a88727a00c9 13-Apr-2017 Wale Ogunwale <ogunwale@google.com> Revert "Ensure visible activities when device is unlocked."

Causes issues with window life-cycle...

Bug: 37119770
Bug: 37244415
Bug: 37281544
This reverts commit 7004a8801d0a60013681a86043bab74b4d42d680.

Change-Id: I0039db6e44488cd82ef745aa979bc8549fd8aeed
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7040f573f3bb3b424d5bf00856ee5c7e421575c0 13-Apr-2017 Rob Carr <racarr@google.com> Merge "Fix auto-pip visibility issues." into oc-dev
fe99773a70e6bdfb141cafa06c91760a9264354e 12-Apr-2017 Jorim Jaggi <jjaggi@google.com> Merge "Disallow task snapshot starting window for intent != ACTION_MAIN" into oc-dev
c33658e597347b733dc1a7859bebdb5da06738dc 12-Apr-2017 Robert Carr <racarr@google.com> Fix auto-pip visibility issues.

In the case that we defer stop for auto-enter picture
in picture, we should also defer changing the visibility. This causes
particularly awkward issues with SurfaceView as the views are left
in a severed state.

Test: Auto-pip Chrome from youtube. Things look alright!
Bug: 36355266
Bug: 36640131
Change-Id: I77de1c3eb9c61b03740cbe49f88dec1af2ed6577
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e3c21e0015c260c76d98f487e36f6167d4bf9d5d 12-Apr-2017 Winson Chung <winsonc@google.com> Fix regression when removing task.

- Limit removing the task immediately to when there is a single task
overlay activity. Certain activities may not work when force-removed
before the clean up work in removeTask() completes especially if the
finishing activity is a part of a launch process (ie. trampoline
activity). This behaviour is only needed for finishing activities that
have actual task overlays.

Bug: 36761629
Test: Launch SiriusXM, and check that it loads
Change-Id: I34c812ab111819e858fe36b6359f82da717ba459
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
bae01b1a70dd721e7343265bedfceee39bdc39f1 12-Apr-2017 Jorim Jaggi <jjaggi@google.com> Disallow task snapshot starting window for intent != ACTION_MAIN

We don't want to show a task snapshot if the intent wasn't the
launcher intent. Likely the app will show something different, so
we shouldn't show a snapshot in this case.

Test: AppWindowContainerControllerTests
Test: Open app, make sure we get snapshot window
Test: Open Chrome, go home, Open chrome incognito from shortcut,
make sure no flash

Change-Id: Ib608ba8070ce09f418f1036248d81eebfa354128
Fixes: 35099602
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7004a8801d0a60013681a86043bab74b4d42d680 10-Apr-2017 Wale Ogunwale <ogunwale@google.com> Ensure visible activities when device is unlocked.

When the device is locked we transition all activities to the stopped
state. However, we were only resuming the activity in the focused stack
when the device is unlocked. We now:
- Ensure all visible acitvities when the device is unlocked regardless
of stack.
- If the activity is marked as visible, but in the STOPPED state, we go
ahead and restart it.
- Correctly set ActivityRecord.stopped to false when we restart an
activity into the PAUSED state.

Fixes: 37119770
Bug: 37244415
Test: Make sure docked activity state isn't STOPPED when device is
unlocked.

Change-Id: I1498eeddaa3c1f5dd5135dca56271ffc22b704f2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
51c1b670224fa1598644426b472d51346dd22f30 08-Apr-2017 Andrii Kulian <akulian@google.com> Fix activity move between displays

1. ActivityConfigCallback might not have been registered
because DecorView was not yet attached to window and ViewRootImpl
was not available. In this CL the callback is set as soon as a
DecorView is attached to window.
2. When private display was removed from system, its stacks were
moved to bottom in AM but moved to top in WM.
3. When reparenting stack visibility of activities should be updated
before reparenting in WM, because otherwise WM will be resizing
windows that should no longer visible and reporting it to clients.

Bug: 34164473
Test: android.server.cts.ActivityManagerDisplayTests
Test: #testOnMovedToDisplayCallback
Test: #testContentDestroyOnDisplayRemoved
Change-Id: I6ccc27d873d0d60d7650659fb25cbfcaaeb0fd07
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7ddf4b3e1159d3144b01b422012992d0a30de563 08-Apr-2017 Winson Chung <winsonc@google.com> Merge "Ensure that a PIP activity gets stopped before MW/PIP mode changes." into oc-dev
d275c9a65c57fdb0ca87019042b02cf6a39dec3b 08-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Return to Home stack when a context of tasks launched from Home finished" into oc-dev
735a5e1438194ca814dd6b602f71a7b675744896 07-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Show recents at correct time when starting activity in docked stack" into oc-dev
47900650862232c0a9a01045041daaadd60765ac 07-Apr-2017 Winson Chung <winsonc@google.com> Ensure that a PIP activity gets stopped before MW/PIP mode changes.

- Adds a workaround to ensure that onStop() is dispatched to the PIP
activities when the PIP is dismissed
- Consolidating dismiss PIP behavior to call moveTaskToFullscreen().
Now we are consistent, and when we expand the PIP, we call
moveTaskToFullscreen(top), and when dismissing the PIP we call
moveTaskToFullscreen(bottom)
- Fixing issue where we were dispatching extra MW/PIP mode changes when
just expanding the PIP
- Fixing typo in last commit where PIP mode change was not getting
scheduled correctly
- Fixing issue where move-to-fullscreen log was sent for each task

Bug: 36567036
Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testStopBeforeMultiWindowCallbacksOnDismiss

Change-Id: I303b88d75e9f136da0c238ef5987804e0684c78e
Signed-off-by: Winson Chung <winsonc@google.com>
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
cd501ecd91bd7016639e8e62d4a739a01971f95c 07-Apr-2017 Wale Ogunwale <ogunwale@google.com> Show recents at correct time when starting activity in docked stack

Previous logic relied on the returnTo type of the task of the activity
we are launching which can get the wrong signal at times because the
original task might have been started from home, but since we are
already in docked mode it shouldn't cause recents activity to be
launched.
We now decide if recents ability should be shown based on if the home
stack is currently visible at the time we started the new activity.
Also, renamed ActivityStack.getStackVisibilityLocked() to
ActivityStack.shouldBeVisible() since it is used to determine if the
stack should be visible and also so it isn't confused with the new
method ActivityStack.isVisible() which returns true if the stack is
currently visible.

Test: manual
Change-Id: I051e72ce93c886d25526af2afef851c95812ab3e
Fixes: 37005549
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
63b8ee365d1be3df6e340f94eea05eb59a8e76d8 11-Jul-2016 Shunta Sato <Shunta.Sato@sonymobile.com> Return to Home stack when a context of tasks launched from Home finished

When the following conditions happen together, another context in
Application stack was launched unexpectedly:
- There is a context of tasks in Application stack, which is launched
from a task on Home stack.
- All tasks/activities in the context are finishing.

Solution:
Add a condition check to see if the task is NOT one of the task
finishing on-top of the top running task.

Bug: 30883775
Test: manual
Author: Ichitaro Kohara <ichitaro.kohara@sonymobile.com>
Change-Id: I5d6097a7c8dc2733ff684957370c987dd158e329
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
4a19438955ab123a2b0862783fd35b8700b06eef 04-Apr-2017 Bryce Lee <brycelee@google.com> Check component before notifying activity is visible.

ActivityStackSupervisor tracks WaitResults which are waiting for an
Activity to become visible. This is used exclusively by
ActivityStarter to wait for an Activity to be brought to the
foreground before returning. However, there are some cases where
other Activities will report a visible state in between. Without a
qualifier, these would cause the ActivityStarter's WaitResult to be
fulfilled and the wrong information would be returned.

This changelist specifies a component the WaitResult should be
triggered on.

Change-Id: I7c356a8d153ddc24603acc55749e9992f9000c3f
Fixes: 36860122
Test: cts-tradefed run cts -m CtsServicesHostTestCases -t android.server.cts.ActivityManagerAmStartOptionsTests#testDashW_Direct
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
9f467df80493159c2a367ef8d08c79a14a7d52aa 04-Apr-2017 Bryce Lee <brycelee@google.com> Merge "Clean up activity/stack associations." into oc-dev
afb6b504b230cdbdc78d66c4b21e0f85145bf901 04-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fixing issue with activity incorrectly auto-entering PiP." into oc-dev
af691c0be7bbfea63e880dd717c51a38a0bc874a 20-Mar-2017 Bryce Lee <brycelee@google.com> Clean up activity/stack associations.

The stack currently holds a reference to resuming and pausing
activities. These are usually cleaned up when the activity ends or
the task is reparented. However, it is possible for an activity to
lose its reference to its task in other areas (such as
ActivityStarter), which can lead to the stack not being updated
correctly.

This changelist adds a method to the ActivityStack to disassociate
the stack from an ActivityRecord. In addition to places where this is
called when an activity ends, this method is invoked on the children
of a task when the task is reparented. The task member variable of
ActivityRecord is also now surrounded by a setter/getter, with the
setter always invoking the dissociation logic on a previous stack.

Test: bit FrameworksServicesTests:com.android.server.am.ActivityRecordTests
Change-Id: Iffeccdb6f011958896271673946acfed28856f53
Fixes: 36387417
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
19c85406cc993076dc93570dddee7e9d116a7f16 04-Apr-2017 Winson Chung <winsonc@google.com> Fixing issue with activity incorrectly auto-entering PiP.

- When the PiP menu activity was brought forward, we were inadvertently
setting the auto-enter supported flag for the PiP base activity as
well, which would trigger auto-enter PiP once the activity is moved
back to fullscreen and then subsequently finished.

Bug: 36352343
Bug: 36364010
Test: android.server.cts.ActivityManagerPinnedStackTests
Change-Id: Id1b800bf392d03b55562fb13374e33a5ff0ebda6
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
5af42fc3052ecaf35c937278a986143a65f6ce5f 25-Mar-2017 Winson Chung <winsonc@google.com> Ensuring multi-window callbacks contain new configuration and are in order

- This CL has two main changes:
1) It modifies the activity multi-window and picture-in-picture mode
changed callbacks to provide the configuration of the activity with
the mode applied.
2) It modifies the order in which the multi-window and picture-in-picture
mode callbacks are made, to ensure that when going in and out of
picture-in-picture: first PiP, then MW, and then the config change.
- Previously, the ordering of the two callbacks was inconsistent. When
calling moveActivityToPinnedStack(), we reparent the task into the pinned
stack (triggering the picture-in-picture mode change), followed by the
resize animation (causes configuration changes). Inversely, when we
expand the task to fullscreen (and not just remove it), we run the
animation first, which resizes the task to the final size (causes
configuration changes) then reparent after the animation completes
(triggering the picture-in-picture mode change).

In this CL, we ensure that for both the transition in and out of PiP, we
defer to the bounds animation to trigger the PiP mode change. Normal
calls to reparent or adding a new task are unchanged. When the PiP
mode change is called from the animation, it provides the final target
bounds which we use to calculate the target configuration of the activity
for the callback. If the bounds animation is interrupted, an update will
also be scheduled if we change the fullscreen state we are animating to.

To work around the issue where we are scheduling MW/PiP mode changes in
both the animation and the configuration change, we also now keep track
of each state internally in the ActivityRecord.

Bug: 36099777
Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testConfigurationChangeOrderDuringTransition

Change-Id: I03513bc3a4d4a72c250983f22f079ce9d7a2cb40
Signed-off-by: Winson Chung <winsonc@google.com>
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6954fc9a7e6b2c6fc0b09448beac2eba7852ff18 25-Mar-2017 Winson Chung <winsonc@google.com> Fix issue with task overlay activities not finishing.

- The task overlay activity should only exist when there are activities
present in the task. When the last such activity is finished, we should
remove the whole task entirely including the task overlay.
- Exposing the task overlay apis to CTS

Bug: 36507456
Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testFinishPipActivityWithTaskOverlay
Change-Id: I1dabe7782fb6769a90d832664e8052be158041e1
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
abb433b30463c741c5b347acfd4dc6fcd430e08b 24-Mar-2017 Winson Chung <winsonc@google.com> Remove task activities from LRU list when task is reparented.

- When a task is reparented, the activities are not removed from the
previous stack's LRU list. Afterwards, when the activity is destroyed,
the previous stack's LRU list will contain an activity that has no
task. Instead, we should remove all of the task's activities from the
LRU list when it is removed, and update the LRU list of the new stack
when the top activity is next resumed.
- Also fixing issue with stack header in dumpsys not printing if there are
no activities (but other states were still being printed for that stack)

Bug: 36253246
Test: adb shell dumpsys activity activities
Change-Id: Ia14f170dceff9eadc48d1ac4aac2f16c714adde2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
82ea6cb9de38fd20ebcddfd84f0132908beeeab1 04-Mar-2017 David Stevens <stevensd@google.com> Switch display uid whitelist from task to activity

Tasks can contain activities from multiple UIDs, so the uid whitelists
for private displays need to be based on activities instead of tasks.

This change also stops keeping track of uids on public displays, since
the uid list is not used for those displays.

Test: android.server.cts.ActivityManagerDisplayTests
Test: #testPermissionLaunchMultiUidTask
Change-Id: I38f1434f581af64f0db40221431994fd5a99bab3
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c81c0ce2e903ae469a532e0537b2f882fd81ec6c 17-Mar-2017 Winson Chung <winsonc@google.com> Showing notification when activity is in PiP.

- Adding callback to SystemUI to be notified which package entered PiP,
and when it leaves PiP.
- Showing a BTW notification on a new PiP-specific channel.

Bug: 36070720
Test: Launch PiP, observe notification, leave PiP, observe no notification
Change-Id: Ibe10298288fe0464d7d136f2571e855f3f5c70ea
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
8fabcd4377351d5e5c2cd83ea8f7534d21fe5ae1 15-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Prevent minimized state changing from other transitions."
521f0114bf025828d249e1a8a2c48841e0951f0b 14-Mar-2017 Winson Chung <winsonc@google.com> Prevent minimized state changing from other transitions.

- When calling adjustFocusedActivityStackLocked(), prevent the home stack
from being brought forward if the task is not over the home stack. This
was causing issues with the docked stack triggering minimized mode when
a task was removed in the assistant stack.
- When checking the visibility of the docked stack, only base it on the
visibility of the assistant stack when it is above the docked stack.
This was causing issues with the docked stack reporting as visible even
when behind the assistant stack due to the subsequent code being run.

Bug: 35363819
Test: android.server.cts.ActivityManagerAssistantStackTests
Change-Id: I48cc901cb6b6166697a4130cc4639ee8f9581f02
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7c3ede366f356d77aebf35c2e3084f2dc90b7d6a 14-Mar-2017 Winson Chung <winsonc@google.com> Fixing crash when enforcing top stack.

- When updating the stack list, the insert index should take the
always-on-top stacks when calculating the stack index to insert into.

Test: android.server.cts.ActivityManagerAssistantStackTests
Change-Id: I30aee7395a12c983fe9b778ef57dea9f76008dde
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
aa2b620cb76cb8a710c3c4500bc5f6975ddc7a84 10-Feb-2017 Matthew Ng <ngmatthew@google.com> Fixes minimized state to match task and stack bounds for cts test

Fixes minimized state for its task and stack bounds to always match
inline with the cts test that was failing.

This also fixes multiple state issues related to splitting home and
recents into different stacks when recents incorrectly reads home stack
bounds to determine bounds for recents.

Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test
CtsServicesHostTestCases
android.server.cts.ActivityManagerActivityVisibilityTests or
ActivityManagerDockedStackTests
Fixes: 35351074, 35145587
Change-Id: I6417a567e937c647818ff26dc08df463e6ef4257
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
af526ec9c36dfbb3c244ad03f8df79311e5ba03c 09-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Corrects the recents and home stacks position around docked state (1/2)"
330757dffa8d8de106e2c073eff09bf8238549a5 28-Feb-2017 Matthew Ng <ngmatthew@google.com> Corrects the recents and home stacks position around docked state (1/2)

Since splitting home stack into home and recents, some problems where
the home stack would appear above when home stack is not visible. This
would cause home stack to be below docked stack and think home is
visible when it is not. Then docking an app would minimize the docked
stack and go into a wierd state when recents is resumed/launched.

When docked stack is used, it will verify that recents is created and
avoids seeing home stack as visible when below docked stack with at
least 1 stack in between. Whenever an app is docked, this will make sure
home stack is below recents.

This will fix some parts of the cts tests that use
"adb shell am stack move-task <taskId> 3 true" and avoid glitches with
the docked stack.

The following scenarios were tested:
- Boot and dock and app without starting recents
- Dock after launching an app (when recents already created)
- Toggle dock with "adb shell am stack move-task <taskId> 3 true" and
undocking multiple times
- Dock with long press recents

Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test
CtsServicesHostTestCases
android.server.cts.ActivityManagerDockedStackTests
Bug: 35351074, 35145587
Change-Id: I6ac25c64f7d1050ea2260631ff4c052fcca3f185
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
261c0f3c69ca471b72afac5e26d332ac1de3f9a3 08-Mar-2017 Winson Chung <winsonc@google.com> Updating moveTaskToBack to handle PiP activities

- When a PiP activity calls moveTaskToBack(), we should fall through to
the same behaviour as dismissing the PiP if there are no other tasks
to show.

Bug: 36034065
Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testMovePipToBackWithNoFullscreenStack
Test: #testMovePipToBackWithVisibleFullscreenStack
Test: #testMovePipToBackWithHiddenFullscreenStack

Change-Id: I83c3d27dabc031546f9f1cf20b808bb8f13d4646
Signed-off-by: Winson Chung <winsonc@google.com>
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
75323c1889d164fc481f87f124468bce38ed33a8 03-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Resize task to fullscreen when moving from pinned stack."
aa5e8c3a298e0290a84776a89f85ebab37aea49c 02-Mar-2017 Bryce Lee <brycelee@google.com> Remove activity from task if not set properly.

We do not start an activity in the case of a lock task mode
violation. However, the activity is still associated with the task
and therefore participates in future interactions, such as
visibility checks.

This changelist addresses this issue by removing the assocation in
the case of failures.

Change-Id: Ibf7edd2bd4532de5e7f355311a808ffd21e542e3
Fixes: 35034729
Fixes: 35035258
Fixes: 34179495
Test: cts-tradefed run cts-dev --module DevicePolicyManager --test com.android.cts.devicepolicy.DeviceOwnerTest#testLockTask_deviceOwnerUser
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7466610e097f310a5df24200c319306ca73e0c2d 23-Feb-2017 Winson Chung <winsonc@google.com> Resize task to fullscreen when moving from pinned stack.

- This was a regression in the original change to move the tasks to the
fullscreen stack when the pinned stack was removed. The task kept its
old bounds, which causes the next animation into the PiP to not run
since the stack bounds are taken from task bounds (which are the old
pinned stack bounds)

Bug: 35326108
Test: run-test CtsServicesHostTestCases
Change-Id: I234910107cf62cc23b2d663161d250b9d59b3934
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6998bc4f137fc04e1946c5bffe25bcb8e9d8a886 01-Mar-2017 Winson Chung <winsonc@google.com> Adding flags to filter dumping of activities.

- To make it consistent with other dump calls, by default dumping
'activity all' or 'activity <activity>' will now dump it if it exists
even if it is not in a visible stack. If -v is specified, only
activities in visible stacks will be dumped, and if -f is specified
then only activities in the focused stack will be dumped.

Bug: 35850518
Test: adb shell dumpsys activity <package> and ensure it runs in the background
Change-Id: Ib8284aedce8073e2a30023a7cd925c6c525817c8
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
4098172f467e6fab5fea96d84ba8e36e032542ca 23-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Ensure we use the fullscreen stack bounds when expanding PiP."
55893331fb3c23067ede1463fe06c7bb6519141c 18-Feb-2017 Winson Chung <winsonc@google.com> Ensure we use the fullscreen stack bounds when expanding PiP.

- When in split screen, the PiP needs to animate to the fullscreen stack
bounds when expanding.
- Created PinnedStackWindowController to house pinned-stack specific
logic.

Bug: 35396882
Test: Expand PiP activity while split

Change-Id: If7397843743ce11b676f5566eba90e3442289fec
Signed-off-by: Winson Chung <winsonc@google.com>
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e74ad8d4983b055edec05cd4885f7429ab36d578 18-Feb-2017 Winson Chung <winsonc@google.com> Fix issues with assistant stack visibility.

- Ensure that we don't mark the docked or fullscreen stacks as
invisible when the assistant stack is over them and translucent.

Bug: 35363819
Test: android.server.cts.ActivityManagerAssistantStackTests
Test: #testTranslucentAssistantActivityStackVisibility

Change-Id: I86698beec4963942dd3816e7d3f43c6614d892ac
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
a2c94eb260e0975d3611feaff34e1e878768f562 17-Feb-2017 Andrii Kulian <akulian@google.com> Merge "Use the top stack on display instead of focused"
0864bbb6b8c2120cf3a960eb15da3d1f3d7ddb2d 17-Feb-2017 Andrii Kulian <akulian@google.com> Use the top stack on display instead of focused

There are places where there is an assumption that there is only
one display with activities in the system and that the focused stack
is usually the topmost stack on current display.
Here we explicitly use the topmost from the stacks on a display
instead of focused stack record in ActivityStackSupervisor.

Bug: 34263289
Bug: 35258038
Test: android.server.cts.ActivityManagerDisplayTests
Test: #testStackFocusSwitchOnDisplayRemoved
Test: #testStackFocusSwitchOnDisplayRemoved2
Change-Id: Ice1a555b0a4460d6bd63be2af7b51b145c85ab7f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7d95df4971cfaa68e2fa84ce6f8656cc548616b5 15-Feb-2017 Andrii Kulian <akulian@google.com> Always check front stack on its current display

Previously checks for front stacks were looking among
stack on primary display only. This doesn't make any
sense for stacks on secondary screens, so let's always
check among other stacks on its current display.

Bug: 34862802
Test: Manual.
Change-Id: I29ee160d455719d75f4a5981a6ba9c60f3d90084
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
8347163dbb64fb61012c0393163283106a0a351e 13-Dec-2016 Winson Chung <winsonc@google.com> Create a new stack for the assistant activity.

- Add a new stack that is not resized with multiwindow, and
appears above the fullscreen and docked stacks, but below
the pinned stack
- Add a method on VoiceInteractionSession to allow the assistant
to launch activities into this new fullscreen stack.
- Also prevent any activities in the assist stack from the
fetching of the on screen assist data.

Bug: 30999386
Test: android.server.cts.ActivityManagerAssistantStackTests

Change-Id: I22ab7629b5f758cf1e66d7d1c26648af6bc887c9
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
3d227ad86cee7aa06f8edd804e93a518d42db5b0 10-Feb-2017 Andrii Kulian <akulian@google.com> Merge "Allow destroying display content on removal"
250d653325ffeeb8ef75e51e3a3d08d6abb8cf9c 09-Feb-2017 Andrii Kulian <akulian@google.com> Allow destroying display content on removal

This CL sets the behavior for displays when they are removed.
For public displays by default all content will be moved to the
primary display and become focused. For private displays default
behavior is to destroy all content - first it moves stacks from
the secondary display to the primary display to the bottom, then
it destroys all activities in those stacks.

This CL adds two specified behaviors as modes, so in future these
rules might be altered if needed.

Bug: 34263289
Test: android.server.cts.ActivityManagerDisplayTests
Test: #testContentDestroyOnDisplayRemoved
Change-Id: I3f89f06ff82cb4b487df58a86ba3b146a32cbd00
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
2a82fe587b850061ace024d2025047554987c10d 02-Feb-2017 Winson Chung <winsonc@google.com> Refactor PiP logic in preparation for expanded state.

- #1: Move logic for handling IME size changes into SysUI, and only rely
on PinnedStackController to provide bounds when first entering
PiP and on rotation
- #2: Doing #1 allows us to move PipMotionHelper to SysUI completely, which
lets us aggregate the animation calls out of PipTouchHandler
- #3: Add proper callbacks to the listeners when the movement bounds
changed from config change, ime change, or aspect ratio change. This
allows SysUI to calculate the associated movement bounds for the
expanded state, and we can then remove the corresponding WM call.
It also means that SysUI is the only thing that needs to know about
the expanded state.
- #4: Fix issue where TV was getting the default bounds, not taking the
aspect ratio when the PiP was entered into account. Doing #3
allows us to report the right bounds.
- #5: Remove dead code related to edge snapping/minimizing now that they
are on by default and associated tuner setting, and controller
callbacks

Test: android.server.cts.ActivityManagerPinnedStackTests (all existing tests pass)

Change-Id: I3ef361bdf8d44094b4c0a11c70ba4db7d697fdec
Signed-off-by: Winson Chung <winsonc@google.com>
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
069bbd382898d3330d284912b3a472495045c363 03-Feb-2017 Wale Ogunwale <ogunwale@google.com> Removed android.R.attr#onTopLauncher

The product that the feature was intended for never launched, so
removing the complexity from the code base.

Test: builds
Change-Id: I75e60ee2da46f6012f03a6077f77bc6b9acecad5
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
a0cd15e1a035dd43a2d68d1bf3c6a2a368cb6f2b 02-Feb-2017 Wale Ogunwale <ogunwale@google.com> Addition separation of adding vs. reparenting activity

- Removed method ActivityRecord.setTask which did only half of what
is needed when adding a task and also only did half of what is needed
for reparenting. Previous callers now need to call either
ActivityRecord.reparent() to reparent and activity or
TaskRecord.addActivityAtIndex() to add an activity to a task.
- Fixed some NPE that resulted from the above change.

Test: adb shell am instrument -w -e class
com.google.android.setupwizard.tests.activity.SetupWizardExitActivityTest
com.google.android.setupwizard.tests.activity
Bug: 34179495

Change-Id: Ic69487f51d1bd139825e6a8054a49ce143065a57
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b0412060ea9e982852c0af1a45754ca9449e1f9d 02-Feb-2017 Winson Chung <winsonc@google.com> Merge changes Iad270dfd,Ice608e6d,I375369a8

* changes:
Adding initial TRON logging for picture-in-picture.
Disallow entering PiP when activity is locked.
Preventing cases where an app can be stopped while entering PiP.
4dabf2396f4fe18b2f83641fe2ac52a913763bad 25-Jan-2017 Winson Chung <winsonc@google.com> Preventing cases where an app can be stopped while entering PiP.

- Ensure that we clear the timeouts on the old stack and reschedule
them on the new stack when moving an activity to a new stack,
otherwise the pause timeout from the old stack will cause onStop()
to be called.
- When adding an activity to the stopping list for processing, prevent
scheduling an idle immediately in case an activity tries to enter
picture-in-picture when handling onUserLeaveHint(). In that case,
schedule an idle after the default idle delay instead.
- In addition, when resuming a resumeWhilePausing activity, prevent the
activity idle to trigger pausing activities to be immediately put into
a stopped state. This was a race between the handling of pause/resume
that would cause a pip activity to get onStop() even if it called enter
pip on pause. Instead, when processing an idle from the activity or
from an immediate idle scheduled by the system, we defer processing
pausing activities until a later idle (that it reschedules).

Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testEnterPipWithResumeWhilePausingActivityNoStop

Change-Id: I375369a800b7fadaa57d6e00e0564bc3ee338979
Signed-off-by: Winson Chung <winsonc@google.com>
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
2fec90513cab75eac8aac6ee2e20697f2520934d 31-Jan-2017 Andrii Kulian <akulian@google.com> Finish stopping activities if requested

If activity was in process of becoming invisible and it needed to be
finished, we weren't actually finishing it if we tried to do it while
in STOPPING state. This lead to activity being removed from stopping
list and stuck in FINISHING state.

Bug: 34195099
Test: android.server.cts.ActivityManagerActivityVisibilityTests
Test: #testFinishActivityWithMoveTaskToBackAfterPause
Test: #testFinishActivityWithMoveTaskToBackAfterStop
Change-Id: Ic892f998b7fda7d5ede9a84b1ab837dbef40af21
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7211d2eba8e02b5e7462313798fc25c0bd36ab2d 28-Jan-2017 Andrii Kulian <akulian@google.com> Rename flag that enables showing display content with keyguard

Renamed SHOW_WITH_INSECURE_LOCKSCREEN to CAN_SHOW_WITH_INSECURE_KEYGUARD.

Test: android.server.cts.ActivityManagerDisplayTests
Change-Id: Ie03ee59730a9e9e715b2bad0a14fdd107b8c7c00
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
ffc7b784348282b7641cf973012b0f67190cecf9 27-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Reparent the activity in the task with associated window containers."
3048004087968674c3af97e1c0b110a223f04703 26-Jan-2017 Winson Chung <winsonc@google.com> Reparent the activity in the task with associated window containers.

- Currently moveActivityToStack() adds the activity to the top of the
new task in the new stack, but the code path to update the window
container controllers assumes that they are in the same task and
attempts to position it by index. Instead, we should properly
reparent the activity in the new task (just like we reparent tasks
into new stacks), and also reparent the associated app window tokens
into their new tasks on the WM side.
- Also should fix an issue when trying to reparent an activity from one
task to another task by affinity.

Bug: 34394702
Test: AppWidgetContainerControllerTests#testReparent
Test: android.server.cts.ActivityManagerPinnedStackTests#testEnterPipFromTaskWithMultipleActivities
Change-Id: Ib767f85eb4f469cfd1c108c55242996325bdb866
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
fc8f82bc6b587bddd2aeaddc54c1ea3f598bb9c3 26-Jan-2017 Andrii Kulian <akulian@google.com> Allow showing content on virtual displays when locked

This adds new flag to virtual display that changes its
behavior when keyguard is shown, but can be dismissed without
entering credentials. This can be applied only to private
virtual displays.

Bug: 34280365
Test: android.server.cts.ActivityManagerDisplayTests
Test: #testVirtualDisplayHidesContentWhenLocked
Test: #testShowWhenLockedVirtualDisplay
Test: #testShowWhenLockedPublicVirtualDisplay
Change-Id: I9c19d36295e62f59bd1db1352af707d54ea51667
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e15352e516fb6ecde12866f0eb27c32470ddbded 21-Dec-2016 Matthew Ng <ngmatthew@google.com> Splitscreen for minimized state that works with resizable launchers

If a launcher is resizable, going to minimized mode (dock task and then
press home) would show a cropped height of the task at the top in a
minimized state and the fullscreen stack would show the home launcher
which takes the rest of the remaining height. If the launcher is not
resizable, it will default the original behavior.

To enable this in a launcher, add android:resizeableActivity="true" in
the AndroidManifest.xml in the <application/> tag.

Test: manual - rotating while minimized, minimizing using dragging task
or holding overview nav button, installing resizable launcher with a
non-resizable launcher
Fixes: 32504542
Change-Id: Idf4015b40f9bec81b70f146f0f2d7df8ccfb4cf0
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b00dc5ebeedaa855eea9ece87ad9ab57e216cd34 25-Jan-2017 Winson Chung <winsonc@google.com> Fixing issue with wrong bounds being reported in StackInfo.

Bug: 34696293
Test: Launch overview from any app
Change-Id: I99a33b3abc9aea54ff12bf2d37a54aeefcdd535e
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
1666e317dc1a17e9435246ec6c8209dbb6ee3696 16-Dec-2016 Wale Ogunwale <ogunwale@google.com> Added StackWindowContainerController

For linking ActivityStack in AMS to TaskStack window container in WMS.

Change-Id: I8b9eaef49e62854d59b22d27f80f5935a5a4d7fc
Bug: 30060889
Test: bit FrameworksServicesTests:com.android.server.wm.StackWindowContainerControllerTests
Test: bit FrameworksServicesTests:com.android.server.wm.TaskWindowContainerControllerTests
Test: Existing test pass and manual testing.
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d339538a67b7d6bb3d7ad73f31ad20ffc932f891 13-Dec-2016 Winson Chung <winsonc@google.com> Remove dependency on resizable activity to enter PiP.

- Removing the requirement for activities to have both the
resizeableActivity and supportsPictureInPicture attribute
to enter PiP. The activity may still be resized when
entering picture-in-picture.

Bug: 34256643
Test: android.server.cts.ActivityManagerPinnedStackTests
Change-Id: If6bd4721c53072e5518f554a8c7598705517c132
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
8b702edea1bb211316e1deb3cbe291f2d48d7f77 20-Jan-2017 Jorim Jaggi <jjaggi@google.com> Add starting windows while unlocking

- Modify screen capturing logic a bit such that it can also take a
screenshot when the display is off.
- Also take snapshot when app visibility is changing without
proper app transition.
- When unlocking, add strating windows for all visible apps.

Test: Unlock phone.
Test: Have an app that sleeps in onStart, make sure unlocking is
instant.
Bug: 31339431
Change-Id: I953ab6cb30d0d264554fd49a46bdc56e23356d13
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
4cbec883f103b9c6bf553ef4f77df492287d30dc 21-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Set permissions for launching on private displays"
fb1bf69d5d7fc8c45e3ddbb8916e21ae57432ff1 17-Jan-2017 Andrii Kulian <akulian@google.com> Set permissions for launching on private displays

- System UIDs must be allowed to launch anything and everywhere.
- Display owner must be allowed to launch activities on it.
- Apps that are already on target display must be allowed to launch
there.
- All other apps mustn't be allowed to launch on private displays.

Bug: 34230873
Test: android.server.cts.ActivityManagerDisplayTests
Test: #testPermissionLaunchFromSystem
Test: #testPermissionLaunchFromAppOnSecondary
Test: #testPermissionLaunchFromOwner
Test: #testPermissionLaunchFromDifferentApp
Change-Id: Ic98005649a6368370c512e822cba4e9decc18ae9
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c2baac059c42765351745f1e2d46b685fe889db7 11-Jan-2017 Winson Chung <winsonc@google.com> Updating picture-in-picture API.

- Consolidating to enterPictureInPictureMode(), the new method will
attempt to put the activity into picture-in-picture mode if the
activity is visible or pausing in a state that would allow us to
pip it. Also consolidate the setting of the PiP aspect ratio and
actions into setPictureInPictureArgs().
- Fixing issue with onPause not completing when moving the
paused activity between stacks while dispatching onPause

Bug: 33692987
Test: android.server.cts.ActivityManagerPinnedStackTests

Change-Id: I3af2365f31a9b95de4a92eae46b77108947b2a49
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c5cc301689649695e03f502e7d1c1492ef5e5d1e 13-Jan-2017 Wale Ogunwale <ogunwale@google.com> Have better separation between adding, positioning, and reparenting task

Several methods in activity manager and window manager performed adding,
positioning, and reparenting a task operation and sometimes failed silently
when things don't work due the callers using the methods for a particular
operation, but getting a different operation due to programmer error.
This CL better separate the methods responsible for adding, positioning, and
reparenting a task and also fails hard when there is an error.

Test: bit FrameworksServicesTests:com.android.server.wm.TaskWindowContainerControllerTests
Test: Manual testing existing PiP doesn't leave the device in a bad state.
Bug: 34260633
Change-Id: Id64367da30fc6214eb6f95b2bd5e58ed0e953a88
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
02886a82d876aa5e31a92444fec70208599c509c 06-Dec-2016 Jorim Jaggi <jjaggi@google.com> Initial implementation of snapshots

All this functionality is hidden behind a flag. If this flag is
active, we disable the regular screenshots.

Instead, we take a screenshot when an app transition for which a
task is disappearing is starting. The screenshot gets stored
into a gralloc buffer. SystemUI uses a new method to retrieve
a snapshot gralloc buffer and then draws it using GraphicBuffer.
createHardwareBitmap().

When starting an existing activity in an existing tasks, or when
bringing an existing tasks to front from recents, we add a new
snapshot starting window. For that, we reuse the existing
starting window, but when creating the window, we use a fake
window that draws the contents of the starting window.

Test: runtest frameworks-services -c
com.android.server.wm.TaskSnapshotControllerTest
Bug: 31339431
Change-Id: If72df07b3e56f30413db5029d0887b8c9665aaf4
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e1fe7fa288a34ecaaab390f49ef540edc4a6c52d 16-Dec-2016 Wale Ogunwale <ogunwale@google.com> Added TaskWindowContainerController

For linking TaskRecord in AMS to Task window container in WMS.

Bug: 30060889
Test: bit FrameworksServicesTests:com.android.server.wm.AppWindowContainerControllerTests
Test: bit FrameworksServicesTests:com.android.server.wm.TaskWindowContainerControllerTests
Test: Existing test pass and manual testing.
Change-Id: I16248f3e96e5087ba24198a48a3bd10a12ae76a6
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6fd63e4df682dfbcc2b86393216a31bd2163e484 07-Jan-2017 Andrii Kulian <akulian@google.com> Merge "Fix selecting focused stack with secondary displays"
7fc22812ce8ef74f9d005f33c30dbeb2ea837ab3 28-Dec-2016 Andrii Kulian <akulian@google.com> Fix selecting focused stack with secondary displays

When the last activity finishes in the stack we're looking for other
stacks and making it focused. However we weren't doing that if the
stack was on a secondary display, so the focused stack records were
not updated in stack supervisor.

Now we're looking for other stacks on the same display first. If there
is nothing focusable left - shifting focus to next focusable display.

Test: android.server.cts.ActivityManagerDisplayTests
Test: #testStackFocusSwitchOnDisplayRemoved
Test: #testStackFocusSwitchOnStackEmptied
Change-Id: Ifbb893e12cbe9c4928b949a86fc8bc027de181e4
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
26c0dfed7a0cd54abafdd0ccbb5b757506d51c76 14-Dec-2016 Wale Ogunwale <ogunwale@google.com> Support for WindowContainer controllers and listeners

- WindowContainerController class allows a component outside window manager
to create a window container and communicate directly with it to make
changes. For example, the ActivityRecord class in activity manager uses the
AppWindowContainerController class to create and communicate with
AppWindowToken window container class which is its counterpart on the window
manager side.
- WindowContainerListener interface allows a component outside WM to get
notified of changes to a window container. For example, the ActivityRecord
class in AM implements the AppWindowContainerListener interface to get
notified of changes to the AppWindowToken container.

Bug: 30060889
Test: Existing tests pass and manual testing.
Test: bit FrameworksServicesTests:com.android.server.wm.WindowContainerControllerTests
Test: bit FrameworksServicesTests:com.android.server.wm.WindowContainerTests
Change-Id: I2896bfa46a80b227052528c7da8cf4e56beab4bc
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
96b97d722f14cd18223b00aaf57ef6b0db47dc0c 29-Dec-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Disallow entering PiP without dismissing keyguard."
0655da0374caff1569c09017e17ac28c4b0b7069 17-Dec-2016 Winson Chung <winsonc@google.com> Disallow entering PiP without dismissing keyguard.

- If an activity is showing on the keyguard and enters picture-
in-picture, then prompt the user to authenticate first
- Fixing NPE in SystemUI due to null runnable being added to the
post-keyguard-gone callbacks
- Prevent FLAG_SHOW_WHEN_LOCKED from applying when determining
visibility over keyguard for activities that are in the pinned
stack

Bug: 33660880
Test: android.server.cts.KeyguardLockedTests
Test: #testEnterPipOverKeyguard

Change-Id: I89477a8a0067e285e5d0122e918fac45274c57ad
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d276563b38907647ce70940e1e90603826df6ab4 13-Dec-2016 Andrii Kulian <akulian@google.com> Add positionChildAt method to WindowContainer

Added method to change the position of a child among siblings.
It accepts int value, which can either specify a target position
or POSITION_TOP/POSITION_BOTTOM.
When child is moved to top or bottom, there is an option to also
perform same action on parents. This will effectively move the
entire branch of the hierarchy tree to top/bottom.

Test: bit FrameworksServicesTests:com.android.server.wm.WindowContainerTests
Test: #testPositionChildAt
Test: #testPositionChildAtIncludeParents
Test: #testPositionChildAtInvalid
Test: bit FrameworksServicesTests:com.android.server.wm.TaskStackContainersTests
Test: bit FrameworksServicesTests:com.android.server.wm.TaskStackTests
Change-Id: I6ade787487055f1c9a305afea64270c243196614
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
a29eb98d9fba99528f0809c448daf2ddae37de7e 14-Dec-2016 Winson Chung <winsonc@google.com> Adding support for PIP actions.

- Introduced generic RemoteAction to represents an action
that can be made across processes with an icon and text
description based on a Notification action.
- Modified PinnedStackController to ensure that it notifies
the listeners from the source of truth, this ensures that
SysUI is in the right state if killed and re-registers
itself.

Test: Enable menu & minimize in SystemUI tuner.
Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testNumPipActions

Change-Id: I5b5d0cf9de3f06b5687337d59cfb91e17355bdb1
Signed-off-by: Winson Chung <winsonc@google.com>
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
1b974dc979c32f87f41d77ae000a5c94faa2d0f8 09-Dec-2016 skuhne@google.com <skuhne@google.com> Fixing timeout caused by non executed animation

The problem became apparent after a springboard activity
called another activity and a moveTaskToFront got requested.

This issue is similar to ag/1647538 where an
ExecuteAppTransision was missing and a timeout occured.

Bug: 33307856
Test: Start PlayStore on ARC++ several times to see that
it shows up immediately and not after a considerable delay.

Change-Id: I25b63bd65385a4ad45bbb1803ae92fb48fe5fe4d
(cherry picked from commit 06f78e83d1010fa5420c7fe88a0b27eb3651bdc3)
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
72919d2c310db04fdb860e926ccb0bfe6e3aef08 09-Dec-2016 Wale Ogunwale <ogunwale@google.com> Untangle creation of Task from addition of AppToken in WM.

Makes it easier to follow what is going on and also clean-up in
preparation of stand way for AM to interact with containers in WM.

Test: Existing tests pass and manual testing
Change-Id: I91754b6d974dce2f696453cdaed175efb0f10c73
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b5c41b786862618b22e532849ddcca48bdc40025 08-Dec-2016 Winson Chung <winsonc@google.com> Adding ability for an app to request auto-enter picture-in-picture.

- If an activity requests that it can auto-enter PIP, then we will trigger
it to enter PIP when the task is effectively being occluded. This does
not affect the activity when the screen is locking, or if it starts new
activities within its own task, or if it finishes itself, or if there is
already a PIP activity.
- Changed setPictureInPictureAspectRatio to also specify the aspect ratio
to use when auto-entering PIP. If the activity is not PIP'ed and has
not requested auto-enter, then the call continues to fail.

Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testAutoEnterPictureInPicture
Test: #testAutoEnterPictureInPictureLaunchActivity
Test: #testAutoEnterPictureInPictureFinish
Test: #testAutoEnterPictureInPictureAspectRatio
Test: #testAutoEnterPictureInPictureOverPip

Change-Id: I6477b6d1f160cf0219d935123bbb505f57ee7a56
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6aa763bbedfb25e278cf0479ffaaee324026f4b3 05-Dec-2016 Jorim Jaggi <jjaggi@google.com> Merge "Deprecate FLAG_DISMISS_KEYGUARD"
04a7a5370c02c21601d3a6ab46749d234ac39cff 02-Dec-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Split home stack into home and recents stack"
ae1ff4f85ffd12ab8a14c610b1474a012536888f 11-Nov-2016 Matthew Ng <ngmatthew@google.com> Split home stack into home and recents stack

Refactored functionality of home stack (HOME_STACK_ID) in the code
base to home stack and recents stack (RECENTS_STACK_ID). Also changed
function and variable names from homeStack to homeOrRecentsStack.

Differentiating home and recents stack will allow readablilty and
managing logic between home and recents stacks. For example, for
multi-window minimized dock state, the home and recents stacks can
be set to different rects where the home stack needs to be a fixed
large size while the recents stack is hidden and the dock stack is
animating to be minimized.

Fixes: 32839371
Test: ./run-test android.server.cts and manually tested split and
rotation
Change-Id: I7603359c2dc20e35924664178634eb761e0367a6
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
0796187e95420b263c8e35a4a43a8749479bc559 23-Nov-2016 Jorim Jaggi <jjaggi@google.com> Deprecate FLAG_DISMISS_KEYGUARD

Since we now have an explicit dismiss method the flag is only
dangerous for falsing. The behavior will be migrated in the
following way:

- Insecure: Treat as FLAG_SHOW_WHEN_LOCKED
- Trusted: Actually dismiss Keyguard.
- Secure: Show bouncer.

We also restore the behavior to not allow dismissing the Keyguard
while it is occluded, which was the case in Nougat.

Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test
android.server.cts.KeyguardTests

Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test
android.server.cts.KeyguardLockedTests

Test: Insecure: Launch FLAG_DISMISS_KEYGUARD activity, make sure
Keyguard is occluded.

Test: Secure: Launch FLAG_DISMISS_KEYGUARD from SHOW_WHEN_LOCKED, make
sure bouncer is shown.

Test: Trusted: Launch FLAG_DISMISS_KEYGUARD from SHOW_WHEN_LOCKED, make
sure Keyguard gets unlocked.

Test: Trusted: Launch FLAG_DISMISS_KEYGUARD, lock screen, make sure
Keyguard is not dismissed/occluded.

Change-Id: I0d1ec9397a83975adb065c6cb81bf23b08c55395
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
241ae10b2189f449e57d8d660235ac56d8fb1b80 03-Nov-2016 Jorim Jaggi <jjaggi@google.com> Add explicit method to dismiss Keyguard

The flag is a bit clunky for most cases, and a method is more
clear.

Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test
android.server.cts.KeyguardTests

Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test
android.server.cts.KeyguardLockedTests

Test: runtest systemui -c
com.android.systemui.keyguard.DismissCallbackRegistryTest

Bug: 30961403
Bug: 27422134
Change-Id: I39de90c7cfecd99350a74f72cd76418e337f2b79
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e8d928a61d020dedb3b076239ebcef13435b6b96 15-Nov-2016 Andrii Kulian <akulian@google.com> Fix stack visibility evaluation

Stack visibility is evaluated based on its position in stack list.
In this case we care only about stacks on the same display.

Test: ActivityManagerDisplayTests
Test: #testLaunchActivitiesAffectsVisibility
Change-Id: Ide42e8b5e240bd61c33cc2d4715e44fc9a940952
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e69c93181f1f313dcedd07f677af1cea953fdf16 01-Nov-2016 Jorim Jaggi <jjaggi@google.com> The big Keyguard transition refactor (8/n)

Don't force mKeyguardGoingAway, as this never recovers. Make sure
to only show the dismissing Keyguard activtiy and recover the
state when trusted state changes.

Test: Make sure Keyguard is in a trusted state, start an activity
with FLAG_DISMISS_KEYGUARD from FLAG_SHOW_WHEN_LOCKED activity
and make sure there is no flicker.

Bug: 32057734
Change-Id: I5d212f6f9d5430250b22c8370f45dc95756432d2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
839def9b549b6279aabd4150b304999e58d15762 02-Nov-2016 Andrii Kulian <akulian@google.com> Add shell command to move activity stacks between displays

Also rename "stack movetask" command to be consistent with other
shell commands.

Test: New CTS tests coming soon.
Change-Id: I3d7e04e0ae8ea76c27c3e4c1e286d5cd4539870c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
ac2561e8206ac42921bb6ddbb0a5972fb360e394 01-Nov-2016 Wale Ogunwale <ogunwale@google.com> Make window token add/remove APIs require displayId

Window tokens can now only be on one display, so we now require clients
that want to add/remove window tokens to specify the display they would
like the token to be created on. This simplifies the token handling code
in WM and will be useful moving forward for clients that want to add
windows to external displays.

Test: Existing tests pass
Change-Id: I6b2d8d58a913b3624f1a9a7bebbb99315613f103
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
fe762344f4475a3a336bb46aef2d59c1fabf32ab 13-Oct-2016 Jorim Jaggi <jjaggi@google.com> The big keyguard transition refactor (1/n)

The heart of this change are two things:
1) Instead of using the force hide mechanism to hide windows behind
Keyguard, we actually make the activities invisible in activity manager.
2) When Keyguard is going away, we change the visibilities in activity
manager and run an app transition.

At the very core we move the responsibility of hiding activities to
ActivityStack, which checks whether Keyguard is showing, and then
hides all non-show-when-locked activities. For that, we need to check
whether any window of an activity has SHOW_WHEN_LOCKED set. We
introduce a callback from WM -> AM in case these Keyguard flags have
changed.

Furthermore, we decide whether to occlude Keyguard in KeyguardController,
which just checks whether the top activity has SHOW_WHEN_LOCKED set. When
this state changes, we prepare an occlude/unocclude app transition, and
in PWM we just inform the Keyguard about the animation so SysUI can play
along this animations in a mostly synchronized manner.

Since we now use an app transition when unlocking the phone, we get
lockscreen launch animations for free - window manager automatically
waits until the activity is drawn, or directly executes the transition
if there is nothing to animate. Thus, we can remove all the infrastructure
around "waitingForActivityDrawn".

The logic to show/hide non-app windows is moved to policy, and we add the
ability to run animations on non-app windows when executing an app
transition.

Test:
1) runtest frameworks-services -c com.android.server.wm.AppTransitionTests
2) Manually test unlocking Keyguard:
2a) Without security
2b) With security
2c) With security but trusted
2d) Portrait while activity behind is in landscape
3) Test launching things from Keyguard
3a) Without security
3b) With security
3c) Launch camera without security
3d) Launch camera with security
3e) Launch camera with securtiy and trusted
3f) Launch voice affordance
4) Set no notifications on lockscreen, drag down, make sure you get
the correct animation
5) Test clicking "emergency" on bouncer
5b) Test "Emergency info" on emergency dialer
5c) Test clicking edit button on emergency info, should show pattern on
Keyguard

Bug: 32057734
Change-Id: Icada03cca74d6a612c1f988845f4d4f601087558
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
bd54c2aab6acc50ac415dfc4a7462d12826e8223 25-Oct-2016 Yorke Lee <yorkelee@google.com> Add new methods to ITaskStackListener

Refactor task change notification logic into a separate class
TaskChangeNotificationController.

Add ActivityManagerService.unregisterTaskStackChangedListener

Add a no-op implementation that clients can subclass to avoid
having to reimplement all new methods when they are added.

Add new methods:
onTaskAdded
onTaskRemoved
onTaskMovedToFront
onTaskDescriptionChanged
onActivityRequestedOrientationChanged
onTaskFinishing

Design doc:
https://docs.google.com/document/d/1IgWZ44rKe9k1CzkjP2Mohv12OgRD1FxH8oLAyzhvCY4/edit#heading=h.yhzl6os0dbo5

Cherry-picked from I8302d6d3baf1ac1ca928765fe203091b9fab4070

Bug: 32277482
Test: Verify that callbacks are called in dummy implementations

Change-Id: I2ac2b870147ef049f3ee05fc5916c99332334526
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6d6fb401c79aadeb35cfc66cd36cb30f92d3552f 27-Oct-2016 Andrii Kulian <akulian@google.com> Refactor stack removal methods

Refactor some parts of stack removal to make methods implementations
correspond to their names.

Change-Id: Ie686c463d67232d9d5fd96468fe3911003d22471
Test: Manual and existing tests still pass.
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
5406e7ade87c33f70c83a283781dcc48fb67cdb9 21-Oct-2016 Andrii Kulian <akulian@google.com> Apply display override config for secondary displays

Now display-specific settings, such as dimensions and orientation,
are stored in display override config. For default display it is
mirroring the global config. Each time when global config is updated,
override of the default display should be updated too and vice versa.

Test: Existing and manual tests still pass.
Change-Id: Ic6c2190092d328820f314a05bed43c875db18170
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
21713ac8ddce33fe49cfa457010da30a883f2239 13-Oct-2016 Andrii Kulian <akulian@google.com> ActivityStack cleanup

- Moved some methods that mostly operate with internals of
ActivityRecord and/or logically should belong their to
ActivityRecord class.
- Reduced visibility of some methods and fields.
- Other minor cleanups.

Test: Manual and existing tests still pass.
Change-Id: I87ed6987c88512dda3cd69fa43a1f093d47d0bff
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
1779e6108ab264689b7d5e5c42ba3cbca6c8189f 13-Oct-2016 Andrii Kulian <akulian@google.com> Use ConfigurationContainer for holding configs in AM hierarchy

Extract configuration holding and handling into separate class
and use it both in hierarchy in AM.

Change-Id: I19ca20152f7473af2c4a7bbedeff69422b1454eb
Test: ConfigurationContainerTests
Test: Existing and manual tests still pass.
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
02b7a83b97593bc0c0c459272dca15d2e7ef8dd5 07-Oct-2016 Andrii Kulian <akulian@google.com> Make stack field private in TaskRecord

This is needed to enforce usage of setter - prerequisite
for ag/1499587.

Change-Id: I194008899d8320a213e82b9106f0589f499941b4
Test: Refactoring only. Manual and existing tests still pass.
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e540c9a1f5cf9ff6b6ac8424e7f19b715424eb40 30-Sep-2016 Jorim Jaggi <jjaggi@google.com> Merge "Fix case in which onTaskStackChanged was not called"
354736e196ff79962b3ddb52619a674044d773e2 23-Aug-2016 Dianne Hackborn <hackbod@google.com> New infrastructure to switch remaining commands to "cmd" calls.

This introduces a new feature of the IBinder command protocol
to allow the shell command implementation to call back into
its caller to ask it to open files in the calling context. This
is needed so that commands that have arguments specifying files
can open those files as the calling shell, not the system (or
whatever) process.

To test this all out, move the "am start" implementation over
to ActivityManagerShellCommand, in particular along with its
option to specify a file in which to write profiling data.

Test: Manual

Change-Id: I0c1e3857defefbd19a2ac29413aafbb34b1e48a3
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7b614376bc96cae1885fd62b1e6cee39caa7b62e 28-Sep-2016 Jorim Jaggi <jjaggi@google.com> Fix case in which onTaskStackChanged was not called

In completeResumeLocked, visibility was changed but we didn't set the
flag so the listeners didn't get notified.

Test:
runtest -c com.android.server.am.TaskStackChangedListenerTest frameworks-services

Change-Id: I4b4076a895baafc877f312d24211a2fc69a98e3b
Fixes: 31527783
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
dca35322651f18756daae43b98df2b1645e07b23 26-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Move task to front in WM when it is moved to front in AM"
aa47c12e2215d894f098bfc452643aaad06a5d1b 24-Sep-2016 Wale Ogunwale <ogunwale@google.com> Move task to front in WM when it is moved to front in AM

ActivityStack.insertTaskAtTop() moved a task to the front of a stack
in activity manager, however the method left it to its callers to
call window manager to move the task to the front of the stack in
window manager. One of the callers forgot to do this...
Now insertTaskAtTop() will call WM whenever it moves a task to the
front of a stack so that the list order remain consistent between
AM and WM.

Bug: 31630938
Test: Manual verification.
Change-Id: I4eddbcaeb8981583a17b51a487165f02907c0989
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
0ba0528aece435d3d8032370ba8c3a3cc563733f 23-Sep-2016 Wale Ogunwale <ogunwale@google.com> Don't take app screenshot in minimize docked stack. am: f5d1e35316 am: 7cc8d16746
am: cdaf9eab60

Change-Id: Ifc22bc38227a45b43d7237cf9abbe0d5b007be46
f5d1e35316fcd027e60655b7ca6ca6341ed1e0ec 22-Sep-2016 Wale Ogunwale <ogunwale@google.com> Don't take app screenshot in minimize docked stack.

When the docked stack is minimized its app windows are cropped
significantly so any screenshot taken will not display the apps
contain. So, we avoid taking a screenshot in that case.

This situation is going to be improve some in O when we switch
recents to also use saved surfaces in which cases it will be able
to display the last app content the user saw vs. just the app's
background color.

Bug: 29830173
Change-Id: I003aa074126ddcb57d5ff6dda756293146646196
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
1e32e025ad5677ce4e3697ca026c2019fe0bd8e9 17-Sep-2016 Andrii Kulian <akulian@google.com> Move updating stack override config to ActivityStack

Also added some multi-display TODOs.

Change-Id: Iada3f84c4f57c9623fc7f116819d4e0267ebc32a
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b10330d5191ebb50c397d8f3de50fda44698337a 16-Sep-2016 Andrii Kulian <akulian@google.com> Use Configuration#unset() instead of #setToDefaults() for clearing

Now Configuration.EMPTY has fontScale set to 0 instead of default 1.
To get config equal to empty unset() method should be used.
Because of incorrect usage of setToDefaults() there was a black flash
when exiting split-screen because override config was no completely
empty. Fixing that also allows us to simplify things a bit when checking
if override config changed.

Bug: 31533188
Test: manual - long-press overview to enter split-screen, repeat to exit.
Change-Id: I6bf7994ff88ebb42db2e2357b762857710432a58
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
8072d11f6a41a68600a15623ca5316ca0def1856 16-Sep-2016 Andrii Kulian <akulian@google.com> Configuration renaming and minor cleanup in AM and WM

- Configuration members in AM and WM are renamed to
mGlobalConfiguration.
- Renamed parameters names in some methods to better represent
their meaning.
- Added and fixed some docs.

Change-Id: Ie51f687fe4c10dbce776435f29d6b853fda50eec
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b2fcc827d792bec737d37984cbb703b05838963c 14-Sep-2016 Wale Ogunwale <ogunwale@google.com> Fixed NPE when pause is complete on a dead app. am: e852400e1b am: 699f40e307
am: 7baba1ab4f

Change-Id: I39bff66ccedd0e426888a85b1938974dcea60af9
45dcd8fb9e27387fda679872608f16508661ee10 14-Sep-2016 Wale Ogunwale <ogunwale@google.com> Immediately deliver new intent to paused activity in docked stack am: 826c706156 am: 35871b76b3
am: f872ce62c4

Change-Id: I266b97e858e7b4aa9c56fd3b55401970b4575698
e852400e1b5016a803c19c4398e3d7cb6239c0f1 14-Sep-2016 Wale Ogunwale <ogunwale@google.com> Fixed NPE when pause is complete on a dead app.

Cause by trying to stop freezing the screen on an activity
record whose refrence we already set to null because the app
is dead. WM will no longer freeze the screen for a dead app.

Bug: 31441504
Change-Id: I6617a5536bce5748b2f4559428ee856f54f0ab81
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
826c706156a5b9eff2bdd4d7ef5fecf75cc884b1 13-Sep-2016 Wale Ogunwale <ogunwale@google.com> Immediately deliver new intent to paused activity in docked stack

When the docked stack is minimized and we are unminimizing it
due to a request to start it's currently paused top activity,
it is possible for the new intent not do be delivered immediately
because it isn't resumed due to another activity been launched in
the system (Recents) which is resumed instead. So, the user won't
see the effect of the new intent until they touch the docked activity
causing it to get the new intent and resume.
We now deliver new intents to the top activity in the docked stack if
it is in a minimized state. Then on the client side we temporarily
resume the activity and pause it again to guarantee onResume is called
after onNewIntent.

Bug: 31371093
Change-Id: Ib1764ccf5efc9d6498ce6cc8a34236c79fc07dad
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
0187e48d79dd40fb594b7ae45efe8d94cb8ab2f3 08-Sep-2016 Wale Ogunwale <ogunwale@google.com> Moved activity to stopped state if relaunched while device is asleep am: 3e99736b61 am: 3709ceaf45
am: b67011f662

Change-Id: I6b29da21368cf5b4d9289cc2123707b6cef743a1
3e99736b61dae559314ce90db68ee40602fa84e5 06-Sep-2016 Wale Ogunwale <ogunwale@google.com> Moved activity to stopped state if relaunched while device is asleep

- If an activity is done relaunching and the device is sleeping or
shutting down, go ahead and force the activity to sleep which will
transition it into the stopped state. We do this after the activity
is relaunched as activities can currently only relaunch into the
resumed or paused state both of which are visible state.
However, the activity should be in the stopped state while the device
is sleeping.
- Also removed previous fix for b/28518380 that prevents activities from
relaunching due to configuration changes while the device is sleeping.
We need to allow relaunches due to configuration changes while the device
is sleeping so the things are responsive when you wake-up the device.
And, it is no longer a big deal since we are transitioning the activity
to the stop state when the relaunch is complete.

Bug: 30253333
Bug: 28518380
Change-Id: I5313c13a13c2d2f9bb43831797918d9e67a30cda
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
686ae0e3a9a380ec38f77f665375e85f73632443 26-Aug-2016 Wale Ogunwale <ogunwale@google.com> Removed debug code that is never.

We have never enabled this in all my time on the team, so instead
of including it in the re-factoring I am doing I am just goint to
remove it.

Change-Id: Ia13c8ed53e4771b0cc70834692f31afd972421ef
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
5d9202885b35cacedab1f121673f420c1b8c5f4d 01-Sep-2016 Jorim Jaggi <jjaggi@google.com> Fix bug that apps are not unminimizing if recent tasks are empty am: 936aaeb878 am: c037bb26cb
am: fbe9038d39

Change-Id: I9e67340012a828cb53a0ee64ad61fe6af2c5b904
b0a8743151526c38896d003d3e68ce3aaf272c61 25-Aug-2016 Chong Zhang <chz@google.com> Add the null ptr check that's not merged in master

ag/1379112 merged to DR branch had an extra null ptr check,
this shouldn't really happen but merge it to master to keep
the branch consistent.

Change-Id: I5047188729be26a7b7190b2ab3f5d8274bca32d5
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c037bb26cb38901e012920858ffb393f7658a327 31-Aug-2016 Jorim Jaggi <jjaggi@google.com> Fix bug that apps are not unminimizing if recent tasks are empty
am: 936aaeb878

Change-Id: I30d83528945b04fbb39ebf1ec4b98841a551930a
c8cccdcbd3ea8511b17d58ddbdc4a15e440f7f89 31-Aug-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix bug that apps are not unminimizing if recent tasks are empty" into nyc-mr1-dev
936aaeb8781e55e988578e7c8b19e973a37b50f1 27-Aug-2016 Jorim Jaggi <jjaggi@google.com> Fix bug that apps are not unminimizing if recent tasks are empty

If an activity was launched in the docked stack and we weren't able
to retrace the launch back to an activity launch from the homescreen
in activity manager, nothing happened.

Now we try to do a better job by also checking some conditions when
the app transition is starting. Note that this might still be racy,
but in practice all activities are usually launched from the same
process so the app is done starting/finishing any activities when
the first frame is drawn, so we are able to catch the correct state
when we figure out that the app transition is starting.

In addition to that, we also need to not hide the docked stack while
lockscreen is showing. This doesn't make any sense anymore as we are
dismissing the docked stack when we show something above the lockscreen,
and this only lead to issues that triggered app visibility events
which triggered this special unnecessarily. This also fixes some flicker/
race-condition in the normal unlocking process I noticed a long time ago
but couldn't really reproduce.

Change-Id: I42683520ba9ee9fbd0c9920501387a573ac94655
Fixes: 30439313
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
813be138ae6f1fbe60a9efc082a30e7d25d03f7e 25-Aug-2016 Chong Zhang <chz@google.com> DO NOT MERGE -- Only use saved surface if started by launcher or moved to front

Restrict saved surface to launcher start (ACTION_MAIN&CATEGORY_
LAUNCHER), or there is no intent at all (eg. task being brought to
front). If the intent is something else, likely the app is going
to show some specific page or view, instead of what's left last time.

This solves problems like the launcher shortcuts on DeckClock,
each of them is a different intent and will show one specific
view regardless of last states. Another example is Chrome tab
opened directly by action VIEW to open some URL.

(Note that this doesn't solve the problem with Chrome homescreen
shortcuts, it will still start with saved surface (if Chrome
is already open). This is because the shortcut is a trampoline
activity that starts the real chrome tab activity, but when
the trampoline is started, the whole task is already brought
to front, and ChromeTab could become visible with the task
before we actually start it.)

bug: 31055479
bug: 27747315

Change-Id: Id3e61c61ef516b0edc1f174320f02661222f226b
(cherry picked from commit ad24f96def42016049de05220593aa049b136def)
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
ad24f96def42016049de05220593aa049b136def 25-Aug-2016 Chong Zhang <chz@google.com> Only use saved surface if started by launcher or moved to front

Restrict saved surface to launcher start (ACTION_MAIN&CATEGORY_
LAUNCHER), or there is no intent at all (eg. task being brought to
front). If the intent is something else, likely the app is going
to show some specific page or view, instead of what's left last time.

This solves problems like the launcher shortcuts on DeckClock,
each of them is a different intent and will show one specific
view regardless of last states. Another example is Chrome tab
opened directly by action VIEW to open some URL.

(Note that this doesn't solve the problem with Chrome homescreen
shortcuts, it will still start with saved surface (if Chrome
is already open). This is because the shortcut is a trampoline
activity that starts the real chrome tab activity, but when
the trampoline is started, the whole task is already brought
to front, and ChromeTab could become visible with the task
before we actually start it.)

bug:27747315

Change-Id: Id3e61c61ef516b0edc1f174320f02661222f226b
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
87761972ee9c07f8baf1f1b868e5ff06bb81eba9 22-Aug-2016 Chong Zhang <chz@google.com> Move okToShowLocked out of ActivityStack

This has nothing to do with stacks, it only depends on activity
flags and current user.

Also use ActivityRecord.okToShowLocked in more places as this
takes into account that the user profile is stopping.

Change-Id: Ieb9aa6b02482f10064390628798375445036489d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
717b2b9cd037ddb1a85a26ab88fe7d633c88a565 10-Aug-2016 Chong Zhang <chz@google.com> Merge "Put activity into stopped state if recreated while stopped"
fec694eca19f695556a8530bf2f8720cce94fe46 09-Aug-2016 Chong Zhang <chz@google.com> Put activity into stopped state if recreated while stopped

Move handling of recreate from client side to AMS, so that relaunch
happens at the right condition and activity goes to right state
after it's relaunched.

bug: 30060825
Change-Id: Ia475c26927b305eb25ae12be8640aab1fb7677a0
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c8e978208aea24b2b6d7ba7e199148ca742112da 08-Aug-2016 Chong Zhang <chz@google.com> Merge "Revert "Check if task was top of stack before it's removed""
fea7a9456ed9f94c552d9b695593bc3640b76a2b 08-Aug-2016 Wale Ogunwale <ogunwale@google.com> Don't ensure configuration for activity we are resuming. am: 950faffd02 am: 4566c74a81
am: c5068fc4a3

Change-Id: Iaf8787ceec2366d37759a13692419d79f940ef2b
bffd889cb0f6ce0e25fc8d236ce491d4e277a6ce 08-Aug-2016 Chong Zhang <chz@google.com> Revert "Check if task was top of stack before it's removed"

This is no longer needed, since we removed focused activity
in ag/1195645, and no longer reorder tasks in cleanUpActivityLocked.

bug: 29937415

This reverts commit e4cf36fbd1ba3ec5e05c5df0421bb97b5f7f3ff0.
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
950faffd02db9aa8c622959be3ff8be612f27aae 08-Aug-2016 Wale Ogunwale <ogunwale@google.com> Don't ensure configuration for activity we are resuming.

Regression introduced in ag/865988 when ASS.ensureActivitiesVisibleLocked()
was added to the end of AS.completePauseLocked() without specifing the
starting/resuming activity. If the starting/resuming activity isn't specified
the resuming activity can be relaunched with the current configuration which
might be different from the configuration the activity will end up in if it has
fixed orientation.
We now pass in the starting/resuming activity to avoid this.

Bug: 30509213
Change-Id: Idd0be84745bad83a1924e850b9b4020b927a78d8
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c4dcd4bc4b87c1236489e201a88e28405816d1d5 30-Jul-2016 Jiaquan He <hejq@google.com> Ensures a not-focused on-top launcher is invisible.

This commit makes sure that an on-top launcher is visible only when it's
focused.

Bug: 30507027
Bug: 30499741
Change-Id: I135048c3f52b9ef47ab578cd2d5231b376004052
(cherry picked from commit e8f7b9c5b315baf288dc0cfaabfd634c2cbe71d2)
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
494209829e86e6f7248104f985acfb9038b1be09 02-Aug-2016 Andrii Kulian <akulian@google.com> Fix finishing activity in non-focused stack am: 995fa2bd2d am: acecd484b1
am: 25a336ae90

Change-Id: Iddec02c37e44682123b0a29b7ea0de1759109078
995fa2bd2d334a37e10760c21ac108f4a3595713 29-Jul-2016 Andrii Kulian <akulian@google.com> Fix finishing activity in non-focused stack

This CL explicitly checks if we're finishing activity in non-focused
stack as there are other cases except this one when we finish paused
activities in FINISH_AFTER_VISIBLE mode.

Bug: 29007436
Bug: 29458854
Change-Id: I67744d23cd72f2fe8861180008bfdd284a7b5e26
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
4340d840989c06d01c52021d18102df19503f32a 29-Jul-2016 Andrii Kulian <akulian@google.com> Merge \\\"Don\\\'t delay child pressed state in freeform mode\\\" into nyc-mr1-dev am: 671bc2052a am: 0adcd5fa0f
am: f718b536c2

Change-Id: Ic56f46bae57f49f205397e828095a8d71ea31fef
9bc01a817be8b15046a92b4362051f93281816a2 08-Jul-2016 Jiaquan He <hejq@google.com> Add visibility logic for onTopLauncher.

This commit adds visibility logic to:
- force an on-top launcher to show on the top;
- determine visibility of each activity stack;
- determine visibility of each activity.

Bug: 29250513

Change-Id: Ie9d4a4ab5d2c2e0b2e44daa9d9e91c361de5e116
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e13e96464e84fda437e416dc5c839de39489ef27 16-Jun-2016 Jiaquan He <hejq@google.com> Add return-to logic for onTopLauncher.

- When an on-top launcher is moved to back, this commit makes sure
that it's moved to the bottom of the home stack, and the home
stack is moved to back.
- This commit also sets the proper return-to type for tasks launched
from an on-top launcher.

Bug: 29393795
Change-Id: If0cfb35d95a5bdab008a6a3809319d3909a56f19
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
dd1e66f737271dedded652cfae69a0cd7d46a86c 16-Jun-2016 Jiaquan He <hejq@google.com> Add more onTopLauncher support.

- Add onTopLauncher checking for TaskRecord.
- Add onTopLauncher to the window manager.

Bug: 28425537
Change-Id: Ic9e53db891dc42463a1a77b106ba93438a052181
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7318d63ba6dbb3042907d10d5369fcd5ac444d67 21-Jul-2016 Andrii Kulian <akulian@google.com> Correctly finish activity in non-focused stack

When activity is finished we first looked for next activity to
show in focused stack. If real next activity to show in place
of finishing one is in the same non-focused stack, we didn't
fully complete the dismissal process and activity was stuck in
FINISHING state.
This CL checks if we're trying to finish visible activity in
paused state and destroy it immediately if top running activity
is visible - same as we do for pinned activities.

Bug: 29458854
Change-Id: I0d5ceb2daa45c0628d89417c8456e132996bcea9
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b2f464103973057bc2dc070eba6fd807b745db24 22-Jul-2016 Chong Zhang <chz@google.com> Clean up surfaces when app is resumed without being stopped. am: 45e6d2dc8b
am: b76adc5117

Change-Id: I35c39c4fc49a953262b5b6ab4cbc2dca2ddf0b8f
d2cb311c02a922ce8c1cd6ae48525259c23c4da2 20-Jul-2016 Chong Zhang <chz@google.com> Call completeResumeLocked after activity is resume-relaunched

This is only needed when we're resuming an activity in
resumeTopActivityInnerLocked. If the activity is being resume-
relaunched elsewhere, we don't need to check this.

Also make sure RESUMED state is only set in ActivityStack#
setResumedActivityLocked.

Change-Id: If4be211f9ded7e5057257563ffc566cd4d65fb33
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
45e6d2dc8b8b7bd4e588368179d8d4b05fc6810c 21-Jul-2016 Chong Zhang <chz@google.com> Clean up surfaces when app is resumed without being stopped.

When quickly toggling between two apps, app could be resumed while
it's stopping but not yet stopped. Upon resuming, it could have
surfaces that's marked mDestroying and waiting for the stopped
to be destroyed.

We need to dispose these surfaces properly. If the window is already
removed, we destroy them. Otherwise, clear mDestroying flag so that
the window is ready to be used again. Leaving mDestroying=true makes
the window ineligible for certain things such as receiving wallpaper.

bug: 30255354
Change-Id: Id881653550595ab8e702d6950949bf202ac5a0d9
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6cda19cab2bcd6d538f98782bd315c6c7ff5a4d5 15-Jun-2016 Chong Zhang <chz@google.com> Remove mFocusedActivity in AM and only keep focused stack

- Remove mFocusedActivity and replace it with resumed activity
where applicable.

- Remove setFocusedActivityLocked and related recursions, only
keep track of focused stack.

- Update focus app with WM at resume time.

- Some clean up of startActivityUnchecked, make sure each of the
setTaskFromXXX methods set up the focused stack properly, and
remove the extra setFocusedActivityLocked before starting.

bug: 29937415

Change-Id: Ib93d3f4d9cded0aa3b480d0d423435c536b7e7b5
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
98742a58710b2feaee0b8fd27bf47e6f1427df57 12-Jul-2016 Wale Ogunwale <ogunwale@google.com> Do remove starting windows for activities in an invisible stack

Depending on app launch timing it is possible for the initializing
activity that is the top of an invisible stack to still have its
starting window visible since we skip removing orphaned starting
window for the top activity in a stack. We now remove starting
windows for all activities in an invisible stack.

Bug: 28173906
Change-Id: Ie5284c9681d06969f647cbe46a77dd072ca61435
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
4ce6754e604abadd8ecd0fe2fa4d503476351cc4 01-Jul-2016 Andrii Kulian <akulian@google.com> Merge "Always send task stack change updates if PiP is enabled" into nyc-mr1-dev
fc20505e37f9986b7ecc5eaa337d3a49a1db265e 01-Jul-2016 Andrii Kulian <akulian@google.com> Merge "Don't update task to return to type for last task over home" into nyc-mr1-dev
8290f8f66a75e89ac3ef4d399798486e7d8682a8 01-Jul-2016 Andrii Kulian <akulian@google.com> Always send task stack change updates if PiP is enabled

PiP stack repositioning is triggered when task stack change
is detected. Usually these updates are sent when there was
a visibility change since last pause. In case when we're
navigating from setting back to launcher on TV there is no
visibility change. This happened to work in most cases
because PipOverlayActivity was shown or hidden somewhere
between user actions.

This CL always notifies about task stack changes if pinned
stack is present on activity pause.

Bug: 29344059
Change-Id: I5ab3f2b8a97983fcb79d58626b6494f8ec31dbf3
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
fd10cd1989966d01011a0cf75f3282f3e12ca5a6 30-Jun-2016 Robert Carr <racarr@google.com> Force CROSSFADE rotation when launching from double tap gesture.

When activity transition triggers a rotation change, the starting
window will normally be the top window at the time we try
to select the window animation. However, these layout params won't
have the apps rotation animation set (as the client code will set that
on the real window, not the starting window). Eventually we would
like to add API to specify rotation animation via manifest to solve
this problem cleanly. In the mean time, we can force a specific rotation
animation from the double tap gesture, and clean up some camera
ugliness. We accomplish this by attaching an animation hint to
ActivityOptions.

Bug: 28838855
Change-Id: If052cd8cbae76651da43f3b4c590cd9dcc1afc0f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
dc0f8933da69f7d462bf256f34f5e9d6dab653f5 29-Jun-2016 Andrii Kulian <akulian@google.com> Don't update task to return to type for last task over home

Resizing docked stack to fullscreen size results in dismissal of
docked stack and moving of tasks to fullscreen stack. When tasks,
which were originally launched from home or recents, are inserted
on top of fullscreen stack, their mTaskToReturnTo value was
overwritten.
This CL doesn't allow to overwrite this field of task if there is
no next task in stack and it was launched from home or recents.

Also this reveals issue b/29342752. When app is moved to PiP mode,
system UI shows another overlay activity in separate task in PiP
stack with hint to user. In ActivityStarter#startActivityUnchecked
some logic assumes that new activity is launched from focused stack.
But PiP stack is not focusable, so we end up thinking that overlay
activity was launched from home stack. This sets mTaskToReturnTo of
overlay task to HOME_ACTIVITY_TYPE instead of
APPLICATION_ACTIVITY_TYPE.
This CL checks if stack id is specified and checks preferred stack
if available instead of currently focused one.

Bug: 29237751
Change-Id: I3a55b84d6a57be758705db51dec60592683e4e02
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
bb7c5aca254bedb7dce4aa47e1da2782fd67d9cf 27-Jun-2016 Andrii Kulian <akulian@google.com> Merge \"Resume only activities in focused stack\" into nyc-dev
am: 06b1d786e9

Change-Id: I699695002213bdc0482d6b44447a5c26a27445d1
c11ce7b1cd1d1e5cda2c1e8acb5b165cd7ce50ef 27-Jun-2016 Andrii Kulian <akulian@google.com> Resume only activities in focused stack

While performing ensureActivitiesVisibleLocked we should only
resume activity in focused stack. Otherwise we can get several
resumed activities at the same time.

Bug: 29619461
Change-Id: Id65fe1a29841ee3166694bfb6a8236151b9fc7ec
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
8fd75428b409ad926e54178ec0dcd47012255d2c 24-Jun-2016 Wale Ogunwale <ogunwale@google.com> Reset relaunching count is app dies during re-launch

WindowManager keeps a count of how many relaunches an app is told
to do so that it can defer app transtions until the relaunches are
done. If the app porcess is killed during one of the relaunches
the app will never report back that it is done relaunching, so
app transtions into the app will not happen until will timeout
from waiting for the app.
We now notify WM of this situation so it can clear the relaunching
count for the app.

Bug: 29551109
Change-Id: Ibadba9f73e6e1bde141385aa8a0e066fbc0c5764
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
1a91866400a458138dbb8d46009f4915bbb742e2 23-Jun-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Notify user when application does not support current display zoom" into nyc-mr1-dev
076b51536ceca28f8c930bfabb42625397a81cc8 23-Jun-2016 Andrii Kulian <akulian@google.com> Merge \"Show unsopported display size dialog on relaunch\" into nyc-dev
am: 354c8cde6c

Change-Id: I46f232290ebc5cf924bf696f20eb134076e83b4f
f42cbe83380dea5c6514d1249ece2ad5c5daa760 22-Jun-2016 Andrii Kulian <akulian@google.com> Show unsopported display size dialog on relaunch

If the display density change made app restart when it was focused
or we navigate back to it after density change and it makes it
restart - we didn't display unsupported display size dialog.

Bug: 29574686
Change-Id: Ic8fdc8a54df160f947e2d340ab2cb2931bac195d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6098085ababfc54455c32832fe5034838c975769 22-Jun-2016 Chong Zhang <chz@google.com> Merge \"Unblock \'am start -W\' if activity is brought to front without launching\" into nyc-dev
am: 75c7cc6ca9

Change-Id: I983331f65f03d50c26b7929866e3ce5d5ae19966
5022da313f6b2fbd16e55ebabaadbb308e96e908 22-Jun-2016 Chong Zhang <chz@google.com> Unblock 'am start -W' if activity is brought to front without launching

If -W is used to start an activity successfully, but this activity just
brings another activity to front without actual launching, the waiting
will be stuck because neither activity will report launch complete.

In this case, we have to treat it as if the -W started an activity and
received return code START_TASK_TO_FRONT. It needs to wait for the new
activity to become visible (or report launch complete if it's already
visible).

This reverts earlier commits afb776d5447e19565c9a826a554911decb9ed92a,
since it's causing problems with launch time reporting.

bug: 28333487
bug: 29451567
Change-Id: I9fd79ab5b3ed8f9de5df34ed9c7b0be3a94620b2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
5f31b984553d7d26a5e49b2625def327e8a88c44 21-Jun-2016 Alan Viverette <alanv@google.com> Notify user when application does not support current display zoom

Bug: 29322470
Change-Id: Id33215f6b0b20b332c3c9101aedf9de0261ee5ea
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b809d1cb79b065443a1d8e19b2d5685c7c3383bd 21-Jun-2016 Andrii Kulian <akulian@google.com> Merge \"Compare intent filter when launching adjacent\" into nyc-dev
am: 9980514ee0

Change-Id: I8c2b03438fdeed6bce12489c5639245b79097577
9980514ee05593dec2f276e13b095735c0bfad25 21-Jun-2016 Andrii Kulian <akulian@google.com> Merge "Compare intent filter when launching adjacent" into nyc-dev
6d296286e4bb1594a2dcfe955883dace504a2f33 21-Jun-2016 Wale Ogunwale <ogunwale@google.com> Merge \"Don\'t re-launch stopped activities while the device is sleeping\" into nyc-dev
am: f159b74608

Change-Id: I83edfb392f0f179b4c28aaab3eba0c51fe11d207
96eea7136a795b225eda6b7542acf0f958e55b56 20-Jun-2016 Wale Ogunwale <ogunwale@google.com> Merge \"Revert \"Don\'t re-launch activities while the device is sleeping\"\" into nyc-dev
am: beaf3707fa

Change-Id: I50f6a45a56650569047c046d275f39b0929c38e4
089586fd9178873eee9791bfae6eb11e30a52d35 20-Jun-2016 Wale Ogunwale <ogunwale@google.com> Don't re-launch stopped activities while the device is sleeping

Don't ensure configuration for stopped activities while the device
is sleeping as we don't want to relaunch activities in this state.
Note that the right configuration will be applied to the activity
the next time we try to make it visible. The re-launch will happen
then.

Bug: 28518380

Change-Id: Id79d7817ba8f213d89cae6964de09cafe17481f9
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
60920d5aa11bbb0e82a7f101cee825586e87aff0 20-Jun-2016 Wale Ogunwale <ogunwale@google.com> Revert "Don't re-launch activities while the device is sleeping"

This reverts commit 0619545be9adca4458cb627c18c211faad6b6275.

Bug: 29497152
Bug: 28518380
Change-Id: I8684b731b1e9973ead7066dc650eff720f70ac91
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
cf9c82b124c1a544b6df19bface5645d437555c0 18-Jun-2016 Fyodor Kupolov <fkupolov@google.com> Merge \"Do not schedule restarts if the system is shutting down\" into nyc-dev
am: 1f0151220e

Change-Id: I34df39f82516cb0e40c12a25340a7b3bb2c5f65a
d3bbb13fe29e8b6c931497daeb124669e050b419 17-Jun-2016 Andrii Kulian <akulian@google.com> Compare intent filter when launching adjacent

When we're looking for a task during adjacent launch, we need to
perform full intent filter comparison instead of just comparing
components.

Bug: 29424577
Change-Id: I10f271986a8dc405e28a053e4cb122c1e9aa6ee0
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
1f0151220e8c3054e826d2c89056bb3aeaf6542e 17-Jun-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Do not schedule restarts if the system is shutting down" into nyc-dev
c577a50d099c35c5e2c96f50b62cfa81843398ef 17-Jun-2016 Alan Viverette <alanv@google.com> Merge "Notify user when application does not support current display zoom" into nyc-dev
9b80b94167a7d218da28b357d1daabf5ab1f309d 17-Jun-2016 Fyodor Kupolov <fkupolov@google.com> Do not schedule restarts if the system is shutting down

Bug: 29357754
Change-Id: Id5cf43fb6c4c6ea04d60bd09e910a9cec194c753
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f6e3c9a5537a5e1e7ef7be956d8a335106afd8f7 16-Jun-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't re-launch activities while the device is sleeping" into nyc-dev
0619545be9adca4458cb627c18c211faad6b6275 16-Jun-2016 Wale Ogunwale <ogunwale@google.com> Don't re-launch activities while the device is sleeping

- Don't ensure configuration for top running activity that is in the
stopped state if the configuration change while the device is sleeping
as we don't want to relaunch activities in this state.
- Don't make activities visible while the device is sleeping and the
activity isn't in voice interaction mode. Making it visible can also
lead to the activity been relaunched due to configuration changing.

Note the the right configuration will be applied to the activity the next
time we try to make it visible. The re-launch will happen then.

Bug: 28518380
Change-Id: Ic22193db645dec358065cb05e7f1afc6fc8ac49f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7df9b45bfe3cc6a6b3f33be008bb69a31b15999f 16-Jun-2016 Alan Viverette <alanv@google.com> Notify user when application does not support current display zoom

Bug: 29322470
Change-Id: Id33215f6b0b20b332c3c9101aedf9de0261ee5ea
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
0e8524719559f0be9c8145dbf9f52100e1fb60c3 15-Jun-2016 Yorke Lee <yorkelee@google.com> Limit global drags to apps targeting SDK 24 and above

Bug: 29127791

Change-Id: Ib5f85a207bdb79eeac0418fda78e452d225761bc
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
369be64bf3dab596a1d804d36bf3ac5e9667baa4 14-Jun-2016 Andrii Kulian <akulian@google.com> Revert "Don't update task to return to type for last task over home"

This reverts commit 21893824c1d15a1a46cb75725ad951620569c3c6.

Original commit revealed issue b/29342752 when launch logic was applied
to incorrect stack while moving to PiP mode.

Bug: 29342752
Bug: 29237751
Change-Id: I88d75399eb4b9daf4de87a9a560eb0df0b515173
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
21893824c1d15a1a46cb75725ad951620569c3c6 11-Jun-2016 Andrii Kulian <akulian@google.com> Don't update task to return to type for last task over home

Resizing docked stack to fullscreen size results in dismissal
of docked stack and moving of tasks to fullscreen stack.
When tasks, which were originally launched from home or recents,
are inserted on top of fullscreen stack, their mTaskToReturnTo
value was overwritten.
This CL doesn't allow to overwrite this field of task if there
is no next task in stack and it was launched from home or recents.

Bug: 29237751
Change-Id: If56cd3f68b6b400c2d5c945431371acfe6269682
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e4cf36fbd1ba3ec5e05c5df0421bb97b5f7f3ff0 03-Jun-2016 Chong Zhang <chz@google.com> Check if task was top of stack before it's removed

To decide if home stack should be brought foreward. If the app is
finishing, it's no longer considered "running" and cleanUpActivityLocked
could move focus to the activity below. Then removeActivityFromHistoryLocked
would fail to bring front home stack as the removed task is no longer top.

bug: 29030518
Change-Id: I887e7c226258651d887cb0a4a6c6caab0a04e6e6
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
206b9faa09ada62ce07026301723805b687e9892 02-Jun-2016 Andrii Kulian <akulian@google.com> Fix task selection logic

When task was selected for activity launched with flag FLAG_ACTIVITY_NEW_TASK
first matching task was omitted if there was another match lower in stack.
This lead to task shuffling in same stack.

Bug: 28848683
Change-Id: I94e55693fc7ed926fc151ba988d257bd2417dd45
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f12fce1a3aa4b28335e3644057c346e205693189 28-May-2016 Andrii Kulian <akulian@google.com> Update override config to include some changes from global config

In override config for task we set Configuration#screenLayout field based on
initial global config + shrink to fit the area on screen given for this task.
However this field also contains information (like layout direction) that we
do not intend to override and it can be changed in global config separately.
In this case we need to update the override config with changes from global
config.

Bug: 28616488
Change-Id: I22673257621b3f9ae7933b37bd0fb9446c6042ea
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
ca2af9e38c31c823f72a6060c45b27fc968e6bd8 26-May-2016 Wale Ogunwale <ogunwale@google.com> Only make Recents activity invisible if not focused on TV devices.

Change was introduced in b/28246419 to fix Recents activity visibility
issues on TV, but was causing other issues on phones. So, only apply
rule on TV devices.

Bug: 28246419
Bug: 28943853
Change-Id: Icd19eae4ffa5e0a798bc9f63bc7a6c9a60422236
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
cac5c322da0b81a1a2106c8e248b0fe476f1ea6b 23-May-2016 Wale Ogunwale <ogunwale@google.com> Only resuming starting dontWaitForPause activity once

For a starting activity that doesn't wait for pause, we can resume it
when ensuring visible activities when pausing back stacks. If this
happens, there is no need to try to resume it again.

Bug: 28853615
Change-Id: Iee40b80eb13ab3fd65fdce0c100c4051e64f229f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
8c09c7dd7a8838383a94ef85974a8ff0841dd8c5 23-May-2016 Wale Ogunwale <ogunwale@google.com> Fixed flicker when docking task from recents.

Regression introduced by ag/1044640 where we don't want recents to the
visible if it's stack isn't fullscreen or focused. However, it is
possible for switching the home stack to not-fullscreen to prolonged
while transitioning to split-screen mode from recents. We now check
for if the docked stack exists which is a better indicator we are in
split-screen mode regardless of if the stask is fullscreen.

Bug: 28882948
Bug: 28246419
Change-Id: I54c02cc1486e7b5bf6a20dd0706c9bfe3f40a953
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
42b3acf9d3eed15324bfa67e92ad751a10e45718 19-May-2016 Andrii Kulian <akulian@google.com> Merge "Rename minWidth/Height attributes" into nyc-dev
cbc73decf11344ebcf7a35c31585b66e021e38a1 18-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Make Recents activity invisible when it is behind a translucent activity" into nyc-dev
f66a83db41711ebd1187bf9e99d0b21e428075f5 17-May-2016 Andrii Kulian <akulian@google.com> Rename minWidth/Height attributes

Rename WindowLayout#minimalWidth and #minimalHeight to #minWidth
and #minHeight to be consistent with other APIs.

Bug: 28775586
Change-Id: Ib7dc26318c4391693ef23f908b4d6090138dd0d7
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e76407c7f3403530b4cb96de324f6194b2011010 17-May-2016 Wale Ogunwale <ogunwale@google.com> Make Recents activity invisible when it is behind a translucent activity

We don't want the recents activity to be visible behind a translucent
fullscreen activity. Instead we want to show the home activity behind
the translucent activity.

Bug: 28246419
Change-Id: I0364a592d7d84c88b39b359431492d0395b0f051
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6874114a957051cc9f469363e7583994c2966758 17-May-2016 Wale Ogunwale <ogunwale@google.com> Correct activity lifecycle when forcedResize activity is finished

- Regerssion introduced ag/1039265. We still need to resume the
starting activity in a task with an overlay activity is the starting
activity is the overlay activity. Otherwise the activity below it
might not be moved to the paused state.
- Also, we don't want to clear starting window for activities that
aren't behind fullscreen activities as we need to display their
starting window until they are done initializing.

Bug: 28808506
Bug: 28751186
Change-Id: I9a1a5feecea2ed3592a4064fca80e240a3bce387
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b406dd20eee28eedb8e9f330a0459d630c026515 17-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fixed bugs with starting windows when displayng forcedResized activity" into nyc-dev
3b23239d6ec9ded858d75f272ca1a677c5c431f9 14-May-2016 Wale Ogunwale <ogunwale@google.com> Fixed bugs with starting windows when displayng forcedResized activity

- Added ActivityOption to mark a starting activity as a taskOverlay
activity. That is the activity will always be the top activity of the
task and doesn't cause the task to be moved to the front when it is added.
- Only set the starting window state of the ActivityRecord to shown if
window manager actually showed the starting window for the activity.
Avoids incorrectly trying to remove starting window for an activity that
didn't show any.
- When starting additional activity in a task, transfer the starting
window from the top most activity with a starting window. It is possible
the top most window does have a starting window like in the case of the
forcedResized activity.
- Only ensure visiblity of an activity we are starting in a task whose top
activity is a task overlay. They need to start in the visible-paused state
and not the resumed state which just causes extra churn in the system.
- Always add additional starting activities in a task with an overlay
activity below the overlay activity.

Bug: 28751186
Change-Id: I3624a4313ae9c406d42c67a3537f67ad685791af
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
db0fa12b736a6901075ae30c2c423a036d6b8139 17-May-2016 Wale Ogunwale <ogunwale@google.com> Update configuration of all visible activities in a stack when resizing

Previously we were only updating configuration for the top activity in
the stack during resizing. This caused an activity behind the top
translucent activity to continue to display in the old configuration
and also get relaunched without window preservation when the top
translucent activity is finished.
We now make sure all activities at all below a translucent activity
have their configuration updated during resizing.

Bug: 28762547
Change-Id: I0926ac6db088cdf3f6a225c552dbfbe944830f68
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e9f5d365bb740edade62290d1d835902a58cfdf2 11-May-2016 Chong Zhang <chz@google.com> Merge "Deliver new activity options after the activity is made visible" into nyc-dev
371c44222f4f3268778efaf20368c92beaa2640c 11-May-2016 Chong Zhang <chz@google.com> Deliver new activity options after the activity is made visible

The return options need to be sent in makeVisibleIfNeeded() (where app
is made visible from invisible), in addition to handleAlreadyVisible().
We can't rely on getting a second ensureActivitiesVisibleLocked to
send the activity options.

bug: 28610520
Change-Id: I38a4fd4624daecddfe9ea49c87753b04b154bb82
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
4f128e4d968b376bb7c3fa209d27b0a30202e604 10-May-2016 Amith Yamasani <yamasani@google.com> Fix multi-window assiststructure trashing

When multiple activities within the same process
try to handle requests for AssistStructure, the
singleton mLastAssistStructure tends to trash
the old structure when a second window's request
comes in.

This change passes in a sessionId so that the
cache is only cleared if the session id changes.

Bug: 28348867
Change-Id: I07efcd933db7e48aefd25a1c95493b71bbcffe4b
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
a5aa3ecbe3426b44b6d550624e7b30f4b84c1025 07-May-2016 Andrii Kulian <akulian@google.com> Merge "Fix onStop not called when activity is under translucent" into nyc-dev
f9949d55c3e23ddbe41012696213e3d38f1d6b32 06-May-2016 Andrii Kulian <akulian@google.com> Fix onStop not called when activity is under translucent

Activity was not stopped when device went to sleep if it was covered by
another translucent activity. The issue appeared after ag/864253 which
disabled stopping for visible activities.

Bug: 28191555
Change-Id: I39f0c5579ee3e5a16db888c72ace5dc43aa307bd
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
ed811d731d211636b8617fb934e02d730a0039f8 06-May-2016 Wale Ogunwale <ogunwale@google.com> Fixed bad focus stack state when focused docked stack is removed

ag/990438 allowed for stack focus not to be adjusted when the currently
focused stack is removed since the caller will be moving the focus to
the right stack next. This was incorrectly enabled for the positionTask
call were the stack will not be moved to the front since the functionality
is used to move task within stacks we don't want to gain focus.

Bug: 28616824
Change-Id: Ia6aea17c0335d036a17b83fed28799428ca58eda
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c70e264de102a1e1a4b77018bcc4eded08d4b254 03-May-2016 Chong Zhang <chz@google.com> Merge "Fix bad animation when pressing Home with translucent activity" into nyc-dev
37634aefb6e32af696355bad859335fa00f14261 03-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fixed some issues with resuming already resumed activity" into nyc-dev
d127c6d46179ac74afe20ccfd99f0d4ed2da0eb0 03-May-2016 Chong Zhang <chz@google.com> Fix bad animation when pressing Home with translucent activity

Force a setAppVisibility if the previous app was translucent, so that
the resumed app is added to the opening app list. Otherwise opening
app list is empty and the transition can't be set up correctly.

bug: 28463843
Change-Id: I7f8e28d0f804c799a429743df6fc501c06d62f21
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
06579d63a865ac87641c7fec56efde39bc2b8f59 01-May-2016 Wale Ogunwale <ogunwale@google.com> Fixed some issues with resuming already resumed activity

- Don’t adjust focus stack when a stack is left empty because we moved
the last task in it to the stack that will be the new top (focused).
Focus can be temporarily adjusted to another stack which we don’t want.
- Protect against trying to resume an already resumed activity in
ASS.resumeFocusedStackTopActivityLocked. This will just cause a crash
on the client side.
- In ASS.moveTasksToFullscreenStackLocked defer resume activity call
until we are done moving all the tasks to the new stack.
- In ASS.moveTaskToStackUncheckedLocked check top running activity
instead of just the top activity when we are trying to determine if
the task as focus and resumed. It is possible the resumed activity
in the task isn’t the top most because the top most is still
initializing or going away.

Bug: 28219871
Change-Id: I8c1113503f6f83d39983375a4f92155ddc04f20f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
ae30f308eed52305d64658bb54bbcdfef66f7783 02-May-2016 Wale Ogunwale <ogunwale@google.com> Allow pinned activities to finish immediately

Pinned activities are normally in the paused state so when finishing
they can finish immediately as there might not be additional transition
in the system to finish them.

Bug: 28434641
Bug: 28350881
Change-Id: I5f1eaf0969a7eb08292cb9cc123bf8c0fddc9ea8
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
103fdec4151684686f900bd0a3af0a7fa82bf159 28-Apr-2016 Chong Zhang <chz@google.com> Merge "Don't wait for visible if there is no running activity left." into nyc-dev
824b6dcb55f6bc436d5aa8f461d5b269a4f5180b 27-Apr-2016 Chong Zhang <chz@google.com> Don't wait for visible if there is no running activity left.

We could run into this situation on some devices (eg. clockworks),
the next activity doesn't get launched until we destroy this one.

allResumedActivitiesVisible() will return false if there is no other
activity running at all. Check top running activity and it's visibility
instead.

bug: 28400334
Change-Id: Ib8957e499580a10206fdd4e27da19fbc2bdb5843
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b8bd069eacc2a888a1ff6e923094e4178ad531a3 28-Apr-2016 Chong Zhang <chz@google.com> Do not add duplicates to mWaitingVisibleActivities

processStoppingActivitiesLocked() only removes one record each time, so
instead of stopping on the next window visible (or next idle), it now
requires two such calls to move the app to destroyed, if there's only
one report, the app never gets removed.

bug: 28417200

Change-Id: I7c5eac240074ed0434a72643a8d52f1726ab906c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
efd9a5ba01be857e837e01fc9a5df24ada19a17b 27-Apr-2016 Chong Zhang <chz@google.com> Finish immediately if the resumed activity is already visible

When in FINISH_AFTER_VISIBLE mode, we need to check visibility of
both the current activity, and the activity to be resumed. If the
resumed activity is already visible, we should finish immediately.
We can't put it into stopping state and wait because there won't be
a window visible callback from the next activity.

bug: 28378359

Change-Id: Ib1fb44acfec33616da76f48102cc00b453e41914
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
592bf0b7d54a236f85d969b9599245f7d0542609 25-Apr-2016 Chong Zhang <chz@google.com> Wait for next app to be visible if current activity is marked visible

WM's AppWindowToken.updateReportedVisibilityLocked() may not report
nowVisible if the app has animation set. So nowVisibible could be false
for a while after the app is already on screen. If we finish the app in
this state, we still need to wait for next app to be visible.

bug: 28019637
Change-Id: I4f9f8e138f5d011a9ab393913159ed2978d26e0d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
afb776d5447e19565c9a826a554911decb9ed92a 23-Apr-2016 Chong Zhang <chz@google.com> fix "am start -W" hang on activity start

Normally launch time counts from the point when the activity is
resumed, to when the first window is drawn. However the activity
could become visible before it is resumed, due to some other
activity in the same task being launched. In this case we still
need to report launch time to unblock
ActivityStarter.startActivityMayWait().

bug: 28333487
Change-Id: I445b602f495ed0c3cb669e2d81a137280317534f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
4c5f7ff42eda45be5f20a7dd981a9f064d8fb01d 22-Apr-2016 Chong Zhang <chz@google.com> Fix black frame in finishing transition

If either visible or nowVisible is true we need to wait for next
activity to become visible before we destroy the previous activity.

In some code path (eg. clear task top), when starting a new activity,
old activity is first paused and visible set to false with a dummy
transition set. Then finish activity is requested. At this point visible
is already false, but nowVisible is true. We still need to wait for
next app become visible to avoid a black frame shown in between.

bug: 27796252

Change-Id: Ief3d5fc8f11c51a729c424f996ab2597c815e4dd
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
023da538a2e8e31ad101fdb14bea9a653eb8f5c0 21-Apr-2016 Jorim Jaggi <jjaggi@google.com> Fix lifecycle bug in when calling positionTask

Sometimes the resumed activity from another stack gets positioned
BELOW the top activity of the current stack. We need to carry over
the mResumedActivity to make sure onPause is called on the moved
activity.

Bug: 28235047
Change-Id: I09e6b032cd8d0b00dc5fdd06bec68e53c25aae73
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
4ccfc30a80d6b63cc938ce3578b19773ca00a2ea 21-Apr-2016 Jorim Jaggi <jjaggi@google.com> Animation fixes when task is not resumed

- Make sure to add the activity to mWaitingVisibleActivities
to not destroy the activity before the app transition has
started.
- Defer layouts in startActivityUnchecked so when clearing the
current activities in the current stack, we don't execute the
app transition yet. We need to wait until the new activities
are added as well.

Bug: 28026847
Change-Id: I252cf139e06197ea34329d1466f1f6162f3e7a30
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f7dab1e53f4c8544a6129ff8785363baec1272dc 16-Apr-2016 Wale Ogunwale <ogunwale@google.com> Always send configuration changes to activity.

We are not sending override configuration changes to activities if the change in
configuration is not significant enough (i.e did resources will not be reloaded
due to the change). This breaks apps that rely on getting onConfigurationChanged()
call whenever the config changes regardless of if resources will be reloaded.
We no deliver all configuration changes to the activity.

Bug: 28177873
Bug: 23904868
Change-Id: Icc979dabb8bc93ae8a976ef6074cd2559aedca67
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
29379ec859bf7118dec9f3248c63ee369218ad6b 12-Apr-2016 Jorim Jaggi <jjaggi@google.com> TRON refinements for multi-window

Bug: 26013430
Change-Id: I89b139b4ca3e7b6a06d8b5b351d67ffac240f73f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
af80db4489d591837e114e75f5040d75b61e6804 08-Apr-2016 Jorim Jaggi <jjaggi@google.com> Fix a few issues with non-resizable info activity

- If stack doesn't have focus, we execute TASK_TO_FRONT transition.
Set the correct animation for this transition type.
- Make sure to execute app transition when we are finishing an
activity that isn't resumed.
- Correctly set mAnimatingExit for the case if the activity is
already paused.

Bug: 27327287
Bug: 27154882
Change-Id: I253938727ba0eea76ebadba242315bd2d305d0b4
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
22bc8519a83efd1c33bf595bca53015d9f7ba6b7 07-Apr-2016 Chong Zhang <chz@google.com> Take screenshot of finishing apps as requested

bug: 27931814
Change-Id: I307bb5759fd4faa296fd575e703967db3e6a2fef
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c3af194138f3df8a81a244e041da98097427b4d2 31-Mar-2016 Chong Zhang <chz@google.com> Merge "Clear deferRelaunchUntilPaused flag after activity relaunch is performed" into nyc-dev
225d1b6334c1e1c56182a890b3432016ea590e17 31-Mar-2016 Chong Zhang <chz@google.com> Clear deferRelaunchUntilPaused flag after activity relaunch is performed

We set deferRelaunchUntilPaused when a relaunch is delayed due to the app
in pausing state, but this flag is not cleared after it's relaunched upon
paused. After that every time the app is paused, it relaunches again.

Change-Id: Ib98956e0760b3c4fe108d93f5c7843e2cbd313de
related-to: b/27834014
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
933076d80561751618f462b26309ce9e4c3ff3bf 30-Mar-2016 Andrii Kulian <akulian@google.com> Refactor usages of Picture In Picture and Multi Window (1/4)

Bug: 27365860
Change-Id: I1590e430a12ceb84cb83da295e0bf7e4378fea96
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
029a28b7d665b0c1cfbc1f6795b18a744d2b4ba3 29-Mar-2016 Andrii Kulian <akulian@google.com> Merge "Add minimal width and height logging to AM dump." into nyc-dev
771f9e0a9c162987378fa0d0947fb57c0183afc7 29-Mar-2016 Andrii Kulian <akulian@google.com> Add minimal width and height logging to AM dump.

Currently this is used in CTS to validate task and stack bounds.

Bug: 27785974
Change-Id: I2dcf6d51dba5d1bf15037d333ff41dea8f5db1d3
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
5e3801ab359634a05ec82992934007fbb21a059a 28-Mar-2016 Wale Ogunwale <ogunwale@google.com> Merge "Don't show home activity when exiting split-screen with recents visible" into nyc-dev
b583f084c9f63b11a58a6ac7ad18613dc38ccdb6 26-Mar-2016 Jorim Jaggi <jjaggi@google.com> Fix flicker

This line was added for window swapping, but it's not actually needed
and causes regressions.

Bug: 27635189
Change-Id: I6c9cdac8d1bf30029b9f36a106e1f2afebfd9072
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c750f5fd2b638b33d147545eac5088e5214975a7 28-Mar-2016 Wale Ogunwale <ogunwale@google.com> Don't show home activity when exiting split-screen with recents visible

If we will be focusing on the home stack next and its current top activity
is visible, then use it as the next task to display vs the return to value.

Bug: 27859516
Bug: 27776008
Change-Id: I5aec0bafb07b7c7391608efdfbdc46b1496d6b57
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
2e751b8c778fd991fcdcec3bc2d1f32a722f436b 17-Mar-2016 Andrii Kulian <akulian@google.com> Update ActivityInfo#WindowLayout apis (1/3)

Adds documentation, renames Layout to WindowLayout and
splits #minimalSize to #minimalWidth and #minimalHeight.

Bug: 27528326
Change-Id: Idb440cb081a14ccdc83309284e906454633c4504
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
192086eb8aff3fb873a7e03ade0b81652aacf25f 11-Mar-2016 Jorim Jaggi <jjaggi@google.com> Implement transition for docking task in recents #1

- When the docking transition is happening, defer updating
the bounds of the home stack until the transition is done.
This is to preserve the scrim which is drawn in the recents
activity.
- Use the PROLONG_AT_START infrastructure to hide the task
in recents when starting the app transition.
- When recents finally get resized at the end of the transition,
reset it's draw state so we don't move the old surface around,
and the new surface gets drawn at the new position, to avoid
flickering.
- Remove hack around not layouting docked divider if it's not
visible, it's not needed anymore and resulted in a wrong
initial position.
- Fix animation selection for docked stack divider.
- Make sure win.moved() always gets called.

Bug: 27607141
Change-Id: I76c35f09461f044a90e2c88335008284b5839cc0
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
941a1f81b0f50ff219a38476ffdba062b81d2fc4 25-Mar-2016 Winson Chung <winsonc@google.com> Merge "Don’t scale task thumbnails." into nyc-dev
217009356efa2b854ab3981dff8d315a0d679c73 25-Mar-2016 Winson <winsonc@google.com> Don’t scale task thumbnails.

- Changing task view thumbnail layout. In portrait, scale the thumbnail
to width for portrait screenshots, and apply the same scale to
landscape screenshots. In landscape, scale screenshots up to 1:1, and
tweak the app transition to clip the sides instead of scaling.
In both orientations, fill with the background color in the remaining
space.
- Moving some resources related to the title bar to be calculated
programmatically so that we can have different header bar sizes which
completely overlap the action bar in the screenshot in each
orientation.
- Constraining the task stack width in landscape to portrait

Bug: 27504677
Change-Id: Ic9b6fdde6dd728d9f2d20a8b89c05b3a350edfbf
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d34e80c0bc5ddff8289563fef8ca47451b46b459 24-Mar-2016 Wale Ogunwale <ogunwale@google.com> Return to correct home stack task in multi-window mode

Previously when determining the next stack to focus to in
multi-window mode, if it is the home stack we just bring it
forward and focus on whatever the home task/activity is.
We should be checking the returnToTask type of the activity/task
that is going away to determine which task in the home stack
we should return to.

Bug: 27776008
Change-Id: I1a864c96b2ef276d2ddeafcb627a2b6a825e2ce7
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
197438180978b91be2ada57b1a1a88832e63bff5 15-Mar-2016 Chong Zhang <chz@google.com> Merge "Fix black frame when unlocking device via clicking on notification" into nyc-dev
dea4bd980cdede60e3e315a77a879b91e1b1de01 15-Mar-2016 Chong Zhang <chz@google.com> Fix black frame when unlocking device via clicking on notification

- Make sure to tell the app to start drawing if it has been stopped, app
could be stopped in visible state.

- When activity is started with NEW_TASK + CLEAR_TASK flags, skip
resuming of the soon-to-be-removed activity, and run enter animation
directly on the new activity. Resuming the old activity causes delay,
and we also run extra enter-exit transition in short succession which
cause glitches.

bug: 27391256
Change-Id: I390ef9fc9855d70a4a9642c06c87cbe548b8b466
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
95b69f82316220bc40d227bf7208920eb6ed9283 11-Mar-2016 Jorim Jaggi <jjaggi@google.com> Merge "Add ability to swap docked/fullscreen stack" into nyc-dev
d47e7e1176dcf6961c7c9fce215f48f03a5098d1 01-Mar-2016 Jorim Jaggi <jjaggi@google.com> Add ability to swap docked/fullscreen stack

Adds tap affordance that moves all tasks of the docked
stack into the fullscreen stack as well as moves the top task
of the fullscreen stack into the docked stack.

Also make sure not to trigger focus switch when tapping the divider
handle. For that, add a method so SysUI can specify the touchable
region which then gets excludes for the focus switch touch region.

Bug: 27358134
Change-Id: I34f39c53cacc0b9c00f87a792b88c3f64a5f61e1
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
56d75cf04df160438dc61fb3e1ca916ea9afc61a 10-Mar-2016 Wale Ogunwale <ogunwale@google.com> Fixed visibility of home stack behind translucent app activity.

A stack is not considered translucent if their top activity is over the
home stack (i.e the home stack should be visible behind the activity).
However, the home stack will not be made visible behind this stack since
the stack is not translucent.
We now make the stack transulcent if the top activity is over the home
stack and the home stack is directly behind this stack.

Also, cleaned up the isStackTranslucent code some to be more readable.

Bug: 27566650
Change-Id: I4d2fe842d26547ba743ca82a456499038a1eb389
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6348b712c2c644936394577ee687ab3628402c7f 09-Mar-2016 Jorim Jaggi <jjaggi@google.com> Merge "Animation for docking task gesture" into nyc-dev
899327f5cbbfb0eae5562b262ccea860c98f6bc4 26-Feb-2016 Jorim Jaggi <jjaggi@google.com> Animation for docking task gesture

- Don't move recents window around during the animation
- Set the correct task size shortly after docking, so recents
starts with the correct size to avoid jank.
- Add staggered animation in recents.

Bug: 27154882
Change-Id: I7c56102feba9c3f6cb86cb5f1d87f0ad3b29c721
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d78ddb409a8499c391322dd1e2b2a97446f9603d 03-Mar-2016 Chong Zhang <chz@google.com> Some fixes for black screen when pressing home button

Pressing home button sometimes involves a rotation (eg. when app is
running in landscape mode but launch is fixed portrait mode). This will
trigger a screen freeze, which clears the transition. We still need to
add the opening app to the opening list even if transition is unset,
otherwise it doesn't wait for app to draw first frame.

Also during rotation, app, launcher and wallpaper all get relaunched.
The transition can't start until the first frame on the new launcher
window comes back. We can't start it based on the draw state of the old
window, because the old window could get removed and readded shortly
after we start the transition, and it shows up as a black frame.

bug: 27391256
bug: 27295820
Change-Id: I346685076657eef209d0fab68f272e218b55e011
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
8051c5c89060906f5a3a1ca4adb3b53bb423e56b 04-Mar-2016 Wale Ogunwale <ogunwale@google.com> Don't make home stack visible if starting activity isn't translucent

We allow the home stack to be visible right behind the fullscreen
stack if all the activities fullscreen stack are translucent and
visible. However, if we are starting an acitvity it isn't visible
yet so our check for translucent activities in the fullscreen
stack will return true since there is nothing visible. This will
cause the home stack to the visible and the visiblilty of its app
token set to true in window manager and it been factored into the
transition animation.

In addition to checking if the activity is visible, we now also
check if it is the starting activity when trying to determine if
the stack is translucent.

Bug: 27448511
Change-Id: Icbbd57c0632cc5389c7ac894800a41f75d4bc450
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
8d5a542f66beae774354038f15dd1afe7fcf754b 04-Mar-2016 Wale Ogunwale <ogunwale@google.com> Clear app token mAppStopped when app resumes.

It is possible for an activity to be in the stopped state without
setting it's visiblility to false in window manager.
For example, the home acitivty behind the lock screen. Since the
lock screen isn't an activity it doesn't affect the visiblity set
of the home activity, so AM doesn't tell WM to hide the app token.
However, AM uses another channel to detect that the device is locked
and moves the activity into stopped state. WM on the other hand also
detects that the device is locked and hides the window surfaces of
all windows behind the lock screen. So, at this point AM has also
told WM that the activity is stopped. Once you unlock the screen
AM resumes the activity but doesn't report any visiblility changes to WM
since it's internal state didn't change. So, if you go from the home
activity to another app the home activity window will be destroyed
before the activity is stopped because mAppStopped is set to true.
We now set mAppStopped to false when the activity is resumed.

Bug: 27286867
Change-Id: Ic75456d30abd582fa44f932f5aeeb449950157ee
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
39bfee5e3674faea992c32204abc1c03429b8cda 24-Feb-2016 Todd Kennedy <toddke@google.com> Splits without restart

In specific cases [as determined by the installer], we can install
splits without restarting the application. The split must be purely
additive [i.e. it should not modify class(es)/resource(s) defined
in the base or other splits. Otherwise, the behaviour could be
inconsistent [e.g. if a modified class was already loaded, the
modified version won't be loaded until the process is restarted].
The platform does not perform any verification that the split is
purely additive.

Bug: 26463098
Change-Id: I3526c3b1b847a8e0afabc7a4787fa770422196b7
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
cd7043e99abd14fd586ab6bf37a40c55cd529f3e 28-Feb-2016 Wale Ogunwale <ogunwale@google.com> Add activity onStop lifecycle to event logs.

Also added reasons why onPause and onResume are called.

Bug: 27384433
Change-Id: If6c304f577b601511f6d9b948061d2cfa0dcb970
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f40c11b11fd73493d0acc39baf8efeee4db7316f 26-Feb-2016 Wale Ogunwale <ogunwale@google.com> Clear starting window request if remove is requested before it is added

It is possible the add starting window to be scheduled and a remove request
come in before it is actually added. In this case we want to prevent the
addition of the starting window by clearing the AppWindowToken.startingData.

Bug: 26659857
Change-Id: I3ef6ea81d555e81b62e894003aadcc51d281b1ad
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
9017ec0b150ee19ca1041b61c2560dff759686d7 25-Feb-2016 Wale Ogunwale <ogunwale@google.com> Remove starting window whenever the acitvity is stopped

The main app window will never finish drawing at this point so there
is nothing to trigger the removal of the starting window.

Also, set ActivityRecord.mStartingWindowShown to true for some cases
where we were telling WM to show starting window but not setting the
flag that would later be used for clean-up.

Bug: 26659857
Change-Id: I7a8582521853f1f95b77d8b08f4dd0cf778f8cbf
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
42625d1bc7ef99c4d4435e8cdebfe3eee57b8d97 12-Feb-2016 Jorim Jaggi <jjaggi@google.com> New behavior for docked stack when going home

- We keep the docked stack visible when home task is visible even
though it's not resizable.
- We introduce the a new concept called "minimizing" the docked stack,
which happens when going home. In this state, the docked stack is
clipped of almost completely.
- To achieve that, we introduce TaskStackBoundsAdjustController,
which adjusts the bounds of the docked stack when minimized. Also,
migrate the IME handling to this new class.
- We also need to inform SysUI that it is now minimized so it can
remove the drag affordance on the divider, and also make it a bit
smaller.
- When we detect an app transition, we check whether the home stack
gets visible/invisible. We then start an animation which runs in
sync with the normal app transition. For that we introduce
DockedStackDividerController.animate(), which performs the animation.

Bug: 27137961
Change-Id: I8623bc73cc6872bf28c5b1b8d5795974576811b2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
46b1ac6f8084e8bdb9e859b718ec949535c776ac 19-Feb-2016 Chong Zhang <chz@google.com> Schedule stop immediately when activity is invisible and done pausing

bug: 27174050
Change-Id: Ie0bf3b4e6954a72bfa7f5d1066406ac021284b8a
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
2be760d43c80249c984a1ea7eccef9a91b3aced6 17-Feb-2016 Wale Ogunwale <ogunwale@google.com> Clean-up starting window if resuming activity in another stack

We currently remove starting windows for initializing activities if we are
resuming another activity in the same stack. However, the starting window
can be orphaned if we are resuming an activity in a different stack and
start another activity in the stack with the starting window in the paused
state at the same time.
We now remove starting windowing for initializing activities that aren't
the top activity in the stack regardless of the stack we are resuming an
activity in.

Bug: 26659857
Change-Id: I6081d52d0c4c0d3556201346cfda7a38e4d02c8e
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
a1c8cfe0ac974b14829ea09d7dc66c186820d29f 17-Feb-2016 Chong Zhang <chz@google.com> Merge "Remove AM/WM traces" into nyc-dev
e05db74fd275ea25d10074825a43cc5c7683ae01 17-Feb-2016 Chong Zhang <chz@google.com> Remove AM/WM traces

Change-Id: I75f70ce18bf133527b33d42148c71c3fd1be9311
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
5658e4b94de91e938459e50d0f5e6ef837ffb4ac 12-Feb-2016 Wale Ogunwale <ogunwale@google.com> Don't resume activity on start if there are activities pausing.

The path to start an activity if it isn't running was unconditionally
resuming the starting activity which we don't do if there are activities
pausing. It now starts the activity in a paused state if other activities
are pausing. It is then resumed when pause completes.

Also, improved logging in BoundsAnimationController and removed some
disabled code that has been in the codebase for 6yrs...

Bug: 26982752
Change-Id: Ie042fc938331127f1270fca1b5905b067b9dae7c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
94b84028ba7d6131120bed2f38292cfd91868d3f 11-Feb-2016 Chong Zhang <chz@google.com> Merge "Mark activity as visible and not stopped after resume-relaunch." into nyc-dev
2b79af1e8a45776ba57cd38a50afe4a6c2f719aa 11-Feb-2016 Chong Zhang <chz@google.com> Mark activity as visible and not stopped after resume-relaunch.

After a resume-relaunch, the activity is assumed to be in resumed state,
and we'll not run the normal code for resume. But it needs to be marked
visible otherwise it will stuck in invisible state.

Also trade some AM traces for WM traces for further debugging.

bug: 27123118
Change-Id: I50ce5cde29f441115675db54523090ef86d95ea8
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d8026641204a908ea419ceed3ae43ee7859c6af0 10-Feb-2016 Wale Ogunwale <ogunwale@google.com> Don't stop paused activities that are visible.

Paused activities can be visible, but stopped activities are not
visible.

Change-Id: I305f77542d198ca897b33ad07ac3fc2a14a04397
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
74e26595e609c3b6ddafb705779296d67ac9735b 05-Feb-2016 Wale Ogunwale <ogunwale@google.com> Further improvement to determining visiblility of tasks in home stack.

673cbd2b6932b39d6804cda2969b7f059c1ce748 introduced logic to make
non-top activities in the home stack invisible under certain
conditions. However, this caused problems with the set-up wizard which
uses the home stack to launch all its activties. Changed the logic to
determine if the next task in the home stack should be visible behind
vs. the next activity in the same task. So, activities in the same task
in the home stack can be visible at the same time, but not activities
in different tasks.

Bug: 26922407
Bug: 26571156
Change-Id: Ied20d45cd27a1adcc105703d8ca21861d1856700
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e66edb10564fa2fd0fb5a9fef2d176870f345646 05-Feb-2016 Jorim Jaggi <jjaggi@google.com> Do not update Record.visible if not setting visibility

In resumeTopActivityInnerLocked we only update the visibility
if not already visible, to avoid a black flicker. However, in the
interaction when docking a task from recents, makeVisible was
called but the conditions weren't met to make it actually visible,
but Record.visible was still set, leading that we didn't call
WM.setAppVisibility in resumeTopActivityInnerLocked

Bug: 27041808
Change-Id: I400470a5b31881542fedd3edb6a97e524666a8a3
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e12aece4cad849efbbe6a806f132613a56699230 03-Feb-2016 Robert Carr <racarr@google.com> Ensure surfaces stay alive until activity stop.

Prior to this commit in this case of activity pause, with finishing=true
the activity manager will notify us of app visibility and we will begin
an exit animation. When this exit animation finishes, we will destroy
the application surface (unless its eligible for saving). However there
are two cases where this breaks down:

1. The exit animation finishes before the activity thread handles
the stop transition. Many activities stop rendering on Pause
but many do not and it is totally legal to do so. Sometimes this
results in non fatal dequeue buffer errors and sometimes results in
fatal errors with Pixel Buffers, etc...
2. We may resume the activity shortly after asking the window manager
to pause it. If the window wasn't eligible for animation, we will
immediately destroy it after being told of the visibility change
following PAUSE_FINISHING. It's possible for this to complete
before we process the resume. On the other hand the client
happilly processes the resume and transitions back from PAUSE
and then crashes once it attempts to use it's surface.

In this commit we have the activity manager notify the window manager
when an application has actually finished (or we have timed out
waiting). For windows which have not been explicitly removed by the
client, we defer destruction until we have received both this signal
and the animation has completed.

Bug: 26793431
Change-Id: Ib6ee8fbdd1f03450fbbfd62468a19e97774befab
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
1b025a6026fc988ad849303f0df7821354b84c86 04-Feb-2016 Jorim Jaggi <jjaggi@google.com> More multi-window fixes

- When exiting multi-window (taskOverride gets EMPTY), emulate
the same task configuration so we don't end up with unnecessary
relaunches.
- Fix flicker by not calling WM.setAppVisibility if the app is
already visible. setAppVisibility makes a dummy transition,
which sets the transformation's alpha to zero if we think that
the app is not visible, which is the case because the app is in
DRAW_PENDING state because we are waiting for it to exit the
dragResize mode, but it's really visible.

Change-Id: Ieb4f586ae86e1185b21a901c57883a1f19d58fee
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
961f4858f2a401366a6691c95b702a2baac67ea1 02-Feb-2016 Wale Ogunwale <ogunwale@google.com> Window resize reporting improvement when docked stack is created

There were a few issues with window resize reporting when a docked
stack is created that caused the client to get frames for fulscreen
even though the task was in split-screen mode.

- Ignore docked stack visibility when get bounds for other stack when
resizing due to docked stack.
- Immediately resize all other stacks in activity manager when the
docked stack is attached to the display.
- Defer surface layouts for the uncheck portion of moving a task to a
stack.
- Don't perform layout of all windows on a display when a stack is
attached to the display since it doesn't have any windows yet.

Bug: 26861802
Change-Id: I2c7f31153da48618e90607c98ec5b29492b6ef38
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
22e2526b64a124a641f79de504d201005174754b 01-Feb-2016 Wale Ogunwale <ogunwale@google.com> Improved timing of when system sends multi-window change event to app

We were previously sending multi-window/PiP mode changed events to
apps once the task config is changed in activity manager.
However, the actual changing of the multi-windowing or PiP mode
might not be fully complete when the app receives the event so they
might be wrong state information they query for like currnet config.
We now schedule the events to be send once the current transaction
cycle is done.

Bug: 26877409
Change-Id: I393b56035bb4197f99b3db3d27c0599835b5f86c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
cd872fb2663ff2e1b018ddbe9187f355c066f5cd 01-Feb-2016 Wale Ogunwale <ogunwale@google.com> Merge "Improved logic for determining visiblility of activities in the home stack"
3b93a4d351aeb154fba8a4b2fa66ca25a951993d 30-Jan-2016 Wale Ogunwale <ogunwale@google.com> Renamed Activity class multi-window APIs

As requested by API council.

Bug: 26507736
Change-Id: I2a87c5eb3c1b48d52703103c2a4f72c250a9a827
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
673cbd2b6932b39d6804cda2969b7f059c1ce748 31-Jan-2016 Wale Ogunwale <ogunwale@google.com> Improved logic for determining visiblility of activities in the home stack

- No other activity in the home stack should be visible behind the home
activity. Home activities is usually a translucent activity with the
wallpaper behind them. However, when they don't have the wallpaper
behind them, we want to show activities in the next application stack
behind them vs. another activity in the home stack like recents.

- We don't want any other activities in the home stack visible if the
recents activity is going to be returning to an application activity
type. We do this to preserve the visible order the user used to get
into the recents activity. The recents activity is normally
translucent and if it doesn't have the wallpaper behind it the next
activity in the home stack shouldn't be visible when the home stack
is brought to the front to display the recents activity from an app.

- Also fixed issue with not setting correct return type for tasks
when they don't have Intent.FLAG_ACTIVITY_TASK_ON_HOME flag set.

Bug: 26571156
Change-Id: I45ef795c6a19ab859e9f6204fb059e875ad798c5
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
21b6058fff4fb2448394b4b4ea3ae28e44c0f69d 27-Jan-2016 Wale Ogunwale <ogunwale@google.com> Added isDockable field to RunningTaskInfo

Allows the caller to know if the task can go in the docked stack.

Bug: 26774816
Change-Id: I96fdf9b4df0ac87d84492e1504baac3ca0767d37
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
513346d8f58e13999133872478a966ea4262701f 27-Jan-2016 Wale Ogunwale <ogunwale@google.com> Don't allow non-dockable activities/tasks in docked stack.

Prevent activities and tasks that are not resizeable and don't
support crop windows resize mode from going into the docked stack.

Bug: 26774816
Change-Id: I1fd23114685be15908e80e8bc5a0216d8bfd049e
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b1faf60b896afe235175354ffd90290ff93a54b4 27-Jan-2016 Wale Ogunwale <ogunwale@google.com> Use resizeMode integer instead of resizeable boolean.

Changes activity manager and window manager to use resizeMode
as defined by ActivityInfo#resizeMode instead of a boolean.

Bug: 26774816
Change-Id: I8cef46d9fba6bfdd21df7da63ed5d5330ad03d4b
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d26176f36039e33b575c044aa119c57e82744847 26-Jan-2016 Wale Ogunwale <ogunwale@google.com> Support different multi-window compatibility modes

- Change idea of activity resizablility from true or false to
unresizeable, cropped_windows, resizeable, and resizeable_and_pipable
- Default pre-N apps to cropped_windows mode and N or greater apps to
unresizeable or resizeable depending on the value of resizeableActivity
attribute.
- Mark legacy apps that specify fix orientation or immersive only mode
as unresizeable.
- Change to hide docked stack when unsupported app is the focus app.

Bug: 26774816
Change-Id: Ie473d36ca95f08e9332ab10fd2f0ec17ef50a02f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
20d7df3c3ff0000678a208b25fcf7ddf90c5abe4 12-Jan-2016 Adrian Roos <roosa@google.com> Crash dialog improvements, move crash code to AppErrors

Factors out the crash and ANR handling code into separate
class and allows clearing cache and restarting app from
crash dialog.

Bug: 22692162
Change-Id: I2a08a4255ea02ab3c7441d351bf278128fcf5a5d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
0af6fa7015cd9da08bf52c1efb13641d30fd6bd7 18-Jan-2016 Amith Yamasani <yamasani@google.com> Voice Interaction from within an Activity

This allows an app to show a voice search button
and invoke a voice interaction session for use
within the activity. Once the activity exits, the
session is stopped.

Test application has a new activity that
demonstrates it with the test voice interaction
service.

This initial version is functional enough for
an integration test, with some more tests
and improvements to come later.

Bug: 22791070
Change-Id: Ib1e5bc8cae1fde40570c999b9cf4bb29efe4916d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
834c236c409f36fc39841af9df233b4c5ebe6ce3 24-Jan-2016 Wale Ogunwale <ogunwale@google.com> Removed some left over log spam.

Change-Id: Iaac41b7202b7634185bf522dfab36832c4830bba
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
a95ca8de4d8b971d41abe44cd54e82560d1e0b37 16-Jan-2016 Jorim Jaggi <jjaggi@google.com> Fix unneccesary activity relaunches

When going from fullscreen to non-fullscreen configuration, task config
changes was always non-zero because in fullscreen, task override config
was empty. Instead, use the actual previous configuration to calculate
diff.

Also make recents handle screenLayout changes.

Bug: 26593320
Change-Id: I57633d60b1e0fc4ae506e276410191a44e1fe221
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
5ded99777adb734a62f7c367b29f589e72955e48 20-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Revert "Temporary logging to debug ActivityStarter crash."

Bug: 26541093

This reverts commit 7fca6d50a57cbc1a45beca1d5d1e5cd1e696fbef.

Change-Id: I41fb70e79f2da6523c40f09a74d1980cbeb2149e
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7fca6d50a57cbc1a45beca1d5d1e5cd1e696fbef 17-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Temporary logging to debug ActivityStarter crash.

Bug: 26541093
Change-Id: Ia2887c1735ea6a5a964c01b63019288b96ef6172
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
3ee3b9d17b2aec84e791f3efa6b9453cab0d9c9b 16-Jan-2016 Suprabh Shukla <suprabh@google.com> Merge "Keeping only running users recents in memory"
09a88f5f3e7d4a3bbfce04ac06594ac590c67d27 02-Dec-2015 Suprabh Shukla <suprabh@google.com> Keeping only running users recents in memory

Currently, all the users' recent tasks are loaded into memory and kept
in sync with the persistent storage. This changes the system so
that it loads a users recents into memory lazily (i.e. when
getRecentTasks is called for that user) and unloads them from the
memory as soon as the user is stopped. This also required bucketizing
the taskIds per user, so that the next available taskId can be assigned
without having knowledge of all the tasks that are stored away in
persistent storage but are not available in memory.
Bug-Id: b/24569398

Change-Id: Ia5cb64d9f4ee727225dce34e45ca63e946ac27a8
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
0e381e278a2c2a3a7c86c9951ac5cbcdc3a186f4 15-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Fix visible-behind not visible for translucent activity in fullscreen stack.

Bug: 26471802
Change-Id: Ide9945c4478805902ca0df92dc2043359a751600
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
fdbdb9f9c6cd2f2cd1a494fb9b295dcaf4fd101c 14-Jan-2016 Jorim Jaggi <jjaggi@google.com> Merge changes I55d96ec3,I0ebc4639

* changes:
Reenable task preloading in recents
When creating docked stack, use SnapAlgorithm
a0fdeec66caa4d70786c7f6f31f79a24eef9da10 07-Jan-2016 Jorim Jaggi <jjaggi@google.com> Reenable task preloading in recents

Make sure to call the task stack changed listener only when
app visibilities changed. This fixes the problem of too many
callbacks when just focusing another activity.

Bug: 26420341
Change-Id: I55d96ec367f7461be1f3e35bc0d12ae4b050ece0
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
4e7fe7142e526c6648aa51e661ab3a470a1c2c03 13-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Fix delivery of visible behind cancel action.

Bug: 26471802

Change-Id: I4e35f904080d1c57bbb034725d34d8c5bca87238
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
3e979d6229a0ad2d9c3c7b05a97d01b5cde03337 13-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Merge "Only request stack resize after non full screen bounds were set."
dce2d161701f318ec71f8fe8de03031e1c4b0046 13-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Only request stack resize after non full screen bounds were set.

Also make sure that the bounds passed to stacks and tasks are not bogus,
as these would mess up the configuration.

Bug: 26512887
Change-Id: I1a3a9c867a2c258a326b31df2bac614ccbb00579
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f81c1d164ab5999ec554c9cb2659e1b2ed93a8d5 12-Jan-2016 Wale Ogunwale <ogunwale@google.com> Fixed some activity visiblility issues in picture-in-picutre mode

- Previously when don't re-launch an activity due to configuration
change if the activity is currently pausing. And, once the pause is
complete we destroy the activity. This logic is based on the assumption
that all activities are fullscreen and pausing is the same as stopping
which means the activity is no longer visible and can be destoried.
This assumption is not true in multi-window mode where you can have
visible activities in the paused state.
We now relaunch the activity once it is done pausing.

- Previously we set the return type of the top task in a stack to home
if the previously focused stack is home while add the task to the stack.
This logic is based on the assumption that the focus stack is the front
stack which isn't true for pinned stack. This causes an activity behind
the top translucent activity in the pinned stack to be marked as invisible
and stopped since the top task is over the home task so we should be
showing the home task behind it and not other tasks in the stack.
We now set the return to task type to application type for task added to
the pinned stack.

Bug: 26273032
Change-Id: I0ffac81f46c57e2d0d900db3417381f059aee7ea
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
303210bbdd2740a9b94ba9a9c10188acd950068f 09-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Start recents when bringing docked task to the front.

We don't want the docked activity to be on top by itself, so we need to
force the recents to come up to.

Bug: 25838525
Change-Id: Icb8184db5cc67e536561674b887bf481595257cc
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
3c2db1d174f4ac7462f8b95430bde1d867b47797 07-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Set screenLayout in task configuration override.

This prevented loading of correct resources when activities are in multi
window mode and the resource had a qualifier that used screen layout.
Specifically, it was causing problem with having the correct minimum
dialog size.

Bug: 26251921
Change-Id: Ia4c16685bd4ef51fcf8283f4fa29602fc93fa10f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
fe89d122e5b6b129b25d5d5316f690bd4ab93fbb 22-Dec-2015 Jorim Jaggi <jjaggi@google.com> Add infrastructure to track activitiy relaunches

As a preparation to start synchronizing task size
with activity relaunches, we need a infrastructure
so we know in AM/WM when an activity is relaunching
and when it's done relaunching.

Bug: 26311778
Bug: 25015474
Change-Id: Ied3795eddbcd112f6329494afbf13178ca49a799
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6cae765b67d3a3b37e2cacbc9816665b5bc080b9 26-Dec-2015 Wale Ogunwale <ogunwale@google.com> Added support for android.R.attr#alwaysFocusable

Allows an activity to always be focusable regardless of if it is in a
stack whose activities are normally not focusable. For example, activities
in pinned stack aren't focusable. This flag allows them to be focusable.

Also, changed ActivityInfo.#{resizeable, supportsPip} to use flags.

Bug: 26273032
Bug: 26034613
Change-Id: I8c63e6d3256757e2e6931e08b8a65269f5169d35
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
4cea0f5bfc7d34299f5f645d37f94b14ac3dc22a 25-Dec-2015 Wale Ogunwale <ogunwale@google.com> Don't allow unfocusable activity/stack to gain focus

Prevents them from being resumed since we always want to resumed
activity to be a focusable acitvity.

Bug: 26273032
Change-Id: Ied832e100d9a2d8915762db53c9230774be21d1c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d046a013921c2ac67318c1543a8b7b9c83b40d65 24-Dec-2015 Wale Ogunwale <ogunwale@google.com> Consolidate resume activity code around focused stack.

Cleaned up the code to make it obvious that only the top
activity in the focused stack should be in the resumes state.

Bug: 26273032
Change-Id: I8d60270f707fe022007c59d25f5678b33a005acf
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
07a0e4980b43d7f3ef8cf7a62592baca0d78a853 17-Dec-2015 Filip Gruszczynski <gruszczy@google.com> Collect activity starting logic into ActivityStarter class.

Change-Id: If1c074d6c278647ec55f2313483945f24aca8b3b
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
0583d3d18812d31d50228a6f29cb15b3219c9e94 18-Dec-2015 Winson Chung <winsonc@google.com> Hiding pinned stack tasks from overview

Bug: 25381158
Change-Id: Iad442b7f5dc49109529cb5dab2168b19837af6e3
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
ad1f8e69e8214a07d1d4532e4302e1202ae2fb29 18-Dec-2015 Wale Ogunwale <ogunwale@google.com> Merge "Fixed some issues with tasks with the same affinity in different stacks"
393819709787326a38cde883493ebf04fe62bd8b 18-Dec-2015 Wale Ogunwale <ogunwale@google.com> Fixed some issues with tasks with the same affinity in different stacks

- It is possible for tasks in different stacks to have the same root
affinity. This can be an issue when we are looking for the best task to
launch an acitivty into since there can be a better match in a different
stack based on class name. We now save the task matched by root afinity
and try to find a better match by class name. If we don't find a better
match we use the match based on root affinity.
- For pinned stack we don't allow root affinity matching as no other
task should be launching in the stack based on affinity.
- Correct ASS#moveActivityToStackLocked to use the passed in stack id
instead of the PINNED_STACK_ID.

Bug: 26015860
Change-Id: I6ec44bc97bf3c669c2305a58563518cf9bfc7804
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
1f544beb7a5bfa7ae34aa86ecf939254ad18d47a 17-Dec-2015 Wale Ogunwale <ogunwale@google.com> Use accessor methods to get/set visibleBehindActivity

The accessor methods have protection against the stack been
in a detached state. Reading the field directly can lead to
an NPE when the stack is detached.

Bug: 26209403
Change-Id: I66fc1871ea96504cf1bcbc72cae9b564d6527bce
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
4f7b035e34c64d25d4aa9ebc567547f2c2758869 15-Dec-2015 Todd Kennedy <toddke@google.com> Merge "Fix ephemeral post-install launching"
7440f177c3e70da0b883f8abffd6c8fc1d507bb8 09-Dec-2015 Todd Kennedy <toddke@google.com> Fix ephemeral post-install launching

Provide the ephemeral installer with some additional pieces of information:
1) instead of de-referencing the URL a second time, give the installer the
exact package name
2) instead of relying on ephemeral apps to define verified links, give the
installer a pending intent to launch when the ephemeral is installed
3) give the installer a pending intent to launch if the installer fails,
for whatever reason, to install the ephemeral app

Bug: 25119046
Change-Id: I45f50481caee09d5d09451e4b2492e64b0faae82
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
ead5c0fc20e5c60a68cd017af0b8eacaf1167a1c 14-Dec-2015 Winson Chung <winsonc@google.com> Enabling history and paging by default

- Removing associated tuner flags

Change-Id: Ia69bf273489b0079c389e7feb1428071569092d5
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
77d9448e2d6dd8a45c5fedef43c8a1cf4afd28b9 11-Dec-2015 Filip Gruszczynski <gruszczy@google.com> Log window mode to tron.

Bug: 26013430
Change-Id: I45d397d956a66f407218047dc10581553f906077
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
285ccef69722e7c4a08b0fce4c568eb9b0c230ec 11-Dec-2015 Wale Ogunwale <ogunwale@google.com> Move focus to visible behind activity when we move the home task back

Bug: 26118045
Change-Id: I106c698260b8215723ea1e50c654061464a1305f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
cff4aa354e8056de53935230463417bba1c42c27 11-Dec-2015 Wale Ogunwale <ogunwale@google.com> Make fullscreen stack visible if it has visible behind activity

Bug: 26118045
Change-Id: I76cfe0f0c08eb6b830a48143bc19479e71f78538
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
3d82ed6be671da98aaf3016d99f57aba56daa97c 10-Dec-2015 Filip Gruszczynski <gruszczy@google.com> Fix activity not launching from recents after it was dismissed.

When activity was launched from recents and started at the same time, we
would first try resuming activities and then focus on the started
activity. That is wrong odering, as the previously focused activity will
be resumed (in this case recents). We need to first focus on the start
activity and then request resuming.

The CL also flag protects some logging that is being very frequently
printed from activity manager.

Bug: 25823213
Change-Id: I5311fb2bf316ce3d298b30fa90fb257978bacdca
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c2f262bc1ad78783ac40e149ea1373526fc2aefe 08-Dec-2015 Jorim Jaggi <jjaggi@google.com> Only take screenshot when hiding activities

So we don't take screenshots when just switching focus between
activities or when docking activities.

Bug: 26070919
Bug: 25845255
Change-Id: Ie924c5f72f4168806b949ad10df7ef139cd280cc
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
ef2f72bb0e6fa6d286e571aea42751a9266151fa 04-Dec-2015 Filip Gruszczynski <gruszczy@google.com> Refactoring: merge two snippets of adding activity to stopped.

Change-Id: I70777333ca9ff6c4f0736e036bd0946add4b041f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
5f986095bed776c119d2f5452e0afeac3a437ea2 05-Dec-2015 Wale Ogunwale <ogunwale@google.com> APIs for activity to know when its windowing/pip modes change

Added APIs that allow activities to ask the system if they are currently
in multi-window or picture-in-picture mode and also get notified when
their modes change.

Bug: 25509834
Bug: 25683717
Change-Id: I4b8c316a49940bd6a8b31a93b345f9fd725a4721
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
3696301ada2d42c67ef98ef7229b774e1418f93e 07-Dec-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Update client configuration when resizing without crossing size threshold."
a99fce54d0db51d6141e810d7c9afc058091ea6d 07-Dec-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Don't lose stopping state when getting paused confirmation."
dba623ae5648923e06157d53fcc0ab8a09a79870 05-Dec-2015 Filip Gruszczynski <gruszczy@google.com> Don't lose stopping state when getting paused confirmation.

In some cases we request pause and soon after request stop of an
activity. An example of this is maximizing an activity in side by side
mode when recents are visible. First, we add recents to a list of
activities to be stopped (because it becomes invisible), then we request
a pause (because we resume full screen activity and pause all other
stacks) and finally request a stop (from the list to which we added the
request).

The activity now will be put into pausing state (requesting pause), then
stopping (requesting stop), then paused (confirmation comes from the
activity) and stopped (another confirmation comes from activity). If we
switch from stopping to paused, the stop confirmation will become
confused.

Bug: 25729693

Change-Id: I935acd71a28f3d0882f608bdd4d7216cd08ba2eb
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
ca66481244913c4a17b62c3ddff214d2ca72c439 04-Dec-2015 Filip Gruszczynski <gruszczy@google.com> Update client configuration when resizing without crossing size threshold.

Even though the activity won't be relaunched and won't receive a
callback about the resize, we still need to update it's configuration.
Otherwise when the application queries for it, it will receive wrong
data.

Bug: 23904868
Change-Id: I601e91b8e71691c1cb5edb2734894441c4fde8e2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
75b3720c50752d988d361a57b2d32f8baaee3e28 04-Dec-2015 Chong Zhang <chz@google.com> Fix app over lockscreen being cropped by docked stack

When secure apps are launched over lockscreen, the bounds should always
be fullscreen. Also docked stack and divider shouldn't be visible while
lockscreen is shown.

bug: 25837786
Change-Id: I0bc681cdb46404fb79e9332d1f82fee51f338da9
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
8294f82562afee6be176c986ff24156aacd32080 04-Dec-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Put PIP windows above transition animations."
114d5ca711775a632b1d2d4ec6c00eddff1bc776 04-Dec-2015 Filip Gruszczynski <gruszczy@google.com> Put PIP windows above transition animations.

PIP activities are already on top of everything else, but during
animation we increase the layer of the animated window for the duration
of the animation and it may cover the PIP. By forcing the same
adjustment on PIP windows we will keep them above animating windows.

Bug: 26015827
Change-Id: I8f7a87f41fed24b3e520fb599a94cf24cc2eeb50
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
21199bd9a7f2d4a23a0272698b2671e9f8503141 02-Dec-2015 Filip Gruszczynski <gruszczy@google.com> Run activity visibility adjustment even if there is no top running.

Ensuring visibility is triggered in unpredictable fashion, e.g. it can
be triggered by attachment of application. It can happen between an
activity stopping due to change of user, but before that operation is
finished and as a result the stopped activity will get marked as
visible even if we mark it as invisible in stop. Instead of trying the
activity as invisbile during stopping, we adjust the visibility ensuring
method to go through stack contents even if there is no top running
activity (because the top running activity is run by a different user)
and force the correct visibility.

Bug: 25958227

Change-Id: I4662667e8151fa25d947bacf33ba915389dd32e8
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
2998eef694f6e3bb348df98a6127890e71427381 03-Dec-2015 Wale Ogunwale <ogunwale@google.com> Set proper stack in WM when activity is moved to stack in AM

When an activity is moved to a stack using the
ActivityStack#moveActivityToStack API a new task is created to
hold the activity in the stack. However, when the new task is
created in the window manager side it uses the stack id of the
previous stack the activity was in. We now pass the stack to use
from activity manager to window manager.

Bug: 25987309
Bug: 25961636
Change-Id: Iecc71f6d9b3e70a8d88e134b42f7532ba5327bad
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d045c829a470b7c95daaa4786f7164ee8130546c 02-Dec-2015 Wale Ogunwale <ogunwale@google.com> Prevent windows in pinned stack from gaining window focus.

Windows in the pinned stack shouldn't receive input keys, so we prevent
they from gaining window focus so the focus/input keys goes to the stack
below the pinned stack.

Also, cleaned up some code.

Bug: 25580816
Change-Id: Iea1f944d167310233c3dbaea140a4ada568bb815
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
387aac6ad7bde21f2c2510cb8a2f3af3959721e0 25-Nov-2015 Winson <winsonc@google.com> Fixing task view heights in paging tasks

- Now, all task views will be bounded by the stack rect, and the
thumbnail bitmaps will be scaled accordingly to fit either by width
(when stacked) or to the view rect (when freeform)
- Fixing issue where the history button was not offset in freeform
- Tweaking thumbnail sizes of fullscreen screenshots
- Still requires changes to fix clipping to the correct aspect ratio in
freeform.

Change-Id: I678b87c2f06947d32f3bb7c60a35f28eb36b5a68
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b15758ab7a6481717d0d29612e870d7241061c31 17-Nov-2015 Chong Zhang <chz@google.com> Support scrolling for non-resizeable tasks in side-by-side mode

Display toast when a non-resizeable task is put into side-by-side mode.

Scroll the task upon a two-finger scroll gesture.

bug: 25433902

Change-Id: I69967056a564cfe7773afb80aa7e7ea7167a791a
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
8b1871d74137d7e36ba0fed5608772f51f62015b 20-Nov-2015 Winson <winsonc@google.com> Adding tuner params for paging and full screen thumbnails.

- Adding “focused” stack state to support paging
- Changing the paging to match UX spec (only auto-page after the first
tap)
- Removing old header focus animation

Change-Id: Id72825b8a1b1c0a2238ee184a6695b13c1d8cb1c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
9104aeab59af670b83cb0058ebb9478d09b414af 14-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Split ActivityStack.ensureActivitiesVisibleLocked.

Change-Id: I027b52f76c868bf7b0a04efcca965e812bf3d35c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c90d2b6b3d4381c119ef35e853f1204e7ebc8870 13-Nov-2015 Chong Zhang <chz@google.com> Merge "Consider stack invisible if it got no running apps."
b16cf34d79707f717564afb6bd4edcc3d8b118ad 13-Nov-2015 Chong Zhang <chz@google.com> Consider stack invisible if it got no running apps.

When we close an freeform app by X button while an app is docked on
the other side, ActivityStack.ensureActivitiesVisibleLocked() failed
to make home stack visible, because it's under the freeform stack
which only contains one finishing activity.

We usually will not do another round of ensureActivitiesVisibleLocked
when the activity is destroyed. Need to make sure visibility is adjusted
to the stack below when we start finishing the last app in a stack.

bug: 25668050
Change-Id: Id2a23cb9480221a4e55ba3be9eab51f6efd8a700
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
66ed4c638323054c883d956b8bc6197ccc2be459 12-Nov-2015 Chong Zhang <chz@google.com> Fix lost window warning

Mark activity window as invisible with window manager when it's
destroyed normally, to differentiate with the case where the app
crashed while visible.

bug: 25671369

Change-Id: I26d8df6b7e08fc5b65cd2c7aa432a3c5c8c5c7b3
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7790fda948e0d878bfda72a18d132eabea0a49cf 11-Nov-2015 Wale Ogunwale <ogunwale@google.com> Merge "Set right bounds/configuration for task when positioned in stack."
935e50292e1404dc5f1705b2a1719cdaee3072b0 10-Nov-2015 Wale Ogunwale <ogunwale@google.com> Set right bounds/configuration for task when positioned in stack.

When AMS.positionTaskInStack API is called we need to make sure
the task has the right bounds and configuration if it is moving
to a different stack.

Bug: 25501082
Change-Id: I2a80aa08a4ee52d860502ab16b6cdb432c954084
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
974f55fa13358cd3f4ffebaf4d9fddbb4c9a3431 10-Nov-2015 Winson Chung <winsonc@google.com> Merge "Saving additional context when taking task screenshots."
c809cbb92692cf5140fd5a452fc24214a098d937 02-Nov-2015 Winson <winsonc@google.com> Saving additional context when taking task screenshots.

- Save the original task size and screen orientation. This ensures that
we will be able to display the screenshots in the right orientation if
we start taking non-square thumbnails.

Change-Id: I17ffe1fc05a447f67753149695a4eaf0baa36e8e
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b317b22ad99c0dc5f253ed2707610d91fcec2908 09-Nov-2015 Wale Ogunwale <ogunwale@google.com> Clear task bounds data when removing non-bounds persistable task.

Bug: 25584169
Change-Id: Ie68fa12bf182e988077e6410197f7f497f839ba2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
280d332bd4dbf13bb05102f86c70b7ee299e0704 04-Nov-2015 Chong Zhang <chz@google.com> Construct ActivityOptions near top level

This saves some duplicate constructions of the ActivityOptions
object from Bundle.

Bug: 23755120
Change-Id: Ie8be54a2e4e84a6a1f3c51e4f2966f7fb0bf1c28
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
112eb8c1f76fff6a670d7c5f85e8c3d656cd3aa8 02-Nov-2015 Chong Zhang <chz@google.com> Save window when an app died while it's visible

- If an app died visible, keep the dead window and leave it on screen.

- Apply 50% dim over the dead window to indicate it's no longer active.

- Monitor touch inputs on the dead window and restart the app on tap.

bug: 24913379
Change-Id: I911da4e6135f2bffaf3b1bbe6f911ff689a278ff
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
92fe44e966b9622c24a6810aaf9c2d8e2b1f9d92 03-Nov-2015 Fyodor Kupolov <fkupolov@google.com> Merge "UserController refactoring"
f63b89c0a10b4e3220b0a4aa1703be3aed0c5a98 28-Oct-2015 Fyodor Kupolov <fkupolov@google.com> UserController refactoring

Addressed comments from the previous cl. Added getters for UserController
fields, direct access is no longer allowed. Moved the following methods:
- getUserManagerLocked. Became getUserManager() - because locking is not
necessary, double checked locking will suffice.
- startUserInForeground /showUserSwitchDialog/sendUserSwitchBroadcastsLocked
- handleIncomingUser/unsafeConvertIncomingUserLocked/isUserRunningLocked/
getUsers/getProfileIds

Bug: 24745840
Change-Id: Id5a5cfb9604e08add29bd9a03c8fe5200bc51fef
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
02a5a6bb9ba05bdf7517de90ede49fb535ea06ca 02-Nov-2015 Wale Ogunwale <ogunwale@google.com> Merge "Added StackId object for checking what features a stack supports"
3797c22ea16e932329ebffdc7e7ce09f9ecd9545 27-Oct-2015 Wale Ogunwale <ogunwale@google.com> Added StackId object for checking what features a stack supports

Helps make the code easier to follow since we are no longer checking
multiple stack ids at various decision points.

Bug: 25282299
Change-Id: Ifa6864a1ef56ce2eca4c94f87a4e0b993de987cd
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
20aa0aed8c9d5f5fc25f239c151529de86603509 30-Oct-2015 Filip Gruszczynski <gruszczy@google.com> More granular reporting of size configurations.

There are two improvements in reporting size configurations:
1) duplicates are removed;
2) smallest width is reported separately;

Change-Id: I8f8235c99e6eefcae178e8d61e79ad0c4d6f1144
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
a445a68fa4c89ad6645566d9bc0544f21617abc7 29-Oct-2015 Wale Ogunwale <ogunwale@google.com> Merge "Support for pinned stack to always be on-top of visible stacks"
1e60e0c61a3ec4b53aeae7fbe9c6da4d047a5d02 28-Oct-2015 Wale Ogunwale <ogunwale@google.com> Support for pinned stack to always be on-top of visible stacks

Bug: 25006507
Change-Id: I577e11224eead72dbb50def6be30b640707d2187
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d64ef3ef33c50a03b4be3b2baaa93aab7319fca8 28-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Freeform to recents app transition.

Bug: 24913782

Change-Id: I54fcbe38c51e5d75fa5ad2cb38de89d371b47bed
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
0f6cb2d7d14b980e2d820a40d3c4849a808d0da5 27-Oct-2015 Winson Chung <winsonc@google.com> Merge "Passing stack id with RunningTaskInfo."
5510f6c1b9c20483e1507147eed7b24ac8bb6363 27-Oct-2015 Winson <winsonc@google.com> Passing stack id with RunningTaskInfo.

- This allows us to remove an extraneous system call when starting
overview, and also allows us to easily check for freeform windows.

Change-Id: I4449dad7bf870f528f671f6e7cb1f9b5f1bc9c1c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
079a0044a366b5a6ab8026aca452676a6e1e7215 24-Oct-2015 Wale Ogunwale <ogunwale@google.com> API for moving top activity in a stack to pinned stack.

* AMS.moveTopStackActivityToPinnedStack can be used to move the top
activity in a stack to the pinned stack and also specify the bounds
the pinned stack should be sized to.
* 'am stack move-top-activity-to-pinned-stack' command for testing
AMS.moveTopStackActivityToPinnedStack API

Bug: 25006507
Change-Id: I8392b4c39d8542153e691be7a627b7f35fd44884
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
99db1863a84364339fc5dc9142f15910cdd96ed8 24-Oct-2015 Wale Ogunwale <ogunwale@google.com> Added support for pinned stack.

Used to support picture-in-picture use case for multi-window

Bug: 25006507
Change-Id: I3bef3f75e0c003f5974274294f1250171d424625
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
610acda80a02317080ebaed79b0c1ce26835b8f9 20-Oct-2015 Fyodor Kupolov <fkupolov@google.com> Introduced UserController for multi-user functionality

The new helper class encapsulates user life-cycle management, provided by
ActivityManagerService.

Bug: 24745840
Change-Id: I8ebfa38febc4090390d1c45a9fc47398e52693ae
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
fdcc4d4235c829a41b4d23043431bb8fa915a440 15-Oct-2015 Chong Zhang <chz@google.com> Assign different oom score to visible apps based on layer ordering.

Pass oom score in kernel's full range [-1000,1000] to lmkd directly

bug: 21411311

Change-Id: I0cab2aa46269a716ea613025d3b84fe7d04404bb
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b3ad483f45b11a574a124f38c9febd13559e45f5 21-Oct-2015 Wale Ogunwale <ogunwale@google.com> Merge "Ensure state transition of paused activity." am: c2b9c5388a am: 11695e8081
am: 8d16a3ddea

* commit '8d16a3ddeac89c426c0965d792df63750a35460e':
Ensure state transition of paused activity.
9caeef72ee19caab9193eb76fc82ff99f7c9534e 20-Oct-2015 riddle_hsu <riddle_hsu@htc.com> Ensure state transition of paused activity.

If there are 2 activties launched during screen off.
Both of them will be scheduled to pause immediately.
But if the first one does not complete pause in time,
and the second one is a non-fullscreen activity, the
first one will still be visible and no need to stop.

After the second one complete pause, mPausingActivity
is cleared, then the first one's complete pause is failed
and keep state at pausing. If it calls finish, it cannot
be destroyed because its state is pausing so expect it will
be paused later, but actually is has complete paused.

Sample and video:
https://code.google.com/p/android/issues/detail?id=190955

Solution:
A failed-to-pause activity should still change state to paused
if it is pausing. Then when the first activity calls finish,
it will satisfy the condition in ActivityStack.finishActivityLocked
"r.state != ActivityState.PAUSING" to continue the finish flow.

Change-Id: I2f211ddf5039b332b0c7d01ccd043aa18fe168f7
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
64776ef01f6ba73348d4412f19e6725e6a55558a 17-Oct-2015 Wale Ogunwale <ogunwale@google.com> Merge "Revert "Dont update thumbnails of freeform windows on focus change""
d2f1d94fe5acc5d23f03bb3b653061184fd67eb5 15-Oct-2015 Filip Gruszczynski <gruszczy@google.com> API for minimal width/height of an activity.

Bug: 21409825

Change-Id: Id6286064713672366dd4dc1f80258450a8039c36
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
979f5ed923db91b08279bb25799c3d54d743d1a7 12-Oct-2015 Wale Ogunwale <ogunwale@google.com> Revert "Dont update thumbnails of freeform windows on focus change"

This reverts commit 17690ffcf7ed47b2719c65bb148190ddcdf4232c.

Can not reproduce the problem reported in the original bug that
required the reverted CL.

Bug: 23591449
Bug: 23562904
Change-Id: I8262cef52036816e9b3f422f6b75b1959a4da7cd
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
3e85ba293f00874d86998d650b54e580c454f3ae 06-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Refactoring: Remove unused parameter from topRunningActivityLocked.

Change-Id: I350e9459af13858e4ed95fe6511383266f509cb8
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
a8be5e50c6dc316ffba5746f5d9b35ac01ee21aa 06-Oct-2015 Chong Zhang <chz@google.com> Do not bring home stack to front when removing non-focused stack

Also, launch task in freeform stack if it's resizeable.

bug: 24671570
Change-Id: Icc4f342b954e5f80dde3609fb65412686f4f0f95
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
85ee65483d877e66c4446fce31520f293f0d67c9 02-Oct-2015 Chong Zhang <chz@google.com> Put ResovlerActivity and noDisplay activities in the source task

Launch the ResolverActivity in the source task, so that the chooser
stays in the bounds of the task, instead of always at the bottom of
the screen.

Also put the nodisplay activities in the source task, it could launch
other activities (eg. ResolverActivity), we need the original task.

Bug: 24136124
Change-Id: I8b22d7f6cba4dc9e57cb19d357091013a74826bb
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f77a6dbac6d8da23dea08449e930b29b62311ddb 27-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Refactoring: Delete AppWindowToken.willBeHidden field."
8aafd3a81ba4ffe04bc36990d18df9f2b8623743 27-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Refactoring: Delete AppWindowToken.willBeHidden field.

The only time AppWindowToken.willBeHidden is used is for determining
if the app should contribute to calculating orientation. In the same
check AppWindowToken.hiddenRequested will be or-ed with willBeHiden,
so it's enough that hiddenRequested to be set.

The only place where willBeHidden is set, is right before
WMS.setAppVisibility is called, which will set hiddenRequested.
Because of this willBeHidden is unnecessary.

Change-Id: Iea35f39f72e7f0dcd76205ef580f3a74cac72d08
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
83301a933ff28eed978b16b54bc569fbe76ef499 25-Sep-2015 Wale Ogunwale <ogunwale@google.com> Added am command to suppress config. changes during task resize.

This command is useful for testing during development, but at some
point we will decide if allowing configuration changes during resizing
is okay or merge in http://ag/759766 to suppress configuration changes
during resizing and deliver the new config. to the app.

This functionality will be reverted once we decide.

Bug: 24380097
Change-Id: I223c08bc939e564a78e70994b599770be9d4730d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6e3cc291ea698d63f9eced987c0697b1745c6da8 24-Sep-2015 Wale Ogunwale <ogunwale@google.com> Merge "Make home stack move like another stack."
925d0d1369f118d9eb4a05a7d088eda19b733436 24-Sep-2015 Wale Ogunwale <ogunwale@google.com> Make home stack move like another stack.

Previously the home stack was either positioned at the top or bottom
of the stack list. This type of movement was okay when there was mainly
2 stacks (home and app), but doesn't work in all cases where we have
multiple stacks.
For example:
1. Launch any activity in the freeform stack
2. Press the home button
3. Launch a translucent or dialog activity
In this case you would except the home stack to be seen behind the
translucent activity since that is the stack the user is coming from,
but you see the freeform stack instead since the home stack was moved
to the bottom of all stacks when the translucent activity was launched.
We no longer move the home stack to the bottom when a new
activity/task/stack comes to the front.

Bug: 23626353
Change-Id: Ic506acc8528e63b8e7f999dd88a450bee6fb4552
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
48c5312316f63ce941ddb9ade1b41c2fb2275958 24-Sep-2015 Wale Ogunwale <ogunwale@google.com> Merge "Allow stacks behind a translucent fullscreen stack to be visible"
bd26d2a5a834454c44d2723e1ceff5874cae4cb4 23-Sep-2015 Wale Ogunwale <ogunwale@google.com> Allow stacks behind a translucent fullscreen stack to be visible

Stacks behind the fullscreen stack with a translucent activity
are always visible so they can act as a backdrop to the translucent
activity.

Bug: 23626353
Change-Id: I3d76ae6bedbba90736706474dcab53d75b60304a
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f387b2839926890f75eff7872c609f4040ffc1f6 23-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Preserve windows during stack resize."
a6e902ec61ab1cd8f7d5df84deab6f26471c22fd 22-Sep-2015 Wale Ogunwale <ogunwale@google.com> Properly size tasks based on stack size.

There were a few places we weren’t doing this correctly

* When a new task is created the bounds should be the stack bounds
if the task is resizeable and not in freeform mode.
* When resizing a stack each task in the stack should be resized
base on if it is resizable vs. using the top running activity in
the stack to determine if all the tasks should be resized.

Change-Id: If3448c5629313e7e7fb91ffe8506014f16ad72db
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
bc5a6c5f0c090852ae2c52328a82c69d680bad3f 22-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Preserve windows during stack resize.

It also adds debugging information for configuration changes, so it's
easier to observe what exactly changes.

Change-Id: Ia2cd4df9a868a8cea216ce137d67a1bb8ed2e6c7
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
61b009e0591df4fcaf5c57c6ce598044263d952f 17-Sep-2015 Wale Ogunwale <ogunwale@google.com> Don't crop home activity windows to stack bounds.

We crop windows to their stack bounds when the docked stack
exists. We don't want to do this for the home activity since
the docked stack isn't visible when the home activity is visible.

Change-Id: Ibb3157dabbb6c979358ddc2098a01c6ddf6540e8
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
1e3523c71b6bbdd90dfd9f8c54943ccba055ed2c 16-Sep-2015 Wale Ogunwale <ogunwale@google.com> Fixed issue with docked stack not showing when recents is up.

Also, re-wroked stack visibility code to be clearer.

Bug: 24093127
Change-Id: I338f50f0953518675818dfb60231c2c3070e695d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
a59ac9cd645d25f03e4e488100bd99f92e83a3a7 11-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Preserve window during resize triggered relaunches.

This changes application code behavior when the activity relaunches due
to configuration change. It only applies to scenarios, where the
configuration change was triggered by a user generated resize of an
activity (i.e. user drags a corner of an activity and thus changes its
size).

Preserving a window means that we will keep the decor view and non
client decor view around, but remove all children views when the
activity gets destroyed. When the activity gets created again, it will
attach its new content to the preserved view hierarchy. Mind, we
actually recreate application side Window object, since some of its
features might changed, but we retain its elevation (to not trigger
relayout with new layout params).

Preserving the window also means that we don't call the window manager
service to remove and later add the window. Instead, we continue using a
single window state throughout the resize operation.

Change-Id: Ie3d2878ed09c99ff343044bfe7a29a0ba07a265e
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c219c0bb861efccfcb220bc9d4784a49c7790409 12-Sep-2015 Wale Ogunwale <ogunwale@google.com> Fixed bug with activity behind non-fullscreen activity not displaying

Regression introduced in I5bf77063252a5abae4e327f6fc42e607091749f9
where some policy for visiblity of tasks in freeform stacks was
added which ended up applying to other types of stacks. We now limit
the policy to just freeform tasks.

Bug: 23957523
Change-Id: Ib6fad5a89e22d64adf0e52b9e8ed5f2239488245
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
9ac01a74c228d32accfcdc8eca4f06faf90a2db8 04-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Fix NPE in ActivityStack.

Change-Id: Ib2cce4e9e0ce16d28d2aec73585a461405ad90d8
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
0fa656b95256b7ad6d3dce287107a79ace3abdb8 01-Sep-2015 Chong Zhang <chz@google.com> Allow apps to pass in launch bounds when moving/starting a task

Pass in bounds via ActivityOptions for moveTaskToFront and
startActivityFromRecents. Allow bounds to be overriden by rects
in starting intents.

Set bounds to null in RecentsView for full screen layout.

Change-Id: I0ff79fd75068f4ba82d5e2c0a21881fabebdadb8
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
aff7f134a29d0eeac9ec07db4b97c36ecb202ea5 03-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Fix fitWithinBounds to actually apply stack bounds.

Bug: 23749629
Change-Id: Idfca4a83647c3a70c954caeca70d73aa9deee38b
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
ebcc875f10f05db7365cd8afbf4e9425221ab14d 26-Aug-2015 Filip Gruszczynski <gruszczy@google.com> Move Configuration creation from Window Manager to Activity Manager.

Currently the construction of configuration is split between thease
two entities. This poses two problems: it's harder to follow the
construction logic and more importantly we can't determine if
configuration changes significantly before delegating work to the
Window Manager. This CL moves the configuration override logic to
the Activity Manager, since it both detects configuration changes and
informs clients about them. Window Manager becomes purely a recipient
of the information.

Change-Id: I075570ee055cce9c5665772fa8d4fe8ccb5c6313
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
17690ffcf7ed47b2719c65bb148190ddcdf4232c 27-Aug-2015 Skuhne <skuhne@google.com> Dont update thumbnails of freeform windows on focus change

Windows should not update their thumbnails upon a focus change since
it costs a lot of time to capture the content and the thumbnail would
be outdated short time later anyways since the window is still
visible anyways.

Bug: 23562904
Change-Id: If5d23a1058e83030770905827d682f649a579f7a
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
9b1ce52f254b4d9c17ebf437f19f45603d3ad5b2 21-Aug-2015 Filip Gruszczynski <gruszczy@google.com> Using initial activity layout to position the launching activity.

The activity can be positioned in the center or in one of the corners.
From there it shifts its position and tries to find a spot where it
doesn't collide with other activities.

The CL also includes a few fixes necessary to pipe the information about
the initial layout through the system.

Change-Id: I2aaf5b6d20044aafec713b7bd4193b05cfbd16f3
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e5390e7379303cfef6160f4679bd7b288b57a9f8 19-Aug-2015 Filip Gruszczynski <gruszczy@google.com> Non colliding positioning of entering resizeable tasks.

When a new task enters freeform work space, it becomes full screen. This
CL makes it non fullscreen upon entry and also tries to position the
task in a way, that won't collide with existing tasks (so it's clear to
the user, that they are still there).

Change-Id: Ia04fdcadd0e85b268c323358cd4b3e04affa7939
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b34a7ad1af54132b6b046ab8f768e0ffb81cf581 14-Aug-2015 Wale Ogunwale <ogunwale@google.com> Added support for docked stack

Docked stacks occupy a dedicated region on a display.
When a docked stack is present all other static stacks bounds
are restricted to the region of the screen not occupied by
the docked stack.

Change-Id: I6aec3aa19c41a7e756375002f3a925977b5533b5
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
055f9e1772d5e76bffb2b0cdb076f65c77b0d173 13-Aug-2015 Chong Zhang <chz@google.com> Merge "Handle activity launch for background users"
45c25ceb3a58f92d9ce339d54d8616e15f2635e0 11-Aug-2015 Chong Zhang <chz@google.com> Handle activity launch for background users

- When launching activities in background, do not move the
target stack to front or resume the top activity, it should
have no observable effect to current user.

- Add the launched background task to recents so that they
can be found when the background user becomes current.

- Keep track of the last accessed stack for background user,
so that we know which stack to start with when that user goes
current

bug: 22929608

Change-Id: I0421a6b490251503df7a7e71465b8aae5138eb2d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b907c9678d857802f46fcf74acde6d2ea53407d3 12-Aug-2015 Wale Ogunwale <ogunwale@google.com> am 0030d77f: am 0c442844: am b3a6244c: am ceada4fd: am e43d43c3: Merge "Fixed issue with moveTaskToBack on single stack devices" into mnc-dev

* commit '0030d77f15717a2274f73658e6dd334101b64e55':
Fixed issue with moveTaskToBack on single stack devices
4270924801c312399bd72ac35eb95f16ed7167e6 11-Aug-2015 Wale Ogunwale <ogunwale@google.com> Fixed issue with moveTaskToBack on single stack devices

Icdad980eec64e081d15679600da07cf4431e40d6 allowed us to
properly return to the home acitvity when a task is moved
to back. However, this improperly moved the home task to
the front if it is the task we are moving to the back on
a single stack device. We now prevent the movement of the
home task to the front from happening.

Bug: 23088310
Change-Id: Ic21779cdb2d2007671d212d41fab5e68be2ae632
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
4f0c1e80062ee786046d6ddf151a94b65bd1abc0 10-Aug-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Only relaunch activity on significant size configuration changes."
2349332f9f69189d7889692b9aafd6f80070e352 30-Jul-2015 Filip Gruszczynski <gruszczy@google.com> Only relaunch activity on significant size configuration changes.

Currently if the configuration width/height/smallest width changes, we
relaunch the activity or invoke onConfigurationChanged callback. When it
comes to size based configuration changes it might not be necessary: if
the size change doesn't pass one of the threshold defined by the
resources, it means there is no need to relaunch the activity.

In this CL the ActivityManager will receive the thresholds from the
application and use them to decide, whether to relaunch the activity.
The application reads the thresholds from the resources, specifically
from resource qualifiers used by the app.

Change-Id: Ie3cf0a172dc1ba0b865cf30c2962e7cfd9ad8436
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
61803ee5137d4235f17de9e78d936af4a44c2bff 08-Aug-2015 Wale Ogunwale <ogunwale@google.com> Fixed focus adjustment issue with freeform stack.

The activity focus was swifting from the freeform stack to
the home stack even though there were still visible tasks
in the stack. This was because the rules of handling focus
adjustment for the fullscreen stack was been applied to
freeform stack. We now keep the focus on the freeform
stack as long as there is a running activity in the stack
that we can adjust focus to.

Bug: 23035924
Change-Id: I8f81299c74b54e751400cfa265243018e69695d2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7f6fad0dbdee24b2a01755dfc130a707c19ee6db 07-Aug-2015 Wale Ogunwale <ogunwale@google.com> Merge "Place task in right stack when resizing"
040b470d8862226f6e5d6698028a655bd5c1bc06 07-Aug-2015 Wale Ogunwale <ogunwale@google.com> Place task in right stack when resizing

The stack that a task is in is dependent on its size
(fullscreen vs. non-fullscreen). This change makes sure the task
is moved to the right stack when the task resizing occurs.

Change-Id: Id4fa6e577c0cc917114331dc6e11810e8a01ee03
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
fc02074e0054fff351c03d3b62c48d2fc15380df 06-Aug-2015 Chong Zhang <chz@google.com> Merge "Only launch an activity in an existing task if activity types match"
b546f7e0d830c2be96eb6ded1c16d49b2429e6c9 05-Aug-2015 Chong Zhang <chz@google.com> Only launch an activity in an existing task if activity types match

Activities with FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_CLEAR_TASK
flags, when sharing the home activity's task, could cause the home
activity to be cleared. Later when home is launched again, a reset
of the task will be triggered each time.

Don't put an activity into a task unless the activity types match.
(This covers both home and recents activities.)

bug: 21880868
Change-Id: Ida26d187a6552914826bf45e537a731b3a15ea70
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
706ed793409f800a2b8dfbe66ac6992d057549de 02-Aug-2015 Wale Ogunwale <ogunwale@google.com> Support creating/launching a task with non-fullscreen bounds

Change-Id: Icc6d6b25b5f6f236030e654a3eb3ec7f00287d2f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
eae451e57dc439644e0b2db9e5d3714a98d9969f 05-Aug-2015 Wale Ogunwale <ogunwale@google.com> Move task focusing activity task to the front when we focus on the stack

Fixes issue where we don't correctly set the current focus window since
the task isn't on top.

Change-Id: Ib541f2a8289571c716c182264f8ec4fccdae30a3
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
ddc1cb2c15549ed23dce9d416680a009fa6ae23c 26-Jul-2015 Wale Ogunwale <ogunwale@google.com> Added support for static vs. dynamic stacks

Now that stacks represent workspaces we can define static
stacks which help shape the characteristics of the tasks
they contain. For example, fullscreen tasks/activities will
normally be launched in the stack with id
FULLSCREEN_WORKSPACE_STACK_ID, while freeform tasks/activities
will normally be launched in the stack with id
FREEFORM_WORKSPACE_STACK_ID.

Also, added ability to position a task at any index in a stack.

Bug: 22068114
Change-Id: Ib6c62a84b5f204fbf072755264c5c5eda6184f97
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e4a0c5722b1d8db95dfc842d716452dbbf02c86d 30-Jun-2015 Wale Ogunwale <ogunwale@google.com> Allow stacks to hold tasks on various sizes.

Tasks are now resizeable just like stacks. Adjusting the size
of a stack will also adjust the size of all it's containing
tasks. This model allows us to be more flexible
in using stacks as workspaces (like you would have in a
desktop environment) and tasks as the resizeable windows
within the workspace.

Also added "adb shell dumpsys window visible-apps" for
getting the list of visible app windows.

Bug: 22068114
Bug: 19182363

Change-Id: I5bf77063252a5abae4e327f6fc42e607091749f9
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
5a452cdad3d5ba05b0593c3b46e175ab423a812d 24-Jul-2015 Wale Ogunwale <ogunwale@google.com> am c4597a90: am 6cd07625: am 1aaf7d6c: am aecf9ba8: am ff21279e: Merge "Fixed issue with not finding existing activity for background user" into mnc-dev

* commit 'c4597a90f97e577afba22400f53e76eff181090c':
Fixed issue with not finding existing activity for background user
25073dd4a8e8efcfe4b0b728ebb98fb7326434c0 22-Jul-2015 Wale Ogunwale <ogunwale@google.com> Fixed issue with not finding existing activity for background user

We currently go through the list of existing activities to find
a match for the launching intent so we can re-use the activity
record if one already exist. However, we exit the search early
once we run across an activity record that doesn't belong to the
current foreground user. This will cause us to create duplicate
activity records if the launching intent is for a backround
user and an activity record already exist.

Based on https://android-review.googlesource.com/#/c/159131

Bug: 22564256
Change-Id: I4b6d94059c11fd2e621e65c8ec2c99427c15b246
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6648b73cb9d5985b6401af604c7a91de23c88305 17-Jul-2015 Dianne Hackborn <hackbod@google.com> am ee924ded: am 587f0c58: am 61f0aec4: am 9236af43: am aaee5b53: Merge "Work on issue #22516282: ChooserTarget URI grants not forwarded" into mnc-dev

* commit 'ee924dedcc36d64a72652bb3e5fb64d5d5c4c6a4':
Work on issue #22516282: ChooserTarget URI grants not forwarded
a7cfbe0e548ac76f20915b65851b8bc9095aa541 16-Jul-2015 Dianne Hackborn <hackbod@google.com> Work on issue #22516282: ChooserTarget URI grants not forwarded

Add new option to startActivityAsCaller() which allows you to
specify that we should not do security checks on the target
activity being launched.

Change-Id: Ie6b28807b96fef35ccdff93b0a01066cfd8fa307
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
885e53a6bd635435260edd719b644d4586529a2f 14-Jul-2015 Wale Ogunwale <ogunwale@google.com> am efb4a3f6: am 061846d1: am ec565efe: am eb2153c7: am 093d8de2: Merge "Finish already paused activity if it should be finished after pausing" into mnc-dev

* commit 'efb4a3f6d2f77e6fff62b2c6f83c5c8497dc133c':
Finish already paused activity if it should be finished after pausing
5126ff53670f4ce2ac8938fd70e1cfdb291a0bad 14-Jul-2015 Wale Ogunwale <ogunwale@google.com> am 1b59c401: am bdd89eed: am d91f9c7e: am 6ede9b67: am 26b0f1e4: Merge "Revert "Finish already paused activity if it should be finished after pausing"" into mnc-dev

* commit '1b59c401c381ecaca5109cf68c65ec56fa3fe8d6':
Revert "Finish already paused activity if it should be finished after pausing"
3f529ee7fa913531331310e00c4cc4dc471f5d1d 13-Jul-2015 Wale Ogunwale <ogunwale@google.com> Finish already paused activity if it should be finished after pausing

If the app requests its activity to be finished allow it to be finished
immediately if the activity is already paused.

Also, don't schedule stop for an activity that was already finished in
ActivityStack.stopActivityLocked().

Bug: 22170595
Bug: 22397812
Change-Id: If349f7d3070a1fd2c0688fda7381b42f625ed9e4
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
12bb956828d2df983baa0dad2523ab19b1a4577b 11-Jul-2015 Wale Ogunwale <ogunwale@google.com> Revert "Finish already paused activity if it should be finished after pausing"

This reverts commit bef8a3e39372ca85104b894f7359deddc97a8fec.

Changed caused some existing apps to crash. Reverting to unblock the
build while I investigate.

Bug: 22170595
Bug: 22397812
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c824eca8049143cb960080a8197de150ff9b47e4 09-Jul-2015 Wale Ogunwale <ogunwale@google.com> am 5ce1fac0: am a7bdd2f9: am 569a271f: am 1fee5522: am dad62b9f: Merge "Finish already paused activity if it should be finished after pausing" into mnc-dev

* commit '5ce1fac0d1a47b01dc3a23bf39f3c1475f1a8c54':
Finish already paused activity if it should be finished after pausing
bef8a3e39372ca85104b894f7359deddc97a8fec 08-Jul-2015 Wale Ogunwale <ogunwale@google.com> Finish already paused activity if it should be finished after pausing

If the app requests its activity to be finished allow it to be finished
immediately if the activity is already paused.

Bug: 22170595
Change-Id: I1ecc0d5f3b85fd80cbe8cdc1d4e32d5c6a50b20c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
92ebe9a289809c4f8845f6bf54a68e4cd575ff9b 04-Jul-2015 Nicolas Prevot <nprevot@google.com> am b06aece7: am d16f1252: am 60373e80: Merge "Fix the case where an intent bounces several times between users." into mnc-dev

* commit 'b06aece751cc86aa859005bbb8843c5ed6be7c6f':
Fix the case where an intent bounces several times between users.
107f7b7becdb5fe6d735a4f1355eb3421f068fb0 01-Jul-2015 Nicolas Prevot <nprevot@google.com> Fix the case where an intent bounces several times between users.

An intent may bounce several times between users.
In this case, we want mContentUserHint to refer to the original
user.

BUG:19656340
Change-Id: I22a35fab0c228140dcb223899f5e38ff33ee5aed
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
48ef6c7d5318c014a0a425b336abc938b5d11ed5 18-Jun-2015 Wale Ogunwale <ogunwale@google.com> am 91ef7852: am 9c4601e4: am 77b09382: Merge "[ActivityManager] Fix index OOB when updating visible." into mnc-dev

* commit '91ef7852dcdf202754f0ed863b831b8efd66034f':
[ActivityManager] Fix index OOB when updating visible.
36ee73d110ccbdcf7f7fb42e3e9a33ce4aa05051 05-Jun-2015 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Fix index OOB when updating visible.

If there is an Activity Z of Task T needs be visible but
isn't running, and the process P of Z is existed, it will
just to schedule launch Z.

The problem will happen when P is died (e.g. kill itself)
right before scheduleLaunchActivity. Once RemoteException
is caught, startSpecificActivityLocked will try to restart
the process and run cleanup procedure because the process
record is existed (death recipient of P has not entered AMS
yet). And assume task T contains X, Y, Z. X and Y have
declared stateNotNeeded=true, so X and Y will be removed
from task T.

Now the size of task T changes from 3 to 1. And because
activityNdx=2 when updating Z, the next round (--activityNdx)
will have exception at activities.get(activityNdx):
IndexOutOfBoundsException: Invalid index 1, size is 1

The ActivityRecord in TaskRecord is removed by below flow:

ActivityStack.ensureActivitiesVisibleLocked
ActivityStackSupervisor.startSpecificActivityLocked
ActivityStackSupervisor.realStartActivityLocked
ApplicationThreadProxy.scheduleLaunchActivity -> IPC fail
ActivityManagerService.startProcessLocked
ActivityManagerService.handleAppDiedLocked
ActivityStackSupervisor.handleAppDiedLocked
ActivityStack.handleAppDiedLocked
ActivityStack.removeHistoryRecordsForAppLocked
ActivityStack.removeActivityFromHistoryLocked
task.removeActivity(r) -> mActivities.remove(r)

There is also similar patch to solve the same problem:
https://android-review.googlesource.com/143780/

Change-Id: Iac646bcb8ed3d3cfb2bda14e05e11abfcfe980d1
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c31ee7c82d83c05999ee86b55dbfc3e582292c9f 08-Jun-2015 Wale Ogunwale <ogunwale@google.com> am b75323e2: am 1b5da5d7: am 281dffb7: Merge "Include launched packageName in systrace." into mnc-dev

* commit 'b75323e20c078a2ae5d9ac770f2c84c354b6f684':
Include launched packageName in systrace.
7829c81345ce8b7e44ab22bf4433be77e0ebd8ae 08-Jun-2015 Narayan Kamath <narayan@google.com> Include launched packageName in systrace.

This makes it easier to tell which package the activity manager is
launching. The downside here is that each launch shows up in a separate
row in the systrace, but this matches up with the "Start proc:" label,
which contains the package name as well and makes it easier to inspect
both simultaneously.

bug: 21632700
Change-Id: I20ebc2f2a2cf0dc74c6d7daa4bafa381ae4c4060
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
058650a28780276caac1e022d8ef2b203a9529d0 27-May-2015 Wale Ogunwale <ogunwale@google.com> am 83101c83: am 027a8733: am b944fdc1: Merge "Converted more AMS Log calls to use ActivityManagerDebugConfig" into mnc-dev

* commit '83101c833f0cd1769caf4cb8026f31a2c55dfa71':
Converted more AMS Log calls to use ActivityManagerDebugConfig
0fc365c1455ebd4064474d27774f41cfcd8e1cb5 26-May-2015 Wale Ogunwale <ogunwale@google.com> Converted more AMS Log calls to use ActivityManagerDebugConfig

Bug: 21276405
Change-Id: I90d47b1b28f716e650df7f4377ed7cdd30b46ec8
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
73795315885adba0732af5cf19f4eeecd559bf30 22-May-2015 Maxim Bogatov <maximbogatov@google.com> Merge "Limit large font accessibility setting to user profile."
b5a380d409a1431a38db978864b9d85b689e3cce 21-May-2015 Dianne Hackborn <hackbod@google.com> Add API to track usage time of apps.

This adds a new ActivityOption for the caller to ask the
system to track the time the user is in the app it launches,
delivering the result when they are done.

The time interval tracked is from when the app launches the
activity until the user leaves that app's flow. They are
considered to stay in the flow as long as new activities
are being launched or returned to from the original flow,
even if they cross package or task boundaries. For example,
if the originator starts an activity to view an image, and
while there the user selects to share, which launches gmail
in a new task, and they complete the share, the time during
that entire operation will be included.

The user is considered to complete the operation once they
switch to another activity that is not part of the tracked
flow. For example, use the notification shade, launcher, or
recents to launch or switch to another app. Simply going
in to these navigation elements does not break the flow
(although the launcher and recents stops time tracking of
the session), it is the act of going somewhere else that
completes the tracking.

The data is delivered to the app through a PendingIntent,
which includes the total time the app was in the flow along
with a time break-down by app package.

Change-Id: If1cf8892d422c52ec5042eba0e15a8e7e8f83abf
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
05075305b4bac26df1c97af1901171ba26f0a48b 20-May-2015 Maxim Bogatov <maximbogatov@google.com> Limit large font accessibility setting to user profile.

There were 2 problems:
1) When Settings application updated font size it called
ActivityManagerNative.updatePersistentConfiguration() that makes IPC
call to system_process. Then font size was persisted in system_process.
But, the user id we save with the font size if calculated based on the
current process, which is UserHandle.USER_OWNER for the system_process.

2) When user was changed font size was not read from database. Font size
from current configuration was always used.

b/18305168

Change-Id: Id847935a1ab1da3ef133e28ed6928c99c5fe0f16
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
2a857f00110c448d702ffa4ee998dfd78688fa21 12-May-2015 Wale Ogunwale <ogunwale@google.com> Merge "Move visibleBehind activities into stop state when sleeping/powerDown" into mnc-dev
540e123b14ef71f0bfda325e11773c1c510fb8ba 02-May-2015 Wale Ogunwale <ogunwale@google.com> Clean-up component states in AMS when component is disabled

Bug: 15804187
Change-Id: I2b5856c5a0a012f34698fb64f8596d32924bbd1f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
5c42e508d1c76d99bb95edd43e1e12a282a05344 08-Apr-2015 Wale Ogunwale <ogunwale@google.com> Move visibleBehind activities into stop state when sleeping/powerDown

Bug: 19523564
Change-Id: I95273a659edc91c5636d6a0d9cd7fe5683ec4f3e
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
85b90abdf942f7347a829b9f4c576b02345d2579 28-Apr-2015 Wale Ogunwale <ogunwale@google.com> Set non-starting visible resumed activity as resumed activity for the stack

When ensuring visible activities for a stack we check to see if there is
already a resumed activity on the stack, so if we need to start an
activity that needs to be visible, we start it in the paused state
if there is already a resumed activity in the stack. This was't
taking into account a non-starting, visible, and resumed activity.

One case this can happen is if the currently resumed activity in
the stack becomes translucent and the activity behind it needs to
be started because it was previously destroyed due to low memory.

Bug: 19636839
Change-Id: I31670fd64d3bcbbf41823f51518ca603c7412e92
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
5c75f0fbe34ae11058d2afbfcd5de23a3e13a2da 17-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am 2051bded: am 53e2c6ec: am c0c8d198: Merge "[ActivityManager] Fix activity always visible."

* commit '2051bded279f2d81e89b2a3731d1ba164ff9054a':
[ActivityManager] Fix activity always visible.
c0c8d1983c5d7c9bc9469944a9d46856aff95ab9 17-Apr-2015 Olawale Ogunwale <ogunwale@google.com> Merge "[ActivityManager] Fix activity always visible."
0bd2aa760346edd096f7c27283f394631f246f30 16-Apr-2015 Wale Ogunwale <ogunwale@google.com> Fail early when starting a background user activity.

If it shouldn't be displayed for all users.

Bug: 13507605
Change-Id: I8fe8e5a98759c1ca058cc7d222817f6d580ffa11
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
2c1d9652fa51b6a3603e0c695c3c67c33c08607c 17-Apr-2015 Wale Ogunwale <ogunwale@google.com> Merge "Return more information when getAppTasks#getTaskInfo is called."
6035e0198ba510654b5d1f6b6a265a15b08576f8 15-Apr-2015 Wale Ogunwale <ogunwale@google.com> Return more information when getAppTasks#getTaskInfo is called.

The RecentTaskInfo object returned when getAppTasks#getTaskInfo
is called now contains baseActivity, topActivity, and numActivities.

Bug: 18723935
Change-Id: Ifc0cd68a57ed2c0823c23ac8d27e3b6ea6bc95e2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6dfdfd6741c5a3dd8d8a49ddbd6ee5dfe2fd292d 15-Apr-2015 Wale Ogunwale <ogunwale@google.com> Added attribute showForAllUsers that deprecates showOnLockScreen

The new name is more meaningful to what the attribute actually does.

Also, force the FLAG_SHOWN_WHEN_LOCKED flag for windows that belong
to acitivties with the showForAllUsers attribute set.

Bug: 20227306
Change-Id: Ifd49166c3ec0e67ae43addc0fb30038523332ea5
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
15df08abd8190353e1430f88c2ed6462d72a5b25 01-Apr-2015 Craig Mautner <cmautner@google.com> Introduce android:lockTaskMode

The ability for tasks to be started in locktask mode or pinned is
dependent on the value of android:lockTaskMode for the root activity
of the task.

For bug 19995702

Change-Id: I514a144a3a0ff7dbdd4987da5361b94bdfe9a437
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7dfe4d7d8562351243eb81c4fcefdae07fc2fecb 16-Feb-2015 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Fix activity always visible.

Sample code, symptom video and detail:
http://code.google.com/p/android/issues/detail?id=87909

If device is sleeping, activity will be paused immediately
after resume, it is unnecessary to force complete it.
Otherwise the state may get worse because mPausingActivity
is cleared, the real pausing from activityPausedLocked won't
be able to complete pause flow (PAUSING to PAUSED).

If the fail-to-pause activity called finish, it will also
cannot complete finish flow because only !PAUSING can do it.
This results in an activity that has visible=true, finishing=true,
state=PAUSING and always show on wallpaper.

Issue flow:
Case 1
1.At home stack and screen off.
2.A task T contains one activity Z and its process was died.
3.Launch new activity X on T.
4.Before activity Z complete resume, any process
bound and died trigger update visibility and resume top.
5.X calls finish.
6.Turn on screen, X will be always visible.

Case 2
1.Launch Settings (or any), press home key.
2.Launch an activity X in Task T, press home key.
3.Kill process of activity X, turn off screen.
4.Launch activity X with NEW_TASK | CLEAR_TASK.
5.Activity X calls finish.
6.Turn on screen, X will be always visible.

Change-Id: I8ca1845fd100e13ec58382c8c0105bf0a9f8137d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
4870e9d5eba59fb257a87f97f1adf0b734cf48d3 09-Apr-2015 Dianne Hackborn <hackbod@google.com> More work on device idle mode and other power stuff.

Add idle mode support to the alarm manager. Introduce
a new concept of flags associated with alarms to tell
the alarm manager how to treat the alarm -- they allow
everything from the alarm that will bring us out of idle
mode, to alarms that are allowed when idle or should
also bring us out of idle. The standalone boolean is
now also a flag.

(Note there is currently no protection from user space
setting the flags however it wants; I will be working
on that in a follow-up change.)

When in idle mode, the alarm manager pushes all alarms
that shouldn't execute during that time over to a
separate list that is not executed until out of idle.
To help with this, I reworked a bit how Alarm objects
are managed, so that when rebatching or moving between
lists we don't have to allocated new objects but can
just use the same existing instance.

Also tweaked the sync manager to deal with idle mode,
which currently just means doing the same thing as when
low on storage -- turning off sync.

Add new ACTION_CHARGING and ACTION_DISCHARGING broadcasts
that apps can listen for to know when the device is actively
charging and discharging. These are better than the old
POWER_CONNECTED and POWER_DISCONNECTED ones because we only
report charging when we actually see that there is enough
power being provided to charge the battery (and will report
discharging if there is not enough power).

The job controller uses these new actions for scheduling
jobs that want to run while plugged in. Removed the
"stable charging" stuff while doing so, since the new
charging state serves as an even better signal for that.

Introduced two new process states: FOREGROUND_SERVICE and
TOP_SLEEPING. This will allow us to treat foreground services
specially (such as still allowing network access to them for
background music playback) while not mixing them together with
whatever happens to be the top activity while the device is
asleep.

Also some other small cleanup here and there.

Change-Id: I7a9808b578bad6f50deb8e1baf919298512a0d3a
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
219af75bce3dfd688b711d1ae4e5af3e8f380426 08-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am ce5bdfea: am 380415b6: am 1bdbce29: Merge "[ActivityManager] Finish the failed-to-pause activity"

* commit 'ce5bdfea12657c1705d910a47cc48b65abc81723':
[ActivityManager] Finish the failed-to-pause activity
1bdbce295cd7978e50b5444420ed222ec6c6281c 08-Apr-2015 Olawale Ogunwale <ogunwale@google.com> Merge "[ActivityManager] Finish the failed-to-pause activity"
047dfd40fd4f3c35d67ea2cb111a98c9db1f3642 08-Apr-2015 louis_chang <louis_chang@htc.com> [ActivityManager] Finish the failed-to-pause activity

Symptom:
In some scenario, the mPausingActivity may be replaced by other
activity. When previous activity paused, the completePausedLocked()
won't be invoked because it is no longer the mPausingActivity. If
the activity is also pending to finish, it would never be done
because the activity kept in PAUSING state. Since the activity's
window also remain visible and is above on Wallpaper, user would
see it when back to home.

Solution:
Finish the failed-to-pause activity if the activity is pending to
finish.

A Real Case:
(1) Screen turn off
(2) The top activity T1 crashed
(3) When finish activity T1, the next top activity T2 will be
scheduled to resume and pause (due to screen off).
(4) The activity T2 is also set to finishing due to T1 crashed.
(5) Before T2 paused and before paused timeout occurs, there has
a new process started which brings up the next top activity T3
to resume and pause. So the pausing activity is now replaced.
(6) When activity T2 paused, it cannot completed the pause operation
T2 will remain in PAUSING and finishing state with its window
visible. The process won't be killed because the oomadj stays
at 1 (Visible).

Change-Id: Ib10fded891b21c774b26a93071c717fa50516e22
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
8d1db149b6a435b69affd82af2f8dc5367477f28 07-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am 5b652282: am a9418c24: am 8928c727: Merge "[ActivityManager] Improve task order of getRunningTasks."

* commit '5b65228224e941b5c26f985d6d0e0ce61068b6d6':
[ActivityManager] Improve task order of getRunningTasks.
565b0f81ebf6a5a7b2ca859628fa0151b7f14dfb 07-Apr-2015 Wale Ogunwale <ogunwale@google.com> Merge "Start non-running activity that should be visible in resume state."
ddc74155c9896b8783c1ba58499b909cce27a577 07-Apr-2015 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Improve task order of getRunningTasks.

Symptom:
During switching task in same stack, the first result
of getRunningTasks will be the behind stack's top task.
e.g.
App Task X is starting task Y, the first entry may be home.

Root Cause:
TaskRecord's lastActiveTime is updated when pausing
or resuming. When X task launch a new task Y, Y is
on the top of task history, before X complete pause,
Y's lastActiveTime will be 0 because it is a new task.
Then when comparing the front task with other stack,
other stack will be regarded as the newer one.

Solution:
If the stack is focused stack, give the top task with the last time.

Change-Id: I0adc07608e03d333e0120a0dbc52a0fbbbb12f34
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
addd00e7f84167231ebd388713ba08bf22ca3103 05-Apr-2015 Wale Ogunwale <ogunwale@google.com> Start non-running activity that should be visible in resume state.

In multi-window mode it is possible for the system-ui launch
multiple activities at the same time that might not all be in a
running process. For the activities that are not in a running
process to be visible, they need to start in the resume state
not the stopped state if they will be the only resumed activity
in the stack.

Change-Id: I8e63d8baa278a46dd2b948052ca765a561355a71
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
3fcb4a89750d6df42f850021cd754500fc084086 06-Apr-2015 Wale Ogunwale <ogunwale@google.com> Fixed bug with ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN not working

There were a few places in ActivityManager and WindowManager that we
were not taking the value of the flag into account when deciding
which task to be up top in multi-user mode.

Bug: 10533764
Change-Id: If2032ccd5f1a67b3ad4af376b4db7043e9070796
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
9e0f8deae851ec917613256dfbe899ae5c1b1ca5 04-Apr-2015 Wale Ogunwale <ogunwale@google.com> Merge "Don't remove task from recents when moving task to another stack."
000957cef387dc7d08fc6563e2221e9023194984 03-Apr-2015 Wale Ogunwale <ogunwale@google.com> Don't remove task from recents when moving task to another stack.

Also, made event log reason for remove task when moving different
from when removing.

Bug: 19946163
Change-Id: Iea2b7a84040759e9ad0a7dc8c6f4aee67b15467b
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b1e8e5e505c46f988706ba4b83159ba51bcbd77f 03-Apr-2015 Olawale Ogunwale <ogunwale@google.com> Merge "Remove debugging for bug 19823482."
eb0e38a812ace6134a2e029f8084f099b6d44318 03-Apr-2015 Craig Mautner <cmautner@google.com> Remove debugging for bug 19823482.

Change-Id: Ibedfb3353e6f7f64e39ad076b329d9cd9657fe5f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
bcfe87f3e05ac65d7ecb7156cd0de580586df5e9 02-Apr-2015 Wale Ogunwale <ogunwale@google.com> resolved conflicts for merge of 65073b91 to master

Change-Id: I65a9d95caa98ec33e41480546b4447ec787c6840
558e849a7772cda924ac0617708c439ed05c17ed 02-Apr-2015 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Avoid improper resume top activity.

When there is a process died, only resume top if
it contains visible activity.

This can fix case 1 in
https://android-review.googlesource.com/#/c/120901/

Change-Id: I45584e76f9e863980d04bbb593d7d26a8900acd0
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
ee006da858459e91666ae53432659e934c8a8dbd 30-Mar-2015 Wale Ogunwale <ogunwale@google.com> Converted more log points in AMS to use ActivityManagerDebugConfig.

Change-Id: I59e777de30e2e9a3c7d086dc634129cd19135fab
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
0b037e93fce761f923330432f51aba40f9a316c8 31-Mar-2015 Craig Mautner <cmautner@google.com> Merge "Remove one ANR cause and add logging for another"
cceeb58c13ee426254a8a25fdd2b9d7e844fdbe2 31-Mar-2015 Craig Mautner <cmautner@google.com> Remove one ANR cause and add logging for another

For bug 19823482.

Change-Id: Ic44c4fd11ef92546118b09526c97446a92a7b4e7
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
8501866d7480da2251fd8ad29fe918cc0c05c451 30-Mar-2015 Craig Mautner <cmautner@google.com> Merge "Still more debugging for bug 19823482"
07927bffa72e35ded65b5eff2815f1337715c416 29-Mar-2015 Wale Ogunwale <ogunwale@google.com> Fixed issue with paused activity still freezing display.

An activity freezes the display when it is relaunched when
configuration changes. If the activity takes time to launch and
another activity is launched before it is done, the activity that
froze the display will be paused and might not have the chance to
unfreeze the display. This will put WindowManager in an odd state.
We now unfreeze the display when an activity is done pausing in case
it was previously freezing the display.

Bug: 19823482
Change-Id: If5538aea639e06d0b8621646bf6b2e12d325287a
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7258118c066db8319237a99a73908134adfc619f 29-Mar-2015 Craig Mautner <cmautner@google.com> Still more debugging for bug 19823482

Change-Id: I2a9270ebd0a31c9dc62732b67c640191549d396e
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
2568c3abcbfc93838fbc8fff270da0ead8878b40 26-Mar-2015 Craig Mautner <cmautner@google.com> Do not set visibility of unstarted activities.

If an activity is started in the stopped state then it shouldn't have
its window manager visibility set to visible. It also should not have
its screen frozen.

Fixes bug 19823482.

Change-Id: I74637a8eefcc97d1ef4d8ea3c661dc7c0c322f59
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
27eac1d58fe0b7ca3a2e27f5ed64eff232745f45 17-Mar-2015 Dianne Hackborn <hackbod@google.com> Add ability to get a screenshot for assist.

New flag you pass in to startSession() to say you want it,
new callback on VoiceInteractionSession to receive it.

Change-Id: I61fdcfdee41a60d46036a2ef16681a9b4181115a
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
3ab9a27e3d612efef6a046d4df7880803df1eef9 16-Mar-2015 Wale Ogunwale <ogunwale@google.com> Convert some log points to in AMS to use ActivityManagerDebugConfig class.

Change-Id: I02154b0e1c2c64af840848fd6def054342922efa
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
fd5767fa37485952b7291ea701cc84c38c2621fc 17-Mar-2015 Wale Ogunwale <ogunwale@google.com> Merge "Remove duplicate move of home stack that can cause animation jank."
3d07c94c393831091958fe6a98811843db8973bd 14-Mar-2015 Dianne Hackborn <hackbod@google.com> Add new voice request for picking from a list.

Also add API for voice interaction service to control
whether the system should hold a wake lock while it is
working with an activity (and actually *do* hold a wake
lock while doing so, duh!).

And while in there, clean up the launching wake lock to
correctly give blame to the app that is launching.

Change-Id: I7cc4d566b80f59fe0a9ac51ae9bbb7188a01f433
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
2913d6a010f63858e0114f778ae7166b88dbb5b0 15-Mar-2015 Vinit Deshpande <vinitd@google.com> am "resolved conflicts for merge of 8995e140 to lmp-mr1-wfc-dev"

merged from goog/mirror-m-wireless-internal-release
3c878f2 resolved conflicts for merge of 8995e140 to lmp-mr1-wfc-dev

Change-Id: I1e850223401fdd36cbeea686d3dd3b8a214ab33c
d80c263e2a45f0a2b65fd9762aa8deea49c8ca72 13-Mar-2015 Wale Ogunwale <ogunwale@google.com> Remove duplicate move of home stack that can cause animation jank.

Each move of the home stack in the ActivityManager ends up calling
into the WindowManager which causes layout to be performed.

Also, fixed issue where ActivityStack.moveTaskToFrontLocked()
could move a task to the front without the focus been adjusted to
the new top activity.

Bug: 19692494
Change-Id: Ib4c999c6dfa1af3fda0fced52b58da614b154d00
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d58617b4f519e69cf8a828210f138d2bcbe4e20a 12-Mar-2015 Wale Ogunwale <ogunwale@google.com> Merge "Protect against NPE for ActivityRecords without a stack."
ab48bc164faf6786b4aedfb1b30214baa3c75b3e 12-Mar-2015 Wale Ogunwale <ogunwale@google.com> Merge "Revert "Revert "Remove activity and window stacks when last task is removed."""
7d701174f423754a2dade39fd16f102c085bd865 11-Mar-2015 Wale Ogunwale <ogunwale@google.com> Protect against NPE for ActivityRecords without a stack.

A previous change allowed us to remove stack that no longer contained
any task. This was causing some NPE when an ActivityRecord.Token or
some other cached ActivityRecord later gets converted back to an
ActivityRecord and we try to access its stack.

Bug: 19552874
Change-Id: Ie9454bbce56591b337f97af40f8c00b8597becdf
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
9c1353ee6cbd50cfe661e53ec0fe09cabae8bd5e 12-Mar-2015 Craig Mautner <cmautner@google.com> am 20553036: am 68694780: Merge "[ActivityManager] Fix index OOB when resetting removed task"

* commit '20553036af92a6369b3e53f54a1f4f0ccaf8e981':
[ActivityManager] Fix index OOB when resetting removed task
04f4d6bb8892fe9b6e8f60d18a4f4dd051ab8124 11-Mar-2015 Wale Ogunwale <ogunwale@google.com> Revert "Revert "Remove activity and window stacks when last task is removed.""

This reverts commit 7a7bf5ea48b12f044c591fb03ed3e58acd28ceb7.
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
686947801e7c35eb60bf25385f46e45db66bee69 11-Mar-2015 Craig Mautner <cmautner@google.com> Merge "[ActivityManager] Fix index OOB when resetting removed task"
1d7919a7eb38a94304e6c0bcb09f743fc6191a58 11-Mar-2015 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Fix index OOB when resetting removed task

Assume task T has an activity X lives in process P.
When P is died and before death recipient being called,
start activity with flag RESET_TASK_IF_NEEDED to bring the
existed task T.

Then scheduleResumeActivity IPC will fail and trigger start
a new process that removes task T.

That results resetTaskIfNeededLocked cannot find the task
when continuing the start flow.

Detail:
https://code.google.com/p/android/issues/detail?id=159558

Change-Id: Icc400c7a6c481a3f78657e9fb83cf0c3a17dde68
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
de01b03a855eb482e2264ee31e98fb4d3a42ebab 11-Mar-2015 Wale Ogunwale <ogunwale@google.com> Merge "Converted some AMS log points to use ActivityManagerDebugConfig."
e23149f1555303940d212b742707518b7f9f84ab 07-Mar-2015 Wale Ogunwale <ogunwale@google.com> Converted some AMS log points to use ActivityManagerDebugConfig.

Change-Id: I0563bafd29ae0bbe596ed8c06fcc573b5ead50b7
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7a7bf5ea48b12f044c591fb03ed3e58acd28ceb7 10-Mar-2015 Wale Ogunwale <ogunwale@google.com> Revert "Remove activity and window stacks when last task is removed."

This reverts commit 0f95e3f0753508344b198c0a76afb892df514f52.

Bug: 19644506
Bug: 19083170
Change-Id: I2eb2a0400be58fe2c5d48a4b68368725e98aaf6f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
cb82f30186ea0f664cdb880cae1114cecd20ebc6 25-Feb-2015 Wale Ogunwale <ogunwale@google.com> Revert "Revert "Have AMS.setFocusedActivityLocked() move the focus stack to the front""

This reverts commit 3426b72cff7f8eeea4c802f4f0fcae4b995e177a
and fixes bugs 19505341 19507107

Bug: 19219490
Bug: 19507107
Bug: 19505341
Change-Id: I7d6fc9fa41ed03bb7834facbb4c453e2561f13c9
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
3426b72cff7f8eeea4c802f4f0fcae4b995e177a 25-Feb-2015 Wale Ogunwale <ogunwale@google.com> Revert "Have AMS.setFocusedActivityLocked() move the focus stack to the front"

This reverts commit af0e44885992b0675d7881c391caeff88414695f.

Unblock the release while I figure-out how the change broke things...

Bug: 19505341
Bug: 19507107
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
fa9ec310d8aac23bd085b0a7f0fe91fe2115181a 25-Feb-2015 Wale Ogunwale <ogunwale@google.com> Merge "Have AMS.setFocusedActivityLocked() move the focus stack to the front"
af0e44885992b0675d7881c391caeff88414695f 24-Feb-2015 Wale Ogunwale <ogunwale@google.com> Have AMS.setFocusedActivityLocked() move the focus stack to the front

Bug: 19219490
Change-Id: I089c42a6cf6277f5975064103c9804c2ab05dcd6
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
5d8a69f2774d5843704f18f6ff608edc55051e9d 24-Feb-2015 Craig Mautner <cmautner@google.com> Merge "Cleanup the activity before the task and stack"
acebdc84d182f39add0432b35d974da58f608749 24-Feb-2015 Craig Mautner <cmautner@google.com> Cleanup the activity before the task and stack

The method cleanupActivityLocked() should be called before
removeActivityFromHistoryLocked(). Previously it didn't matter but
now that we null TaskRecord.stack when removing the last activity
from the task it does.

Fixes NPE in bug 19491381.

Change-Id: Ia6f8f560c0fe4df330577f313e24d7dd02c18409
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
53a29a90f35f72462c0d6ad650921d5566c1f8f0 24-Feb-2015 Wale Ogunwale <ogunwale@google.com> Added ActivityManager API and AM command to resize a task.

Also fixed issue with ActivityStackSupervisor.moveTaskToStackLocked()
functionality not working correctly.

Change-Id: Ia13f1e92a7c59ce6543c226533ac8ea623488290
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d697ceac0227822ab33d8f7cbe5442cc37d9d74a 21-Feb-2015 Wale Ogunwale <ogunwale@google.com> Improved back button behavior in multi-window mode.

Pressing the back button on the last activity in a stack that isn't
full screen causes the home stack to move forward and hide all other
visible stacks. This change allows the affected stack to be removed
while keeping the other stack visible.

Bug: 19423645
Change-Id: I30d84f84d525c114ee4993c1e4178af70fe47440
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
49853bf1dfb1cc1ee19e56e457c36e65b5dfdd59 23-Feb-2015 Wale Ogunwale <ogunwale@google.com> Don't delete home stack when last task is removed.

Bug: 19470291
Change-Id: I4a6c24edb6cc83a0f155836ce4e1394807da1563
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
0f95e3f0753508344b198c0a76afb892df514f52 20-Feb-2015 Wale Ogunwale <ogunwale@google.com> Remove activity and window stacks when last task is removed.

Also,
* Only restore recent task to a full screen stack instead of any
randomly sized stack.
* Fixed issue where we were restore task from recents for some
operations when we didn't need to.
* Null out TaskRecord.stack when the task is removed from the
stack.

Bug: 19083170
Change-Id: I4e006f101f9d0f2aebde130ad77afc4d258c6612
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
00c5e4e1908877fea23b1b2aab97f122dba2ceef 10-Feb-2015 Wale Ogunwale <ogunwale@google.com> Merge "Set TaskStack config orientation based on dimensions"
a928127a74d6ffe9334774e64a4470aedbe6c28b 07-Feb-2015 Wale Ogunwale <ogunwale@google.com> Set TaskStack config orientation based on dimensions

The TaskStack override configuration is set based on the
stack dimensions so we can load the most acturate resources
for activities in the stack in a multi-window environment.

Also, disabled fixed screen orientation for resizeable
activities.

Bug: 19305402
Change-Id: I7b182554523b12f2ef77f8bbc7b16891231125bf
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c2607b4ececbefd18f223fa89d1b1aac56516009 08-Feb-2015 Wale Ogunwale <ogunwale@google.com> Include stack override configurations in onConfigurationChanged() call.

Important for activities that handle configuration changes.

Change-Id: I4d1612026f293fbb99e1abc17e663f0215658ae6
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b95a8abcafbd9b5c8c6c08abe0a94c2224d251ad 03-Feb-2015 Craig Mautner <cmautner@google.com> am c0e9c1d0: am 240e8743: Merge "[ActivityManager] Set appropriate relation of task to home" automerge: 7d1aded

* commit 'c0e9c1d0a405c66e7ec75eb6268f84fe1d466344':
[ActivityManager] Set appropriate relation of task to home
c0e9c1d0a405c66e7ec75eb6268f84fe1d466344 03-Feb-2015 Craig Mautner <cmautner@google.com> am 240e8743: Merge "[ActivityManager] Set appropriate relation of task to home"
automerge: 7d1aded

* commit '7d1adede2fbea8f4c0ad92214bee16395498dd07':
[ActivityManager] Set appropriate relation of task to home
240e8743977d1a1e7a43ff42e0d52148db10cda8 03-Feb-2015 Craig Mautner <cmautner@google.com> Merge "[ActivityManager] Set appropriate relation of task to home"
9d3de4cfb42519fefe9d8b03c38ba440bd6bc886 02-Feb-2015 Wale Ogunwale <ogunwale@google.com> Support for activity to opt-in/out of resizeable/multi-window support.

Bug: 19178148
Change-Id: I5819a71cdc48e0af4add11a6d4a503ec5cbe5d63
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
aab56dbc1ef5c91afad1e61d633305bb3aa3cb1b 30-Jan-2015 Todd Kennedy <toddke@google.com> Show stacks underneath a resized stack

When a stack is resized, make sure any non-fullscreen stack beneath it
becomes visible. This may mean additional activities are resumed in the
process.

Bug: 19083171
Change-Id: I5e7a3f82d76932ea2b9dbf0324ea183c42ee5496
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
783f28691e27b7b116730fad4f9fd9c083bab283 27-Jan-2015 Wale Ogunwale <ogunwale@google.com> Merge "Support activities in the same process having different resources."
8f5f7e9245278a46326ea0f04f193976c363695e 27-Jan-2015 Craig Mautner <cmautner@google.com> Precompute FLAG_ACTIVITY_NO_ANIMATION

Save lots of passing around of ActivityRecords when all you care
about is the flag.

Fixes bug 18088522 item #14

Change-Id: Ib6d95ef06b44faa1715a196ab710f96ed4517213
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
83162a90278d9d52d8fca7ee20ba314b452261de 26-Jan-2015 Craig Mautner <cmautner@google.com> Eliminate groupId and add task to AppWindowToken

Simplifies access by eliminating indirect referencing.

Fixes bug 18088522 item #15.

Change-Id: I9049192a7f3e1028d60c4f2d4d4a0d4aad590aa4
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
60454dbc4d815c90ff2713e224953d6547fc3ad5 24-Jan-2015 Wale Ogunwale <ogunwale@google.com> Support activities in the same process having different resources.

Activities can be of various sizes in a multi-window environment.
This change allows them to have override configurations that allows
different resources to the loaded if needed.

Bug: 19002213
Change-Id: Ib2c7be0b427f5ce05e7a362bcdd496ddbc9164f0
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
3c878f26c94e69d21fc633708329f8e6b87943f3 26-Jan-2015 Craig Mautner <cmautner@google.com> resolved conflicts for merge of 8995e140 to lmp-mr1-wfc-dev

Change-Id: I21ffad3247858dc072964a5fa4beb609010c2b1a
1de57d883e41e7ea46fa4fab6b9da7044ed5cd7c 26-Jan-2015 Craig Mautner <cmautner@google.com> resolve merge conflicts of 2322ea5 to master.

Change-Id: I1570e633bf0d552a32d7fa9a2e0ebd81953f632b
2322ea558eced3deed94193d9b9d498f69b14a78 26-Jan-2015 Craig Mautner <cmautner@google.com> am 8995e140: Merge "Add reason string for bringing stack to front" into lmp-mr1-dev
automerge: afc6d33

* commit 'afc6d332790166943302f051d32ec0874d9280aa':
Add reason string for bringing stack to front
299f960e5e5837da44cd81692388f3cbd5d2c362 26-Jan-2015 Craig Mautner <cmautner@google.com> Add reason string for bringing stack to front

Additional debug and useful information.
Also removed am_resume_activity verbosity and refactored method to
eliminate unused parameter.

For bug 17721767.

Change-Id: Ie1c0652a38a0c6ae6db27a52a9e5da29e252e300
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b4d43538d7cbcea5ddcfd32edb4ada2c211b2a04 21-Jan-2015 louis_chang <louis_chang@htc.com> Resume home activity can skip resume and cause ANR. DO NOT MERGE

Symptom:
In some scenario, there might have two home tasks
in the home stack. If the top home task was finishing
and expected to return to home stack, no activity
will resume.

Root Cause:
Unable to perform resumeHomeStackTask() because the
resumeTopActivityLocked() has been prevented to invoke
recursively.

Solution:
Just resume the next activity if already in home stack

Change-Id: I24ecbcac6cee4ddbd90cdd27c4f4915cffb9b354
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
9ba23db50c399867dffb0731d145e1831fe9e829 21-Jan-2015 Craig Mautner <cmautner@google.com> Merge "[ActivityManager] No home activity resumed and cause key dispatch ANR" automerge: 247e828 automerge: ad55787
automerge: 7748fd8

* commit '7748fd81350ba2db9864527281d62fbf02a90145':
[ActivityManager] No home activity resumed and cause key dispatch ANR
7748fd81350ba2db9864527281d62fbf02a90145 21-Jan-2015 Craig Mautner <cmautner@google.com> Merge "[ActivityManager] No home activity resumed and cause key dispatch ANR" automerge: 247e828
automerge: ad55787

* commit 'ad55787db2f9e4b56a8406026566564d6aa08d5a':
[ActivityManager] No home activity resumed and cause key dispatch ANR
2d094e947759d4c3f331e5679667e5ca1b45c48f 21-Jan-2015 louis_chang <louis_chang@htc.com> [ActivityManager] No home activity resumed and cause
key dispatch ANR

Symptom:
In some scenario, there might have two home tasks
in the home stack. If the top home task was finishing
and expected to return to home stack, no activity
will resume.

Root Cause:
Unable to perform resumeHomeStackTask() because the
resumeTopActivityLocked() has been prevented to invoke
recursively.

Solution:
Just resume the next activity if already in home stack

Change-Id: I24ecbcac6cee4ddbd90cdd27c4f4915cffb9b354
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b7dae3b56561303f13f55d1652c56d5e0062d1fe 21-Jan-2015 Craig Mautner <cmautner@google.com> am 1388342c: am 088bf3a3: Merge "More debugging for bug 17721767" into lmp-mr1-dev
automerge: 07d2f0c

* commit '07d2f0cff4d08bec4ff5ea22f9c42532f3c83e35':
More debugging for bug 17721767
07d2f0cff4d08bec4ff5ea22f9c42532f3c83e35 21-Jan-2015 Craig Mautner <cmautner@google.com> am 1388342c: am 088bf3a3: Merge "More debugging for bug 17721767" into lmp-mr1-dev

* commit '1388342c7f6e9c235d31b01edf3716e83fad3e64':
More debugging for bug 17721767
94ab46659bac1ffdfd7b72d15a68ea6d3b09224e 20-Jan-2015 Craig Mautner <cmautner@google.com> More debugging for bug 17721767

Narrow down why GEL is being resumed instead of the top stack.

Change-Id: I79c0be4adf0ccee30e1a5aa4308ee91148f239fa
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
8c14c15aad749d285b6f395019467a12da7fc9c6 16-Jan-2015 Craig Mautner <cmautner@google.com> Replace waitingVisible and other refactors

- ActivityRecord.waitingVisible is identical to
ActivityStackSupervisor.mWaitingVisibleActivities.contains(). This
ArrayList is never very large so much code can be simplified by
eliminating the waitingVisible member.

- The processStoppingActivityLocked() method can eliminate a lot of
variables by traversing the list top down. This makes the code
simpler to analyze and maintain.

- Declarations of ArrayLists do not need parameterization in the new
constructor. These have been removed in ActivityStackSupervisor.

Fixes item #5 of bug 18088522.

Change-Id: Ib9d648c5fa32c8dd7313882864886c929e1ebc21
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c82f2f5f9cb1bd4f5bcbd39a8ddf0d8da84f7104 09-Dec-2014 Wale Ogunwale <ogunwale@google.com> Add RecentTasks class to house recent tasks functionality.

Cleaned-up ActivityManagerService a little by moving recent
tasks functionality to new class RecentTasks.

Bug: 18556524
Change-Id: I4c877c9695b63d7fdb1b6b7addb737fd663e86c7
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
64a5234a3a04108e259730cbdbbb03fd70ff24ed 05-Jan-2015 Sungsoo Lim <sungsoo@google.com> am 269aad53: am b65ad80d: Merge "DO NOT MERGE Make mute/unmute work" into lmp-mr1-dev

* commit '269aad530493ccdd7ec78c1704eebd4476348b5d':
DO NOT MERGE Make mute/unmute work
48248c80e58c459d211d36164baa69354e070c07 24-Dec-2014 Sungsoo Lim <sungsoo@google.com> DO NOT MERGE Make mute/unmute work

Bug: 18844550
Change-Id: I431a223d55430aa8e1bb28f0275e11876ed0e0bb
(cherry picked from commit d1851e6e4e49b6a45d9e013de2e1384711975328)
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
ebc440ea5d97d1e3424c4aa636311ab8ec494e76 29-Dec-2014 Craig Mautner <cmautner@google.com> am 443d1a6a: am cfa31a60: Merge "[ActivityManager] Reset ActivityRecord\'s waitingVisible"
automerge: 3551ce9

* commit '3551ce9d8e8244376d63b65e0352ffa03198ba2a':
[ActivityManager] Reset ActivityRecord's waitingVisible
3551ce9d8e8244376d63b65e0352ffa03198ba2a 29-Dec-2014 Craig Mautner <cmautner@google.com> am 443d1a6a: am cfa31a60: Merge "[ActivityManager] Reset ActivityRecord\'s waitingVisible"

* commit '443d1a6ae3b9550a4a1b46926b336c1a534db2f4':
[ActivityManager] Reset ActivityRecord's waitingVisible
c215a4fb2f6ef739e3f1a8d627bca3a3a063b879 26-Dec-2014 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Set appropriate relation of task to home

All below cases should return to home but the top will be Settings.
The initial steps are
1.Launch Settings from home
2.Press home key
3.Launch activity A in task X from home

Case 1
4.A starts activity B in task Y and calls moveTaskToBack

Case 2
4.A starts activity B in task X and calls moveTaskToBack
5.B calls finish

Case 3
4.A launches activity B in task Y
5.B launches A with NEW_TASK (bring existed task)
6.A calls finish return to B
7.B calls finish

Case 4
4.A launches activity B in task X
5.B launches C in task X
6.C launches A with flag NEW_TASK and CLEAR_TOP
7.A calls finish

Solution:
Transfer return-to to next adjacent task.

Change-Id: Icdad980eec64e081d15679600da07cf4431e40d6
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
1110f5547018030c316562b217a073b16364ed51 19-Dec-2014 louis_chang <louis_chang@htc.com> [ActivityManager] Reset ActivityRecord's waitingVisible

Symptom:
The ActivityRecord's waitingVisible is not set to false for
all cases when the ActivityRecord is removed from
mStackSupervisor.mWaitingVisibleActivities.

Solution:
Set the waitingVisible to false when it is removed from
mStackSupervisor.mWaitingVisibleActivities

Change-Id: If0f0683971d70a6866b0167e91dd95feebaac178
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6c13f5921dd69e94d0dcf6bad7ce2ab9a038cdfa 18-Dec-2014 Craig Mautner <cmautner@google.com> am 2eb575b4: am 2281e7d6: Merge "Make window mgr stack movement track activity mgr" into lmp-mr1-dev
automerge: 4ed8a33

* commit '4ed8a336efc76847fbf3e11a0ae66aa74c422846':
Make window mgr stack movement track activity mgr
4ed8a336efc76847fbf3e11a0ae66aa74c422846 18-Dec-2014 Craig Mautner <cmautner@google.com> am 2eb575b4: am 2281e7d6: Merge "Make window mgr stack movement track activity mgr" into lmp-mr1-dev

* commit '2eb575b4b0429d42c14627627d9630ba6056262e':
Make window mgr stack movement track activity mgr
6b904ef4741321dcb01caee9795c2a044018706c 18-Dec-2014 Craig Mautner <cmautner@google.com> Make window mgr stack movement track activity mgr

There were situations where the activity manager ActivityStack was
moved to the front but the corresponding window manager TaskStack
was not. This caused the wrong activity to receive focus which led
to Application Not Responding errors.

One path in particular occurred in startActivityUncheckedLocked()
where curTop.task != intentActivity.task and
sourceStack.topActivity().task != sourceRecord.task. In this case
targetStack.moveTaskToFrontLocked() was never called.

This fix forces all calls to ActivityStack.moveToFront() to make
a call to WindowManagerService.moveTaskToTop() and eliminates
redundant calls to moveTaskToTop().

Fixes bug 17721767.

Change-Id: Ibf01389810dd36724eaec5a4a07560144b2f4cef
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
539db51a7d45d95673f21b579bf9b353e9c19c70 15-Dec-2014 Todd Kennedy <toddke@google.com> propagate reason to finishActivityLocked()

Bug: 18704347
Change-Id: I830ad08f344db5be99760e0112d96729077b29c6
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
dc101a11df864a36c4d8867b1e7bc4b4d39a90a0 10-Dec-2014 Wale Ogunwale <ogunwale@google.com> Always take an activity screenshot when pausing. automerge: 37f2718
automerge: bfa6059

* commit 'bfa6059b78dfe0a40e71df055c60e431478a3e9d':
Always take an activity screenshot when pausing.
37f271869ed9c9e9f0e7de7339017e0bb6719780 09-Dec-2014 Wale Ogunwale <ogunwale@google.com> Always take an activity screenshot when pausing.

http://ag/261732 introduced an optimization where we only take
the activity screenshot if is is not the activity we took a
screenshot for last. This causes us to display a stale screenshot
for activities that change their display content (using fragments)
without going through the pause/resume cycle. It should be safe
to always take a screenshot when we are pausing since the code
path is only called once per pause/resume cycle.

Bug: 18682160
Change-Id: Ie5c43cfd806286808af4233c5917ae7071908ebb
(cherry picked from commit eacdf2ce04899b0a3abef55e4e7e1fe9c1649932)
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c73923bcf9f1ec488c04430db9a6de8c03028a2c 10-Dec-2014 Wale Ogunwale <ogunwale@google.com> Merge "Always take an activity screenshot when pausing."
eacdf2ce04899b0a3abef55e4e7e1fe9c1649932 09-Dec-2014 Wale Ogunwale <ogunwale@google.com> Always take an activity screenshot when pausing.

http://ag/261732 introduced an optimization where we only take
the activity screenshot if is is not the activity we took a
screenshot for last. This causes us to display a stale screenshot
for activities that change their display content (using fragments)
without going through the pause/resume cycle. It should be safe
to always take a screenshot when we are pausing since the code
path is only called once per pause/resume cycle.

Bug: 18682160
Change-Id: Ie5c43cfd806286808af4233c5917ae7071908ebb
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
40c5c0ef16462668fb13717f59254f8696eac127 09-Dec-2014 Craig Mautner <cmautner@google.com> am 74a66013: am f71f5e89: Merge "[ActivityManager] fix NPE in ActivityStack.resetTargetTaskIfNeededLocked."

* commit '74a660136096d0ab10fe8d0f99c63ef535aa5552':
[ActivityManager] fix NPE in ActivityStack.resetTargetTaskIfNeededLocked.
4b5a9a09e55a81a1c060cd42e673066afd71e554 09-Dec-2014 Mark Lu <Mark_Lu@htc.com> [ActivityManager] fix NPE in ActivityStack.resetTargetTaskIfNeededLocked.

Symptom:
in .ActivityStack.resetTargetTaskIfNeededLocked, "allowTaskReparenting" if case will call setTask
to remove activities from task, that will caused numActivities in main for-loop not consist with task.mActivities size.
caused NPE will happend in finish activities for-loop due to get null object from activities when clearWhenTaskReset" as true case.

Root Cause:
when clearWhenTaskReset as true, will set "end" variable as numActivities -1, but if calling setTask to remove activities from task,
end value will out of date & not same with task.mActivities size.

Solution:
use activities.size() - 1 to assign end value.

Change-Id: I5d7fe22e1df2fc61738db23402e7c42cf6d8c4cc
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
1864a509b06ab2e3e7de25d38776f03aca5e865e 01-Dec-2014 louis_chang <louis_chang@htc.com> [ActivityManager] Invalidate last screenshot when activity relaunched

Symptom:
The task thumbnail is not updated when activity relaunched.

Reproduce Steps:
1. Put device in portrait
2. Launch Calculator
3. Launch Recent App (the Calculator's screenshot is correct)
4. Rotate device to landscape
5. Click Calculator in Recent App to return to Calculator (Calculator has relaunched to landsacpe ui)
6. Launch Recent App again (the Calculator's screenshot is not updated)

Change-Id: I92e951ea2ee215c52ca6e50cf6f9e02deb787bce
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
fee5e3d32a26c3ac2136e37cad15fd9cc41066db 03-Dec-2014 Winson Chung <winsonc@google.com> am 50511096: am de9848c6: Merge "Initial changes to add callback on task stack changes. (Bug 17672056, Bug 18291345)" into lmp-mr1-dev

* commit '50511096998ffff4fa5c001e46b056201fb0b892':
Initial changes to add callback on task stack changes. (Bug 17672056, Bug 18291345)
740c3ac782675d190941b2ab1905e56f246c1b11 13-Nov-2014 Winson Chung <winsonc@google.com> Initial changes to add callback on task stack changes. (Bug 17672056, Bug 18291345)

Add a listener to listen for changes in the Task stacks to preload thumbnails from the
system. In addition, reduce the amount of synchronous work done in activity creation
and first measure/layout passes.

Change-Id: I8bd9155d7a05e89c190a20429acff69a17808208
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b361f48b38f89c029a4ea5548d876f34fd74a7fc 02-Dec-2014 Craig Mautner <cmautner@google.com> am ca017a38: am 50f513c5: Merge "[ActivityManager] Invalidate last screenshot when activity relaunched"

* commit 'ca017a38c9eb12fe92d24a72ad3ee4c33b00e5de':
[ActivityManager] Invalidate last screenshot when activity relaunched
3d9c431ca4311eb8e87d303d2fcd3499c8856101 01-Dec-2014 louis_chang <louis_chang@htc.com> [ActivityManager] Invalidate last screenshot when activity relaunched

Symptom:
The task thumbnail is not updated when activity relaunched.

Reproduce Steps:
1. Put device in portrait
2. Launch Calculator
3. Launch Recent App (the Calculator's screenshot is correct)
4. Rotate device to landscape
5. Click Calculator in Recent App to return to Calculator (Calculator has relaunched to landsacpe ui)
6. Launch Recent App again (the Calculator's screenshot is not updated)

Change-Id: I92e951ea2ee215c52ca6e50cf6f9e02deb787bce
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c8d97850a8a3bc3bad882067fef60608bdbf7228 22-Nov-2014 Craig Mautner <cmautner@google.com> am a673263d: am 0a398d7b: Merge "Treat screen-on while pausing as pause timeout." into lmp-mr1-dev

* commit 'a673263d059997f846fa1765776758c6d06e5131':
Treat screen-on while pausing as pause timeout.
0a398d7bb477c57508e5a7374e91cb331b689290 21-Nov-2014 Craig Mautner <cmautner@google.com> Merge "Treat screen-on while pausing as pause timeout." into lmp-mr1-dev
4c9041cf837cda13c749b148661d18c3fab0fbd6 21-Nov-2014 Jeff Brown <jeffbrown@google.com> am 1ac13e02: am 682ed6b6: Merge "resolved conflicts for merge of 694c1d2b to lmp-mr1-dev" into lmp-mr1-dev

* commit '1ac13e0212a770c918d32e6c645682466113632c':
Support keeping activities resumed while dozing.
9ef94019386183cb88ad090965418ef294bbb79a 21-Nov-2014 Jeff Brown <jeffbrown@google.com> resolved conflicts for merge of 694c1d2b to lmp-mr1-dev

Change-Id: I9a9b724e0fd12aa161ff276540431b9d8e218e2b
f49b0a45aece9bad42d81a09eeceaf1b5b6c06df 21-Nov-2014 Craig Mautner <cmautner@google.com> Treat screen-on while pausing as pause timeout.

If an activity is started pausing when the screen turns off and
hasn't completed pausing by the time the screen turns back on then
we will end up showing the activity below it when the pause times
out.

In particular pausing the secure camera exposes the activity on
the top of the stack if you turn the screen off and back on
immediately.

Immediately forcing the existing pause to complete when the screen
comes back on allows the keyguard to obscure anything that might
otherwise be shown.

Fixes bug 17713150.

Change-Id: Ibe275991aa325a7d326bf2a24511aeb4dcbb7e1b
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
1e910d17cef3ef21c09ead282b829ab7bb7bdedb 20-Nov-2014 Wale Ogunwale <ogunwale@google.com> am 70273e05: Merge "Stop activity onVisibleBehindCanceled()" into lmp-mr1-dev
automerge: 005080e

* commit '005080e5f8c3cfd7918bb9a62e36384d6a08351e':
Stop activity onVisibleBehindCanceled()
1f4c02bb18ef8e8cc0fecd6786209089f84de147 13-Nov-2014 Wale Ogunwale <ogunwale@google.com> Stop activity onVisibleBehindCanceled()

Once an activity is no longer visible behind and has released
its background resources, it is added to the list of activities
that can be stopped, but not actually stopped until the next
major event (like another activity starting). We now schedule
the idle processing once the background resources have been
released so the activity can be stopped as soon as possible.

Bug: 18191707
Change-Id: I472eee949c1a78b4d944454463f03c90e7d2618b
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
2240f806346a1a642881214fdde821f6d83b4841 12-Nov-2014 Jorim Jaggi <jjaggi@google.com> am d04f864c: am b9eedce2: Merge "Fix lockscreen launch animations once and for all" into lmp-mr1-dev

* commit 'd04f864cae1ae553398774692effb663b73f902c':
Fix lockscreen launch animations once and for all
44f60cca7bb31e2f9b4b7bf25bb2e0cfb0e3e1e1 07-Nov-2014 Jorim Jaggi <jjaggi@google.com> Fix lockscreen launch animations once and for all

In SysUI, make sure not to dismiss Keyguard multiple times when just
waiting for a deferred dismissal, so WindowManager doesn't get
multiple calls to keyguardGoingAway.

Change heuristics how notifying Keyguard about activity drawn works.
Always notify Keyguard after executing an app transition, and notify
it also when not doing a transition after a startActivity call.

For that to work, update AppWindowToken.startingDisplayed also when
the window is displayed, but force hidden because of Keyguard.

Further, handle the case correctly when a window gets added during
the Keyguard exit animation by overriding the start time for the
animation of that new window. Also don't apply a transition animation
for a window when executing keyguard exit animation, so by removing
a starting window we don't break this animation.

Last but not least, tell Keyguard to start exiting immediately if
animations for exiting are disabled, like when going to phone/camera
on lockscreen. Before, we always had a delay of 1 second because we
waited for the timeout.

Bug: 1599196
Bug: 18272544
Change-Id: I596b2489f814b934abd256e16079d3d3f326e209
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f82ab735a7d353bb400f0e6343f7553a8afa4887 11-Nov-2014 Prabhakar Thirumoorthy <prabhakar@google.com> am 2cc8043c: Merge "If task isn\'t found in recents, look in the stacks." into lmp-mr1-dev
automerge: d476bfd

* commit 'd476bfd01b7443d63381141d14a20833421d8657':
If task isn't found in recents, look in the stacks.
2cc8043cad4c51aeffd5650b669b15e93fb980d5 11-Nov-2014 Prabhakar Thirumoorthy <prabhakar@google.com> Merge "If task isn't found in recents, look in the stacks." into lmp-mr1-dev
e042bf2b22b391f13d8e43ddcd657183992c7197 11-Nov-2014 Craig Mautner <cmautner@google.com> If task isn't found in recents, look in the stacks.

It may take an attach to move a task into the recents list. If the
timing is right a task may not be in recents by the time we are
removing it from the stacks due to a finish. In that case we should
look in the stacks for the task as well as looking in recents.

Fixes bug 18017409.

Change-Id: Idcfe2e263c9d0fe9a063fdf22515ac4e7fe89ecb
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
95ef0ac77738eac98e4952fe1e94db64c1560f5e 11-Nov-2014 Dianne Hackborn <hackbod@google.com> am 525da301: am 85d558cd: Add Activity API to get referrer information.

* commit '525da301930e554dc331828adee35613f945c250':
Add Activity API to get referrer information.
85d558cd486d195aabfc4b43cff8f338126f60a5 04-Nov-2014 Dianne Hackborn <hackbod@google.com> Add Activity API to get referrer information.

This expands the use of EXTRA_REFERRER to be relevant anywhere,
allowing apps to supply referrer information if they want. However,
if they don't explicitly supply it, then the platform now keeps
track of package names that go with Intents when delivering them
to apps, which it can be returned as the default value.

The new method Activity.getReferrer() is used to retrieve this
referrer information. It knows about EXTRA_REFERRER, it can return
the default package name tracked internally, and it also can return
a new EXTRA_REFERRER_NAME if that exists. The latter is needed
because we can't use EXTRA_REFERRER in some cases since it is a Uri,
and things like #Intent; URI extras can only generate primitive type
extras. We really need to support this syntax for referrers, so we
need to have this additional extra field as an option.

When a referrer is to a native app, we are adopting the android-app
scheme. Since we are doing this, Intent's URI creation and parsing
now supports this scheme, and we improve its syntax to be able to build
intents with custom actions and stuff, instead of being all hung up
on custom schemes.

While doing this, fixed a problem when parsing both intent: and new
android-app: schemes with a selector portion, where we were not
respecting any scheme that was specified.

Change-Id: I06e55221e21a8156c1d6ac755a254fea386917a2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
22254f504f10a0190792060de2820ccf7323a84f 07-Nov-2014 Craig Mautner <cmautner@google.com> am 39f6be12: Merge "More fixes for keyguard animations." into lmp-mr1-dev automerge: 7b1b0f6

* commit '39f6be121627303d9c485832c4b730867151d9f8':
More fixes for keyguard animations.
42d04db459e5a510c8c815c38e17e419c3e3b404 06-Nov-2014 Craig Mautner <cmautner@google.com> More fixes for keyguard animations.

Add a state machine for calling comeOutOfSleepIfNeededLocked() so
that it is only called after the lockscreen has started dismissing
but not before resumeTopActivityLocked(). Also keep
resumeTopActivityLocked() from being called from
comeOutOfSleepIfNeededLocked() recursively.

Have starting windows count towards notifying the keyguard that a
window has been drawn.

Do not update wallpaper animations based on their not being included
in the windows being animated if there are no windows being animated.

And always improve logging.

Fixes bug 15991916.

Change-Id: I0d21c5337f0e89d9eacc8dab2cdaa52fec43ac0b
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
9be76b0e4054e954e84e1317353e55a137bbb1a3 05-Nov-2014 Wale Ogunwale <ogunwale@google.com> am ed247003: Merge "Fix issue #18240452: No recents screenshot when resuming from keyguard." into lmp-mr1-dev automerge: c56a1f1

* commit 'ed247003857b7d1c0200a2e3102a6d263eb457bb':
Fix issue #18240452: No recents screenshot when resuming from keyguard.
d3e2a0891b9710dc63fbc15800e7c45909301737 05-Nov-2014 Wale Ogunwale <ogunwale@google.com> Fix issue #18240452: No recents screenshot when resuming from keyguard.

WindowManager.keyguardGoingAway() isn't called early enough when you exit
the keyguard by clicking on a notification. So, the WindowState for the
preivous activity behind the keyguard is never transitioned to visible
and the activity manager then fails to take the screenshot for recents.
We will now be taking a screenshot of the activity before we go to sleep
so we are not dependent on signals from the keyguard.

Change-Id: I2acb2ad7a627d4e446ba11c9a0842d21fa6922d3
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
bee6dfe09d4381f9ddf666fd04012c662f31e7fd 02-Oct-2014 Craig Mautner <cmautner@google.com> am 8a33674b: am 3867e4d0: am 9ab8fbbc: am 245645ca: Merge "Don\'t clear visible-behind activity if it is top" into lmp-dev

* commit '8a33674bed6791c63eee9d798693e25bc07b7cba':
Don't clear visible-behind activity if it is top
6f357112f867173bc43ee5ecc3c1b9d91271a9e2 02-Oct-2014 Craig Mautner <cmautner@google.com> am 245645ca: Merge "Don\'t clear visible-behind activity if it is top" into lmp-dev

* commit '245645ca460150b4030d84c88faa931345a90a50':
Don't clear visible-behind activity if it is top
d1ac9bd2bd599e9bbefd2143cea4ae886157815c 02-Oct-2014 Wink Saville <wink@google.com> Merge commit '62321ab1' into fix-merge-conflict-lmp-dev-plus-aosp

* commit '62321ab1':
Maybe fix issue #17700474: manta: high occurrence of device booted...

Conflicts:
services/core/java/com/android/server/am/ActivityManagerService.java

Change-Id: I7d472115d83a3dde326f991c245b2c6fed29e00c
ed49288a002369579918cd303eed14d9738b76fb 01-Oct-2014 Wink Saville <wink@google.com> Merge commit '62321ab1' into fix-merge-conflict

* commit '62321ab1':
Maybe fix issue #17700474: manta: high occurrence of device booted...

Conflicts:
services/core/java/com/android/server/am/ActivityManagerService.java

Change-Id: Ica4d544d11c1f81be793bdb4dea610396b32e946
245645ca460150b4030d84c88faa931345a90a50 01-Oct-2014 Craig Mautner <cmautner@google.com> Merge "Don't clear visible-behind activity if it is top" into lmp-dev
64ccb7086741d520c041273610519a5c2f65b440 01-Oct-2014 Craig Mautner <cmautner@google.com> Don't clear visible-behind activity if it is top

Previously if an activity requested to keep running behind
translucent activities (Activity.requestVisibleBehind()) and then
converted itself to opaque (Activity.convertFromTranslucent()), we
would clear the visible-behind activity. This change tests to see
if the top activity is the visible-behind activity and does not
clear it in that case.

This change also clears the visible-behind activity whenever it
comes back to the front. That forces the activity to call
requestVisibleBehind() each time it is resumed.

Fixes bug 17648436.

Change-Id: Id0fc4d7e2a2b907675305d98bad1b08cb610919e
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7622a0f8e4198adf0aae5d4e167ee132b34f4cdb 30-Sep-2014 Dianne Hackborn <hackbod@google.com> Maybe fix issue #17700474: manta: high occurrence of device booted...

...but dev.bootcomplete flag is not set

Rework things to address a few issues I found:

- When the activity goes idle, the way we were handling finishing the
boot there was calling finishBooting() with the lock held, but it
shouldn't. We now dispatch that and turning on the screen together
in a separate message.

- Make sure we don't try to start the home activity until we have
reached the point of the system being ready and mBooting being set.
This ensures we don't do any work prematurely.

Change-Id: If30c1f287af73bc2164e7aadbe98022ae42cc5e7
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
ae6865522e2dd3a9bc0bd3d95f669bff4a415d2f 20-Sep-2014 Dianne Hackborn <hackbod@google.com> am 0eec7efe: am 423a1069: am cec64f46: am da7e72b1: Merge "Fix issue #17492300: NavUtils.shouldUpRecreateTask returns different..." into lmp-dev

* commit '0eec7efe935d3eeb9d5fe52eb5c7cf0ca2463b49':
Fix issue #17492300: NavUtils.shouldUpRecreateTask returns different...
77290e69a2d4b266d23183269c08dc284634699d 20-Sep-2014 Dianne Hackborn <hackbod@google.com> am c34f5727: am da7e72b1: Merge "Fix issue #17492300: NavUtils.shouldUpRecreateTask returns different..." into lmp-dev

* commit 'c34f5727986ab3dd84ea10d3f783805392954469':
Fix issue #17492300: NavUtils.shouldUpRecreateTask returns different...
f3eb843665d0e52729a7063442f1c229568c3118 20-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17492300: NavUtils.shouldUpRecreateTask returns different...

...value in L

Only do the new logic when the task is a document.

Change-Id: I4664b94a3fe86ea266c2feb4e889c14c06751a15
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c581561fc011b1675d520f0250115f2a959bae45 17-Sep-2014 Dianne Hackborn <hackbod@google.com> am e2de4ac1: am ff6eebd6: am b68528cd: am 3061d2b9: Merge "Fix issue #17507017: took ~3 seconds to move an app to the foreground" into lmp-dev

* commit 'e2de4ac106719ace45b16e822e1eff1bc289ed75':
Fix issue #17507017: took ~3 seconds to move an app to the foreground
c73c2fd55f0c3adde26dfa3a6f9fd26cd388b124 17-Sep-2014 Dianne Hackborn <hackbod@google.com> am 3ca3e107: am 596d38f8: am 1e4d9476: am 1a7cb969: Merge "Fix issue #16662560: SingleTop activity is getting instantiated multiple time" into lmp-dev

* commit '3ca3e107acec9967c3d8b6ea819835f4f9b14b87':
Fix issue #16662560: SingleTop activity is getting instantiated multiple time
f13f4735ca7ddf30da8f2edf3555ed1a42d84097 17-Sep-2014 Dianne Hackborn <hackbod@google.com> am 8ee35cd4: am 3061d2b9: Merge "Fix issue #17507017: took ~3 seconds to move an app to the foreground" into lmp-dev

* commit '8ee35cd4cd4242e30f6b989dd4746166fbe58dcc':
Fix issue #17507017: took ~3 seconds to move an app to the foreground
877f2b86cfd72d7fad1e50c4301f6e034ea954f5 17-Sep-2014 Dianne Hackborn <hackbod@google.com> am af9e070e: am 1a7cb969: Merge "Fix issue #16662560: SingleTop activity is getting instantiated multiple time" into lmp-dev

* commit 'af9e070e0b0940de568fe19d65fe19b3a22cfb1e':
Fix issue #16662560: SingleTop activity is getting instantiated multiple time
603537986568e6be03d167a431505739e9357ed5 17-Sep-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #17507017: took ~3 seconds to move an app to the foreground" into lmp-dev
7922882189a5c1cc62de7e91b067f90d9a3e2f2b 16-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #16662560: SingleTop activity is getting instantiated multiple time

Introduce a concept of a "root affinity" to a task -- this is the
affinity of the initial activity in the task. Use this instead of
the current affinity in findTaskLocked(), where we look for an
existing task to use for a NEW_TASK intent.

This changes the semantics of the new "relinquish task identity" mode
so that it doesn't relinquish the root affinity of the task. This
means when we are in the old style application-based recents matching
of findTaskLocked(), we will never count these tasks as the same as
the application's tasks only because they have relinquished their
identity to that application. This is probably okay, it is basically
putting a different line between new document-centric recents and
old application-centric recents when they are mixed together.

Change-Id: I73a22ead9bd08e98bf67ad035a017f828c6a6715
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
95465200b0f652c48d40ca1028238763dd647900 16-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17507017: took ~3 seconds to move an app to the foreground

This is because of the 5 second timeout from when the user can bring
home to the foreground until regular third party apps can launch an
activity on top of it. Activities launched from notifications look
like they are being launched by the app, so get impacted by the timeout.

Fix this be also looking at the actual caller to see if they are
allowed to pop in front regardless of the timeout.

Change-Id: I63fbc2bcabf585e6d2810a2309f0613fdf91fdf5
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
cec6f37a7c214e2a744fa1d8b65b3c4a156393d9 15-Sep-2014 Dianne Hackborn <hackbod@google.com> am f29a8d99: am 601e63e8: Merge "Fix issue #16907799: Processes containing bound services..." into lmp-dev

* commit 'f29a8d99ce874490935113037fda887a8d3532eb':
Fix issue #16907799: Processes containing bound services...
465fa3963534e41ead0dce1273b71fd50c58c973 14-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #16907799: Processes containing bound services...

...are killed over eagerly.

When the current foreground activity is moving to the background,
it was briefly going through the CACHED_ACTIVITY state before the
correct LAST_ACTIVITY state, allowing its bound service processes
to be killed (because they went in to the cached list). To solve
this, as long as a process has stopping activities, it won't go
lower than LAST_ACTIVITY.

Also fixed a problem where we could put a process in CACHED_EMPTY
instead of CACHED_ACTIVITY_CLIENT. There were a number of cases
in the binding flow and also the client process state transitions
where we would not correctly updateing the bound client activity
state.

And add some sanity code so that if a process hosting a
service is killed, and a client process of that service is in the
cached state, we kill the client process. This avoids situations
where we can start thrashing around in the cached list because we
are restarting process for no reason -- since they will just
continue to be cached.

Finally, tune the process LRU list to allow twice as many cached
activity processes (from 8 to 16), so we can make better use of
the RAM we have available these days.

Change-Id: Ib0cdf78c321cbb035259fc9dd6ee27b5ba1f90c5
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
4bde299148580913eb392585617a6027b407f4b2 11-Sep-2014 Dianne Hackborn <hackbod@google.com> am 14a0ec03: am 022cfcda: Merge "Fix issue #17414533: update batterystats occasionally takes a couple..." into lmp-dev

* commit '14a0ec0324a9aa5ce7bc2c767c744092fd128143':
Fix issue #17414533: update batterystats occasionally takes a couple...
652973fca83c48d8b4622493f10e656b8d86dd17 11-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17414533: update batterystats occasionally takes a couple...

...hundred milliseconds.

Rework the locking so that no critical paths block on the cpu collection.

Change-Id: Ie615a033f7f8b523b67abee62c581d1a8fce324c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e05da2757c10d31ee663f04dc72a69aba03ac690 08-Sep-2014 Craig Mautner <cmautner@google.com> am b36ef767: am 851f7eb5: Merge "Ignore finishing activities when fetching the top" into lmp-dev

* commit 'b36ef767ba68b66457b05c9b185a45fd595fb4ed':
Ignore finishing activities when fetching the top
d2a38c78543c913da851d6c377c1890a20516a23 08-Sep-2014 Craig Mautner <cmautner@google.com> Merge "Ignore finishing activities when fetching the top" into lmp-dev
0175b882b5e021907c307ab0e455bff014ad8784 08-Sep-2014 Craig Mautner <cmautner@google.com> Ignore finishing activities when fetching the top

When the top activity is finishing we don't want to be comparing
it for matches to launching activities. This was keeping curTop
from matching itself when launching a lower task.

Fixes bug 17383648.

Change-Id: I837ac087ef965d99d12c98ab1c779de46716e204
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7bc4c083236dfbb0a82e668878e4c0f7b399187c 07-Sep-2014 Dianne Hackborn <hackbod@google.com> am 8c7be259: am 6a83e4d1: Merge "Work on issue #17357238: Recents is often slow if not used in a while" into lmp-dev

* commit '8c7be25983e44e8e1bfcb721f50ae23ca7aabf32':
Work on issue #17357238: Recents is often slow if not used in a while
a4e102ee580282dc7abeb22f4a025813e53b9431 05-Sep-2014 Dianne Hackborn <hackbod@google.com> Work on issue #17357238: Recents is often slow if not used in a while

Add a new activity attribute, resumeWhilePausing, that allows an
activity specifying it to immediately start running without waiting
for the previous activity to pause. The recents activity is updated
to use this.

The implementation of this is ultimately fairly simple -- if we are
in the path of resuming such an activity, and find that we first need
to pause the existing activity, then within the activity manager we
do the regular pause flow but act like it has immediately finished
pausing right then so that we can immediately go on to the resume.
To make this clean, we tell the activity when asking it to pause that
it should not come back and tell us it is done, because we aren't in
any way waiting for it.

One potentially important change I needed to make here is the pause
callback no longer provides the saved persistent state, because we
now can't count on that callback happening. I don't think there was
really any utility in this anyway -- all modern apps will have their
save state flow happen as part of stopping, not pausing, so we'll
only capture that saved state when the stop is reported back anyway.
And since we do send the saved state back when stopping, it would
always blow away whatever we had gotten at the pause.

Finally, update the documentation for AppTask.startActivity(), and
fix the implementation handling that to be cleaner -- we need to
deal with inTask first before getting in to "oh noes add NEW_TASK
if this isn't coming from a calling activity" flow.

Change-Id: Ia1da0fac90d7bdbaafdda2e34850d795ce17a39f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
53b07246de5beeaf1b541bb4b84e564113b6ccfd 05-Sep-2014 Craig Mautner <cmautner@google.com> am 6a7356b0: am 4075b321: Merge "Prevent recursion in resumeTopActivityLocked" into lmp-dev

* commit '6a7356b001a3e9e192a420146c63406ecc27fdf8':
Prevent recursion in resumeTopActivityLocked
46edee0994354e828bd6d0bffe60b6036b8c1388 05-Sep-2014 Craig Mautner <cmautner@google.com> Merge "Prevent recursion in resumeTopActivityLocked" into lmp-dev
544efa76639b46e4177b385d498fca60c8b6ded5 05-Sep-2014 Craig Mautner <cmautner@google.com> Prevent recursion in resumeTopActivityLocked

The existing recursion in resumeTopActivityLocked() finally caused
a problem by attempting to pause the same activity twice. By
preventing the recursion with this change we no longer face that
problem.

Fixes bug 17260463.

Change-Id: I0954614fc1a7dc0eeeef9335c1b973a42a7fc345
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
2d0368a775193230c8df41084868b485effcaa3c 05-Sep-2014 Dianne Hackborn <hackbod@google.com> am 33435c99: am 10053171: Merge "Fix issue #17175312: Calendar crashed when tapping on the event notification" into lmp-dev

* commit '33435c99a5235b07780b59b43ee5eec4810d1535':
Fix issue #17175312: Calendar crashed when tapping on the event notification
925e2b335237153648ecad84d5fa280669f4cf1a 04-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17175312: Calendar crashed when tapping on the event notification

mActivities can be null.

Change-Id: I9cc1a08d19d2c38a4ebaaf0ed2168cfbeeaf3b51
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
19042f10fa9612a6d0cb6a990269b08d440f54dd 28-Aug-2014 Winson Chung <winsonc@google.com> am ef390cca: am 62354353: Merge "Change API to return thumbnail size instead of individual dimensions. (Bug 17295512)" into lmp-dev

* commit 'ef390cca57352e4284827981d39d6cb600b2811d':
Change API to return thumbnail size instead of individual dimensions. (Bug 17295512)
48a10a56e98b008ac55b9d50aee1ad33b377e367 27-Aug-2014 Winson Chung <winsonc@google.com> Change API to return thumbnail size instead of individual dimensions. (Bug 17295512)

- Fixing issue where we were pulling the thumbnail dimensions too early in AMS. (Bug 17286904)
- Simplifying the Recents code between start & configuration change

Change-Id: I6d667cbf37b844939e5fc466da613bb78ca05082
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
339878e1a5aaf3d2e760beddefa06ed01ad4eb5a 27-Aug-2014 Jorim Jaggi <jjaggi@google.com> am 3d9509d3: am ddf411d6: Merge "Fix that Keyguard didn\'t always get onActivityDrawn call" into lmp-dev

* commit '3d9509d3bc6409a5600d23e1ded2eaa431c0cad9':
Fix that Keyguard didn't always get onActivityDrawn call
4c499be0edc24eb2e2b9705dba52a2059823e4aa 27-Aug-2014 Jorim Jaggi <jjaggi@google.com> Fix that Keyguard didn't always get onActivityDrawn call

Bug: 16481924
Change-Id: I299645c940c71820aa7dc70985e41da869f1368a
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
3cc8dbb87e42e92c9881ba8bd887287194341c67 27-Aug-2014 Dianne Hackborn <hackbod@google.com> am bad701ee: am 61b7055e: Merge "Fix issue #17179314: Make recents limits consistent" into lmp-dev

* commit 'bad701ee645948d92982bad90e4d4cfc868e6816':
Fix issue #17179314: Make recents limits consistent
852975d5377bfe5f4abc9d2a28e301aa2fa99994 23-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17179314: Make recents limits consistent

The max limit is now 100 (or 50 on svelte devices), and that is
what everyone used.

Re-arranged things so we have a big expensive "fix the world!"
function for recents that we go in to at only select points:
when first initializing the system, when external storage comes
and goes, and if we detect something wrong with the recents
structure.

With that, now getRecentTasks() and addRecentTaskLocked() are
generally much simpler, doing very little work in most cases.
This will help a lot with scaling up to many more recents
entries.

Change-Id: I7b5ae89edc06568f68c8af54a4420aff7635581c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
302da59d8b673499c69efda4078c8927f3f1a1c3 26-Aug-2014 Dianne Hackborn <hackbod@google.com> am f1bb15d2: am 55953caa: Merge "Fix issue #16311398: Limit number of documents a process can open" into lmp-dev

* commit 'f1bb15d214bdb70e348ee7d649c1249a67434534':
Fix issue #16311398: Limit number of documents a process can open
89ad456ea49cb62615ebdcac83a2515743bbe5fa 25-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #16311398: Limit number of documents a process can open

In application processes, monitor for when we start getting close
to the Dalvik heap limit, and ask the activity manager to try to
prune old activity instances in that case.

Add an explicit API for apps to ask that they have their own
activity instances cleaned up, if they want.

Fix some bugs in launching activities that were not correctly
applying the "multi task" behavior in the appropriate situations
of document-centric recents.

Clean up the activity manager's process removal code to all share
a common path.

Add a new "Spam" option to ActivityTests, which continually creates
new tasks, checking that the activity manager will now prune old
tasks rather than letting the app run out of RAM.

And while I was was doing this, I found problems with the path
for bringing an empty task to the foreground -- it could make
a new task instead of re-starting the root activity in the
existing task. This is fixed, and some code in the recents
UI for working around the bug is removed.

And as long as I am doing that, we now have nice hooks in to
the activity manager for AppTask to give some APIs for better
managing the task, so add those along with more tests for these
APIs in ActivityTests.

We should look at also having the activity manager try to prune
old tasks when it sees app processes being killed, to better balance
memory use across multiple processes when some processes may host
many documents. That however is for another CL...

Change-Id: I2bb81c3f92819350c868c7a7470b35817eb9bea9
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e98a423e40410fbef27bcc434f060e717c2f6c36 26-Aug-2014 Dianne Hackborn <hackbod@google.com> am 2e4f0834: am 8db0a171: Merge "Fix issue #16366571: UIDs for work and normal Chrome processes are the same" into lmp-dev

* commit '2e4f0834b4630484fa42d2ab6f0c59752d845a22':
Fix issue #16366571: UIDs for work and normal Chrome processes are the same
4cce1de9fe95ffc3b968de87579a543a461f96bb 26-Aug-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #16366571: UIDs for work and normal Chrome processes are the same" into lmp-dev
885fbe5c070cf1579c96ab8e150449af00e16501 24-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #16366571: UIDs for work and normal Chrome processes are the same

Use uid as main key for determining which app tasks a caller has
access to.

Change-Id: Ibbe3f0f64197671d279c3fc519edfc720d442938
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
9986e646433941dff16dd198d5c64361ea9f778e 22-Aug-2014 Dianne Hackborn <hackbod@google.com> am ceb86f91: am f5b988b8: Merge "Work on issue #17011123: Hit Back/Recents button when in Recents..." into lmp-dev

* commit 'ceb86f912d9cc0cc0fa62f712b0105a5d239a973':
Work on issue #17011123: Hit Back/Recents button when in Recents...
6f4d61ff2e3143bea37bbc1a7a2a0ab415b2c88a 22-Aug-2014 Dianne Hackborn <hackbod@google.com> Work on issue #17011123: Hit Back/Recents button when in Recents...

...without interacting with any of the Recents items should not bring
Home back to top

Up navigation needs to be smarter about multi-document and in the case
of being at the root of a document know to re-construct a task for
the app.

Change-Id: Ief874e46e9a9897379dda1010bcce4c5b03d82f1
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
865bac56f5c9a93826474a88064eba7d70c9f6f5 21-Aug-2014 Dianne Hackborn <hackbod@google.com> am a7d4d7bc: am ee6e179e: Merge "Fix issue #17038762: Add API to add entries to the recents list" into lmp-dev

* commit 'a7d4d7bcfa51aa6d556652141a34c497bb4132d0':
Fix issue #17038762: Add API to add entries to the recents list
aec68bb89fe614181a20eb97340149406218ce2f 21-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17038762: Add API to add entries to the recents list

New API Added to ActivityManager for adding an entry. See docs
there.

Repercussions:

- I hit a bug in system UI where if the thumbnail has alpha, it tries
to modify it, but thumbnails are loading immutable so crashes. Fixed
this by loading the bitmaps to be mutable.
- Improved dump output of recents; there was a lot of stuff missing.
Also split the recents dump output from the rest of the activity
output, since it can be really large.
- Added tests to the lovely ActivityTest app.

Bonus: new method on AppTask to control the exclude from recents flag.

Change-Id: I01e543db4d15320ee1701e95872fef73c116526c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f082842f2bd4764776dbe71accbc66bdb1391fbd 14-Aug-2014 Jose Lima <joselima@google.com> am b991fd6e: am ec8834a3: Renamed "media playing" APIs to "visible behind"

* commit 'b991fd6ec57b0f59e20f85a9cb9c63ac9d0ab98a':
Renamed "media playing" APIs to "visible behind"
4b6c6697da5a20c08b2f9f2ca40c94008477e914 13-Aug-2014 Jose Lima <joselima@google.com> Renamed "media playing" APIs to "visible behind"

- Request from API Review: rename the media playing APIs to a more
generic name, reflecting the background visibility feature these
methods actually control.
- Made the new isActivityVisibleBehind().
- Changed convertFromTranslucent() and convertToTranslucent() to be
SystemApi.

Bug: 16959028
Change-Id: I526eac22f44273b3254dd6201f89194d13e597e2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
728f39f5783ecd2a5491a43c47443fb9e16549b2 13-Aug-2014 Jorim Jaggi <jjaggi@google.com> am 119b3c40: am 36abea42: Merge "Lockscreen launch animations" into lmp-dev

* commit '119b3c40078d532dce4b1de56f4645b6ea587874':
Lockscreen launch animations
8de4311c51229efbe2f2d0afbf298982c5cadd96 11-Aug-2014 Jorim Jaggi <jjaggi@google.com> Lockscreen launch animations

- Get rid of ActivityManager.dismissKeyguardOnNextActivity, which was
used for two different things: Dismiss keyguard from somewhere else
(not really necessary anymore), wait to actually dismiss keyguard
after the window behind is drawn. Instead, introduce
keyguardWaitingForActivityDrawn(), and change the semantics where
necessary.
- Make wallpaper_close_enter consistent with task_open_enter and the
Keyguard launch animation.
- Close the panel even on lockscreen when launching a notification.
- Block notification shade updates during the collapsing motion so
notification don't play the disappear animation immediately after
having launched a notification.

Bug: 15991916

Change-Id: I133c177b84e926c87c1a404ba93d633593fec3ab
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
8f3e9e209473c8c61a0d4862c51a4d35d64466c3 08-Aug-2014 Craig Mautner <cmautner@google.com> am 408f22c1: am 6cb91260: Make next activity opaque when media stops

* commit '408f22c1ebfac63f90d89fbad091974957af98ee':
Make next activity opaque when media stops
fa387ad6cfa996d09050f8f6c39eaa0537893d20 05-Aug-2014 Craig Mautner <cmautner@google.com> Make next activity opaque when media stops

Call convertFromTranslucent on next activity when an activity below
it stops playing media.

Fixes bug 14469711.

Change-Id: I7e4346987cb620cb3a8c09096ff3a639cf344679
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
689e2752923d56f3cf6615241923b08a3d78e350 31-Jul-2014 Craig Mautner <cmautner@google.com> am f37034ac: am 905fe15e: Merge "[ActivityManager] Avoid mistaking visibility by finishing task."

* commit 'f37034aca6e04d170a3abd2e9b19dcfd711c4e82':
[ActivityManager] Avoid mistaking visibility by finishing task.
7544c829972d5ea33ab2ac9ec1e9a4974909d8d8 29-Jul-2014 Craig Mautner <cmautner@google.com> am 09875ec7: am 0fa45d93: Merge "Remove PendingActivityLaunches based on stack." into klp-modular-dev

* commit '09875ec7292b19e07c38b6127406d6aa7490e26c':
Remove PendingActivityLaunches based on stack.
09875ec7292b19e07c38b6127406d6aa7490e26c 29-Jul-2014 Craig Mautner <cmautner@google.com> am 0fa45d93: Merge "Remove PendingActivityLaunches based on stack." into klp-modular-dev

* commit '0fa45d93f7265c130d5dc49a51130ed74db5cec9':
Remove PendingActivityLaunches based on stack.
0fa45d93f7265c130d5dc49a51130ed74db5cec9 29-Jul-2014 Craig Mautner <cmautner@google.com> Merge "Remove PendingActivityLaunches based on stack." into klp-modular-dev
7f13ed37fd2a0533fa7c5e330519decd89fdc1d5 28-Jul-2014 Craig Mautner <cmautner@google.com> Remove PendingActivityLaunches based on stack.

Was previously removing by trying to match activities, but the
activity being matched would not have been in the stack yet. Since
it doesn't get added to the stack when it goes into the list
of pending activities. By removing all pending activities associated
with the stack we clean up all such pending activities.

Fixes bug 16045752.

Change-Id: I6b5981ffcce674139837b06362e573299bbc9e52
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
a9c5257a15f2efb5c017d2ecadb5a7360230bfee 25-Jul-2014 Craig Mautner <cmautner@google.com> am a0bb44ef: Merge "Finish crashed activities immediately" into klp-modular-dev

* commit 'a0bb44efe96ca70635b64dac8922b225d1a19407':
Finish crashed activities immediately
8e5b133bf63c0f29ce059bf0ef05695a2f7f99b8 24-Jul-2014 Craig Mautner <cmautner@google.com> Finish crashed activities immediately

By finishing crashed activities right away the VirtualDisplays
associated with ActivityView are removed immediately rather than
being deferred. Also there is no waiting for Pause (0.5 sec) and
Destroy (10 sec) timeouts to expire.

Fixes bug 15092354.

Change-Id: Ie4941cb19dcc6f6fc61b2475162ea2794c9558a2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
9bcc6e83d98dc5608d15f38c12d397be650c637c 30-Jul-2014 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Avoid mistaking visibility by finishing task.

Cherry-picked from aosp into lmp-dev.

Sympton:
Next activity only adds to history but does not launch/resume then results ANR.

Root Cause:
In a rare timing, some windows are switched at the same time,
it will cause some finishing records on the top temporarily,
then set startIt to false that skip to resume the real top activty.

Solution:
If all activities in a task are finishing, do not use it to check.
The behavior/checking is the same concept as in JellyBean:
// If starting in an existing task, find where that is...
boolean startIt = true;
for (int i = NH-1; i >= 0; i--) {
ActivityRecord p = mHistory.get(i);
if (p.finishing) { // <--
continue;
}

Change-Id: I9d81a7b5182400c52e173da23eee61c74692beee

Conflicts:
services/java/com/android/server/am/ActivityStack.java
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6ba042b51496b9763d721b6dca8a591c323d648c 28-Jul-2014 George Mount <mount@google.com> Make returning ActivityOptions part of ActivityRecord.

Bug 16626030

Getting the timing correct for when to clear returning activity options
was difficult when Activities can be destroyed and recreated. Moving
the returning ActivityOptions to the ActivityRecord forces the
ActivityOptions to only apply to the correct Activity.

Change-Id: Ib5400b157eb741ae484aae0cc83172a3db637a3e
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
040491594d922177c892d377bfff17b272bb6611 25-Jul-2014 Craig Mautner <cmautner@google.com> am 053ce1e7: am 40185726: am a9c5257a: am a0bb44ef: Merge "Finish crashed activities immediately" into klp-modular-dev

* commit '053ce1e7a85e3ca7820a3b9e1b2c203d1a1a345b':
Finish crashed activities immediately
5ec618e3c3163928bd4c1109756764fcd9f90dae 25-Jul-2014 Craig Mautner <cmautner@google.com> am a9c5257a: am a0bb44ef: Merge "Finish crashed activities immediately" into klp-modular-dev

* commit 'a9c5257a15f2efb5c017d2ecadb5a7360230bfee':
Finish crashed activities immediately
a8f076e8c3e4750d9860cc24376838bad73ba7a1 25-Jul-2014 Nicolas Prevot <nprevot@google.com> am e7469eca: am c50bbc02: Merge "Migrate extras to ClipData for image/video capture intents." into lmp-dev

* commit 'e7469eca60b76931830e3679788865ee8582add1':
Migrate extras to ClipData for image/video capture intents.
d1c99b1fe85ed03261a77a14ae52e7fa3a6e523a 04-Jul-2014 Nicolas Prevot <nprevot@google.com> Migrate extras to ClipData for image/video capture intents.

The intents ACTION_IMAGE_CAPTURE, ACTION_IMAGE_CAPTURE_SECURE and ACTION_VIDEO_CAPTURE are now handled in a way
similar to ACTION_SEND and ACTION_SEND_MULTIPLE.
Migrate the uri in the EXTRA_OUTPUT extra to clipData, and add the flag GRANT_WRITE_URI_PERMISSION.

The userIds are now added to extra uris in the process receiving the intent, (not in the system process), because the
system process may not be able to parcel/unparcel the extras.

BUG: 15534203

Change-Id: I8f79666b726bc6d7745bf777ad3c7518945c5cc3
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
25dd00a5192e064c13dc367d22230fd31c3bab48 17-Jul-2014 Craig Mautner <cmautner@google.com> am 73c69b27: am c2d339a6: Merge "resolved conflicts for merge of 0a931069 to lmp-dev" into lmp-dev

* commit '73c69b2727b311d12f1ca8ad197db7cbe83d162c':
Additional cleanup after stack deletion.
aa9b0f15753541ff8e4d62e6497c11800c737077 17-Jul-2014 Craig Mautner <cmautner@google.com> resolved conflicts for merge of 0a931069 to lmp-dev

Conflicts:
services/core/java/com/android/server/am/ActivityManagerService.java
services/core/java/com/android/server/am/ActivityStackSupervisor.java

Change-Id: I68e8290566b51fadb5671abdd9d05faf28502e22
0a93106964eec2462ec86e372def1b0d1526cd7d 17-Jul-2014 Justin Koh <justinkoh@google.com> am 65d7c332: Merge "Additional cleanup after stack deletion." into klp-modular-dev

* commit '65d7c332d7b613f23a26066051cc7496e0efa994':
Additional cleanup after stack deletion.
ee36c77acd3b92c64e53e19c570e2482382db870 16-Jul-2014 Craig Mautner <cmautner@google.com> Additional cleanup after stack deletion.

- Remove activity from PendingActivityLaunch list when it is removed
from stack. This prevents the delayed launch causing
IllegalArgumentException in b/16045752.
- Move PendingActivityLaunch from ActivityManagerService to
ActivityStackSupervisor.
- Immediately call onTaskListEmptyLocked() in cases where no
activities are found in stack.

Fixes bug 16045752.

Change-Id: Ia69a449e7f5e08ab6e36157d0fd793c4d2fdaca4
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f33f4d7f60eb11ef288961cd00dec0ff06373a15 16-Jul-2014 Craig Mautner <cmautner@google.com> am 15c2da7c: am 2e7b2521: Merge "[ActivityManager]: Update home process when home activity resumed"

* commit '15c2da7ce51ad1c1cbb07602644fa7291e8c7896':
[ActivityManager]: Update home process when home activity resumed
76ae2f07e04ae5288a8c485a0c37e844743e012b 16-Jul-2014 Craig Mautner <cmautner@google.com> am 07c3b195: am d543c3e1: Merge "[ActivityManager] Do not finish root activity when reset task"

* commit '07c3b19556b03a51c661b21c19c16deebab6065b':
[ActivityManager] Do not finish root activity when reset task
bb742462781a73bb25516067c8fe6311c1c8a93e 08-Jul-2014 Craig Mautner <cmautner@google.com> Launch activity behind launching task.

Use ActivityOptions.makeLaunchTaskBehindAnimation() to launch tasks
behind the current task. Includes animations for launching and
launched tasks.

Fixes bug 16157517.

Change-Id: I0a94af70b4748592e94673b958ee824cfb3d7ec0
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
0b23e20be6121286567726e995cf3617c022a844 15-Jul-2014 Craig Mautner <cmautner@google.com> Merge "Add null check" into lmp-dev
3b1dac8c5aea2aaf12453aa8063630bd6bde0a92 15-Jul-2014 Craig Mautner <cmautner@google.com> Add null check

Fixes bug 15847145.

Change-Id: Ia4d223da578bc38516824dd82dd3c5b8d58328dd
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
01e9a97fe68dbba42a0edd0ad965ccfe2b8efe7d 10-Jul-2014 George Mount <mount@google.com> Don't lose ActivityOptions during orientation change.

Bug 16188506

Change-Id: I056153e6ddbaf328dd65b8b27a91ae773c33ea22
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
a2ff611fd6312510f03a2556c2932f87ba3144af 15-Jul-2014 Alan Viverette <alanv@google.com> resolved conflicts for merge of dca272b8 to lmp-dev

Change-Id: Ifbd10ace66f7488f225bfae6e26bab60ab56e651
dca272b8c21f2910424496b97cd9b7a558008876 11-Jul-2014 Michael Kolb <kolby@google.com> am 0cb38d2e: Merge "Add configuration for activity thumbnails" into klp-modular-dev

* commit '0cb38d2e5ab32fd34c8129f3c2d1c158bad9abc3':
Add configuration for activity thumbnails
5f6238e4a7b2b54c4852852bd9bf045f387a5e42 10-Jul-2014 Michael Kolb <kolby@google.com> Add configuration for activity thumbnails

Bug: 15750584

Change-Id: I0b2bfb46022b46d7649f6d9ba9ba74cdfc70a6ea
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
a228ae95ea2f842c0e84f237c64bf032689410dd 09-Jul-2014 Craig Mautner <cmautner@google.com> Add task affiliation

Introduces new flag Intent.FLAG_ACTIVITY_LAUNCH_BEHIND which
causes the newly launched task to affiliate with the launching task.
(Later this flag will also launch the task behind the current task).
This shows up in a new member of the RecentTaskInfo class. This also
causes the recents list returned by getRecentsInfo to be rearranged
so that affiliated tasks are together.

Fixes bug 16157517.

Change-Id: Ia1386af50da2f01809278b62d249f05c6a0de951
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
083baf99ff1228e96ede96aac88c8200c4fdc2b2 11-Jul-2014 Winson Chung <winsonc@google.com> Fixing a few potential crashes, preparing for Task affiliations framework changes.

- Deferring widget host listening to speed up startup
- Ensuring that we animate to the right task position in the stack and not just the front-most
- Removing assumption that we can only get screenshots for the most recent task
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
9d8a30d9e1c17877cd45686a8f6aa70142c33573 07-Jul-2014 Craig Mautner <cmautner@google.com> am a7f02a5c: am ef2e7667: Merge "[ActivityManager] Avoid keeping restarting home when only home activity exists."

* commit 'a7f02a5cda27147fe7076805187fb6fbc60fdcfb':
[ActivityManager] Avoid keeping restarting home when only home activity exists.
ee2e45acbff28986c2ced636b7550d0afbb0eeb7 27-Jun-2014 Craig Mautner <cmautner@google.com> Add Media Playing API

These methods permit an activity to play or continue playing media
behind a translucent activity above it. Particularly the home
activity in Android TV. Methods exist to notify the upper activity
when playing starts or stops and for notifying the playing activity
when to stop playing and release its resources.

Methods are called when either activity's state changes or new
activities are launched.

Fixes bug 14469711.

Change-Id: I7ba10c5a4683504931cffa228488f5281e5bbf86
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
468f7da79715cd7445a854ee118312cff4f2f1fd 08-Jul-2014 George Mount <mount@google.com> Merge "Introduce onNewActivityOptions for return activity"
eb8abf7207aa118065999514f9248affbdd94de1 03-Jul-2014 Craig Mautner <cmautner@google.com> Introduce onNewActivityOptions for return activity

When an activity that is already translucent returns to the
previous activity using a scene transition the receiving activity
did not receive its ActivityOptions for its side of the animation.
The new method onNewActivityOptions() delivers those options.

Fixes bug 14869070.

Change-Id: I09b136b3213aae5d3521894e17a7500ac793f3d2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6ea0d0a2592395b8980c24304733daec628e947e 03-Jul-2014 Dianne Hackborn <hackbod@google.com> Fix cleanup of voice sessions.

They would leave active voice activities lingering around.

Change-Id: I5b6716ab303636ebdf2f13c3172552a73dae3bb1
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
0df9858802d80e4275326521813c580176fb24f2 07-Jul-2014 Craig Mautner <cmautner@google.com> am 9d8a30d9: am a7f02a5c: am ef2e7667: Merge "[ActivityManager] Avoid keeping restarting home when only home activity exists."

* commit '9d8a30d9e1c17877cd45686a8f6aa70142c33573':
[ActivityManager] Avoid keeping restarting home when only home activity exists.
c0ffce5ddd6446f1d46a49cdfaeda4a2ce408e1d 01-Jul-2014 Craig Mautner <cmautner@google.com> Use cached thumbnails in Recent tasks.

The thumbnail returned from ActivityManager.getTaskThumbnail() now
contains either a Bitmap or a ParcelFileDescriptor that points to
a file containing a compressed Bitmap. The Recent tasks list is
now responsible for all thumbnail Bitmap caching as the activity
manager keeps only the most recent 5. This also permits low memory
devices to have many more tasks in the Recent tasks list.

As part of this CL the concept of subtasks is removed eliminating
code supporting the TaskAccessInfo and IThumbnailRetriever classes.

Fixes bug 15828934.

Change-Id: I0fd0320a1a04e3c78d79357899b83a2fff97abf2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
70778d7d53e1ade34f9ddcdf0860540bb18d7648 02-Jul-2014 George Mount <mount@google.com> Stop temporary window from showing with activity transitions.

Bug 15424905

When creating a new process, a temporary window would show,
even when within the same task. This CL prevents the temporary
window from showing when using
ActivityOptions.makeSceneTransitionAnimation(...)

Change-Id: I93c40ba0b41ed90ebe6e9802d1236f8c81d60abe
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
76e2a765b495f15a718dc4dfd9d81e9539a7074b 24-Jun-2014 Craig Mautner <cmautner@google.com> Don't set return to recents on every resume

Checking for previous task to be the Recents activity every time
through resumeTopActivityLocked() leads to missetting the
mTaskToReturnTo to Recents for Recents. Instead check for
Recents launching a task in moveTaskToFront and startActivity.

Fixes bug 15832448.

Change-Id: Ib64fe26f3fd3fdcd878edafb041928ec02757e63
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
84984faf530e525b066e28710d0f9beb32142ec5 19-Jun-2014 Craig Mautner <cmautner@google.com> Return to recents when coming from recents

If a task is launched from recents then backing all the way
out of the task will return you to recents. Entering the task
in any other way (home, another activity, nav bar) will reset
this behavior.

Fixes bug 15703876.

Change-Id: I98dc36e4dbcb238d59e2175832076de7225bfdd9
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
9d4e9bcebbd97ad51daa0ef15cfba5aabb399bbb 19-Jun-2014 Craig Mautner <cmautner@google.com> Allow a root activity to relinquish task identity

If a an acitivty with attribute android:relinquishTaskIdentity true
is the root activity of a task then the intent of that task will
be that of the first activity in the stack with
android:relinquishTaskIdentity set false.

The ability to set intent also includes the ability to set the
TaskDescription of the task.

Fixes bug 15675610.
Fixes bug 10428661.

Change-Id: Ib28a9eae3b9832eeeef9106adbebe344184ee5ae
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
916cd9770ce865bad98f15a68be74f3aa607e727 14-Jun-2014 Craig Mautner <cmautner@google.com> am 6335fbcb: Revert "Revert "Close ActivityView and ActivityContainer cleanly.""

* commit '6335fbcba106147d914acae0a9d8f4fcd53af768':
Revert "Revert "Close ActivityView and ActivityContainer cleanly.""
6335fbcba106147d914acae0a9d8f4fcd53af768 14-Jun-2014 Craig Mautner <cmautner@google.com> Revert "Revert "Close ActivityView and ActivityContainer cleanly.""

This reverts commit dd5c94717077c9366dee364c88a86a78e5ee2688.
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
0f3d3dd26c7c726752c92fbf92fb1502ba4b77f0 13-Jun-2014 Justin Koh <justinkoh@google.com> am dd5c9471: Revert "Close ActivityView and ActivityContainer cleanly."

* commit 'dd5c94717077c9366dee364c88a86a78e5ee2688':
Revert "Close ActivityView and ActivityContainer cleanly."
dd5c94717077c9366dee364c88a86a78e5ee2688 13-Jun-2014 Justin Koh <justinkoh@google.com> Revert "Close ActivityView and ActivityContainer cleanly."

This reverts commit 4a9f129874785d34930f165268dbc618e4bc2618.

Conflicts:
services/core/java/com/android/server/am/ActivityStackSupervisor.java

Change-Id: Ic1f4df7f4cb644de7ddebcdc8ce632b46c5ba8f2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f5030ecbca4f8dc217204d96d3f0a3511acf49ac 12-Jun-2014 Craig Mautner <cmautner@google.com> am 4a9f1298: Close ActivityView and ActivityContainer cleanly.

* commit '4a9f129874785d34930f165268dbc618e4bc2618':
Close ActivityView and ActivityContainer cleanly.
4a9f129874785d34930f165268dbc618e4bc2618 11-Jun-2014 Craig Mautner <cmautner@google.com> Close ActivityView and ActivityContainer cleanly.

- Do not call IActivityContainer.release() from
ActivityView.finalize() if it has already been called from
ActivityView.release(). Eliminates IBinder finalized Exception.

- Call ActivityRecord.makeFinishing() before calling ActivityStack.
destroyActivityLocked(). Forces call to scheduleDestroyActivity()
and eventually removeFromHistory(). Otherwise removeFromHistory()
is never called and window manager AppWindowTokens become orphans.

- Defer call to ActivityContainer.detachLocked() until all
activities have finished or timed out. Fixes problem where Display
is removed while activities are still launching.

- Call ActivityStackSupervisor.deleteActivityContainer() when all
activities have finished or timed out. Fixes orphaned
ActivityContainers.

Fixes bug 15450798.
Fixes bug 15484154.
Fixes bug 15383479.
Fixes bug 15316558.
Fixes bug 15168560.
Fixes bug 15143914.

Change-Id: Id3c641976b6f825458690f9ee063c07818b56f23
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d163e751895930a1c8d8d6c3d7e0a37177dbbf19 14-Jun-2014 Craig Mautner <cmautner@google.com> Revert "Revert "Close ActivityView and ActivityContainer cleanly.""

This reverts commit dd5c94717077c9366dee364c88a86a78e5ee2688.

Change-Id: I7bac1aa1d96fa7922cc835949730a26204f15f2f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
220cad6d9743f134c0d44623fc56cd57467866e7 13-Jun-2014 Qiwen Zhao <zhao@google.com> Merge commit '0f3d3dd2'

Conflicts:
services/core/java/com/android/server/am/ActivityStack.java
services/core/java/com/android/server/am/ActivityStackSupervisor.java
4c07d0246fb37e6a77be2c5cdcdf55a989b90f75 12-Jun-2014 Craig Mautner <cmautner@google.com> Merge commit 'f5030ecb' into manualmerge

Conflicts:
services/core/java/com/android/server/am/ActivityStack.java
services/core/java/com/android/server/am/ActivityStackSupervisor.java

Change-Id: Ie38e3e8b82f588d36e955664904f3ab84bdfaaf5
82b3201a95063a1fe51842417c444c0dfd8cf780 07-Jun-2014 Nick Kralevich <nnk@google.com> resolved conflicts for merge of 13ed83ee to master

Change-Id: Ia3739cfa7af60e6a47bf94d403df190f3f2cd082
ffcfcaadfefec2fb56f67a0a614a54bf4599d62b 05-Jun-2014 Craig Mautner <cmautner@google.com> Implement maxRecents and fix TaskPersister bug

Activities can now set the maximum number of times that they will
appear in the recent task lists when using DocCentric mode. The
default number is 15, the min 1, and the max 100.

Also a bug in TaskPersister that deleted files because it did not
properly parse their task ids is fixed.

Fixes bug 13736052.

Change-Id: I7ccb4e6f89d6202ff31c8577bb7b9d8d1b7e5e8d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b6011c1c2a2452174c7ce973e1867b912996081d 05-Jun-2014 Craig Mautner <cmautner@google.com> Merge commit '21483b9f' into manualmerge

Change-Id: If9261cc1625f9f492697fe16c21d2b71c0cc0e11
21483b9f0b5a92aec10d858d9e3525abd190504c 05-Jun-2014 Craig Mautner <cmautner@google.com> am e34fcf8f: Merge "Add callback when ActivityView activities complete" into klp-modular-dev

* commit 'e34fcf8ff9a023641505a8decdeb1b77232d8a16':
Add callback when ActivityView activities complete
d94b47f3b671f5afbc79b061a9b8fa7aa8b22f87 03-Jun-2014 Craig Mautner <cmautner@google.com> Add callback when ActivityView activities complete

Users of ActivityViews can now be informed when there are no more
active activities in ActivityView by registering a callback.

Fixes bug 15330616.

Change-Id: I39d55bdb0db8b0a12ee751cdcb039b7fbb899c85
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6b942b8c52f7071ae6c590f3080c7e52dfef7d9e 02-Jun-2014 Nicolas Prevot <nprevot@google.com> Small fix related to cross-profile result intents.

Change-Id: Id99d6406cdd8ceddacf6fee0cf66e7e59d749a15
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
1015efb143b51a5d31f2f932528f295cfa1add1f 29-May-2014 Nicolas Prevot <nprevot@google.com> Merge "Making the content resolver work with result intents."
71ac80c46a1b094ad951e59c24791d9e9ef769bf 29-May-2014 Craig Mautner <cmautner@google.com> Merge "Revert "Modify task navigation to return to recent tasks." DO NOT MERGE" into lmp-preview-dev
b9a6c8ad99c7885dccc23223068c0a551f350cd5 29-May-2014 Craig Mautner <cmautner@google.com> Revert "Modify task navigation to return to recent tasks." DO NOT MERGE

This reverts commit 1a4e211e03f1f795d935058e27356a0e8bc5df7c.

Change-Id: Ia691b93347c7eb2395933e5a5ba385ea94e08d6f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
fdaaf91f356a1dcd960c48a5f0137869d561cb23 29-May-2014 Craig Mautner <cmautner@google.com> Merge "Revert "Modify task navigation to return to recent tasks.""
719e621186adc1ba5a365bddea01cbe73bb26b02 29-May-2014 Craig Mautner <cmautner@google.com> Revert "Modify task navigation to return to recent tasks."

This reverts commit 19174878e25ebfd8806595f83df7bdea1d239c07.

Change-Id: I98db2c9aa975495c5828b3d16b8b45f515e6a5fa
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c6cf95c0f5f7250c65e40c441fe58d8cbfd114c9 29-May-2014 Nicolas Prevot <nprevot@google.com> Making the content resolver work with result intents.

prepareToLeaveUser is called if necessary on result intents.
Adding the targetUserId to grantUriPermissionFromIntentLocked
This allows the GET_CONTENT intent to work across profiles.

Change-Id: Id81280c23247aeda7ad56e34af9b12a6f3a00a3c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e30e02f5d9a9141c9ee70c712d4f9d52c88ea969 28-May-2014 Dianne Hackborn <hackbod@google.com> Add system layer for voice interaction services.

New window layer that voice interaction service windows
go in to. Includes a new voice-specific content rectangle
that voice activities are placed in to.

Add specific animations for this layer, sliding down from
the top (though this can be customized by the voice interaction
service).

Also add the concept of activities running for voice interaction
services for purposes of adjusting the animation used for them,
again sliding from the top, but not (yet?) customizable by the
voice interaction service.

Change-Id: Ic9e0e8c843c2e2972d6abb4087dce0019326155d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
2eb4f9c377c01b5644c00f4b0cca2e655e107998 22-May-2014 Winson Chung <winsonc@google.com> DO NOT MERGE

Removing unnecessary public values. (Bug 14995844)
(cherry picked from commit aa327fc2ce428f939885e1172578ff1dc975214c)

Change-Id: I98672d0ed3120c15bf31ce7a21ab604cfe66273d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
8f4f2ff5cbd9cf5733437afeb54f8a2453d9e616 27-May-2014 Winson Chung <winsonc@google.com> Merge "DO NOT MERGE " into lmp-preview-dev
e67a784eb2c914c04c62ea5dfa1e3751df5582cc 21-May-2014 Craig Mautner <cmautner@google.com> Modify task navigation to return to recent tasks. DO NOT MERGE

Tasks launched from the recent task list will now return to the list
when they are finished. Also tasks that are launched from the
notification panel and services will now return to the list,
provided that the launcher is not front and center when they are
launched.

Fixes bug 14464114.

Change-Id: Ic0d3731fc7248d1eaa80e5ee399753d80e80c979
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
df6523f2703920a1d2a84c45b862b325b8cebf40 21-May-2014 Craig Mautner <cmautner@google.com> Modify task navigation to return to recent tasks.

Tasks launched from the recent task list will now return to the list
when they are finished. Also tasks that are launched from the
notification panel and services will now return to the list,
provided that the launcher is not front and center when they are
launched.

Fixes bug 14464114.

Change-Id: Ic0d3731fc7248d1eaa80e5ee399753d80e80c979
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
21d24a21ea4aaadd78e73de54168e8a8a8973e4d 23-Apr-2014 Craig Mautner <cmautner@google.com> Add code for persisting tasks and activities to disk DO NOT MERGE

Recent tasks that have the persistable flag set are
saved to /data/system/recent_tasks/ on shutdown and in the
background. Their thumbnails are saved to
/data/system/recent_images/.

Change-Id: Ifb820a01c412fe1f8c0f6e41aa655fafd89eaa8d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
deec695253aa5856135be3ffdcd35eaafed9e526 24-May-2014 Craig Mautner <cmautner@google.com> Merge "Add code for persisting tasks and activities to disk"
376543bc5f1f8a4465f6f0f9c9b45f96f37b3d06 22-May-2014 Winson Chung <winsonc@google.com> DO NOT MERGE

Invalidating screenshots when we resume the task that they were taken in. (Bug 13587139)

- Removing multiple calls to get the same thumbnail screenshot
(cherry picked from commit d4ce870e9ad24eff444443bd19ca2061f7c3099d)

Change-Id: Id1feea856a1374173c7f0d329d6f11482794df1a
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
ef73ee1dd98acfc4a19561367cfc3e4d8bbe06ea 23-Apr-2014 Craig Mautner <cmautner@google.com> Add code for persisting tasks and activities to disk

Recent tasks that have the persistable flag set are
saved to /data/system/recent_tasks/ on shutdown and in the
background. Their thumbnails are saved to
/data/system/recent_images/.

Change-Id: Ifb820a01c412fe1f8c0f6e41aa655fafd89eaa8d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6784f1c62379f2226d895cd944d716c17f4cb195 22-May-2014 Winson Chung <winsonc@google.com> Removing unnecessary public values. (Bug 14995844)
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
cc12f28e5dc6bd027971c995c7aab63dadcc0d35 22-May-2014 Winson Chung <winsonc@google.com> Invalidating screenshots when we resume the task that they were taken in. (Bug 13587139)

- Removing multiple calls to get the same thumbnail screenshot
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
9aeb60739909aa2b8100c95157835e4e3db28519 19-May-2014 Winson Chung <winsonc@google.com> Merge "Enabling alternate recents on all form factors."
7fd239cf0a1ddc0500b51d97e0e6c3539b42639f 14-May-2014 Craig Mautner <cmautner@google.com> Merge "Pass ActivityOptions back from finishing activity."
fd08622588d5a90c11216894344e58147ff6359a 14-May-2014 Winson Chung <winsonc@google.com> Enabling alternate recents on all form factors.

Change-Id: I9dec6da7646205b72f46cedf604fadfb03cab6d4
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
233ceeebab7efe6ad4783371003c4cf29b896436 10-May-2014 Craig Mautner <cmautner@google.com> Pass ActivityOptions back from finishing activity.

Adding an ActivityOptions parameter to convertToTranslucent provides
a mechanism for delivering these options to the activity that
launched the one that is returning.

Fixes bug 13032208.
Fixes bug 14469460.
Fixes bug 14597427.

Change-Id: I4115dd3c69de9d175f6df0498a6e964fca5eca29
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
5ae2afdc2aeec468436ca126a6da1e8dd90d7aff 13-May-2014 bulic <bulic@google.com> Merge "Prevent home task from being set as ontopofhome"
ccd230712d8ec4c017f8ab9b24ee53b4e5dfc19b 12-May-2014 bulic <bulic@google.com> Prevent home task from being set as ontopofhome

If the front activity of a task that is on top of home finishes, the oldest task in
other stacks will be set as ontopofhome (which in this case meant the
home task was set to ontopofhome). The solution is to ensure we
only set a task to ontopofhome if the finishing activity is in the same
stack.

Change-Id: Idd8f9af4d3d9bd2de3c519d3dcc60f479695ae0c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d9ddf2e9d04f8a53d7445a96aa3e192fa86f08d6 09-May-2014 Craig Mautner <cmautner@google.com> Merge "Introduce persistent forms of Activity lifecycle calls."
a002604af0c9b1204556610537b85685d7055996 23-Apr-2014 Craig Mautner <cmautner@google.com> Introduce persistent forms of Activity lifecycle calls.

When an Activity is created with R.attr.persistable true different
forms of activity lifecycle methods including PersistableBundle will
be used.

Fixes bug 13736007.

Change-Id: I7e92917b300b76964257cfcc26c24e76aa19bd16
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
729cb2391f8eedbab9af1d0ef62febb0b56292cc 06-May-2014 Jose Lima <joselima@google.com> Remove unecessary code from ActivityStack

- Due to a previous CL to allow activities to be visible under
the Home stack, some code un ActivityStack became unecessary.
- This CL removes the uused code and changes the interface of
ensureActivitiesVisibleLocked, since we no longer need to
special case visibility for the Home stack.

Change-Id: I5cffe903bc82041fe79bfc63107df71ddf01232c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
41db4a77fa4659d60ad055ec1819a410ce35bf28 08-May-2014 Craig Mautner <cmautner@google.com> Use new doccentric flags and attributes in Sharing

Put the new doccentric flags and attributes into use. And make their
first application the Share widget. Sharing now creates a new task
which is destroyed once the share action has completed.

Fixes bug 14463859.

Change-Id: I34c4c79775ef44d65e1967be5601997a2d46b210
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c03c9167c2d9a1e22fb2b176b00a0524177fb037 02-May-2014 Dianne Hackborn <hackbod@google.com> Further work on voice interaction services.

This makes VoiceInteractionSession a more first-class
concept. Now the flow is that a VoiceInteractionService
calls startSession() when it wants to begin a session.
This will result in a new VoiceInteractionSession via the
VoiceInteractionSessionService containing it, and the
session at that point an decide what to do. It can now
show UI, and it is what has access to the startVoiceActivity
API.

Change-Id: Ie2b85b3020ef1206d3f44b335b128d064e8f9935
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
be2ba85c4f84463e6ff1747132f021769811f14b 03-May-2014 Jose Lima <joselima@google.com> Merge "Allow activities to be visible behind the Home Stack"
09233289624a85093b1d99e4a6a149bf09059d8d 30-Apr-2014 Dianne Hackborn <hackbod@google.com> Make GET_TASKS signature|system.

Normal apps can't hold it now. If they try to use
getRecentTasks() or getRunningTasks() without the permission,
they will only see their own tasks and home in the list.

Also took this opportunity to eradicate all of the old pending
thumbnail stuff.

Change-Id: I6dc52a06221c78097162e4a8b482027b798bf3ee
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7ba7125af1962b322d48ac5a49f698565da2b84c 30-Apr-2014 Jose Lima <joselima@google.com> Allow activities to be visible behind the Home Stack

- Only hide/stop activities behind the Home stack if the Home
stack contains a full-screen/opaque activity.

Change-Id: I69f951b91753f48d0344a9d534569cfb8de1d57f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
648c83b4ee5fe825aa4032e0bb32c1d6269b02ad 29-Apr-2014 Winson Chung <winsonc@google.com> Fixing NPE. (Bug 14385152)

Change-Id: Ie6d1e7c3e5dcf721e945c4933c077fa6abb10067
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
91097de49b0f683b00e26a75dbc0ac6082344137 05-Apr-2014 Dianne Hackborn <hackbod@google.com> Initial implementation of new voice interaction API.

This gives a basic working implementation of a persist
running service that can start a voice interaction when
it wants, with the target activity(s) able to go through
the protocol to interact with it. It may even work when
the screen is off by putting the activity manager in the
correct state to act like the screen is on.

Includes a sample app that is a voice interation service
and also has an activity it can launch.

Now that I have this initial implementation, I think I
want to rework some aspects of the API.

Change-Id: I7646d0af8fb4ac768c63a18fe3de43f8091f60e9
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
67b082e02cbfb7bafe046a619e686e9a5c1abc05 25-Apr-2014 Winson Chung <winsonc@google.com> Merge "Enabling doc centric recents on phones."
f6ead5d62e62ff9a466bd4cbbea77390ce00605b 24-Apr-2014 Craig Mautner <cmautner@google.com> Take screenshots of pausing activity

Previous CL to optimize out excessive screenshots (ag/379669) was too
effective and didn't take screenshots when going into an activity
that had attribute Window_windowNoDisplay. Adding in the test for
ActivityRecord.noDisplay allows screenshots for this situation.

Fixes bug 13410507.

Change-Id: Ieafebf44b7d1a3ba18115e762fba113f8d1c0252
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6c83b77b87a1f8b247874c9544d4975d13da7d23 22-Apr-2014 Craig Mautner <cmautner@google.com> am 43c6a98f: am 6985badc: Fix black ActivityView

* commit '43c6a98f0ffe079429735a485acaa81841740fac':
Fix black ActivityView
7ad27288f1b66733a4fcb2bdcb17dd5db6c6423d 22-Apr-2014 Craig Mautner <cmautner@google.com> am c00c89b1: am f4c909bc: Fix ActivityView lifecycle

* commit 'c00c89b1add5bcbf6a76287c9a3384877449c746':
Fix ActivityView lifecycle
43c6a98f0ffe079429735a485acaa81841740fac 22-Apr-2014 Craig Mautner <cmautner@google.com> am 6985badc: Fix black ActivityView

* commit '6985badc632f2ff8425aa86423577a96eafc49e9':
Fix black ActivityView
c00c89b1add5bcbf6a76287c9a3384877449c746 22-Apr-2014 Craig Mautner <cmautner@google.com> am f4c909bc: Fix ActivityView lifecycle

* commit 'f4c909bcb87d6f103c9f9e8255fa61bd86f4de67':
Fix ActivityView lifecycle
6985badc632f2ff8425aa86423577a96eafc49e9 22-Apr-2014 Craig Mautner <cmautner@google.com> Fix black ActivityView

Don't add the surface to the VirtualDisplay until the activity
has drawn. That will keep the TextureView from turning black.

Fixes bug 12821632.

Change-Id: Ia06e9f91be3e14ad724f735ae4e201ac798863a2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f4c909bcb87d6f103c9f9e8255fa61bd86f4de67 18-Apr-2014 Craig Mautner <cmautner@google.com> Fix ActivityView lifecycle

Major changes to maintain the VirtualDisplay across repeated
attach/detach cycles of an ActivityView. This keeps the activities
and VirtualDisplays in the ActivityView from getting into bad states.

Fixes bug 14107002.

Change-Id: Idc2aaf85ac496eab0eeb436736cb10a2020040e8
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f9f2314aa444e32b93caecd06cb4f10a71a2df39 21-Apr-2014 Winson Chung <winsonc@google.com> Enabling doc centric recents on phones.

Change-Id: If853cdcbf3fc75001060e522bce2e0d49d2ddea3
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
934ef05799532b75d349338c4300671cec1ab162 16-Apr-2014 Craig Mautner <cmautner@google.com> am 4b81e89d: am 2fd3cb95: Merge "Fix ActivityContainer callback parcelling." into klp-modular-dev

* commit '4b81e89d9b7a2cf3ed5aacd9c647aed47f4c4675':
Fix ActivityContainer callback parcelling.
4b81e89d9b7a2cf3ed5aacd9c647aed47f4c4675 16-Apr-2014 Craig Mautner <cmautner@google.com> am 2fd3cb95: Merge "Fix ActivityContainer callback parcelling." into klp-modular-dev

* commit '2fd3cb9544df1e09caa725a8d542cf2fe1df0c75':
Fix ActivityContainer callback parcelling.
e3a00d745fad479f560e96cec23e957f37d1c043 16-Apr-2014 Craig Mautner <cmautner@google.com> Fix ActivityContainer callback parcelling.

The Binder interface for passing a callback was not implemented
properly. Also the callback for ActivityContainer now has a new
API.

Change-Id: I6b719be0cb57542f022a3cc14e8f4efde60b1a50
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f4824a06884e096beef921646cba4be29d7f36fc 02-Apr-2014 Kenny Guy <kennyguy@google.com> Fix issue with not allowing activities for current user.

Change-Id: Ic2e30c3f4990a03aac9801ee9bf5f270a5e90ef8
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
2a764949c943681a4d25a17a0b203a0127a4a486 02-Apr-2014 Kenny Guy <kennyguy@google.com> Rename related users to profiles.

Rename the related user concept as profiles.
When returning profiles of a user include the
user as a profile of itself.

Change-Id: Id5d4f29017b7ca6844632ce643f10331ad733e1d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
71888f54cb256f0d5527e2dd66f95e83992d795f 29-Mar-2014 Craig Mautner <cmautner@google.com> am 1872ce3e: am 155e3133: am d511bc17: Merge "[ActivityManager] Fix a bug: unable to start activity after starting activities during screen off."

* commit '1872ce3e7af0e2130a9e8f9f52983cd234f6ead0':
[ActivityManager] Fix a bug: unable to start activity after starting activities during screen off.
1872ce3e7af0e2130a9e8f9f52983cd234f6ead0 29-Mar-2014 Craig Mautner <cmautner@google.com> am 155e3133: am d511bc17: Merge "[ActivityManager] Fix a bug: unable to start activity after starting activities during screen off."

* commit '155e3133407e590f18e7e16eddc6fc743f35b0fd':
[ActivityManager] Fix a bug: unable to start activity after starting activities during screen off.
9410f5983b2fab4bac220dab0fab7cde10e6d34a 27-Mar-2014 Craig Mautner <cmautner@google.com> am 723f7bbc: am 7f7ce0f7: am a2824410: Merge "Do not show Home behind full screen activity"

* commit '723f7bbcf34168b216421eee4b7d86199f90de1f':
Do not show Home behind full screen activity
723f7bbcf34168b216421eee4b7d86199f90de1f 27-Mar-2014 Craig Mautner <cmautner@google.com> am 7f7ce0f7: am a2824410: Merge "Do not show Home behind full screen activity"

* commit '7f7ce0f71b5f1b5274b0cda190401823508cda1f':
Do not show Home behind full screen activity
2c92c9700c7b06f3c7dd5ab15d8343dfce68c833 20-Mar-2014 George Mount <mount@google.com> Fix null ActivityOptions when starting an Activity in a new Process.

Bug 13563265

Change-Id: Ie56cd6d55f13dbf68bafb82ab4bd6b27fde60df6
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d00f47402cb886a43a3448128bdcd9dd2f348a2a 12-Mar-2014 Craig Mautner <cmautner@google.com> Launch new tasks with Doc Centric flag.

Introduction of new Intent flag FLAG_ACTIVITY_NEW_DOCUMENT. When
this flag is set the target activity will be launched in its own
task. This is the start of the new Doc Centric mode of working.

Change-Id: I719168532134ab2c5ea3300df676c2b2a0e81795
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
aea74a5977ca9f1054926eb24f247562c3a4a6ba 08-Mar-2014 Craig Mautner <cmautner@google.com> Add Lock Task Mode.

When in lock task mode only the specified task may run. All
attempts to switch to another task are ignored until the task
finishes or a call to stopLockTaskMode() is made.

Change-Id: I6cfe92fe1bcf22cd47b5398c08e23c52a4092dda
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
303e1ff1fec8b240b587bb18b981247a99833aa8 08-Mar-2014 Winson Chung <winsonc@google.com> Initial changes for recents.

Change-Id: Ide2c202b4a5b25410f0f32bd0a81ccf817ede38f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
734983fff35d9ed2b7a9848bdfbca401887d0dd8 05-Mar-2014 Amith Yamasani <yamasani@google.com> Allow related users to show activities on primary user

Make ActivityManager and WindowManager understand related users.

Task stack will now contain interleaved tasks for related users,
but still group regular users separately from groups of related users.

InputMethodManagerService permits related users to invoke IME and receive
key events.

Change-Id: I3bd87b32aec69c3f8d470c8b29b144f4e849c808
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e1abfdf711ce9ff3b15ff1b4d86531f5a8dd3dec 21-Feb-2014 Craig Mautner <cmautner@google.com> am 6222a8ef: am 1648f042: am fd8a8ccb: Merge "Set the new SurfaceControl opaque flag." into klp-modular-dev

* commit '6222a8ef853609ea9c0f725c2412a2d25968d9da':
Set the new SurfaceControl opaque flag.
71dd1b63436e9cdd5cbd2d42cd5841d497da8238 19-Feb-2014 Craig Mautner <cmautner@google.com> Set the new SurfaceControl opaque flag.

Converts surfaces from transparent to opaque and opaque to transparent
without creating a new surface. Uses the new SurfaceControl.setOpaque
method.

Fixes bug 12387406.

Change-Id: I669c064e622e211b00b1585183a488d5b3f4b778
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
33fa09b1ffe8d14d146de4b2632103d831ff8988 11-Feb-2014 Craig Mautner <cmautner@google.com> am 2d6b55aa: am 312ba86b: Change task removal sequence

* commit '2d6b55aaa9dd03f7d934f7a192989513b1087357':
Change task removal sequence
312ba86b476fa1d83864a7d465135cc9a4e94ad8 11-Feb-2014 Craig Mautner <cmautner@google.com> Change task removal sequence

- Remove task after removing activity. Removing the task before
removing the activity led to problems when the task was still needed.

- In WindowManager wait for activity manager to remove the task.
Previously was automatically removing the task when the last activity
was removed.

Fixes bug 12957434.

Change-Id: I7f6b1f09a2e2a845f177f337769075c9376f8bdb
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
9e4adfb358ca3680288c07201efc8811472a579d 05-Feb-2014 Craig Mautner <cmautner@google.com> resolved conflicts for merge of 32360147 to master

Change-Id: I97cc95f66df50006469f8debd286966cc21edb60
df88d73092c62a1a3cd2b2056ca63ae2e70cc238 27-Jan-2014 Craig Mautner <cmautner@google.com> Add IIntentSender to ActivityContainer.startActivity

PendingIntents and IntentSenders can now be launched. Still does not
work once the host activity has been paused and resumed.

Window manager TaskStacks now exist independently of Displays and app
windows persist after Displays are removed below them. Attaching the
stack to a new Display does not yet restore the windows to it.

Fixes bug 12747909.

Change-Id: I509007ee23fda400b353f483cf6ecce08177763b
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e0d1e295f15a5c70ca030732fd9309f0dc50b2cc 28-Jan-2014 Craig Mautner <cmautner@google.com> am af17925f: am 45b68ac3: am 09325627: am 245b58d6: am baf2c7a4: Merge "[ActivityManager]: Fix the activity visibility state not sync between ActivityManager and WindowManager"

* commit 'af17925f94c3a293022a4c41fc284a0a9312dcb6':
[ActivityManager]: Fix the activity visibility state not sync between ActivityManager and WindowManager
af17925f94c3a293022a4c41fc284a0a9312dcb6 28-Jan-2014 Craig Mautner <cmautner@google.com> am 45b68ac3: am 09325627: am 245b58d6: am baf2c7a4: Merge "[ActivityManager]: Fix the activity visibility state not sync between ActivityManager and WindowManager"

* commit '45b68ac3a7acb7af95fdfc5c0e31560b3c28c9f8':
[ActivityManager]: Fix the activity visibility state not sync between ActivityManager and WindowManager
441b57bce9dcd507a3e36b911b5adeacb066c9be 16-Jan-2014 Craig Mautner <cmautner@google.com> am 593a4e6f: Fix NPE when destroyActivity occurs after detach.

* commit '593a4e6f982cecddc3f2f6107044b5e12fab3e20':
Fix NPE when destroyActivity occurs after detach.
fc8fa54f80b419966b3893a0992354a17c270333 16-Jan-2014 Craig Mautner <cmautner@google.com> am e9ddaa0b: Merge "Cleanup after ActivityView" into klp-modular-dev

* commit 'e9ddaa0b183d979be782a63970929cebd861b7c9':
Cleanup after ActivityView
593a4e6f982cecddc3f2f6107044b5e12fab3e20 16-Jan-2014 Craig Mautner <cmautner@google.com> Fix NPE when destroyActivity occurs after detach.

*** FATAL EXCEPTION IN SYSTEM PROCESS: ActivityManager
java.lang.NullPointerException
at com.android.server.am.ActivityStack.removeTask(ActivityStack.java:3627)
at com.android.server.am.ActivityStack.removeActivityFromHistoryLocked(ActivityStack.java:2693)
at com.android.server.am.ActivityStack.activityDestroyedLocked(ActivityStack.java:2878)
at com.android.server.am.ActivityStack$ActivityStackHandler.handleMessage(ActivityStack.java:296)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at com.android.server.am.ActivityManagerService$AThread.run(ActivityManagerService.java:1868)

Change-Id: Ifaf0fe6c62d1f63897d57dc96b4d86d8111b45db
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
34b73dfaa3a92e5a85abf62317183fb114f2ffff 13-Jan-2014 Craig Mautner <cmautner@google.com> Cleanup after ActivityView

- Release Surface and VirtualDisplay when shutting down ActivityView.
- Shut down child stacks when relaunching parent activity.

Change-Id: I60314b2b43bd2da5406cf6ec871293b5baca157c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
3a43aa9cef79324dd149a47c5a73ce1fa8ed95b3 15-Jan-2014 Craig Mautner <cmautner@google.com> am 9cfb2e5f: Merge "Retain stacks even if they are empty." into klp-modular-dev

* commit '9cfb2e5f4c95c16d8ca531808f60486f214f9039':
Retain stacks even if they are empty.
9cfb2e5f4c95c16d8ca531808f60486f214f9039 15-Jan-2014 Craig Mautner <cmautner@google.com> Merge "Retain stacks even if they are empty." into klp-modular-dev
04a0ea60ac7e20369e63edc4f3f8cedf8425a439 13-Jan-2014 Craig Mautner <cmautner@google.com> Retain stacks even if they are empty.

Previously stacks would be removed when the last ActivityRecord was
removed. This causes problems for ActivityContainers which persist and
permit activities to be launched into an empty stack.

Change-Id: Ia79ac65d17c42eff3a7b1321980c21b29996001b
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
663fb7a09e48c77a7fff4f7a8488b08175170d6f 11-Jan-2014 Craig Mautner <cmautner@google.com> am da9b87a7: am 5d8936b4: am 27581792: am 54f99137: am 3747768b: Merge "Fix visibility of multiple non-fullscreen activities."

* commit 'da9b87a70994ed00868dd4405243932fe7e267f2':
Fix visibility of multiple non-fullscreen activities.
da9b87a70994ed00868dd4405243932fe7e267f2 11-Jan-2014 Craig Mautner <cmautner@google.com> am 5d8936b4: am 27581792: am 54f99137: am 3747768b: Merge "Fix visibility of multiple non-fullscreen activities."

* commit '5d8936b4cfdb14941536e533c2cc376e99b9f7d5':
Fix visibility of multiple non-fullscreen activities.
88a00abe0803327bb55171082e18fe2901c35d49 10-Jan-2014 Craig Mautner <cmautner@google.com> am 0bb2a4de: Merge "Call moveHomeStack before moving any stack." into klp-modular-dev

* commit '0bb2a4deee6451a2f3075254761e9bfb38429fa4':
Call moveHomeStack before moving any stack.
fefeef8249e898d2d450da21d0edda49b88be7ce 10-Jan-2014 Craig Mautner <cmautner@google.com> Call moveHomeStack before moving any stack.

Order matters, otherwise mFocusedStack and mLastStack aren't updated
correctly.

Fixes bug 12478856.

Change-Id: I12e4334678bb3af49d1ff26c4003def3e8d987c2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b859449b717b24ac6e678c303d7706d55fd184f7 08-Jan-2014 Craig Mautner <cmautner@google.com> resolved conflicts for merge of 88bfc6dd to master

Change-Id: Ib656ac0591b21ad14f2df51021729552e9373515
e0a3884cb627efc650e19fbe76b1b3343468cf57 17-Dec-2013 Craig Mautner <cmautner@google.com> Extend stack management to other displays.

- Abandon ActivityContainer.startActivity() in favor of
IActivityManager.startActivityAsUserInContainer().
- Modify Am to test starting an activity on a container.
- Create a DisplayContext as the base context if the activity token
is on a different display.
- Test for home display in more cases when manipulating home stack.
- Rename mDisplayInfos => mActivityDisplays.
- Create new method for moving task to front of stack regardless of
which display it is on.

Change-Id: I4fcb83ae844c5839ee3e2722229623d1a80ed921
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
49782e46c0eb85a25ae2abcf80880c48dbab5aea 20-Dec-2013 Amith Yamasani <yamasani@google.com> am 9158825f: Move some system services to separate directories

* commit '9158825f9c41869689d6b1786d7c7aa8bdd524ce':
Move some system services to separate directories
9158825f9c41869689d6b1786d7c7aa8bdd524ce 22-Nov-2013 Amith Yamasani <yamasani@google.com> Move some system services to separate directories

Refactored the directory structure so that services can be optionally
excluded. This is step 1. Will be followed by another change that makes
it possible to remove services from the build.

Change-Id: Ideacedfd34b5e213217ad3ff4ebb21c4a8e73f85
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java