How to turn off sleep mode on a Huawei phone. Sleep mode on an Android phone: how to disable it, including completely? Selecting the lock type

There are universal methods for increasing the operating time of mobile devices

Phones are constantly being improved, losing weight, becoming thinner, their processors becoming more powerful, and their screens becoming larger. And with all this technological progress, the load on batteries increases.

Phone manufacturers are constantly trying to extend the battery life of their devices. But with everyday use, the batteries also last an average of one to two days without recharging. Moreover, the functionality of devices, the resource intensity of programs, and the frequency of phone use are also increasing. This all leads to even faster battery depletion. It is enough to launch some program on your phone, surf the Internet for several hours, and the battery will remind you of itself by asking for recharging.

At the same time, there are certain universal methods for increasing the battery life of mobile devices. Let's look at these methods in more detail.

1. Disabling the Auto Brightness option. When in Auto Brightness mode, the phone adjusts the screen brightness to the light level of the place where you are at a particular moment. At the same time, such a useful function in general is in demand only if you move around a lot, and accordingly, the lighting intensity changes (street - transport - office, and so on). In the case when you spend most of the time in a room with a stable level of lighting, it will be beneficial for you to turn off the “Auto-Brightness” mode. Set the brightness mode that is most suitable and convenient for you; you will probably have to significantly reduce the brightness mode set automatically by your phone. And all because the standard light control sensor changes the screen backlight mode even when it is not necessary to do so. The light sensor in real mode reacts to shadows falling on the phone screen, glare of light, light from a computer monitor, and lighting fixtures. And this effect occurs constantly until the phone’s screen is on and it does not automatically go into sleep mode or auto-lock mode. And this, of course, is the work of sensors, energy consumption, premature, accelerated discharge of the phone battery.

2. Disable "Automatic screen rotation" mode. This useful function will also not be in demand all the time; at the same time, the accelerometer - a sensor in the phone that responds to turning the phone from a horizontal to a vertical position and back, will consume significant amounts of energy, which could be spent on more necessary, often necessary telephone conversations.

3. Reduce automatic screen lock time(there may be a “screen timeout” item in the settings). By default, a phone from a store usually has a timeout of one minute. That is, after one minute of inactivity, the phone goes into sleep mode, standby mode, and the screen automatically turns off and locks. It is important to understand that the shorter the interval between entering sleep mode, the more economical the phone's energy consumption.

4. Clean the phone's RAM. After working in any phone application, do not forget to close it. Remaining in the phone's RAM, applications continue to constantly use the device's system resources, thereby consuming battery power and reducing the battery life of the device. A similar remark applies to the so-called installed “live wallpapers”.

5. When working on devices with an Amoled display It is beneficial to install completely plain black wallpaper on your screen. In Amoled, power consumption directly depends on the brightness level of the screen. Such screens require more energy; if bright, light wallpapers are installed, they consume even more energy than liquid crystal options. Reduce screen brightness and use a dark screensaver background.

6. Change the reader mode in the device to “night”(or inversion). Reading books or any other text directly from the phone screen is very energy-intensive. However, here you can use a little trick. Inversion will replace the screen background with black, while the font will turn white. Thus, we will fulfill the condition from the previous paragraph. A dark screen will end up using less power than a white screen, like a sheet of paper.

7. Disable Bluetooth and Wi-Fi modules. Modern devices have a function to automatically turn off these modules, but they are turned off only when the device goes into sleep mode. Therefore, it is safer to disable them manually. Similarly, when not using the device, turn off all online services and email. It is also beneficial to save battery power by disabling all system reminders and messages. Disconnect the device from 3G networks. Such simple operations will extend the phone's operation without recharging for several hours.

8. Turn off vibration and vibration feedback on your phone. The vibration motor that sets the phone in motion consumes quite a bit of battery power; turning off vibration will not cause much inconvenience for the user, at the same time it will allow you to use the phone for a longer time.

9. Follow the temperature conditions recommended by the phone manufacturer. A comfortable temperature, and for a phone this is around 15 - 25 degrees, will extend the life of the battery, reduce the rate of its random discharge, and prevent malfunctions in the device.

