@@ -648,7 +648,25 @@ class LayoutFields {
648648 }
649649 final LayoutFields mInnerFields = new LayoutFields ();
650650
651+ static class AppWindowAnimParams {
652+ AppWindowAnimator mAppAnimator ;
653+ ArrayList <WindowStateAnimator > mWinAnimators ;
654+
655+ public AppWindowAnimParams (final AppWindowAnimator appAnimator ) {
656+ mAppAnimator = appAnimator ;
657+
658+ final AppWindowToken wtoken = appAnimator .mAppToken ;
659+ mWinAnimators = new ArrayList <WindowStateAnimator >();
660+ final int N = wtoken .allAppWindows .size ();
661+ for (int i = 0 ; i < N ; i ++) {
662+ mWinAnimators .add (wtoken .allAppWindows .get (i ).mWinAnimator );
663+ }
664+ }
665+ }
666+
651667 static class LayoutToAnimatorParams {
668+ boolean mParamsModified ;
669+
652670 static final long WALLPAPER_TOKENS_CHANGED = 1 << 0 ;
653671 long mChanges ;
654672
@@ -659,6 +677,7 @@ static class LayoutToAnimatorParams {
659677 WindowState mUpperWallpaperTarget ;
660678 DimAnimator .Parameters mDimParams ;
661679 ArrayList <WindowToken > mWallpaperTokens = new ArrayList <WindowToken >();
680+ ArrayList <AppWindowAnimParams > mAppWindowAnimParams = new ArrayList <AppWindowAnimParams >();
662681 }
663682 /** Params from WindowManagerService to WindowAnimator. Do not modify or read without first
664683 * locking on either mWindowMap or mAnimator and then on mLayoutToAnim */
@@ -7324,50 +7343,9 @@ public void handleMessage(Message msg) {
73247343 case UPDATE_ANIM_PARAMETERS : {
73257344 // Used to send multiple changes from the animation side to the layout side.
73267345 synchronized (mWindowMap ) {
7327- final WindowAnimator .AnimatorToLayoutParams animToLayout =
7328- mAnimator .mAnimToLayout ;
7329- synchronized (animToLayout ) {
7330- animToLayout .mUpdateQueued = false ;
7331- boolean doRequest = false ;
7332- final int bulkUpdateParams = animToLayout .mBulkUpdateParams ;
7333- // TODO(cmautner): As the number of bits grows, use masks of bit groups to
7334- // eliminate unnecessary tests.
7335- if ((bulkUpdateParams & LayoutFields .SET_UPDATE_ROTATION ) != 0 ) {
7336- mInnerFields .mUpdateRotation = true ;
7337- doRequest = true ;
7338- }
7339- if ((bulkUpdateParams & LayoutFields .SET_WALLPAPER_MAY_CHANGE ) != 0 ) {
7340- mInnerFields .mWallpaperMayChange = true ;
7341- doRequest = true ;
7342- }
7343- if ((bulkUpdateParams & LayoutFields .SET_FORCE_HIDING_CHANGED ) != 0 ) {
7344- mInnerFields .mWallpaperForceHidingChanged = true ;
7345- doRequest = true ;
7346- }
7347- if ((bulkUpdateParams & LayoutFields .SET_ORIENTATION_CHANGE_COMPLETE )
7348- == 0 ) {
7349- mInnerFields .mOrientationChangeComplete = false ;
7350- } else {
7351- mInnerFields .mOrientationChangeComplete = true ;
7352- if (mWindowsFreezingScreen ) {
7353- doRequest = true ;
7354- }
7355- }
7356- if ((bulkUpdateParams & LayoutFields .SET_TURN_ON_SCREEN ) != 0 ) {
7357- mTurnOnScreen = true ;
7358- }
7359-
7360- mPendingLayoutChanges |= animToLayout .mPendingLayoutChanges ;
7361- if (mPendingLayoutChanges != 0 ) {
7362- doRequest = true ;
7363- }
7364-
7365- mWindowDetachedWallpaper = animToLayout .mWindowDetachedWallpaper ;
7366-
7367- if (doRequest ) {
7368- mH .sendEmptyMessage (CLEAR_PENDING_ACTIONS );
7369- performLayoutAndPlaceSurfacesLocked ();
7370- }
7346+ if (copyAnimToLayoutParamsLocked ()) {
7347+ mH .sendEmptyMessage (CLEAR_PENDING_ACTIONS );
7348+ performLayoutAndPlaceSurfacesLocked ();
73717349 }
73727350 }
73737351 break ;
@@ -9109,16 +9087,26 @@ void updateLayoutToAnimationLocked() {
91099087 // Copy local params to transfer params.
91109088 ArrayList <WindowStateAnimator > winAnimators = layoutToAnim .mWinAnimators ;
91119089 winAnimators .clear ();
9112- final int N = mWindows .size ();
9090+ int N = mWindows .size ();
91139091 for (int i = 0 ; i < N ; i ++) {
91149092 final WindowStateAnimator winAnimator = mWindows .get (i ).mWinAnimator ;
91159093 if (winAnimator .mSurface != null ) {
91169094 winAnimators .add (winAnimator );
91179095 }
91189096 }
9097+
91199098 layoutToAnim .mWallpaperTarget = mWallpaperTarget ;
91209099 layoutToAnim .mLowerWallpaperTarget = mLowerWallpaperTarget ;
91219100 layoutToAnim .mUpperWallpaperTarget = mUpperWallpaperTarget ;
9101+
9102+ final ArrayList <AppWindowAnimParams > paramList = layoutToAnim .mAppWindowAnimParams ;
9103+ paramList .clear ();
9104+ N = mAnimatingAppTokens .size ();
9105+ for (int i = 0 ; i < N ; i ++) {
9106+ paramList .add (new AppWindowAnimParams (mAnimatingAppTokens .get (i ).mAppAnimator ));
9107+ }
9108+
9109+ layoutToAnim .mParamsModified = true ;
91229110 scheduleAnimationLocked ();
91239111 }
91249112 }
@@ -9146,6 +9134,48 @@ void stopDimming() {
91469134 setAnimDimParams (null );
91479135 }
91489136
9137+ private boolean copyAnimToLayoutParamsLocked () {
9138+ boolean doRequest = false ;
9139+ final WindowAnimator .AnimatorToLayoutParams animToLayout = mAnimator .mAnimToLayout ;
9140+ synchronized (animToLayout ) {
9141+ animToLayout .mUpdateQueued = false ;
9142+ final int bulkUpdateParams = animToLayout .mBulkUpdateParams ;
9143+ // TODO(cmautner): As the number of bits grows, use masks of bit groups to
9144+ // eliminate unnecessary tests.
9145+ if ((bulkUpdateParams & LayoutFields .SET_UPDATE_ROTATION ) != 0 ) {
9146+ mInnerFields .mUpdateRotation = true ;
9147+ doRequest = true ;
9148+ }
9149+ if ((bulkUpdateParams & LayoutFields .SET_WALLPAPER_MAY_CHANGE ) != 0 ) {
9150+ mInnerFields .mWallpaperMayChange = true ;
9151+ doRequest = true ;
9152+ }
9153+ if ((bulkUpdateParams & LayoutFields .SET_FORCE_HIDING_CHANGED ) != 0 ) {
9154+ mInnerFields .mWallpaperForceHidingChanged = true ;
9155+ doRequest = true ;
9156+ }
9157+ if ((bulkUpdateParams & LayoutFields .SET_ORIENTATION_CHANGE_COMPLETE ) == 0 ) {
9158+ mInnerFields .mOrientationChangeComplete = false ;
9159+ } else {
9160+ mInnerFields .mOrientationChangeComplete = true ;
9161+ if (mWindowsFreezingScreen ) {
9162+ doRequest = true ;
9163+ }
9164+ }
9165+ if ((bulkUpdateParams & LayoutFields .SET_TURN_ON_SCREEN ) != 0 ) {
9166+ mTurnOnScreen = true ;
9167+ }
9168+
9169+ mPendingLayoutChanges |= animToLayout .mPendingLayoutChanges ;
9170+ if (mPendingLayoutChanges != 0 ) {
9171+ doRequest = true ;
9172+ }
9173+
9174+ mWindowDetachedWallpaper = animToLayout .mWindowDetachedWallpaper ;
9175+ }
9176+ return doRequest ;
9177+ }
9178+
91499179 boolean reclaimSomeSurfaceMemoryLocked (WindowStateAnimator winAnimator , String operation ,
91509180 boolean secure ) {
91519181 final Surface surface = winAnimator .mSurface ;
0 commit comments