Sleep mode has disappeared on Android, what should I do? Sleep lock for Android. Activate energy saving mode

By default, sleep mode, that is, the screen turns off when inactive on an Android smartphone, occurs after 30 or 60 seconds. As a rule, this is more than enough for most users, and turning off the display saves battery power. However, sometimes this time is not enough, so you need to increase the time before entering sleep mode. How to do it? Now you will find out everything.

Disable screen sleep for up to 30 minutes

On most Android smartphones, the maximum time of inactivity before the screen turns off is 30 minutes. If these numbers are enough for you, you just need to change the settings.

Go to the settings section.

Open the "Screen" section.

Find the line “Sleep mode”, tap on it.

Select the maximum period of user inactivity before the screen goes into sleep mode.

All. If necessary, the time can be changed at any time.

How to disable sleep mode completely (for more than 30 minutes)?

If the screen turns off during inactivity for more than 30 minutes, you will have to install a third-party application.

Open Play Market.

Write in search screen alive, click on the search button.

Choose an application, read reviews, install.

Let’s take “Staying Screen” from Active Mobile Applications as an example.

Install and launch. We select an application for which the screen should not go dark, tap on it and see the corresponding icon.

This application should not turn off the screen when there is no user activity at all. Other similar applications, which you can also install from the Play Market, work in much the same way.

Honor 6 is equipped with a non-removable lithium polymer battery with a capacity of 3100 mAh (11.5 Wh). The battery capacity is not record-breaking, but very good and sufficient to ensure long battery life.

The Honor 6 software has a large number of power consumption settings. In the "Energy Saving" menu, you can select one of three energy consumption profiles - "Performance", "Smart" and "Energy Saving". In this case, the smartphone predicts the remaining operating time in each mode.

The energy saving mode in Honor 6 is implemented in a very interesting way. It blocks almost all phone functions, except calls, SMS and access to contacts. But in this mode the smartphone works for a very long time. This is a good solution for those moments when the battery is almost empty and you absolutely need to stay connected. Moreover, if the battery charge drops to a critically low level, the smartphone itself will prompt you to switch to energy saving mode; the user can choose the threshold for triggering this warning (8, 20 or 30 percent).

Due to aggressive settings, the built-in power manager often closes applications running in the background. Messaging applications (for example, Viber) may also be targeted. But the user can manually specify which applications should be protected from being closed in sleep mode. For example, on my Honor 6 I enabled this option for Viber.

Finally, there is a special mode in the menu, which in the Russian version of the interface is for some reason called “Screensaver” (in the Ukrainian version it is called “Economy robot mode”). In this mode, the smartphone draws and displays graphics in a resolution of 1280x720, resulting in increased performance and reduced power consumption. True, the clarity of small fonts suffers somewhat.

In balanced power consumption mode, Honor 6 can last about two days with three hours of screen operation per day. This is a very worthy result. If you play games on your smartphone, the operating time is expectedly reduced, but even in this case, the device survives until the evening without any problems.

We translate... Translate Chinese (Simplified) Chinese (Traditional) English French German Italian Portuguese Russian Spanish Turkish

Unfortunately, we are unable to translate this information right now - please try again later.

Christopher Bird

Power Management in Android Operating System - Sleep Lock

Probably, many have encountered a situation where a mobile device cannot operate on a single battery charge for a full day. Everyone understands the unpleasantness of the situation when, by the end of the working day, the phone turns into a useless brick. Modern applications make it possible to perform tasks on smartphones that previously required a computer. But if we compare smartphones with PCs, then due to their significantly smaller size, they also differ in significantly lower battery capacity. Thus, the phone must have, in essence, the functionality of a laptop, but at the same time - and this is a very strict requirement - it must run on battery power for quite a long time without recharging.

Android and other mobile operating systems have achieved long battery life by using an aggressive power management model. After some time of using the phone, the screen turns off and the CPU goes into a low-power mode. Thus, when the phone is not in use, very little energy is consumed. Thanks to this approach, phones can work in standby mode without recharging for several days. The Android power manager is built on the following, quite logical principle: when the screen turns off, the CPU also turns off.

But Android developers have provided the ability to prevent devices running this OS from going into sleep mode. In some cases, you may want the CPU to remain active even when the screen is off, or you may want to prevent the screen from automatically turning off when performing certain tasks. For this purpose, Google* developers have included so-called sleep locks in the PowerManager API. Applications that need to avoid the device falling asleep can take advantage of this blocking. While the system has an active sleep lock, the device will not be able to “sleep”, that is, go into standby mode (until the lock is removed). When using sleep locks, it is important to understand that you need to properly remove these locks when they are not needed. Otherwise, the device’s battery will quickly run out: after all, the device will not be able to return to a state of reduced power consumption.