10. Install additional applications, allowing for a full cycle of recharging the battery with low current. This is, for example, BatteryDoctor, the program implements careful control over battery consumption, and this has a positive effect on the battery life of the phone on a single charge.

Thus, the proposed tips, accessible to everyone, will guarantee to extend the phone’s operation without recharging to four or even six hours.

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 ACCEPTS NO LIABILITY FOR AND DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, WITH RESPECT TO THE SALE AND/OR USE OF ITS PRODUCTS, INCLUDING LIABILITY OR WARRANTY AI REGARDING THEIR FITNESS FOR A PARTICULAR PURPOSE, PROFIT OR 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.

All smartphones and tablets running Android have a set time after which the device goes into sleep mode. Most devices go to sleep after 30 seconds of user inactivity. This time is set by default, but not everyone has enough time to read and view content. You can increase it in the settings, and to completely disable the screen timeout, you will have to activate the option in the “For Developers” section or use a special application.

Such a short time before the screen fades out is set for two reasons. Firstly, for security reasons - so that no one can use the device without the owner’s knowledge if he has not blocked it. And the second reason lies in saving battery power.

The fact is that the display backlight drains the smartphone’s battery, so a significant increase in the time after which the screen goes out will reduce the operating time of the device on a single charge. Here it’s worth finding the “golden mean” - setting the timeout so that you feel comfortable using the phone, but at the same time, so that the device does not work for nothing for half an hour if you forget to press the lock button.

Therefore, it is best to disable “falling asleep” of the display only in the necessary programs, and for the entire system set the timeout value within one to two minutes. How to do this is described later in the article.

Other instructions on the topic:

Setting up sleep mode on Android

On any Android smartphone, the screen timeout can be adjusted in the settings. To do this, go to the “Screen” section, on new versions of Android, click “Advanced” and open “Sleep mode”.

In MIUI on Xiaomi, the “Sleep mode” item is located in the “Lock and security” section.

Now select the length of inactivity after which the device will be locked.

On stock Android, you cannot completely disable the timeout (the maximum value that can be set is 30 minutes). But this option is present in firmware, for example: in MIUI on Xiaomi smartphones and in EMUI on Huawei and Honor phones.

But in the section both on stock Android and firmware there is an item “Do not turn off the screen”. If activated, the device will not go into sleep mode while charging.

How to disable screen falling asleep in applications using Stay Alive!

Third-party developers have created dozens of special programs that allow you to disable timeout during charging, for the entire system or for individual applications. In the latter case, the display will not go dark when applications that the user has selected are running or running in the background.

One of the best programs of its kind is Stay Alive! . Moreover, all the necessary functions are available in its free version – that’s what we’ll use. On new versions of Android 5, after installing the application, you will have to allow access to your usage history. When you launch the program for the first time, a warning window will pop up - by clicking the “OK” button, you will go to the “Data Access” section, and there you can select Stay Alive! and provide access to usage history.

If you ignored the message that appeared when you first launched Stay Alive!, you can go to the “Data Access” section as follows: go to “Settings” → “Applications and notifications”, if necessary, click “Advanced”, and select “Special access” " There you will find the “Data Access” item.

In MIUI, the item is called “Applications with data access” and it is located in the “Device Administration” section along the path: “Settings” → “Advanced settings” → “Privacy”.

On Huawei and Honor smartphones, to allow Stay Alive! To track which apps you use, open the Settings menu and go to Security & Privacy → Advanced Settings → Access Usage Statistics. Choose Stay Alive! and turn on the “Track usage” toggle switch.

After launching the application for the first time and granting it the necessary permission, Stay Alive! will start working, and the smartphone will stop going into sleep mode. By default, the “Keep screen on while charging and battery” item will be activated, and the timeout will be completely disabled. To prevent the screen from going dark only during charging, select “Keep screen on while charging”, and if you want to pause the program, click on “Pause Stay Alive!”.

Also using the Stay Alive! You can disable device locking when certain applications are running or running in the background. To do this, activate the “Enable selected apps” function and select the “Keep screen on ONLY for selected apps” option. Then open the “Select apps that will Stay Alive!” and mark the programs you need. To make it easier to search for applications, you can use the search.

