Prevent adding methods in WindowInsetsAnimationController

It is a public interface which should not have different versions
sharing the same API level. This CL moves the methods to an
@hide interface.

Fix: 198614722
Test: atest android.signature.cts.api.current.SignatureTest
Change-Id: Ib02708aeb1ec960bda20b6b60d4df6f0c9b4d9d6
This commit is contained in:
Tiger Huang
2021-09-03 04:24:34 +08:00
parent f596b7c8f0
commit 4ba9fc6168
8 changed files with 49 additions and 23 deletions

View File

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

View File

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

View File

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

View File

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

View File

@@ -43,7 +43,7 @@ import android.view.animation.Interpolator;
* @hide
*/
public class InsetsResizeAnimationRunner implements InsetsAnimationControlRunner,
WindowInsetsAnimationController, WindowInsetsAnimationControlListener {
InternalInsetsAnimationController, WindowInsetsAnimationControlListener {
private final InsetsState mFromState;
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).
*/
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.InsetsState;
import android.view.InsetsState.InternalInsetsType;
import android.view.InternalInsetsAnimationController;
import android.view.SurfaceControl;
import android.view.SyncRtSurfaceTransactionApplier;
import android.view.WindowInsetsAnimation;
@@ -571,7 +572,7 @@ class InsetsPolicy {
}
@Override
public <T extends InsetsAnimationControlRunner & WindowInsetsAnimationController>
public <T extends InsetsAnimationControlRunner & InternalInsetsAnimationController>
void startAnimation(T runner, WindowInsetsAnimationControlListener listener, int types,
WindowInsetsAnimation animation,
Bounds bounds) {