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

Commit 908422cc authored by Jack Richardson's avatar Jack Richardson Committed by Android (Google) Code Review
Browse files

Merge "Prevent crash due to missing CUJ type." into main

parents 14200e38 f1016587
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.internal.jank;

import android.annotation.IntDef;
import android.util.Log;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.FrameworkStatsLog;
@@ -28,6 +29,8 @@ import java.util.Arrays;
/** @hide */
public class Cuj {
    @VisibleForTesting
    private static final String TAG = "Cuj";

    public static final int MAX_LENGTH_OF_CUJ_NAME = 82;

    // Every value must have a corresponding entry in CUJ_STATSD_INTERACTION_TYPE.
@@ -985,6 +988,10 @@ public class Cuj {
    }

    public static int getStatsdInteractionType(@CujType int cujType) {
      if (cujType < 0 || cujType >= CUJ_TO_STATSD_INTERACTION_TYPE.length) {
        Log.e(TAG, "getStatsdInteractionType: cujType: " + cujType + " is out of range.");
        return NO_STATSD_LOGGING;
      }
      return CUJ_TO_STATSD_INTERACTION_TYPE[cujType];
    }