To ensure that the device does not “fall asleep” while the selected applications are running, one of two modes must also be activated: “Keep screen on while charging” or “Keep screen on while charging and battery”. If “Pause Stay Alive!” is selected, the program will not work.

To disable timeout for the entire system, except for certain applications, select “Keep screen on EXCEPT for selected apps”, open the list of programs (click “Select apps that will Stay Alive!”) and mark the ones you need.

To reduce battery consumption when sleep mode is disabled, the developer of Stay Alive! added the function “Allow the screen to dim”. If activated, the screen will dim, but not go dark.

On many Android smartphones and tablets, the screen turns off after 30 seconds of user inactivity. As a rule, this is the best option in which you can comfortably use the device and save its battery power. But there are times when you need to disable sleep mode while an application is running. Since this cannot be done using standard Android tools, we will tell you how to implement this in other ways.
First, let's decide why we might need to disable the screen timeout, because excess screen time leads to rapid battery drain? For example, you read an article in a browser or watch a video on YouTube, pause, and within a minute your device is already fast asleep. Or another option - you use your smartphone as a control panel or show slides. Thus, the most common cases where an always-on screen is required are:

  • reading e-books, documents, other text information;
  • viewing photo and video materials;
  • demonstrating something on a smartphone screen;
  • games whose gameplay does not require active action;
  • work with GPS and mapping programs.
Some programs and games do an excellent job of this task on their own. Typically, many e-readers, video players and other applications have an option in the settings that prevents the device from falling asleep. But not all of them. In such cases, the easiest way is to set a longer screen timeout for the active mode in the system settings. But, you see, this is not so much inconvenient as it is irrational. Therefore, we will do things differently and use third-party tools to fine-tune the screen lock.

Method 1. Xposed module

This method requires a special runtime environment to be installed on the device. The module that we need to connect to the Xposed Framework is called Stay Awake – Keep On Screen. It makes it easy to disable screen lock on specific apps and return to previous screen timeout settings.

How to download and install Stay Awake – Keep On Screen:
After all these steps, you can use the enable/disable sleep mode feature at the system level for each application. It works very simply. To prevent the screen from turning off, simply hold down both volume buttons in any active application. You will see the message “Stay Awake Enable” - this means that the screen in the current application will be turned on permanently.

Using this module is convenient because it remembers in which applications you have disabled the screen timeout, and you can return everything back at any time by simply pressing the volume buttons. This function works even at the level of the native launcher.

Method 2. Applications

This application in the Russian-language Google Play is known as “Never-fading Screen”. A small utility with a nice design has one single function - to prevent the device from going into sleep mode while selected applications are running. To activate it, simply launch Keep Screen On and select the necessary applications during which you want to keep the screen always on.


The utility can work with all programs installed on the device, including system services. The advantage of Keep Screen On is its ease of use and the fact that the application is completely free and does not contain advertising.


Another free, but more functional application called Stay Alive!, which can also manage screen timeout. The utility allows you to set rules for turning off the screen not only for selected applications, but also for those programs and system services that have not been selected. At the same time, Stay Alive! does not have any filters or additional options for applications and shows all software components installed on the device in a general list. And if you have, for example, 100+ applications installed, then it is better to use the search. A special feature of the utility is that it allows you to keep the screen on, even when a specific program is not running, but is running in the background.


Stay Alive! has several operating modes:
  • active mode while charging the device;
  • active mode during charging and when running on battery power;
  • pause mode (inactive mode);
  • automatic mode with rules for selected applications.
They are switched using a small panel that is hidden behind the curtain.


We have to admit, Stay Alive! fulfills its main task with 5+. The application does not simply prevent the device from going into sleep mode, but offers individual settings for various conditions. For example, you can prevent the screen from turning off when charging, when connected to a car dock, or completely disable the screen timeout. In addition, Stay Alive! can pause when the battery charge reaches a specified percentage.

Among the additional features there is a very useful option “Allow the screen to dim”, which allows you to dim the screen, but not turn it off completely.


The only drawback of Stay Alive! - These are paid functions, the most important of which is application autoloading. So, if you are using the free version, you will have to manually launch the utility every time you turn on/reboot the device.

How do you set the screen timeout on your mobile device? And have you ever had to prevent the screen from turning off in certain programs?

Publications on the topic