devices. Powermanager
: This class gives you control of the power state of the device. powermanager. wakelock
: Lets you say that you need to have the device on. Android controls the power supply through various lock locks. Note that the lock and unlock must appear in pairs. First, the code in the previous standup tim
or driver. The user wake-up lock is mapped to the kernel wake-up lock. Any active kernel-level wake-up lock can prevent the system from being suspended in the ACPI S3 State (in RAM suspended)-it is the most energy-saving status f
is worth noting that in this case, the system will use the CPU Wake Lock in the entire onreceive handler of the broadcast receiver.Note: If you start a service or broadcast an intent in the OnReceive handler of the broadcast receiver, it is possible that the serviceBefore starting, the wake Lock used will be released.
setWakMode () signature:SetWakeMode (Context context, int mode)
The first parameter is the current context, and the second parameter is the state to be locked. It is set to a constant of the int type and is defined in the final class PowerManager. PowerManager is designed to manage the locking status of Android power consumption. It is related to locking the CUP. There are four types of locking statuses, n
, Android provides the API for Wake Lock, which allows the application to have permission to prevent the AP from entering hibernation through code.Wakelock Blocks the application processor (application Processor) from suspending, ensuring critical code runs, and by interrupting the application processor (application Processor), you can prevent the screen from darkening. After all the Wakelock are released,
In the process of using the Win7 system, sometimes we will encounter and do not perform a lock screen operation, but after a period of time without the computer Win7 will automatically enter the lock state, wake up need to enter a password. What do we do if we need to unlock the system lock screen wakeup password?
() to wake up all the waiting threads, if necessary.The method used (keyword):The object name, wait (), causes the current thread to wait before another thread calls this object's notify () method or the Notifyall () method.The object name. Notify (); Wakes a single thread waiting on this object monitor.The object name. Notifyall (); Wakes all the threads waiting on this object monitor. Note: The above method (keyword) must be used in synchronizat
Lock.lock (); The number of votes judged, greater than 0, can be sold, variable--operation if (Ticket > 0) { try{ //execute code System.out.println that may cause thread safety issues ( Thread.CurrentThread (). GetName () + "Sale" +ticket--); catch (Exception ex) { }finally{ //release lock, call
Tip: This command is only used in sliding unlock state.
1. In standby mode, click "Application".
2. Click "Set".
3. Click on "My Device".
4. Click on "Lock Screen".
5. "Wake up in the lock screen" to tick.
6. Click "Set Wake Command".
7. Click "
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.