How to get sleep or turn off time settings

37 Views Asked by At

I am investigating an issue, where android device is being automatically turned off without any reason.

The device was left yesterday running, with 57% battery. Today in the morning, the device was turned off. After starting the device, the battery shown 43%.

The following call returns 60s as screen off timeout - which is ok.

Settings.System.getInt(contentResolver, Settings.System.SCREEN_OFF_TIMEOUT)

How can I get sleep timeout? I can see the following as hiden.

public static final String SLEEP_TIMEOUT = "sleep_timeout";

It is not visible to my code, and invoking the following returns 0 and throws exception without the default value ...

Settings.System.getInt(contentResolver, "sleep_timeout", 0)

And is there some turnoff_timeout settings to be checked?

0

There are 0 best solutions below