Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 62c08270 authored by Hawkwood Glazier's avatar Hawkwood Glazier Committed by Automerger Merge Worker
Browse files

Merge "Fix NPE in Stepped Clock Animation" into tm-qpr-dev am: 8df7edf0 am:...

Merge "Fix NPE in Stepped Clock Animation" into tm-qpr-dev am: 8df7edf0 am: a1b9a4bc am: 1f3f54b0

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



Change-Id: I9c9b24e8e49107a6da2f97b8d140e0e41ca47247
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 60fb66f5 1f3f54b0
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
import static com.android.keyguard.KeyguardClockSwitch.LARGE;
import static com.android.keyguard.KeyguardClockSwitch.SMALL;

import android.annotation.Nullable;
import android.database.ContentObserver;
import android.os.UserHandle;
import android.provider.Settings;
@@ -458,6 +459,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
        mView.setClock(clock, mStatusBarStateController.getState());
    }

    @Nullable
    private ClockController getClock() {
        return mClockEventController.getClock();
    }
@@ -510,7 +512,9 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
    }

    /** Gets the animations for the current clock. */
    @Nullable
    public ClockAnimations getClockAnimations() {
        return getClock().getAnimations();
        ClockController clock = getClock();
        return clock == null ? null : clock.getAnimations();
    }
}
+12 −7
Original line number Diff line number Diff line
@@ -159,6 +159,7 @@ import com.android.systemui.model.SysUiState;
import com.android.systemui.navigationbar.NavigationBarController;
import com.android.systemui.navigationbar.NavigationBarView;
import com.android.systemui.navigationbar.NavigationModeController;
import com.android.systemui.plugins.ClockAnimations;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.FalsingManager.FalsingTapListener;
import com.android.systemui.plugins.qs.QS;
@@ -1592,10 +1593,9 @@ public final class NotificationPanelViewController implements Dumpable {
                transition.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
                transition.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);

                boolean customClockAnimation =
                            mKeyguardStatusViewController.getClockAnimations() != null
                            && mKeyguardStatusViewController.getClockAnimations()
                                    .getHasCustomPositionUpdatedAnimation();
                ClockAnimations clockAnims = mKeyguardStatusViewController.getClockAnimations();
                boolean customClockAnimation = clockAnims != null
                        && clockAnims.getHasCustomPositionUpdatedAnimation();

                if (mFeatureFlags.isEnabled(Flags.STEP_CLOCK_ANIMATION) && customClockAnimation) {
                    // Find the clock, so we can exclude it from this transition.
@@ -5119,9 +5119,14 @@ public final class NotificationPanelViewController implements Dumpable {
            Rect from = (Rect) startValues.values.get(PROP_BOUNDS);
            Rect to = (Rect) endValues.values.get(PROP_BOUNDS);

            anim.addUpdateListener(
                    animation -> mController.getClockAnimations().onPositionUpdated(
                            from, to, animation.getAnimatedFraction()));
            anim.addUpdateListener(animation -> {
                ClockAnimations clockAnims = mController.getClockAnimations();
                if (clockAnims == null) {
                    return;
                }

                clockAnims.onPositionUpdated(from, to, animation.getAnimatedFraction());
            });

            return anim;
        }
+7 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.keyguard;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.eq;
@@ -365,6 +366,12 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase {
        assertEquals(View.VISIBLE, mFakeWeatherView.getVisibility());
    }

    @Test
    public void testGetClockAnimations_nullClock_returnsNull() {
        when(mClockEventController.getClock()).thenReturn(null);
        assertNull(mController.getClockAnimations());
    }

    private void verifyAttachment(VerificationMode times) {
        verify(mClockRegistry, times).registerClockChangeListener(
                any(ClockRegistry.ClockChangeListener.class));