This article describes some Android apps that use sleep locks in Android 4.0. The article also describes the "Wakelocks" application from the SDPSamples set to demonstrate the implementation of sleep locks in code.

Using sleep locks with apps

On an Android system, you can see which services are holding sleep locks and preventing the system from entering one of the power saving modes. The file /proc/wakelocks on the device contains a list of services and drivers that use sleep locks. By monitoring the contents of the /sys/power/wake_lock file (requires root access), you can see if there is a CPU lock and which service is holding the wakelock2 lock. I was able to record several cases of using locks on my Galaxy Nexus smartphone running Android 4.0:

Table: Using sleep locks with stock Android apps

The YouTube and Music apps are good examples of using sleep blocking at various levels. The YouTube app takes over the sleep lock while the user is watching a streaming video. During the entire video playback, the screen remains on (regardless of the screen parameters set in the system). But if the user presses the power button during playback, the device will go into sleep mode: the screen will turn off and audio and video playback will stop. The Music app uses a different sleep lock when playing audio. The screen settings do not change, so the device screen will turn off as configured. But even when the screen is off, sleep lock will prevent the CPU from turning off so that music playback continues even if the user presses the power button.

Selecting the lock type

Before you start writing sleep lock code, you need to understand what types of sleep locks there are so that you can choose the most appropriate type to use in your application. The Android PowerManager API describes the various lock flags available that change the device's power state:

Flag meaningCPUScreenKeyboard backlight
PARTIAL_WAKE_LOCKOnOffOff
SCREEN_DIM_WAKE_LOCKOnDarkenedOff
SCREEN_BRIGHT_WAKE_LOCKOnFull brightnessOff
FULL_WAKE_LOCKOnFull brightnessFull brightness

Table: From the Android PowerManager API.

Please note that sleep locks significantly reduce the battery life of Android devices, so sleep locks should not be used if you can do without them. If possible, they should be removed as soon as possible.

An app that uses sleep blocking must request specific permission to do so. This is accomplished by applying the android.permission.WAKE_LOCK permission in the application manifest file. This means that even if a user installs a sleep blocking app using Google Play, users will receive a warning that the app contains components that may prevent the phone from sleeping. If you want to prevent the screen from dimming during a specific application action, you can do this in a way that does not require special permission. WindowManager has a variable, FLAG_KEEP_SCREEN_ON, that can be set if the application's View method needs to keep the screen on. It is recommended to use this approach for screen control, since its impact occurs only within the application. When the user switches to another application, WindowManager removes the sleep lock.

Keeping the screen on (from the SDPSamples set)

The WakeLock application from the SDPSamples demonstrates that the application can keep the screen on using the Window Manager, without writing sleep lock code. Launch the WakeLock application and select the "Win Man Screen On" list item.

As long as the button status bar displays the text “Screen is LOCKED,” the screen will be on. If the status bar of the button contains the text “Screen is UNLOCKED”, then after 5 seconds of inactivity the screen will turn off.

In code, this is done by the screenLockUpdateState() function in WakeLockActivity.java by setting and clearing FLAG_KEEP_SCREEN_ON for the current window each time the button is pressed and the state changes.

