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

Commit 8b379c95 authored by Steven Terrell's avatar Steven Terrell Committed by Android (Google) Code Review
Browse files

Merge "Add Navigation Component" into main

parents ccfc0fe6 62b7a6ba
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -9190,8 +9190,9 @@ package android.app.blob {
package android.app.jank {
  @FlaggedApi("android.app.jank.detailed_app_jank_metrics_api") public final class AppJankStats {
    ctor public AppJankStats(int, @NonNull String, @Nullable String, @Nullable String, long, long, @NonNull android.app.jank.RelativeFrameTimeHistogram);
    ctor public AppJankStats(int, @NonNull String, @Nullable String, @Nullable String, @Nullable String, long, long, @NonNull android.app.jank.RelativeFrameTimeHistogram);
    method public long getJankyFrameCount();
    method @Nullable public String getNavigationComponent();
    method @NonNull public android.app.jank.RelativeFrameTimeHistogram getRelativeFrameTimeHistogram();
    method public long getTotalFrameCount();
    method public int getUid();
+15 −2
Original line number Diff line number Diff line
@@ -57,6 +57,8 @@ public final class AppJankStats {
    // Histogram of relative frame times encoded in predetermined buckets.
    private RelativeFrameTimeHistogram mRelativeFrameTimeHistogram;

    // Navigation component associated to this stat.
    private String mNavigationComponent;

    /** Used to indicate no widget category has been set. */
    public static final String WIDGET_CATEGORY_UNSPECIFIED = "unspecified";
@@ -158,6 +160,8 @@ public final class AppJankStats {
     *
     * @param appUid the Uid of the App that is collecting jank stats.
     * @param widgetId the widget id that frames will be associated to.
     * @param navigationComponent the intended navigation target within the activity, this could be
     *                            a navigation destination, screen and/or pane.
     * @param widgetCategory a category used to organize widgets in a structured way that indicates
     *                       they serve a similar purpose or perform related functions. Must be
     *                       prefixed with WIDGET_CATEGORY_ and have a suffix of one of the
@@ -172,14 +176,14 @@ public final class AppJankStats {
     * @param jankyFrames the total number of janky frames that were counted for this stat.
     * @param relativeFrameTimeHistogram the histogram with predefined buckets. See
     * {@link #getRelativeFrameTimeHistogram()} for details.
     *
     */
    public AppJankStats(int appUid, @NonNull String widgetId,
    public AppJankStats(int appUid, @NonNull String widgetId, @Nullable String navigationComponent,
            @Nullable @WidgetCategory String widgetCategory,
            @Nullable @WidgetState String widgetState, long totalFrames, long jankyFrames,
            @NonNull RelativeFrameTimeHistogram relativeFrameTimeHistogram) {
        mUid = appUid;
        mWidgetId = widgetId;
        mNavigationComponent = navigationComponent;
        mWidgetCategory = widgetCategory != null ? widgetCategory : WIDGET_CATEGORY_UNSPECIFIED;
        mWidgetState = widgetState != null ? widgetState : WIDGET_STATE_UNSPECIFIED;
        mTotalFrames = totalFrames;
@@ -254,4 +258,13 @@ public final class AppJankStats {
    public @NonNull RelativeFrameTimeHistogram getRelativeFrameTimeHistogram() {
        return mRelativeFrameTimeHistogram;
    }

    /**
     * Returns the navigation component if it exists that this stat applies to.
     *
     * @return the navigation component if it exists that this stat applies to.
     */
    public @Nullable String getNavigationComponent() {
        return mNavigationComponent;
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ public class JankUtils {
        AppJankStats jankStats = new AppJankStats(
                /*App Uid*/APP_ID,
                /*Widget Id*/"test widget id",
                /*navigationComponent*/null,
                /*Widget Category*/AppJankStats.WIDGET_CATEGORY_SCROLL,
                /*Widget State*/AppJankStats.WIDGET_STATE_SCROLLING,
                /*Total Frames*/100,