Represents the result of segmenting sleep after the user is awake. Its contents depend on the status code:
STATUS_SUCCESSFUL or
STATUS_MISSING_DATA, then an instance of this class contains a detected sleep
start time and a detected sleep end time. These times represent the beginning and end of
sleep during a particular day.STATUS_NOT_DETECTED, then an instance of this class
contains no other information.To retrieve any detected sleep start/end times, call
getStartTimeMillis() and
getEndTimeMillis(), respectively. Note that both of these times are the UNIX epoch
time (milliseconds since 1/1/1970 UTC).
The sleep detection result depends on sampled device motion and ambient light readings
during the past day. For customized sleep segmentation, use
SleepClassifyEvent.
| int | STATUS_MISSING_DATA | Sleep segment was detected, but there was some missing data near the detected sleep segment. |
| int | STATUS_NOT_DETECTED | Sleep segment is not detected in the past day, or there isn't enough confidence that the user slept during the past day. |
| int | STATUS_SUCCESSFUL | Successfully detected sleep segment in the past day. |
| public static final Creator<SleepSegmentEvent> | CREATOR |
| boolean | |
| static List<SleepSegmentEvent> | |
| long |
getEndTimeMillis()
If the status is STATUS_SUCCESS or STATUS_MISSING_DATA, this method returns the
UNIX epoch time for the moment when the system detects that the user stops
sleeping and wakes up.
|
| long |
getSegmentDurationMillis()
The amount of elapsed time, in milliseconds, that the system detected that the
user was asleep based on the device sensor data.
|
| long |
getStartTimeMillis()
If the status is STATUS_SUCCESS or STATUS_MISSING_DATA, this method returns the
UNIX epoch time (milliseconds since 1/1/1970 UTC) for the moment when the
system detects that the user begins sleeping.
|
| int |
getStatus()
Get a status code that indicates whether the system succeeded in detecting
sleep and gathering sleep data.
|
| static boolean | |
| int |
hashCode()
|
| String |
toString()
|
| void |
writeToParcel(Parcel out, int
flags)
|
Sleep segment was detected, but there was some missing data near the detected sleep segment. This could happen for a variety of reasons, including the following: the user turned off their device, the user delayed logging into their device after a system reboot or system upgrade, or an event occurred that paused the detection.
Sleep segment is not detected in the past day, or there isn't enough confidence that the user slept during the past day. This could happen for a variety of reasons, including the following: too much missing data, the user sleeps with the light, the user interacts with their device often, or the user's device doesn't support the sensors needed for sleep detection.
Successfully detected sleep segment in the past day.
Extracts the list of SleepSegmentEvent from an Intent.
| intent | the Intent to extract from |
|---|
SleepSegmentEvents
if the intent has events, or an empty list if the intent doesn't contain any
events.If the status is STATUS_SUCCESS or STATUS_MISSING_DATA, this method returns the UNIX epoch time for the moment when the system detects that the user stops sleeping and wakes up. If the status is STATUS_NOT_DETECTED, this method returns 0.
The amount of elapsed time, in milliseconds, that the system detected that the user was asleep based on the device sensor data. If the status is STATUS_NOT_DETECTED, this method returns 0.
If the status is STATUS_SUCCESS or STATUS_MISSING_DATA, this method returns the UNIX epoch time (milliseconds since 1/1/1970 UTC) for the moment when the system detects that the user begins sleeping. If the status is STATUS_NOT_DETECTED, this method returns 0.
Get a status code that indicates whether the system succeeded in detecting sleep and gathering sleep data.
Checks whether the Intent has any SleepSegmentEvent.
| intent | the Intent to extract from |
|---|