AppJankStats
public
final
class
AppJankStats
extends Object
java.lang.Object | |
↳ | 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 | |
---|---|
String |
WIDGET_CATEGORY_ANIMATION
UI elements that facilitate playing animations. |
String |
WIDGET_CATEGORY_KEYBOARD
UI elements that facilitate displaying, hiding or interacting with keyboard. |
String |
WIDGET_CATEGORY_MEDIA
UI elements that facilitate media playback. |
String |
WIDGET_CATEGORY_NAVIGATION
UI elements that facilitate in-app navigation. |
String |
WIDGET_CATEGORY_OTHER
UI elements that don't fall in one or any of the other categories. |
String |
WIDGET_CATEGORY_SCROLL
UI elements that facilitate scrolling. |
String |
WIDGET_CATEGORY_UNSPECIFIED
Used to indicate no widget category has been set. |
String |
WIDGET_STATE_ANIMATING
Used to indicate the UI element is currently animating. |
String |
WIDGET_STATE_DRAGGING
Used to indicate the UI element is currently being dragged. |
String |
WIDGET_STATE_FLINGING
Used to indicate the UI element is currently being flung. |
String |
WIDGET_STATE_NONE
Used to indicate the UI element currently has no state and is idle. |
String |
WIDGET_STATE_PLAYBACK
Used to indicate the UI element is currently playing media. |
String |
WIDGET_STATE_PREDICTIVE_BACK
Used to indicate predictive back navigation is currently being used |
String |
WIDGET_STATE_SCROLLING
Used to indicate the UI element is currently scrolling. |
String |
WIDGET_STATE_SWIPING
Used to indicate the UI element is currently being swiped. |
String |
WIDGET_STATE_TAPPING
Used to indicate the UI element is currently being tapped on, for example on a keyboard. |
String |
WIDGET_STATE_UNSPECIFIED
Used to indicate no widget state has been set. |
String |
WIDGET_STATE_ZOOMING
Used to indicate the UI element is currently zooming. |
Public constructors | |
---|---|
AppJankStats(int appUid, String widgetId, String navigationComponent, String widgetCategory, String widgetState, long totalFrames, long jankyFrames, RelativeFrameTimeHistogram relativeFrameTimeHistogram)
Creates a new AppJankStats object. |
Public methods | |
---|---|
long
|
getJankyFrameCount()
Returns the number of frames that were determined to be janky for this stat. |
String
|
getNavigationComponent()
Returns the navigation component if it exists that this stat applies to. |
RelativeFrameTimeHistogram
|
getRelativeFrameTimeHistogram()
Returns a Histogram containing relative frame times in millis grouped into predefined buckets. |
long
|
getTotalFrameCount()
Returns the total number of frames counted for this stat. |
int
|
getUid()
Returns the app uid. |
String
|
getWidgetCategory()
Returns the category that the widget's functionality generally falls into, or
|
String
|
getWidgetId()
Returns the id of the widget that reported state changes. |
String
|
getWidgetState()
Returns the widget's state that was reported for this stat, or
|
Inherited methods | |
---|---|
Constants
WIDGET_CATEGORY_ANIMATION
public static final String WIDGET_CATEGORY_ANIMATION
UI elements that facilitate playing animations.
Constant Value: "animation"
WIDGET_CATEGORY_KEYBOARD
public static final String WIDGET_CATEGORY_KEYBOARD
UI elements that facilitate displaying, hiding or interacting with keyboard.
Constant Value: "keyboard"
WIDGET_CATEGORY_MEDIA
public static final String WIDGET_CATEGORY_MEDIA
UI elements that facilitate media playback.
Constant Value: "media"
WIDGET_CATEGORY_NAVIGATION
public static final String WIDGET_CATEGORY_NAVIGATION
UI elements that facilitate in-app navigation.
Constant Value: "navigation"
WIDGET_CATEGORY_OTHER
public static final String WIDGET_CATEGORY_OTHER
UI elements that don't fall in one or any of the other categories.
Constant Value: "other"
WIDGET_CATEGORY_SCROLL
public static final String WIDGET_CATEGORY_SCROLL
UI elements that facilitate scrolling.
Constant Value: "scroll"
WIDGET_CATEGORY_UNSPECIFIED
public static final String WIDGET_CATEGORY_UNSPECIFIED
Used to indicate no widget category has been set.
Constant Value: "unspecified"
WIDGET_STATE_ANIMATING
public static final String WIDGET_STATE_ANIMATING
Used to indicate the UI element is currently animating.
Constant Value: "animating"
WIDGET_STATE_DRAGGING
public static final String WIDGET_STATE_DRAGGING
Used to indicate the UI element is currently being dragged.
Constant Value: "dragging"
WIDGET_STATE_FLINGING
public static final String WIDGET_STATE_FLINGING
Used to indicate the UI element is currently being flung.
Constant Value: "flinging"
WIDGET_STATE_NONE
public static final String WIDGET_STATE_NONE
Used to indicate the UI element currently has no state and is idle.
Constant Value: "none"
WIDGET_STATE_PLAYBACK
public static final String WIDGET_STATE_PLAYBACK
Used to indicate the UI element is currently playing media.
Constant Value: "playback"
WIDGET_STATE_PREDICTIVE_BACK
public static final String WIDGET_STATE_PREDICTIVE_BACK
Used to indicate predictive back navigation is currently being used
Constant Value: "predictive_back"
WIDGET_STATE_SCROLLING
public static final String WIDGET_STATE_SCROLLING
Used to indicate the UI element is currently scrolling.
Constant Value: "scrolling"
WIDGET_STATE_SWIPING
public static final String WIDGET_STATE_SWIPING
Used to indicate the UI element is currently being swiped.
Constant Value: "swiping"
WIDGET_STATE_TAPPING
public static final String WIDGET_STATE_TAPPING
Used to indicate the UI element is currently being tapped on, for example on a keyboard.
Constant Value: "tapping"
WIDGET_STATE_UNSPECIFIED
public static final String WIDGET_STATE_UNSPECIFIED
Used to indicate no widget state has been set.
Constant Value: "unspecified"
WIDGET_STATE_ZOOMING
public static final String WIDGET_STATE_ZOOMING
Used to indicate the UI element is currently zooming.
Constant Value: "zooming"
Public constructors
AppJankStats
public AppJankStats (int appUid, String widgetId, String navigationComponent, String widgetCategory, String widgetState, long totalFrames, long jankyFrames, 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 WIDGET_CATEGORY_UNSPECIFIED , WIDGET_CATEGORY_SCROLL , WIDGET_CATEGORY_ANIMATION , WIDGET_CATEGORY_MEDIA , WIDGET_CATEGORY_NAVIGATION , WIDGET_CATEGORY_KEYBOARD , or 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 WIDGET_STATE_UNSPECIFIED , WIDGET_STATE_NONE , WIDGET_STATE_SCROLLING , WIDGET_STATE_FLINGING , WIDGET_STATE_SWIPING , WIDGET_STATE_DRAGGING , WIDGET_STATE_ZOOMING , WIDGET_STATE_ANIMATING , WIDGET_STATE_PLAYBACK , WIDGET_STATE_TAPPING , or 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
public long getJankyFrameCount ()
Returns the number of frames that were determined to be janky for this stat.
Returns | |
---|---|
long |
the number of frames that were determined to be janky for this stat. |
getNavigationComponent
public String getNavigationComponent ()
Returns the navigation component if it exists that this stat applies to.
Returns | |
---|---|
String |
the navigation component if it exists that this stat applies to.
This value may be null . |
getRelativeFrameTimeHistogram
public RelativeFrameTimeHistogram getRelativeFrameTimeHistogram ()
Returns a Histogram containing relative frame times in millis grouped into predefined
buckets. See RelativeFrameTimeHistogram
for more information.
Returns | |
---|---|
RelativeFrameTimeHistogram |
Histogram containing relative frame times in predefined buckets. This value cannot be null. |
getTotalFrameCount
public long getTotalFrameCount ()
Returns the total number of frames counted for this stat.
Returns | |
---|---|
long |
the total number of frames counted for this stat. |
getWidgetCategory
public String getWidgetCategory ()
Returns the category that the widget's functionality generally falls into, or
WIDGET_CATEGORY_UNSPECIFIED
if no value was passed in.
Returns | |
---|---|
String |
the category that the widget's functionality generally falls into, this value cannot
be null.
Value is WIDGET_CATEGORY_UNSPECIFIED , WIDGET_CATEGORY_SCROLL , WIDGET_CATEGORY_ANIMATION , WIDGET_CATEGORY_MEDIA , WIDGET_CATEGORY_NAVIGATION , WIDGET_CATEGORY_KEYBOARD , or WIDGET_CATEGORY_OTHER |
getWidgetId
public String getWidgetId ()
Returns the id of the widget that reported state changes.
Returns | |
---|---|
String |
the id of the widget that reported state changes. This value cannot be null. |
getWidgetState
public String getWidgetState ()
Returns the widget's state that was reported for this stat, or
WIDGET_STATE_UNSPECIFIED
if no value was passed in.
Returns | |
---|---|
String |
the widget's state that was reported for this stat. This value cannot be null.
Value is WIDGET_STATE_UNSPECIFIED , WIDGET_STATE_NONE , WIDGET_STATE_SCROLLING , WIDGET_STATE_FLINGING , WIDGET_STATE_SWIPING , WIDGET_STATE_DRAGGING , WIDGET_STATE_ZOOMING , WIDGET_STATE_ANIMATING , WIDGET_STATE_PLAYBACK , WIDGET_STATE_TAPPING , or WIDGET_STATE_PREDICTIVE_BACK |