Package org.robolectric.shadows
Class ShadowStatsManager
java.lang.Object
org.robolectric.shadows.ShadowStatsManager
@Implements(value=android.app.StatsManager.class,
isInAndroidSdk=false,
minSdk=28)
public class ShadowStatsManager
extends Object
Shadow for
StatsManager
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A key used to store the configKey and subscriberId in the broadcastSubscriberMap. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addConfig
(long configKey, byte[] config) static void
addReportData
(long configKey, byte[] data) Adds metrics data that the shadow should return fromStatsManager.getReports(long)
.Retrieves the broadcast subscriber map stored in the shadow as a result ofStatsManager#setBroadcastSubscriber()
.static byte[]
getConfigData
(long configKey) Retrieves the statsd configurations stored in the shadow as a result ofStatsManager.addConfig(long, byte[])
andStatsManager.removeConfig(long)
.protected long[]
protected byte[]
getReports
(long configKey) protected byte[]
protected void
removeConfig
(long configKey) static void
reset()
protected void
setBroadcastSubscriber
(PendingIntent pendingIntent, long configKey, long subscriberId) static void
setRegisteredExperimentIds
(long[] experimentIds) Sets the registered experiment ids that the shadow should return fromStatsManager.getRegisteredExperimentIds()
.static void
setStatsMetadata
(byte[] metadata) Sets the statsd metadata that the shadow should return fromStatsManager.getStatsMetadata()
.
-
Constructor Details
-
ShadowStatsManager
public ShadowStatsManager()
-
-
Method Details
-
reset
-
addReportData
public static void addReportData(long configKey, byte[] data) Adds metrics data that the shadow should return fromStatsManager.getReports(long)
. -
setStatsMetadata
public static void setStatsMetadata(byte[] metadata) Sets the statsd metadata that the shadow should return fromStatsManager.getStatsMetadata()
. -
setRegisteredExperimentIds
public static void setRegisteredExperimentIds(long[] experimentIds) Sets the registered experiment ids that the shadow should return fromStatsManager.getRegisteredExperimentIds()
. -
getConfigData
public static byte[] getConfigData(long configKey) Retrieves the statsd configurations stored in the shadow as a result ofStatsManager.addConfig(long, byte[])
andStatsManager.removeConfig(long)
. -
getBroadcastSubscriberMap
public static Map<ShadowStatsManager.BroadcastSubscriberKey,PendingIntent> getBroadcastSubscriberMap()Retrieves the broadcast subscriber map stored in the shadow as a result ofStatsManager#setBroadcastSubscriber()
.- Returns:
- A map where the keys are
ShadowStatsManager.BroadcastSubscriberKey
objects, which contain the configKey and subscriberId, and the values arePendingIntent
objects.
-
getReports
-
getStatsMetadata
-
addConfig
-
removeConfig
-
setBroadcastSubscriber
@Implementation protected void setBroadcastSubscriber(PendingIntent pendingIntent, long configKey, long subscriberId) -
getRegisteredExperimentIds
-