Loading packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java +5 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,11 @@ public class KeyguardStatusView extends GridLayout { return info; } @Override public boolean hasOverlappingRendering() { return false; } // DateFormat.getBestDateTimePattern is extremely expensive, and refresh is called often. // This is an optimization to ensure we only recompute the patterns when the inputs change. private static final class Patterns { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +6 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private ImageView mCameraImageView; private ImageView mPhoneImageView; private ImageView mLockIcon; private View mIndicationText; private ActivityStarter mActivityStarter; private UnlockMethodCache mUnlockMethodCache; Loading Loading @@ -87,6 +88,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL mCameraImageView = (ImageView) findViewById(R.id.camera_button); mPhoneImageView = (ImageView) findViewById(R.id.phone_button); mLockIcon = (ImageView) findViewById(R.id.lock_icon); mIndicationText = findViewById(R.id.keyguard_indication_text); watchForCameraPolicyChanges(); watchForAccessibilityChanges(); updateCameraVisibility(); Loading Loading @@ -231,6 +233,10 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL return mLockIcon; } public View getIndicationView() { return mIndicationText; } @Override public void onMethodSecureChanged(boolean methodSecure) { updateTrust(); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java +33 −9 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone; import android.content.res.Resources; import android.graphics.Path; import android.view.animation.AccelerateInterpolator; import android.view.animation.PathInterpolator; import com.android.systemui.R; Loading @@ -31,6 +32,10 @@ public class KeyguardClockPositionAlgorithm { private static final float CLOCK_RUBBERBAND_FACTOR_MIN = 0.08f; private static final float CLOCK_RUBBERBAND_FACTOR_MAX = 0.8f; private static final float CLOCK_SCALE_FADE_START = 0.95f; private static final float CLOCK_SCALE_FADE_END = 0.75f; private static final float CLOCK_SCALE_FADE_END_NO_NOTIFS = 0.5f; private static final float CLOCK_ADJ_TOP_PADDING_MULTIPLIER_MIN = 1.4f; private static final float CLOCK_ADJ_TOP_PADDING_MULTIPLIER_MAX = 3.2f; Loading Loading @@ -61,6 +66,8 @@ public class KeyguardClockPositionAlgorithm { sSlowDownInterpolator = new PathInterpolator(path); } private AccelerateInterpolator mAccelerateInterpolator = new AccelerateInterpolator(); /** * Refreshes the dimension values. */ Loading Loading @@ -94,11 +101,22 @@ public class KeyguardClockPositionAlgorithm { int clockNotificationsPadding = getClockNotificationsPadding() + result.stackScrollerPaddingAdjustment; int padding = y + clockNotificationsPadding; y += clockAdjustment; result.clockY = y; result.stackScrollerPadding = mKeyguardStatusHeight + padding; result.clockAlpha = getClockAlpha(result.stackScrollerPadding - (y + mKeyguardStatusHeight)); result.clockScale = getClockScale(result.stackScrollerPadding, result.clockY, y + getClockNotificationsPadding() + mKeyguardStatusHeight); result.clockAlpha = getClockAlpha(result.clockScale); } private float getClockScale(int notificationPadding, int clockY, int startPadding) { float scaleMultiplier = getNotificationAmountT() == 0 ? 6.0f : 5.0f; float scaleEnd = clockY - mKeyguardStatusHeight * scaleMultiplier; float distanceToScaleEnd = notificationPadding - scaleEnd; float progress = distanceToScaleEnd / (startPadding - scaleEnd); progress = Math.max(0.0f, Math.min(progress, 1.0f)); progress = mAccelerateInterpolator.getInterpolation(progress); return progress; } private int getClockNotificationsPadding() { Loading Loading @@ -144,11 +162,12 @@ public class KeyguardClockPositionAlgorithm { + t * CLOCK_ADJ_TOP_PADDING_MULTIPLIER_MAX; } private float getClockAlpha(int clockNotificationPadding) { float t = getNotificationAmountT(); t = (float) Math.pow(t, 0.3f); float multiplier = 1 + 2 * (1 - t); float alpha = 1 + (float) clockNotificationPadding * multiplier / mKeyguardStatusHeight * 3; private float getClockAlpha(float scale) { float fadeEnd = getNotificationAmountT() == 0.0f ? CLOCK_SCALE_FADE_END_NO_NOTIFS : CLOCK_SCALE_FADE_END; float alpha = (scale - fadeEnd) / (CLOCK_SCALE_FADE_START - fadeEnd); return Math.max(0, Math.min(1, alpha)); } Loading @@ -167,6 +186,11 @@ public class KeyguardClockPositionAlgorithm { */ public int clockY; /** * The scale of the Clock */ public float clockScale; /** * The alpha value of the clock. */ Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +21 −13 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.view.accessibility.AccessibilityEvent; import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; import android.widget.LinearLayout; import android.widget.TextView; import com.android.systemui.R; import com.android.systemui.statusbar.ExpandableView; Loading @@ -48,6 +49,11 @@ public class NotificationPanelView extends PanelView implements View.OnClickListener, NotificationStackScrollLayout.OnOverscrollTopChangedListener, KeyguardPageSwipeHelper.Callback { // Cap and total height of Roboto font. Needs to be adjusted when font for the big clock is // changed. private static final int CAP_HEIGHT = 1456; private static final int FONT_HEIGHT = 2163; private static final float LOCK_ICON_ACTIVE_SCALE = 1.2f; private KeyguardPageSwipeHelper mPageSwiper; Loading @@ -56,7 +62,7 @@ public class NotificationPanelView extends PanelView implements private View mQsPanel; private View mKeyguardStatusView; private ObservableScrollView mScrollView; private View mStackScrollerContainer; private TextView mClockView; private NotificationStackScrollLayout mNotificationStackScroller; private int mNotificationTopPadding; Loading Loading @@ -105,7 +111,7 @@ public class NotificationPanelView extends PanelView implements new KeyguardClockPositionAlgorithm.Result(); private boolean mIsSwipedHorizontally; private boolean mIsExpanding; private KeyguardBottomAreaView mKeyguardBottomArea; private boolean mBlockTouches; private ArrayList<View> mSwipeTranslationViews = new ArrayList<>(); private int mNotificationScrimWaitDistance; Loading Loading @@ -137,9 +143,9 @@ public class NotificationPanelView extends PanelView implements mHeader.getBackgroundView().setOnClickListener(this); mHeader.setOverlayParent(this); mKeyguardStatusView = findViewById(R.id.keyguard_status_view); mStackScrollerContainer = findViewById(R.id.notification_container_parent); mQsContainer = findViewById(R.id.quick_settings_container); mQsPanel = findViewById(R.id.quick_settings_panel); mClockView = (TextView) findViewById(R.id.clock_view); mScrollView = (ObservableScrollView) findViewById(R.id.scroll_view); mScrollView.setListener(this); mNotificationStackScroller = (NotificationStackScrollLayout) Loading Loading @@ -179,6 +185,11 @@ public class NotificationPanelView extends PanelView implements protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); // Update Clock Pivot mKeyguardStatusView.setPivotX(getWidth() / 2); mKeyguardStatusView.setPivotY( (FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize()); // Calculate quick setting heights. mQsMinExpansionHeight = mHeader.getCollapsedHeight() + mQsPeekHeight; mQsMaxExpansionHeight = mHeader.getExpandedHeight() + mQsContainer.getHeight(); Loading @@ -201,7 +212,7 @@ public class NotificationPanelView extends PanelView implements * showing. */ private void positionClockAndNotifications() { boolean animateClock = mNotificationStackScroller.isAddOrRemoveAnimationPending(); boolean animate = mNotificationStackScroller.isAddOrRemoveAnimationPending(); int stackScrollerPadding; if (mStatusBar.getBarState() != StatusBarState.KEYGUARD) { int bottom = mStackScrollerOverscrolling Loading @@ -219,17 +230,17 @@ public class NotificationPanelView extends PanelView implements getHeight(), mKeyguardStatusView.getHeight()); mClockPositionAlgorithm.run(mClockPositionResult); if (animateClock || mClockAnimator != null) { if (animate || mClockAnimator != null) { startClockAnimation(mClockPositionResult.clockY); } else { mKeyguardStatusView.setY(mClockPositionResult.clockY); } applyClockAlpha(mClockPositionResult.clockAlpha); updateClock(mClockPositionResult.clockAlpha, mClockPositionResult.clockScale); stackScrollerPadding = mClockPositionResult.stackScrollerPadding; mTopPaddingAdjustment = mClockPositionResult.stackScrollerPaddingAdjustment; } mNotificationStackScroller.setIntrinsicPadding(stackScrollerPadding); requestScrollerTopPaddingUpdate(animateClock); requestScrollerTopPaddingUpdate(animate); } private void startClockAnimation(int y) { Loading Loading @@ -262,13 +273,10 @@ public class NotificationPanelView extends PanelView implements }); } private void applyClockAlpha(float alpha) { if (alpha != 1.0f) { mKeyguardStatusView.setLayerType(LAYER_TYPE_HARDWARE, null); } else { mKeyguardStatusView.setLayerType(LAYER_TYPE_NONE, null); } private void updateClock(float alpha, float scale) { mKeyguardStatusView.setAlpha(alpha); mKeyguardStatusView.setScaleX(scale); mKeyguardStatusView.setScaleY(scale); } public void animateToFullShade() { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +18 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ public abstract class PanelView extends FrameLayout { protected int mTouchSlop; protected boolean mHintAnimationRunning; private boolean mOverExpandedBeforeFling; private float mOriginalIndicationY; private ValueAnimator mHeightAnimator; private ObjectAnimator mPeekAnimator; Loading @@ -82,6 +83,7 @@ public abstract class PanelView extends FrameLayout { private Interpolator mLinearOutSlowInInterpolator; private Interpolator mBounceInterpolator; protected KeyguardBottomAreaView mKeyguardBottomArea; protected void onExpandingFinished() { mBar.onExpandingFinished(); Loading Loading @@ -652,6 +654,22 @@ public abstract class PanelView extends FrameLayout { }); animator.start(); mHeightAnimator = animator; mOriginalIndicationY = mKeyguardBottomArea.getIndicationView().getY(); mKeyguardBottomArea.getIndicationView().animate() .y(mOriginalIndicationY - mHintDistance) .setDuration(250) .setInterpolator(mLinearOutSlowInInterpolator) .withEndAction(new Runnable() { @Override public void run() { mKeyguardBottomArea.getIndicationView().animate() .y(mOriginalIndicationY) .setDuration(450) .setInterpolator(mBounceInterpolator) .start(); } }) .start(); } /** Loading Loading
packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java +5 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,11 @@ public class KeyguardStatusView extends GridLayout { return info; } @Override public boolean hasOverlappingRendering() { return false; } // DateFormat.getBestDateTimePattern is extremely expensive, and refresh is called often. // This is an optimization to ensure we only recompute the patterns when the inputs change. private static final class Patterns { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +6 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private ImageView mCameraImageView; private ImageView mPhoneImageView; private ImageView mLockIcon; private View mIndicationText; private ActivityStarter mActivityStarter; private UnlockMethodCache mUnlockMethodCache; Loading Loading @@ -87,6 +88,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL mCameraImageView = (ImageView) findViewById(R.id.camera_button); mPhoneImageView = (ImageView) findViewById(R.id.phone_button); mLockIcon = (ImageView) findViewById(R.id.lock_icon); mIndicationText = findViewById(R.id.keyguard_indication_text); watchForCameraPolicyChanges(); watchForAccessibilityChanges(); updateCameraVisibility(); Loading Loading @@ -231,6 +233,10 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL return mLockIcon; } public View getIndicationView() { return mIndicationText; } @Override public void onMethodSecureChanged(boolean methodSecure) { updateTrust(); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java +33 −9 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone; import android.content.res.Resources; import android.graphics.Path; import android.view.animation.AccelerateInterpolator; import android.view.animation.PathInterpolator; import com.android.systemui.R; Loading @@ -31,6 +32,10 @@ public class KeyguardClockPositionAlgorithm { private static final float CLOCK_RUBBERBAND_FACTOR_MIN = 0.08f; private static final float CLOCK_RUBBERBAND_FACTOR_MAX = 0.8f; private static final float CLOCK_SCALE_FADE_START = 0.95f; private static final float CLOCK_SCALE_FADE_END = 0.75f; private static final float CLOCK_SCALE_FADE_END_NO_NOTIFS = 0.5f; private static final float CLOCK_ADJ_TOP_PADDING_MULTIPLIER_MIN = 1.4f; private static final float CLOCK_ADJ_TOP_PADDING_MULTIPLIER_MAX = 3.2f; Loading Loading @@ -61,6 +66,8 @@ public class KeyguardClockPositionAlgorithm { sSlowDownInterpolator = new PathInterpolator(path); } private AccelerateInterpolator mAccelerateInterpolator = new AccelerateInterpolator(); /** * Refreshes the dimension values. */ Loading Loading @@ -94,11 +101,22 @@ public class KeyguardClockPositionAlgorithm { int clockNotificationsPadding = getClockNotificationsPadding() + result.stackScrollerPaddingAdjustment; int padding = y + clockNotificationsPadding; y += clockAdjustment; result.clockY = y; result.stackScrollerPadding = mKeyguardStatusHeight + padding; result.clockAlpha = getClockAlpha(result.stackScrollerPadding - (y + mKeyguardStatusHeight)); result.clockScale = getClockScale(result.stackScrollerPadding, result.clockY, y + getClockNotificationsPadding() + mKeyguardStatusHeight); result.clockAlpha = getClockAlpha(result.clockScale); } private float getClockScale(int notificationPadding, int clockY, int startPadding) { float scaleMultiplier = getNotificationAmountT() == 0 ? 6.0f : 5.0f; float scaleEnd = clockY - mKeyguardStatusHeight * scaleMultiplier; float distanceToScaleEnd = notificationPadding - scaleEnd; float progress = distanceToScaleEnd / (startPadding - scaleEnd); progress = Math.max(0.0f, Math.min(progress, 1.0f)); progress = mAccelerateInterpolator.getInterpolation(progress); return progress; } private int getClockNotificationsPadding() { Loading Loading @@ -144,11 +162,12 @@ public class KeyguardClockPositionAlgorithm { + t * CLOCK_ADJ_TOP_PADDING_MULTIPLIER_MAX; } private float getClockAlpha(int clockNotificationPadding) { float t = getNotificationAmountT(); t = (float) Math.pow(t, 0.3f); float multiplier = 1 + 2 * (1 - t); float alpha = 1 + (float) clockNotificationPadding * multiplier / mKeyguardStatusHeight * 3; private float getClockAlpha(float scale) { float fadeEnd = getNotificationAmountT() == 0.0f ? CLOCK_SCALE_FADE_END_NO_NOTIFS : CLOCK_SCALE_FADE_END; float alpha = (scale - fadeEnd) / (CLOCK_SCALE_FADE_START - fadeEnd); return Math.max(0, Math.min(1, alpha)); } Loading @@ -167,6 +186,11 @@ public class KeyguardClockPositionAlgorithm { */ public int clockY; /** * The scale of the Clock */ public float clockScale; /** * The alpha value of the clock. */ Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +21 −13 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.view.accessibility.AccessibilityEvent; import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; import android.widget.LinearLayout; import android.widget.TextView; import com.android.systemui.R; import com.android.systemui.statusbar.ExpandableView; Loading @@ -48,6 +49,11 @@ public class NotificationPanelView extends PanelView implements View.OnClickListener, NotificationStackScrollLayout.OnOverscrollTopChangedListener, KeyguardPageSwipeHelper.Callback { // Cap and total height of Roboto font. Needs to be adjusted when font for the big clock is // changed. private static final int CAP_HEIGHT = 1456; private static final int FONT_HEIGHT = 2163; private static final float LOCK_ICON_ACTIVE_SCALE = 1.2f; private KeyguardPageSwipeHelper mPageSwiper; Loading @@ -56,7 +62,7 @@ public class NotificationPanelView extends PanelView implements private View mQsPanel; private View mKeyguardStatusView; private ObservableScrollView mScrollView; private View mStackScrollerContainer; private TextView mClockView; private NotificationStackScrollLayout mNotificationStackScroller; private int mNotificationTopPadding; Loading Loading @@ -105,7 +111,7 @@ public class NotificationPanelView extends PanelView implements new KeyguardClockPositionAlgorithm.Result(); private boolean mIsSwipedHorizontally; private boolean mIsExpanding; private KeyguardBottomAreaView mKeyguardBottomArea; private boolean mBlockTouches; private ArrayList<View> mSwipeTranslationViews = new ArrayList<>(); private int mNotificationScrimWaitDistance; Loading Loading @@ -137,9 +143,9 @@ public class NotificationPanelView extends PanelView implements mHeader.getBackgroundView().setOnClickListener(this); mHeader.setOverlayParent(this); mKeyguardStatusView = findViewById(R.id.keyguard_status_view); mStackScrollerContainer = findViewById(R.id.notification_container_parent); mQsContainer = findViewById(R.id.quick_settings_container); mQsPanel = findViewById(R.id.quick_settings_panel); mClockView = (TextView) findViewById(R.id.clock_view); mScrollView = (ObservableScrollView) findViewById(R.id.scroll_view); mScrollView.setListener(this); mNotificationStackScroller = (NotificationStackScrollLayout) Loading Loading @@ -179,6 +185,11 @@ public class NotificationPanelView extends PanelView implements protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); // Update Clock Pivot mKeyguardStatusView.setPivotX(getWidth() / 2); mKeyguardStatusView.setPivotY( (FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize()); // Calculate quick setting heights. mQsMinExpansionHeight = mHeader.getCollapsedHeight() + mQsPeekHeight; mQsMaxExpansionHeight = mHeader.getExpandedHeight() + mQsContainer.getHeight(); Loading @@ -201,7 +212,7 @@ public class NotificationPanelView extends PanelView implements * showing. */ private void positionClockAndNotifications() { boolean animateClock = mNotificationStackScroller.isAddOrRemoveAnimationPending(); boolean animate = mNotificationStackScroller.isAddOrRemoveAnimationPending(); int stackScrollerPadding; if (mStatusBar.getBarState() != StatusBarState.KEYGUARD) { int bottom = mStackScrollerOverscrolling Loading @@ -219,17 +230,17 @@ public class NotificationPanelView extends PanelView implements getHeight(), mKeyguardStatusView.getHeight()); mClockPositionAlgorithm.run(mClockPositionResult); if (animateClock || mClockAnimator != null) { if (animate || mClockAnimator != null) { startClockAnimation(mClockPositionResult.clockY); } else { mKeyguardStatusView.setY(mClockPositionResult.clockY); } applyClockAlpha(mClockPositionResult.clockAlpha); updateClock(mClockPositionResult.clockAlpha, mClockPositionResult.clockScale); stackScrollerPadding = mClockPositionResult.stackScrollerPadding; mTopPaddingAdjustment = mClockPositionResult.stackScrollerPaddingAdjustment; } mNotificationStackScroller.setIntrinsicPadding(stackScrollerPadding); requestScrollerTopPaddingUpdate(animateClock); requestScrollerTopPaddingUpdate(animate); } private void startClockAnimation(int y) { Loading Loading @@ -262,13 +273,10 @@ public class NotificationPanelView extends PanelView implements }); } private void applyClockAlpha(float alpha) { if (alpha != 1.0f) { mKeyguardStatusView.setLayerType(LAYER_TYPE_HARDWARE, null); } else { mKeyguardStatusView.setLayerType(LAYER_TYPE_NONE, null); } private void updateClock(float alpha, float scale) { mKeyguardStatusView.setAlpha(alpha); mKeyguardStatusView.setScaleX(scale); mKeyguardStatusView.setScaleY(scale); } public void animateToFullShade() { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +18 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ public abstract class PanelView extends FrameLayout { protected int mTouchSlop; protected boolean mHintAnimationRunning; private boolean mOverExpandedBeforeFling; private float mOriginalIndicationY; private ValueAnimator mHeightAnimator; private ObjectAnimator mPeekAnimator; Loading @@ -82,6 +83,7 @@ public abstract class PanelView extends FrameLayout { private Interpolator mLinearOutSlowInInterpolator; private Interpolator mBounceInterpolator; protected KeyguardBottomAreaView mKeyguardBottomArea; protected void onExpandingFinished() { mBar.onExpandingFinished(); Loading Loading @@ -652,6 +654,22 @@ public abstract class PanelView extends FrameLayout { }); animator.start(); mHeightAnimator = animator; mOriginalIndicationY = mKeyguardBottomArea.getIndicationView().getY(); mKeyguardBottomArea.getIndicationView().animate() .y(mOriginalIndicationY - mHintDistance) .setDuration(250) .setInterpolator(mLinearOutSlowInInterpolator) .withEndAction(new Runnable() { @Override public void run() { mKeyguardBottomArea.getIndicationView().animate() .y(mOriginalIndicationY) .setDuration(450) .setInterpolator(mBounceInterpolator) .start(); } }) .start(); } /** Loading