AppJankStats
class AppJankStats
kotlin.Any | |
↳ | android.app.jank.AppJankStats |
This class stores detailed jank statistics for an individual UI widget. These statistics provide performance insights for specific UI widget states by correlating the number of "Janky frames" with the total frames rendered while the widget is in that state. This class can be used by library widgets to provide the system with more detailed information about where jank is happening for diagnostic purposes.
Summary
Constants | |
---|---|
static String |
UI elements that facilitate playing animations. |
static String |
UI elements that facilitate displaying, hiding or interacting with keyboard. |
static String |
UI elements that facilitate media playback. |
static String |
UI elements that facilitate in-app navigation. |
static String |
UI elements that don't fall in one or any of the other categories. |
static String |
UI elements that facilitate scrolling. |
static String |
Used to indicate no widget category has been set. |
static String |
Used to indicate the UI element is currently animating. |
static String |
Used to indicate the UI element is currently being dragged. |
static String |
Used to indicate the UI element is currently being flung. |
static String |
Used to indicate the UI element currently has no state and is idle. |
static String |
Used to indicate the UI element is currently playing media. |
static String |
Used to indicate predictive back navigation is currently being used |
static String |
Used to indicate the UI element is currently scrolling. |
static String |
Used to indicate the UI element is currently being swiped. |
static String |
Used to indicate the UI element is currently being tapped on, for example on a keyboard. |
static String |
Used to indicate no widget state has been set. |
static String |
Used to indicate the UI element is currently zooming. |
Public constructors | |
---|---|
AppJankStats(appUid: Int, widgetId: String, : String?, widgetCategory: String?, widgetState: String?, totalFrames: Long, jankyFrames: Long, relativeFrameTimeHistogram: RelativeFrameTimeHistogram) Creates a new AppJankStats object. |
Public methods | |
---|---|
Long |
Returns the number of frames that were determined to be janky for this stat. |
String? |
Returns the navigation component if it exists that this stat applies to. |
RelativeFrameTimeHistogram |
Returns a Histogram containing relative frame times in millis grouped into predefined buckets. |
Long |
Returns the total number of frames counted for this stat. |
Int |
getUid() Returns the app uid. |
String |
Returns the category that the widget's functionality generally falls into, or |
String |
Returns the id of the widget that reported state changes. |
String |
Returns the widget's state that was reported for this stat, or |
Constants
WIDGET_CATEGORY_ANIMATION
static val WIDGET_CATEGORY_ANIMATION: String
UI elements that facilitate playing animations.
Value: "animation"
WIDGET_CATEGORY_KEYBOARD
static val WIDGET_CATEGORY_KEYBOARD: String
UI elements that facilitate displaying, hiding or interacting with keyboard.
Value: "keyboard"
WIDGET_CATEGORY_MEDIA
static val WIDGET_CATEGORY_MEDIA: String
UI elements that facilitate media playback.
Value: "media"
WIDGET_CATEGORY_NAVIGATION
static val WIDGET_CATEGORY_NAVIGATION: String
UI elements that facilitate in-app navigation.
Value: "navigation"
WIDGET_CATEGORY_OTHER
static val WIDGET_CATEGORY_OTHER: String
UI elements that don't fall in one or any of the other categories.
Value: "other"
WIDGET_CATEGORY_SCROLL
static val WIDGET_CATEGORY_SCROLL: String
UI elements that facilitate scrolling.
Value: "scroll"
WIDGET_CATEGORY_UNSPECIFIED
static val WIDGET_CATEGORY_UNSPECIFIED: String
Used to indicate no widget category has been set.
Value: "unspecified"
WIDGET_STATE_ANIMATING
static val WIDGET_STATE_ANIMATING: String
Used to indicate the UI element is currently animating.
Value: "animating"
WIDGET_STATE_DRAGGING
static val WIDGET_STATE_DRAGGING: String
Used to indicate the UI element is currently being dragged.
Value: "dragging"
WIDGET_STATE_FLINGING
static val WIDGET_STATE_FLINGING: String
Used to indicate the UI element is currently being flung.
Value: "flinging"
WIDGET_STATE_NONE
static val WIDGET_STATE_NONE: String
Used to indicate the UI element currently has no state and is idle.
Value: "none"
WIDGET_STATE_PLAYBACK
static val WIDGET_STATE_PLAYBACK: String
Used to indicate the UI element is currently playing media.
Value: "playback"
WIDGET_STATE_PREDICTIVE_BACK
static val WIDGET_STATE_PREDICTIVE_BACK: String
Used to indicate predictive back navigation is currently being used
Value: "predictive_back"
WIDGET_STATE_SCROLLING
static val WIDGET_STATE_SCROLLING: String
Used to indicate the UI element is currently scrolling.
Value: "scrolling"
WIDGET_STATE_SWIPING
static val WIDGET_STATE_SWIPING: String
Used to indicate the UI element is currently being swiped.
Value: "swiping"
WIDGET_STATE_TAPPING
static val WIDGET_STATE_TAPPING: String
Used to indicate the UI element is currently being tapped on, for example on a keyboard.
Value: "tapping"
WIDGET_STATE_UNSPECIFIED
static val WIDGET_STATE_UNSPECIFIED: String
Used to indicate no widget state has been set.
Value: "unspecified"
WIDGET_STATE_ZOOMING
static val WIDGET_STATE_ZOOMING: String
Used to indicate the UI element is currently zooming.
Value: "zooming"
Public constructors
AppJankStats
AppJankStats(
appUid: Int,
widgetId: String,
: String?,
widgetCategory: String?,
widgetState: String?,
totalFrames: Long,
jankyFrames: Long,
relativeFrameTimeHistogram: RelativeFrameTimeHistogram)
Creates a new AppJankStats object.
Parameters | |
---|---|
appUid |
Int: the Uid of the App that is collecting jank stats. |
widgetId |
String: the widget id that frames will be associated to. This value cannot be null . |
navigationComponent |
String?: the intended navigation target within the activity, this could be a navigation destination, screen and/or pane. This value may be null . |
widgetCategory |
String?: 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 following:SCROLL, ANIMATION, MEDIA, NAVIGATION, KEYBOARD, OTHER or will be set to UNSPECIFIED if no value is passed. This value may be null . Value is android.app.jank.AppJankStats#WIDGET_CATEGORY_UNSPECIFIED , android.app.jank.AppJankStats#WIDGET_CATEGORY_SCROLL , android.app.jank.AppJankStats#WIDGET_CATEGORY_ANIMATION , android.app.jank.AppJankStats#WIDGET_CATEGORY_MEDIA , android.app.jank.AppJankStats#WIDGET_CATEGORY_NAVIGATION , android.app.jank.AppJankStats#WIDGET_CATEGORY_KEYBOARD , or android.app.jank.AppJankStats#WIDGET_CATEGORY_OTHER |
widgetState |
String?: the state the widget was in while frames were counted. Must be prefixed with WIDGET_STATE_ and have a suffix of one of the following: NONE, SCROLLING, FLINGING, SWIPING, DRAGGING, ZOOMING, ANIMATING, PLAYBACK, TAPPING, PREDICTIVE_BACK or will be set to WIDGET_STATE_UNSPECIFIED if no value is passed. This value may be null . Value is android.app.jank.AppJankStats#WIDGET_STATE_UNSPECIFIED , android.app.jank.AppJankStats#WIDGET_STATE_NONE , android.app.jank.AppJankStats#WIDGET_STATE_SCROLLING , android.app.jank.AppJankStats#WIDGET_STATE_FLINGING , android.app.jank.AppJankStats#WIDGET_STATE_SWIPING , android.app.jank.AppJankStats#WIDGET_STATE_DRAGGING , android.app.jank.AppJankStats#WIDGET_STATE_ZOOMING , android.app.jank.AppJankStats#WIDGET_STATE_ANIMATING , android.app.jank.AppJankStats#WIDGET_STATE_PLAYBACK , android.app.jank.AppJankStats#WIDGET_STATE_TAPPING , or android.app.jank.AppJankStats#WIDGET_STATE_PREDICTIVE_BACK |
totalFrames |
Long: the total number of frames that were counted for this stat. |
jankyFrames |
Long: the total number of janky frames that were counted for this stat. |
relativeFrameTimeHistogram |
RelativeFrameTimeHistogram: the histogram with predefined buckets. See getRelativeFrameTimeHistogram() for details. This value cannot be null . |
Public methods
getJankyFrameCount
fun getJankyFrameCount(): Long
Returns the number of frames that were determined to be janky for this stat.
Return | |
---|---|
Long |
the number of frames that were determined to be janky for this stat. |
getNavigationComponent
fun getNavigationComponent(): String?
Returns the navigation component if it exists that this stat applies to.
Return | |
---|---|
String? |
the navigation component if it exists that this stat applies to. This value may be null . |
getRelativeFrameTimeHistogram
fun getRelativeFrameTimeHistogram(): RelativeFrameTimeHistogram
Returns a Histogram containing relative frame times in millis grouped into predefined buckets. See RelativeFrameTimeHistogram
for more information.
Return | |
---|---|
RelativeFrameTimeHistogram |
Histogram containing relative frame times in predefined buckets. This value cannot be null. |
getTotalFrameCount
fun getTotalFrameCount(): Long
Returns the total number of frames counted for this stat.
Return | |
---|---|
Long |
the total number of frames counted for this stat. |
getWidgetCategory
fun getWidgetCategory(): String
Returns the category that the widget's functionality generally falls into, or WIDGET_CATEGORY_UNSPECIFIED
if no value was passed in.
Return | |
---|---|
String |
the category that the widget's functionality generally falls into, this value cannot be null. Value is android.app.jank.AppJankStats#WIDGET_CATEGORY_UNSPECIFIED , android.app.jank.AppJankStats#WIDGET_CATEGORY_SCROLL , android.app.jank.AppJankStats#WIDGET_CATEGORY_ANIMATION , android.app.jank.AppJankStats#WIDGET_CATEGORY_MEDIA , android.app.jank.AppJankStats#WIDGET_CATEGORY_NAVIGATION , android.app.jank.AppJankStats#WIDGET_CATEGORY_KEYBOARD , or android.app.jank.AppJankStats#WIDGET_CATEGORY_OTHER |
getWidgetId
fun getWidgetId(): String
Returns the id of the widget that reported state changes.
Return | |
---|---|
String |
the id of the widget that reported state changes. This value cannot be null. |
getWidgetState
fun getWidgetState(): String
Returns the widget's state that was reported for this stat, or WIDGET_STATE_UNSPECIFIED
if no value was passed in.