PowerManager service through the system, and then the system uses the service to us.
2. Gotosleep () method, this method can force our screen to extinguish. We can call this:After you get the PM object, this calls
Pm.gotosleep (Systemclock.uptimemillis ());
3. Setbacklightbrightness () method, this method can set the brightness of the backlight, from 0-255
Three. Timed off screen
So here, you can also introduce a way to control the screen is Powermanager.wakelockAs the name su
corresponding level.
Flags parameter description:
3. PARTIAL_WAKE_LOCK: Screen off, keyboard light off
4. SCREEN_DIM_WAKE_LOCK: screen dim, keyboard light off
5. SCREEN_BRIGHT_WAKE_LOCK: screen bright, keyboard light off
6. FULL_WAKE_LOCK: screen bright, keyboard bright
ACQUIRE_CAUSES_WAKEUP: Forces Screen and keyboard light to be turned on when a request is locked.
ON_AFTER_RELEASE: reset activity timer when the lock is released
Note:
If you have applied for partial
This article was reproduced in: http://blog.csdn.net/yudajun/article/details/7748760Android Settings Branch Standby there are two waysThe first is simply achieved by setting the WindowManager property:In the Activity Oncreat () method, set theGetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_ SCREEN_ON);The second implementation of PowerManager and Powermanager.wakelock using Android:Add lockPrivate voidAcquirewakelock () {if(
Flags parameter description:
Partial_wake_lock: screen off, keyboard light off
Screen_dim_wake_lock: screen dim, keyboard light off
Screen_bright_wake_lock: screen bright, keyboard light off
Full_wake_lock: screen bright, keyboard bright
Acquire_causes_wakeup: Forces screen and keyboard light to be turned on when a request is locked.
On_after_release: reset activity timer when the lock is released
Note:
If you have applied for partial wakel
, important only for debugging. */ public IntentService(String name) { super(); mName = name; } /** * Sets intent redelivery preferences. Usually called from the constructor * with your preferred semantics. * *
If enabled is true, * {@link #onStartCommand(Intent, int, int)} will return * {@link Service#START_REDELIVER_INTENT}, so if this process dies before * {@link #onHandleIntent(Intent)} returns, the process will be restarted * and the intent redel
the width and high properties of the video stream, and then notify prepared. No more tracking down. The prepare process is complete.Next, we go back to the Java layer before the Scaninternalsubtitletracks () method in the Prepare methodThe method is to scan the embedded captions and track them.The execution process of startThe next analysis looks at the START process in MediaPlayer:The above code summarizes: The Start method is used to start or re-resume playback, if playback was previously pau
->detect_change = 0;
/* If The card was removed the bus would be marked * as Dead-extend the wakelock so userspace * can respond * * if (host->bus_dead) Extend_wakelock = 1; Need to set up a wakelock lock so that user space can be made in a timely manner corresponding/* * let Mmc_bus_put () free the bus/bus_ops if we ' ve found that * the card
is no longer present.
*/Mmc_bus_put (hos
often only the outer class calls this inner class. Therefore, it is not necessary to use a Java file specifically to store this class.B, Static is used to modify the internal members of the class. such as static methods, static member variables. Its only function is to be generated as the class is loaded (not as the object is produced), so that it can be obtained directly with the class name + static member name. This allows the static inner class to be understood, and it can be obtained direct
, keyboard light off
4.screen_dim_wake_lock:screen DIM, keyboard light off
5.screen_bright_wake_lock:screen BRIGHT, keyboard light off
6.full_wake_lock:screen Bright, keyboard bright
Acquire_causes_wakeup: Force screen and keyboard to open once a lock is requested light
On_after_release: Reset the activity timer when the lock is released
Note:
If you apply for partial wakelock, the system does not sleep even if you press the Power key, as music
many places. Anticipatory, deadline, and cfq I/O scheduling both use the RB tree for request tracking, as well as the CD/DVD drive package management. The high-resolutiontimer uses the RB tree to organize scheduled requests. The ext3 file system also uses the RB tree to manage directories. The Virtual Storage Management System also provides a Rb tree for VMAs (virtual memory areas) management. Of course, network data packets scheduled by file descriptors, password keys, and "Level Token buckets
Topic:
When the android program is running, the background light remains awake, that is, no black screen.
First run the Code:
Note that you need to add permissions
/***** @ Author zhujianbin **/public class utils {Private Static wakelock Wl;/*** keep the screen awake (that is, the background light is not off) * @ Param on whether to wake up */public static void keepscreenon (context, Boolean on) {If (on) {powermanager PM = (powermanager) context.
Android sleep (suspend). In a kernel that has been installed with Android patches, The state_store () function will go to another path and enter request_suspend_state (). The file is located in earlysuspend. c. These functions are added to the Android system. earlysuspend and late resume will be introduced later. Involved files:Linux_source/kernel/power/Main. cLinux_source/kernel/power/earlysuspend. cLinux_source/kernel/power/wakelock. c(1) FeaturesEa
Android keeps the screen on, while android keeps on
Android keeps the screen bright, and PowerManager. WakeLock is used.
packagecom.hebaijun.wakelock;importandroid.app.Activity;importandroid.os.Bundle;importandroid.os.PowerManager;publicclassWakeLockActivityextendsActivity{PowerManager.WakeLockwakeLock;/**Calledwhentheactivityisfirstcreated.*/@OverridepublicvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layo
not allow this scheme, you can set up a wakelock directly here.powermanager powermanager = (PowerManager) Getsystemservice (power_service); wakelock WakeLock = Powermanager.newwakelock (Powermanager.partial_wake_lock,mywakelocktag"); wakelock.acquire (); Release Lock: Wakelock.release ()Using Wakefulbroadcastreceiver
Manage the lifecycle of a background t
the external class name + internal class name. Examples are as follows:public class Build {..............public static class VERSION {................public static final String RELEASE = getString ("Ro.build.version.release");................}................}The external can be accessed directly through the Build.VERSION.RELEASE.Add one: the definition of class variables in a class (independent of the static topic). WakeLock is a class in the PowerM
specifically to store this class.B, Static is used to modify the internal members of the class. such as static methods, static member variables. Its only function is to be generated as the class is loaded (not as the object is produced), so that it can be obtained directly with the class name + static member name. This allows the static inner class to be understood, and it can be obtained directly from the external class name + internal class name. Examples are as follows:public class Build {..
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.