Loading core/java/android/view/InsetsAnimationControlImpl.java +14 −0 Original line number Original line Diff line number Diff line Loading @@ -44,6 +44,7 @@ import android.annotation.Nullable; import android.content.res.CompatibilityInfo; import android.content.res.CompatibilityInfo; import android.graphics.Insets; import android.graphics.Insets; import android.graphics.Matrix; import android.graphics.Matrix; import android.graphics.Point; import android.graphics.Rect; import android.graphics.Rect; import android.util.ArraySet; import android.util.ArraySet; import android.util.Log; import android.util.Log; Loading Loading @@ -203,6 +204,19 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll mControllingTypes &= ~types; mControllingTypes &= ~types; } } @Override public void updateSurfacePosition(SparseArray<InsetsSourceControl> controls) { for (int i = controls.size() - 1; i >= 0; i--) { final InsetsSourceControl control = controls.valueAt(i); final InsetsSourceControl c = mControls.get(control.getType()); if (c == null) { continue; } final Point position = control.getSurfacePosition(); c.setSurfacePosition(position.x, position.y); } } @Override @Override public @AnimationType int getAnimationType() { public @AnimationType int getAnimationType() { return mAnimationType; return mAnimationType; Loading core/java/android/view/InsetsAnimationControlRunner.java +8 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.view; package android.view; import android.util.SparseArray; import android.util.proto.ProtoOutputStream; import android.util.proto.ProtoOutputStream; import android.view.InsetsController.AnimationType; import android.view.InsetsController.AnimationType; import android.view.InsetsState.InternalInsetsType; import android.view.InsetsState.InternalInsetsType; Loading Loading @@ -44,6 +45,13 @@ public interface InsetsAnimationControlRunner { */ */ void notifyControlRevoked(@InsetsType int types); void notifyControlRevoked(@InsetsType int types); /** * Updates the surface positions of the controls owned by this runner if there is any. * * @param controls An array of {@link InsetsSourceControl} that the caller newly receives. */ void updateSurfacePosition(SparseArray<InsetsSourceControl> controls); /** /** * Cancels the animation. * Cancels the animation. */ */ Loading core/java/android/view/InsetsAnimationThreadControlRunner.java +17 −1 Original line number Original line Diff line number Diff line Loading @@ -62,8 +62,13 @@ public class InsetsAnimationThreadControlRunner implements InsetsAnimationContro @Override @Override public void scheduleApplyChangeInsets(InsetsAnimationControlRunner runner) { public void scheduleApplyChangeInsets(InsetsAnimationControlRunner runner) { synchronized (mControl) { // This reads the surface position on the animation thread, but the surface position // would be updated on the UI thread, so we need this critical section. // See: updateSurfacePosition. mControl.applyChangeInsets(null /* outState */); mControl.applyChangeInsets(null /* outState */); } } } @Override @Override public void notifyFinished(InsetsAnimationControlRunner runner, boolean shown) { public void notifyFinished(InsetsAnimationControlRunner runner, boolean shown) { Loading Loading @@ -148,10 +153,21 @@ public class InsetsAnimationThreadControlRunner implements InsetsAnimationContro } } @Override @Override @UiThread public void notifyControlRevoked(@InsetsType int types) { public void notifyControlRevoked(@InsetsType int types) { mControl.notifyControlRevoked(types); mControl.notifyControlRevoked(types); } } @Override @UiThread public void updateSurfacePosition(SparseArray<InsetsSourceControl> controls) { synchronized (mControl) { // This is called from the UI thread, however, the surface position will be used on the // animation thread, so we need this critical section. See: scheduleApplyChangeInsets. mControl.updateSurfacePosition(controls); } } @Override @Override @UiThread @UiThread public void cancel() { public void cancel() { Loading core/java/android/view/InsetsController.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -829,7 +829,13 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation requestedStateStale = requestedVisibilityChanged || imeRequestedVisible; requestedStateStale = requestedVisibilityChanged || imeRequestedVisible; } } } if (mTmpControlArray.size() > 0) { // Update surface positions for animations. for (int i = mRunningAnimations.size() - 1; i >= 0; i--) { mRunningAnimations.get(i).runner.updateSurfacePosition(mTmpControlArray); } } } mTmpControlArray.clear(); mTmpControlArray.clear(); Loading Loading
core/java/android/view/InsetsAnimationControlImpl.java +14 −0 Original line number Original line Diff line number Diff line Loading @@ -44,6 +44,7 @@ import android.annotation.Nullable; import android.content.res.CompatibilityInfo; import android.content.res.CompatibilityInfo; import android.graphics.Insets; import android.graphics.Insets; import android.graphics.Matrix; import android.graphics.Matrix; import android.graphics.Point; import android.graphics.Rect; import android.graphics.Rect; import android.util.ArraySet; import android.util.ArraySet; import android.util.Log; import android.util.Log; Loading Loading @@ -203,6 +204,19 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll mControllingTypes &= ~types; mControllingTypes &= ~types; } } @Override public void updateSurfacePosition(SparseArray<InsetsSourceControl> controls) { for (int i = controls.size() - 1; i >= 0; i--) { final InsetsSourceControl control = controls.valueAt(i); final InsetsSourceControl c = mControls.get(control.getType()); if (c == null) { continue; } final Point position = control.getSurfacePosition(); c.setSurfacePosition(position.x, position.y); } } @Override @Override public @AnimationType int getAnimationType() { public @AnimationType int getAnimationType() { return mAnimationType; return mAnimationType; Loading
core/java/android/view/InsetsAnimationControlRunner.java +8 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.view; package android.view; import android.util.SparseArray; import android.util.proto.ProtoOutputStream; import android.util.proto.ProtoOutputStream; import android.view.InsetsController.AnimationType; import android.view.InsetsController.AnimationType; import android.view.InsetsState.InternalInsetsType; import android.view.InsetsState.InternalInsetsType; Loading Loading @@ -44,6 +45,13 @@ public interface InsetsAnimationControlRunner { */ */ void notifyControlRevoked(@InsetsType int types); void notifyControlRevoked(@InsetsType int types); /** * Updates the surface positions of the controls owned by this runner if there is any. * * @param controls An array of {@link InsetsSourceControl} that the caller newly receives. */ void updateSurfacePosition(SparseArray<InsetsSourceControl> controls); /** /** * Cancels the animation. * Cancels the animation. */ */ Loading
core/java/android/view/InsetsAnimationThreadControlRunner.java +17 −1 Original line number Original line Diff line number Diff line Loading @@ -62,8 +62,13 @@ public class InsetsAnimationThreadControlRunner implements InsetsAnimationContro @Override @Override public void scheduleApplyChangeInsets(InsetsAnimationControlRunner runner) { public void scheduleApplyChangeInsets(InsetsAnimationControlRunner runner) { synchronized (mControl) { // This reads the surface position on the animation thread, but the surface position // would be updated on the UI thread, so we need this critical section. // See: updateSurfacePosition. mControl.applyChangeInsets(null /* outState */); mControl.applyChangeInsets(null /* outState */); } } } @Override @Override public void notifyFinished(InsetsAnimationControlRunner runner, boolean shown) { public void notifyFinished(InsetsAnimationControlRunner runner, boolean shown) { Loading Loading @@ -148,10 +153,21 @@ public class InsetsAnimationThreadControlRunner implements InsetsAnimationContro } } @Override @Override @UiThread public void notifyControlRevoked(@InsetsType int types) { public void notifyControlRevoked(@InsetsType int types) { mControl.notifyControlRevoked(types); mControl.notifyControlRevoked(types); } } @Override @UiThread public void updateSurfacePosition(SparseArray<InsetsSourceControl> controls) { synchronized (mControl) { // This is called from the UI thread, however, the surface position will be used on the // animation thread, so we need this critical section. See: scheduleApplyChangeInsets. mControl.updateSurfacePosition(controls); } } @Override @Override @UiThread @UiThread public void cancel() { public void cancel() { Loading
core/java/android/view/InsetsController.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -829,7 +829,13 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation requestedStateStale = requestedVisibilityChanged || imeRequestedVisible; requestedStateStale = requestedVisibilityChanged || imeRequestedVisible; } } } if (mTmpControlArray.size() > 0) { // Update surface positions for animations. for (int i = mRunningAnimations.size() - 1; i >= 0; i--) { mRunningAnimations.get(i).runner.updateSurfacePosition(mTmpControlArray); } } } mTmpControlArray.clear(); mTmpControlArray.clear(); Loading