Files
frameworks_base/core/java/android/app
Tony Mak ec319aba34 Introduce AMS.getLastResumedActivityUserId to fix work profile icon issue
Problem:
Work profile status bar icon feeature is relied on two callbacks
1. onForegroundProfileSwitch  (AMS.setResumedActivityLocked)
2. appTransitionStarting (WMS)

We assume callback 1 is always called before 2, but it is not the case.
These two callbacks are triggered by two handlers in two different threads,
and hence race condition happens.

Solution:
Not rely on onForegroundProfileSwitch to update mManagedProfileFocused
flag anymore. Query getLastResumedActivityUserId in appTransitionStarting.
Also, make sure mLastResumedActivity is updated before sending message
to WMS in setResumedActivityLocked.

Test: Start a work app, observe that the work icon is shown.
Test: Start a personal app, observe that work icon is gone.
Test: Dock the work app, tap on it (give it focus), observe that work
      icon is shown.
Test: Start a work app, switch user, can see the icon is gone. Switch back,
      icon is back.

Bug: 34159089

Change-Id: I2cee141d18e8b7d5607b26dd7a2fd5bc9cd0ebb3
2017-03-29 10:03:39 +00:00
..
2017-03-22 18:51:00 -07:00
2017-03-21 14:42:35 -07:00
2017-03-03 17:27:56 -08:00
2017-01-31 14:58:17 -08:00
2017-03-16 15:45:10 -07:00
2017-03-03 17:27:56 -08:00
2016-09-15 08:42:35 -04:00
2017-03-22 20:15:20 +00:00
2016-11-04 10:43:25 -07:00
2016-11-04 10:43:25 -07:00