Merge "Prevent adding methods in WindowInsetsAnimationController" into sc-v2-dev am: 4fba1c4453

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15746916

Change-Id: I2ebf5654dfb85f39d50b4e211a802c2d78265b75
This commit is contained in:
Tiger Huang
2021-09-03 10:44:23 +00:00
committed by Automerger Merge Worker
8 changed files with 49 additions and 23 deletions

View File

@@ -35,7 +35,7 @@ public interface InsetsAnimationControlCallbacks {
* <li>Dispatch {@link WindowInsetsAnimationControlListener#onReady}</li> * <li>Dispatch {@link WindowInsetsAnimationControlListener#onReady}</li>
* </ul> * </ul>
*/ */
<T extends InsetsAnimationControlRunner & WindowInsetsAnimationController> <T extends InsetsAnimationControlRunner & InternalInsetsAnimationController>
void startAnimation(T runner, WindowInsetsAnimationControlListener listener, int types, void startAnimation(T runner, WindowInsetsAnimationControlListener listener, int types,
WindowInsetsAnimation animation, Bounds bounds); WindowInsetsAnimation animation, Bounds bounds);

View File

@@ -69,7 +69,7 @@ import java.util.Objects;
* @hide * @hide
*/ */
@VisibleForTesting @VisibleForTesting
public class InsetsAnimationControlImpl implements WindowInsetsAnimationController, public class InsetsAnimationControlImpl implements InternalInsetsAnimationController,
InsetsAnimationControlRunner { InsetsAnimationControlRunner {
private static final String TAG = "InsetsAnimationCtrlImpl"; private static final String TAG = "InsetsAnimationCtrlImpl";

View File

@@ -54,7 +54,7 @@ public class InsetsAnimationThreadControlRunner implements InsetsAnimationContro
@Override @Override
@UiThread @UiThread
public <T extends InsetsAnimationControlRunner & WindowInsetsAnimationController> public <T extends InsetsAnimationControlRunner & InternalInsetsAnimationController>
void startAnimation(T runner, WindowInsetsAnimationControlListener listener, int types, void startAnimation(T runner, WindowInsetsAnimationControlListener listener, int types,
WindowInsetsAnimation animation, Bounds bounds) { WindowInsetsAnimation animation, Bounds bounds) {
// Animation will be started in constructor already. // Animation will be started in constructor already.

View File

@@ -632,7 +632,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
runningAnimations.add(runner.getAnimation()); runningAnimations.add(runner.getAnimation());
} }
if (((WindowInsetsAnimationController) runner).applyChangeInsets(state)) { if (((InternalInsetsAnimationController) runner).applyChangeInsets(state)) {
finishedAnimations.add(runner.getAnimation()); finishedAnimations.add(runner.getAnimation());
} }
} }
@@ -1513,7 +1513,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
@VisibleForTesting @VisibleForTesting
@Override @Override
public <T extends InsetsAnimationControlRunner & WindowInsetsAnimationController> public <T extends InsetsAnimationControlRunner & InternalInsetsAnimationController>
void startAnimation(T runner, WindowInsetsAnimationControlListener listener, int types, void startAnimation(T runner, WindowInsetsAnimationControlListener listener, int types,
WindowInsetsAnimation animation, Bounds bounds) { WindowInsetsAnimation animation, Bounds bounds) {
mHost.dispatchWindowInsetsAnimationPrepare(animation); mHost.dispatchWindowInsetsAnimationPrepare(animation);

View File

@@ -43,7 +43,7 @@ import android.view.animation.Interpolator;
* @hide * @hide
*/ */
public class InsetsResizeAnimationRunner implements InsetsAnimationControlRunner, public class InsetsResizeAnimationRunner implements InsetsAnimationControlRunner,
WindowInsetsAnimationController, WindowInsetsAnimationControlListener { InternalInsetsAnimationController, WindowInsetsAnimationControlListener {
private final InsetsState mFromState; private final InsetsState mFromState;
private final InsetsState mToState; private final InsetsState mToState;

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.view;
/**
* An internal interface which provides methods that will be only used by the framework.
* @hide
*/
public interface InternalInsetsAnimationController extends WindowInsetsAnimationController {
/**
* Flags whether {@link WindowInsetsAnimationControlListener#onReady(
* WindowInsetsAnimationController, int)} has been invoked.
* @hide
*/
void setReadyDispatched(boolean dispatched);
/**
* Returns the {@link InsetsState} based on the current animation progress.
*
* @param outState the insets state which matches the current animation progress.
* @return {@code true} if the animation has been finished; {@code false} otherwise.
* @hide
*/
boolean applyChangeInsets(InsetsState outState);
}

View File

@@ -188,20 +188,4 @@ public interface WindowInsetsAnimationController {
* fullscreen or non-overlapping). * fullscreen or non-overlapping).
*/ */
boolean hasZeroInsetsIme(); boolean hasZeroInsetsIme();
/**
* Flags whether {@link WindowInsetsAnimationControlListener#onReady(
* WindowInsetsAnimationController, int)} has been invoked.
* @hide
*/
void setReadyDispatched(boolean dispatched);
/**
* Returns the {@link InsetsState} based on the current animation progress.
*
* @param outState the insets state which matches the current animation progress.
* @return {@code true} if the animation has been finished; {@code false} otherwise.
* @hide
*/
boolean applyChangeInsets(InsetsState outState);
} }

View File

@@ -43,6 +43,7 @@ import android.view.InsetsSource;
import android.view.InsetsSourceControl; import android.view.InsetsSourceControl;
import android.view.InsetsState; import android.view.InsetsState;
import android.view.InsetsState.InternalInsetsType; import android.view.InsetsState.InternalInsetsType;
import android.view.InternalInsetsAnimationController;
import android.view.SurfaceControl; import android.view.SurfaceControl;
import android.view.SyncRtSurfaceTransactionApplier; import android.view.SyncRtSurfaceTransactionApplier;
import android.view.WindowInsetsAnimation; import android.view.WindowInsetsAnimation;
@@ -585,7 +586,7 @@ class InsetsPolicy {
} }
@Override @Override
public <T extends InsetsAnimationControlRunner & WindowInsetsAnimationController> public <T extends InsetsAnimationControlRunner & InternalInsetsAnimationController>
void startAnimation(T runner, WindowInsetsAnimationControlListener listener, int types, void startAnimation(T runner, WindowInsetsAnimationControlListener listener, int types,
WindowInsetsAnimation animation, WindowInsetsAnimation animation,
Bounds bounds) { Bounds bounds) {