Public void screenLockUpdateState() ( if (mIsDisplayLocked) ( ... // update display state getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); ) else ( ... // update display state getWindow().clearFlags(WindowManager .LayoutParams.FLAG_KEEP_SCREEN_ON); ) )

Implementation of sleep blocking

The WakeLock application from the SDPSamples set implements various types of sleep locks. After launching the WakeLock application, select one of 4 types of sleep locks: Power Wake Lock Full, Power Wake Lock Bright, Power Wake Lock Dim and Power Wake Lock Partial. These 4 options correspond to the 4 sleep lock flags described in the PowerManager API. Each element demonstrates the device's response to an attempt to turn off the screen after 5 seconds.

By monitoring the contents of the /sys/power/wake_lock file (requires root access), you can see that only the PARTIAL_WAKE_LOCK sleep lock is retained after pressing the power button. Other sleep locks do not allow you to turn off the screen completely: it continues to work at one or another brightness level.

When writing code for sleep locks, you must first request permission to use them in your AndroidManifest.xml manifest:

You can then create a WakeLock object containing the acquire() and release() functions to manage sleep locking. A good example is in the WakeLockActivity.java file:

Public void onCreate(Bundle savedInstanceState) ( ... mPowerManager = (PowerManager) getSystemService(Context.POWER_SERVICE); ... mWakeLock = mPowerManager. newWakeLock(mWakeLockState, "UMSE PowerTest"); if (mWakeLock != null) ( mWakeLock. acquire(); ... ) protected void onDestroy() ( if (mWakeLock != null) ( mWakeLock.release(); mWakeLock = null; ) ... )

Conclusion

Sleep Lock is an Android system feature that allows developers to change the default power state of a device. The danger of using sleep locks in apps is that they drain your batteries prematurely. Some clear benefits of sleep locks are evident in a number of standard Google apps, such as navigation or music and video playback. Each application developer must make their own decision about whether sleep blocking is appropriate.

about the author

Christopher Bird began his career at Intel SSG in 2007 and is involved in building the Atom ecosystem of phones and tablets.

Reference materials

2 LWN – “Wakelocks and the embedded problem”: http://lwn.net/Articles/318611/

Notes

THE INFORMATION IN THIS DOCUMENT IS PROVIDED FOR INTEL PRODUCTS ONLY. NO EXPRESS OR IMPLIED LICENSE, ELIGIBILITY OR OTHER INTELLECTUAL PROPERTY RIGHT IS GRANTED HEREIN. EXCEPT AS PROVIDED IN THE TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL DISCLAIMS ANY RESPONSIBILITY FOR AND DISCLAIMS WARRANTIES, EXPRESS OR IMPLIED, WITH RESPECT TO THE SALE AND/OR USE OF ITS PRODUCTS, INCLUDING LIABILITY OR WARRANTY WARRANTIES REGARDING THEIR FITNESS FOR A PARTICULAR PURPOSE, PROFIT OR NON-INFRINGEMENT -EITHER PATENTS, COPYRIGHTS OR OTHER INTELLECTUAL PROPERTY RIGHTS.

EXCEPT AS AGREED IN WRITING BY INTEL, INTEL PRODUCTS ARE NOT INTENDED FOR USE IN SITUATIONS WHERE FAILURE COULD RESULT IN INJURY OR DEATH.

Intel reserves the right to change the specifications and descriptions of its products without notice. Designers should not rely on missing characteristics, or characteristics marked “reserved” or “unspecified.” These features are reserved by Intel for future use and are not guaranteed to have no compatibility conflicts. The information in this document is subject to change without notice. Do not use this information in the final design.

The products described in this document may contain errors or inaccuracies which may cause actual product specifications to differ from those described herein. Already identified errors can be provided upon request. Please obtain the latest specifications from your local Intel sales office or local distributor before placing your order.

Numbered copies of documents referenced in this document, as well as other Intel materials, can be ordered by calling 1-800-548-4725 or downloaded from http://www.intel.com/design/literature.htm

The software and loads used in benchmark tests may have been optimized to achieve high performance on Intel microprocessors. Performance tests such as SYSmark and MobileMark are performed on specific computer systems, components, programs, operations and functions. Any changes to any of these elements may change the results. When selecting the products you purchase, you should consult other information and performance tests, including tests of the performance of a particular product in combination with other products.

This document and the software described herein are provided under a license and may be used and distributed only in accordance with the terms of the license.

Intel® and the Intel logo are trademarks of Intel Corporation in the United States and other countries.

© Intel Corporation, 2012. All rights reserved.

*Other names and trademarks may be the property of third parties.

Unlike iOS and Windows Phone, Android can have many apps and services running in the background. All of them create an additional load on the RAM and processor, which means they waste precious energy. Moreover, they work even when not needed - for example, at night, while you are sleeping.

There are several ways to solve the problem of excessive consumption of device resources by Android applications: prohibit applications that you rarely use from starting when the system boots, or more radically, turn off Wi-Fi, mobile Internet and most background processes.

1. Install it from Google Play, launch it.

2. Go to the Phone Boost section, click the “Autostart Manager” button, it shows all the applications that launch when the device is turned on.

3. Review the list and disable autorun of those applications that you think should not be running in the background all the time.


Now go to system settings, open the running applications manager and close those that you will not need in the near future.


More serious resource savings can be achieved using applications that put the device into deep sleep when the screen turns off. One such application is . It allows you to disable the 3G module, Internet, Bluetooth, data synchronization and greatly limit the operation of background processes.

How to use Deep Sleep Battery Saver:

1. Install it from Google Play, launch it and give it root rights.

2. If desired, change the interface language to Russian.


3. Go to the “Profile” tab and choose what happens when your device’s screen is turned off. The more stringent the savings, the less device resources will be consumed.

4. In the settings of Deep Sleep Battery Saver, you can select applications for the “white list” - they will be able to work in the background, even if deep sleep is activated.

When using Deep Sleep Battery Saver, the battery life of the device can be extended significantly, and at the same time, the smartphone does not distract you every time you receive a new email or message. True, notifications will arrive with a delay - only when the application turns on the Internet.