Merge "Add ClockId to AOD CUJs" into udc-qpr-dev

This commit is contained in:
Hawkwood Glazier
2023-08-17 18:41:22 +00:00
committed by Android (Google) Code Review
6 changed files with 44 additions and 7 deletions

View File

@@ -65,7 +65,7 @@ class DefaultClockController(
protected var onSecondaryDisplay: Boolean = false
override val events: DefaultClockEvents
override val config = ClockConfig()
override val config = ClockConfig(DEFAULT_CLOCK_ID)
init {
val parent = FrameLayout(ctx)

View File

@@ -199,6 +199,8 @@ data class ClockMetadata(
/** Render configuration for the full clock. Modifies the way systemUI behaves with this clock. */
data class ClockConfig(
val id: String,
/** Transition to AOD should move smartspace like large clock instead of small clock */
val useAlternateSmartspaceAODTransition: Boolean = false,

View File

@@ -39,6 +39,7 @@ import java.lang.annotation.RetentionPolicy;
public class KeyguardClockSwitch extends RelativeLayout {
private static final String TAG = "KeyguardClockSwitch";
public static final String MISSING_CLOCK_ID = "CLOCK_MISSING";
private static final long CLOCK_OUT_MILLIS = 133;
private static final long CLOCK_IN_MILLIS = 167;
@@ -192,6 +193,14 @@ public class KeyguardClockSwitch extends RelativeLayout {
return mLogBuffer;
}
/** Returns the id of the currently rendering clock */
public String getClockId() {
if (mClock == null) {
return MISSING_CLOCK_ID;
}
return mClock.getConfig().getId();
}
void setClock(ClockController clock, int statusBarState) {
mClock = clock;

View File

@@ -48,8 +48,10 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.jank.InteractionJankMonitor;
import com.android.internal.jank.InteractionJankMonitor.Configuration;
import com.android.internal.logging.UiEventLogger;
import com.android.keyguard.KeyguardClockSwitch;
import com.android.systemui.DejankUtils;
import com.android.systemui.Dumpable;
import com.android.systemui.R;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
@@ -420,6 +422,25 @@ public class StatusBarStateControllerImpl implements
}
}
/** Returns the id of the currently rendering clock */
public String getClockId() {
if (mView == null) {
return KeyguardClockSwitch.MISSING_CLOCK_ID;
}
View clockSwitch = mView.findViewById(R.id.keyguard_clock_container);
if (clockSwitch == null) {
Log.e(TAG, "Clock container was missing");
return KeyguardClockSwitch.MISSING_CLOCK_ID;
}
if (!(clockSwitch instanceof KeyguardClockSwitch)) {
Log.e(TAG, "Clock container was incorrect type: " + clockSwitch);
return KeyguardClockSwitch.MISSING_CLOCK_ID;
}
return ((KeyguardClockSwitch) clockSwitch).getClockId();
}
private void beginInteractionJankMonitor() {
final boolean shouldPost =
(mIsDozing && mDozeAmount == 0) || (!mIsDozing && mDozeAmount == 1);
@@ -429,6 +450,7 @@ public class StatusBarStateControllerImpl implements
Choreographer.CALLBACK_ANIMATION, this::beginInteractionJankMonitor, null);
} else {
Configuration.Builder builder = Configuration.Builder.withView(getCujType(), mView)
.setTag(getClockId())
.setDeferMonitorForAnimationStart(false);
mInteractionJankMonitor.begin(builder);
}

View File

@@ -223,10 +223,14 @@ class UnlockedScreenOffAnimationController @Inject constructor(
}
.setCustomInterpolator(View.ALPHA, Interpolators.FAST_OUT_SLOW_IN),
true /* animate */)
interactionJankMonitor.begin(
notifShadeWindowControllerLazy.get().windowRootView,
CUJ_SCREEN_OFF_SHOW_AOD
)
val builder = InteractionJankMonitor.Configuration.Builder
.withView(
InteractionJankMonitor.CUJ_SCREEN_OFF_SHOW_AOD,
notifShadeWindowControllerLazy.get().windowRootView
)
.setTag(statusBarStateControllerImpl.getClockId())
interactionJankMonitor.begin(builder)
}
override fun onStartedWakingUp() {

View File

@@ -77,7 +77,7 @@ public class KeyguardStatusViewControllerTest extends KeyguardStatusViewControll
public void updatePosition_primaryClockAnimation() {
ClockController mockClock = mock(ClockController.class);
when(mKeyguardClockSwitchController.getClock()).thenReturn(mockClock);
when(mockClock.getConfig()).thenReturn(new ClockConfig(false, true));
when(mockClock.getConfig()).thenReturn(new ClockConfig("MOCK", false, true));
mController.updatePosition(10, 15, 20f, true);
@@ -92,7 +92,7 @@ public class KeyguardStatusViewControllerTest extends KeyguardStatusViewControll
public void updatePosition_alternateClockAnimation() {
ClockController mockClock = mock(ClockController.class);
when(mKeyguardClockSwitchController.getClock()).thenReturn(mockClock);
when(mockClock.getConfig()).thenReturn(new ClockConfig(true, true));
when(mockClock.getConfig()).thenReturn(new ClockConfig("MOCK", true, true));
mController.updatePosition(10, 15, 20f, true);