Loading core/java/com/android/internal/jank/InteractionJankMonitor.java +6 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_IN import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SPLASHSCREEN_AVD; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SPLASHSCREEN_EXIT_ANIM; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__STATUS_BAR_APP_LAUNCH_FROM_CALL_CHIP; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__UNFOLD_ANIM; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__USER_SWITCH; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__WALLPAPER_TRANSITION; Loading Loading @@ -174,6 +175,7 @@ public class InteractionJankMonitor { public static final int CUJ_SCREEN_OFF_SHOW_AOD = 41; public static final int CUJ_ONE_HANDED_ENTER_TRANSITION = 42; public static final int CUJ_ONE_HANDED_EXIT_TRANSITION = 43; public static final int CUJ_UNFOLD_ANIM = 44; private static final int NO_STATSD_LOGGING = -1; Loading Loading @@ -226,6 +228,7 @@ public class InteractionJankMonitor { UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SCREEN_OFF_SHOW_AOD, UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__ONE_HANDED_ENTER_TRANSITION, UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__ONE_HANDED_EXIT_TRANSITION, UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__UNFOLD_ANIM, }; private static volatile InteractionJankMonitor sInstance; Loading Loading @@ -290,6 +293,7 @@ public class InteractionJankMonitor { CUJ_SCREEN_OFF_SHOW_AOD, CUJ_ONE_HANDED_ENTER_TRANSITION, CUJ_ONE_HANDED_EXIT_TRANSITION, CUJ_UNFOLD_ANIM, }) @Retention(RetentionPolicy.SOURCE) public @interface CujType { Loading Loading @@ -695,6 +699,8 @@ public class InteractionJankMonitor { return "ONE_HANDED_ENTER_TRANSITION"; case CUJ_ONE_HANDED_EXIT_TRANSITION: return "ONE_HANDED_EXIT_TRANSITION"; case CUJ_UNFOLD_ANIM: return "UNFOLD_ANIM"; } return "UNKNOWN"; } Loading packages/SystemUI/shared/src/com/android/systemui/unfold/util/JankMonitorTransitionProgressListener.kt 0 → 100644 +37 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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 com.android.systemui.unfold.util import android.view.View import com.android.internal.jank.InteractionJankMonitor import com.android.internal.jank.InteractionJankMonitor.CUJ_UNFOLD_ANIM import com.android.systemui.unfold.UnfoldTransitionProgressProvider.TransitionProgressListener import java.util.function.Supplier class JankMonitorTransitionProgressListener(private val attachedViewProvider: Supplier<View>) : TransitionProgressListener { private val interactionJankMonitor = InteractionJankMonitor.getInstance() override fun onTransitionStarted() { interactionJankMonitor.begin(attachedViewProvider.get(), CUJ_UNFOLD_ANIM) } override fun onTransitionFinished() { interactionJankMonitor.end(CUJ_UNFOLD_ANIM) } } packages/SystemUI/src/com/android/systemui/statusbar/window/StatusBarWindowController.java +8 −1 Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.fragments.FragmentHostManager; import com.android.systemui.statusbar.phone.StatusBarContentInsetsProvider; import com.android.systemui.unfold.UnfoldTransitionProgressProvider; import com.android.systemui.unfold.util.JankMonitorTransitionProgressListener; import java.util.Optional; Loading Loading @@ -81,7 +83,8 @@ public class StatusBarWindowController { WindowManager windowManager, IWindowManager iWindowManager, StatusBarContentInsetsProvider contentInsetsProvider, @Main Resources resources) { @Main Resources resources, Optional<UnfoldTransitionProgressProvider> unfoldTransitionProgressProvider) { mContext = context; mWindowManager = windowManager; mIWindowManager = iWindowManager; Loading @@ -94,6 +97,10 @@ public class StatusBarWindowController { if (mBarHeight < 0) { mBarHeight = SystemBarUtils.getStatusBarHeight(mContext); } unfoldTransitionProgressProvider.ifPresent( unfoldProgressProvider -> unfoldProgressProvider.addCallback( new JankMonitorTransitionProgressListener( /* attachedViewProvider=*/ () -> mStatusBarWindowView))); } public int getStatusBarHeight() { Loading Loading
core/java/com/android/internal/jank/InteractionJankMonitor.java +6 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_IN import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SPLASHSCREEN_AVD; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SPLASHSCREEN_EXIT_ANIM; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__STATUS_BAR_APP_LAUNCH_FROM_CALL_CHIP; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__UNFOLD_ANIM; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__USER_SWITCH; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__WALLPAPER_TRANSITION; Loading Loading @@ -174,6 +175,7 @@ public class InteractionJankMonitor { public static final int CUJ_SCREEN_OFF_SHOW_AOD = 41; public static final int CUJ_ONE_HANDED_ENTER_TRANSITION = 42; public static final int CUJ_ONE_HANDED_EXIT_TRANSITION = 43; public static final int CUJ_UNFOLD_ANIM = 44; private static final int NO_STATSD_LOGGING = -1; Loading Loading @@ -226,6 +228,7 @@ public class InteractionJankMonitor { UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SCREEN_OFF_SHOW_AOD, UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__ONE_HANDED_ENTER_TRANSITION, UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__ONE_HANDED_EXIT_TRANSITION, UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__UNFOLD_ANIM, }; private static volatile InteractionJankMonitor sInstance; Loading Loading @@ -290,6 +293,7 @@ public class InteractionJankMonitor { CUJ_SCREEN_OFF_SHOW_AOD, CUJ_ONE_HANDED_ENTER_TRANSITION, CUJ_ONE_HANDED_EXIT_TRANSITION, CUJ_UNFOLD_ANIM, }) @Retention(RetentionPolicy.SOURCE) public @interface CujType { Loading Loading @@ -695,6 +699,8 @@ public class InteractionJankMonitor { return "ONE_HANDED_ENTER_TRANSITION"; case CUJ_ONE_HANDED_EXIT_TRANSITION: return "ONE_HANDED_EXIT_TRANSITION"; case CUJ_UNFOLD_ANIM: return "UNFOLD_ANIM"; } return "UNKNOWN"; } Loading
packages/SystemUI/shared/src/com/android/systemui/unfold/util/JankMonitorTransitionProgressListener.kt 0 → 100644 +37 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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 com.android.systemui.unfold.util import android.view.View import com.android.internal.jank.InteractionJankMonitor import com.android.internal.jank.InteractionJankMonitor.CUJ_UNFOLD_ANIM import com.android.systemui.unfold.UnfoldTransitionProgressProvider.TransitionProgressListener import java.util.function.Supplier class JankMonitorTransitionProgressListener(private val attachedViewProvider: Supplier<View>) : TransitionProgressListener { private val interactionJankMonitor = InteractionJankMonitor.getInstance() override fun onTransitionStarted() { interactionJankMonitor.begin(attachedViewProvider.get(), CUJ_UNFOLD_ANIM) } override fun onTransitionFinished() { interactionJankMonitor.end(CUJ_UNFOLD_ANIM) } }
packages/SystemUI/src/com/android/systemui/statusbar/window/StatusBarWindowController.java +8 −1 Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.fragments.FragmentHostManager; import com.android.systemui.statusbar.phone.StatusBarContentInsetsProvider; import com.android.systemui.unfold.UnfoldTransitionProgressProvider; import com.android.systemui.unfold.util.JankMonitorTransitionProgressListener; import java.util.Optional; Loading Loading @@ -81,7 +83,8 @@ public class StatusBarWindowController { WindowManager windowManager, IWindowManager iWindowManager, StatusBarContentInsetsProvider contentInsetsProvider, @Main Resources resources) { @Main Resources resources, Optional<UnfoldTransitionProgressProvider> unfoldTransitionProgressProvider) { mContext = context; mWindowManager = windowManager; mIWindowManager = iWindowManager; Loading @@ -94,6 +97,10 @@ public class StatusBarWindowController { if (mBarHeight < 0) { mBarHeight = SystemBarUtils.getStatusBarHeight(mContext); } unfoldTransitionProgressProvider.ifPresent( unfoldProgressProvider -> unfoldProgressProvider.addCallback( new JankMonitorTransitionProgressListener( /* attachedViewProvider=*/ () -> mStatusBarWindowView))); } public int getStatusBarHeight() { Loading