Enum Class WakeLockAvailability
- All Implemented Interfaces:
Serializable,Comparable<WakeLockAvailability>,Constable
Whether the browser can hold a screen wake lock in the current page context.
Held by WakeLock.availabilitySignal(). Reading the value does not
call the browser API ? it reports whether the next WakeLock.request()
has any chance of succeeding.
Typical usage: hide a "keep screen on" toggle entirely when the value is
UNSUPPORTED (no user action can change this), and otherwise offer it
and observe WakeLock.activeSignal(UI) for the actual state.
- Since:
- 25.2
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe browser exposes the Screen Wake Lock API and the page is served from a secure context, soWakeLock.request()has a chance of succeeding.The browser has not yet reported a value.The Screen Wake Lock API is not usable in the current page context ? the browser does not implement it, or the page is served over an insecure connection (plain HTTP rather than HTTPS orlocalhost). -
Method Summary
Modifier and TypeMethodDescriptionstatic WakeLockAvailabilityReturns the enum constant of this class with the specified name.static WakeLockAvailability[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SUPPORTED
The browser exposes the Screen Wake Lock API and the page is served from a secure context, soWakeLock.request()has a chance of succeeding. Whether the browser actually grants the lock still depends on page visibility, battery state, and other transient conditions ? observeWakeLock.activeSignal(UI)for the actual outcome. -
UNSUPPORTED
The Screen Wake Lock API is not usable in the current page context ? the browser does not implement it, or the page is served over an insecure connection (plain HTTP rather than HTTPS orlocalhost). No user action can change this; applications should hide wake-lock-related controls entirely instead of offering a button that would always fail. -
UNKNOWN
The browser has not yet reported a value. This is the seed value held during the brief window between UI attach and the bootstrap response being processed; in practice applications see it only as a transient state.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-