@@ -1972,6 +1972,11 @@ void wallpaperOffsetsComplete(IBinder window) {
19721972 }
19731973 }
19741974
1975+ // TODO(cmautner): Move to WindowAnimator.
1976+ void setWallpaperOffset (final WindowStateAnimator winAnimator , final int left , final int top ) {
1977+ mH .sendMessage (mH .obtainMessage (H .SET_WALLPAPER_OFFSET , left , top , winAnimator ));
1978+ }
1979+
19751980 void updateWallpaperOffsetLocked (WindowState changingTarget , boolean sync ) {
19761981 final int dw = mAppDisplayWidth ;
19771982 final int dh = mAppDisplayHeight ;
@@ -2010,10 +2015,8 @@ void updateWallpaperOffsetLocked(WindowState changingTarget, boolean sync) {
20102015 if (SHOW_TRANSACTIONS ) logSurface (wallpaper ,
20112016 "POS " + wallpaper .mShownFrame .left
20122017 + ", " + wallpaper .mShownFrame .top , null );
2013- winAnimator .mSurfaceX = wallpaper .mShownFrame .left ;
2014- winAnimator .mSurfaceY = wallpaper .mShownFrame .top ;
2015- winAnimator .mSurface .setPosition (wallpaper .mShownFrame .left ,
2016- wallpaper .mShownFrame .top );
2018+ setWallpaperOffset (winAnimator , (int ) wallpaper .mShownFrame .left ,
2019+ (int ) wallpaper .mShownFrame .top );
20172020 } catch (RuntimeException e ) {
20182021 Slog .w (TAG , "Error positioning surface of " + wallpaper
20192022 + " pos=(" + wallpaper .mShownFrame .left
@@ -2474,25 +2477,20 @@ static void logSurface(Surface s, String title, String msg, RuntimeException whe
24742477 Slog .i (TAG , str );
24752478 }
24762479 }
2477-
2480+
2481+ // TODO(cmautner): Move to WindowStateAnimator.
2482+ void setTransparentRegionHint (final WindowStateAnimator winAnimator , final Region region ) {
2483+ mH .sendMessage (mH .obtainMessage (H .SET_TRANSPARENT_REGION ,
2484+ new Pair <WindowStateAnimator , Region >(winAnimator , region )));
2485+ }
2486+
24782487 void setTransparentRegionWindow (Session session , IWindow client , Region region ) {
24792488 long origId = Binder .clearCallingIdentity ();
24802489 try {
24812490 synchronized (mWindowMap ) {
24822491 WindowState w = windowForClientLocked (session , client , false );
24832492 if ((w != null ) && w .mHasSurface ) {
2484- if (SHOW_LIGHT_TRANSACTIONS ) Slog .i (TAG ,
2485- ">>> OPEN TRANSACTION setTransparentRegion" );
2486- Surface .openTransaction ();
2487- try {
2488- if (SHOW_TRANSACTIONS ) logSurface (w ,
2489- "transparentRegionHint=" + region , null );
2490- w .mWinAnimator .mSurface .setTransparentRegionHint (region );
2491- } finally {
2492- Surface .closeTransaction ();
2493- if (SHOW_LIGHT_TRANSACTIONS ) Slog .i (TAG ,
2494- "<<< CLOSE TRANSACTION setTransparentRegion" );
2495- }
2493+ setTransparentRegionHint (w .mWinAnimator , region );
24962494 }
24972495 }
24982496 } finally {
@@ -2615,6 +2613,7 @@ public int relayoutWindow(Session session, IWindow client, int seq,
26152613 long origId = Binder .clearCallingIdentity ();
26162614
26172615 synchronized (mWindowMap ) {
2616+ // TODO(cmautner): synchronize on mAnimator or win.mWinAnimator.
26182617 WindowState win = windowForClientLocked (session , client , false );
26192618 if (win == null ) {
26202619 return 0 ;
@@ -6656,6 +6655,10 @@ final class H extends Handler {
66566655 public static final int WAITING_FOR_DRAWN_TIMEOUT = 24 ;
66576656 public static final int BULK_UPDATE_PARAMETERS = 25 ;
66586657
6658+ public static final int ANIMATOR_WHAT_OFFSET = 100000 ;
6659+ public static final int SET_TRANSPARENT_REGION = ANIMATOR_WHAT_OFFSET + 1 ;
6660+ public static final int SET_WALLPAPER_OFFSET = ANIMATOR_WHAT_OFFSET + 2 ;
6661+
66596662 private Session mLastReportedHold ;
66606663
66616664 public H () {
@@ -7079,6 +7082,28 @@ public void handleMessage(Message msg) {
70797082
70807083 requestTraversalLocked ();
70817084 }
7085+ break ;
7086+ }
7087+
7088+ // Animation messages. Move to Window{State}Animator
7089+ case SET_TRANSPARENT_REGION : {
7090+ // TODO(cmautner): Remove sync.
7091+ synchronized (mWindowMap ) {
7092+ Pair <WindowStateAnimator , Region > pair =
7093+ (Pair <WindowStateAnimator , Region >) msg .obj ;
7094+ final WindowStateAnimator winAnimator = pair .first ;
7095+ winAnimator .setTransparentRegionHint (pair .second );
7096+ }
7097+ break ;
7098+ }
7099+
7100+ case SET_WALLPAPER_OFFSET : {
7101+ // TODO(cmautner): Remove sync.
7102+ synchronized (mWindowMap ) {
7103+ final WindowStateAnimator winAnimator = (WindowStateAnimator ) msg .obj ;
7104+ winAnimator .setWallpaperOffset (msg .arg1 , msg .arg2 );
7105+ }
7106+ break ;
70827107 }
70837108 }
70847109 }
0 commit comments