Merge "KeygaurdBottomArea additional API cleanup" into tm-qpr-dev

This commit is contained in:
TreeHugger Robot
2022-07-16 07:43:53 +00:00
committed by Android (Google) Code Review
5 changed files with 41 additions and 31 deletions

View File

@@ -265,9 +265,6 @@ public interface CentralSurfaces extends Dumpable, ActivityStarter, LifecycleOwn
boolean isPulsing();
@Nullable
View getAmbientIndicationContainer();
boolean isOccluded();
//TODO: These can / should probably be moved to NotificationPresenter or ShadeController

View File

@@ -1858,12 +1858,6 @@ public class CentralSurfacesImpl extends CoreStartable implements
return mDozeServiceHost.isPulsing();
}
@androidx.annotation.Nullable
@Override
public View getAmbientIndicationContainer() {
return mAmbientIndicationContainer;
}
/**
* When the keyguard is showing and covered by a "showWhenLocked" activity it
* is occluded. This is controlled by {@link com.android.server.policy.PhoneWindowManager}

View File

@@ -39,6 +39,7 @@ import android.util.Log;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewPropertyAnimator;
import android.view.WindowInsets;
import android.widget.FrameLayout;
import android.widget.ImageView;
@@ -62,6 +63,9 @@ import com.android.systemui.qrcodescanner.controller.QRCodeScannerController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.wallet.controller.QuickAccessWalletController;
import java.util.ArrayList;
import java.util.List;
/**
* Implementation for the bottom area of the Keyguard, including camera/phone affordance and status
* text.
@@ -347,8 +351,17 @@ public class KeyguardBottomAreaView extends FrameLayout {
dozeTimeTick();
}
public View getIndicationArea() {
return mIndicationArea;
/**
* Returns a list of animators to use to animate the indication areas.
*/
public List<ViewPropertyAnimator> getIndicationAreaAnimators() {
List<ViewPropertyAnimator> animators =
new ArrayList<>(mAmbientIndicationArea != null ? 2 : 1);
animators.add(mIndicationArea.animate());
if (mAmbientIndicationArea != null) {
animators.add(mAmbientIndicationArea.animate());
}
return animators;
}
@Override
@@ -418,9 +431,17 @@ public class KeyguardBottomAreaView extends FrameLayout {
}
/**
* Sets the alpha of the indication areas and affordances, excluding the lock icon.
* Sets the alpha of various sub-components, for example the indication areas and bottom quick
* action buttons. Does not set the alpha of the lock icon.
*/
public void setAffordanceAlpha(float alpha) {
public void setComponentAlphas(float alpha) {
setImportantForAccessibility(
alpha == 0f
? View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
: View.IMPORTANT_FOR_ACCESSIBILITY_AUTO);
if (mAmbientIndicationArea != null) {
mAmbientIndicationArea.setAlpha(alpha);
}
mIndicationArea.setAlpha(alpha);
mWalletButton.setAlpha(alpha);
mQRCodeScannerButton.setAlpha(alpha);

View File

@@ -3197,14 +3197,7 @@ public final class NotificationPanelViewController extends PanelViewController {
getExpandedFraction());
float alpha = Math.min(expansionAlpha, 1 - computeQsExpansionFraction());
alpha *= mBottomAreaShadeAlpha;
mKeyguardBottomArea.setAffordanceAlpha(alpha);
mKeyguardBottomArea.setImportantForAccessibility(
alpha == 0f ? View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
: View.IMPORTANT_FOR_ACCESSIBILITY_AUTO);
View ambientIndicationContainer = mCentralSurfaces.getAmbientIndicationContainer();
if (ambientIndicationContainer != null) {
ambientIndicationContainer.setAlpha(alpha);
}
mKeyguardBottomArea.setComponentAlphas(alpha);
mLockIconViewController.setAlpha(alpha);
}

View File

@@ -41,6 +41,7 @@ import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewPropertyAnimator;
import android.view.ViewTreeObserver;
import android.view.animation.Interpolator;
@@ -66,6 +67,7 @@ import com.android.systemui.util.time.SystemClock;
import com.android.wm.shell.animation.FlingAnimationUtils;
import java.io.PrintWriter;
import java.util.List;
public abstract class PanelViewController {
public static final boolean DEBUG = PanelView.DEBUG;
@@ -1032,16 +1034,19 @@ public abstract class PanelViewController {
animator.start();
setAnimator(animator);
View[] viewsToAnimate = {
mKeyguardBottomArea.getIndicationArea(),
mCentralSurfaces.getAmbientIndicationContainer()};
for (View v : viewsToAnimate) {
if (v == null) {
continue;
}
v.animate().translationY(-mHintDistance).setDuration(250).setInterpolator(
Interpolators.FAST_OUT_SLOW_IN).withEndAction(() -> v.animate().translationY(
0).setDuration(450).setInterpolator(mBounceInterpolator).start()).start();
final List<ViewPropertyAnimator> indicationAnimators =
mKeyguardBottomArea.getIndicationAreaAnimators();
for (final ViewPropertyAnimator indicationAreaAnimator : indicationAnimators) {
indicationAreaAnimator
.translationY(-mHintDistance)
.setDuration(250)
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
.withEndAction(() -> indicationAreaAnimator
.translationY(0)
.setDuration(450)
.setInterpolator(mBounceInterpolator)
.start())
.start();
}
}