Android app Black and white list
When the Android device system works, many service runs in the background, only when the system memory is not enough to kill the background service automatically.
Android OTT Box Project development, the network set-top box running memory 512m/1g memory is not enough to use, in order to improve the smoothness of the system, compile the firmware to add the app black and white list function.
The Android system will issue a broadcastreceiver boot broadcast after booting
Add Bootcompletedreceiveraml.java in Settings app
Public class bootcompletedreceiveraml extends broadcastreceiver { Public Static FinalString TAG ="Bootcompletedreceiveraml"; Public void OnReceive(context context, Intent Intent) {Initscreensaver (); Initenablerunningbackgroudcomponents (); Initenableautorunningcomponents (); Initlaunchercomponents (); }//Set into black and white list of screensavers Private void Initscreensaver() {Settings.System.putInt (Mcontext.getcontentresolver (), Settings.System.BOOT_GUIDE_COMPLETED,1); Idreammanager Mdreammanager = IDreamManager.Stub.asInterface (Servicemanager.getservice (dreamservice.dream_service )); ComponentName dream = Newcomponentname ("Com.mipt.screensaver","Com.mipt.screensaver.ScreenSaverService");Try{componentname[] dreams = {Dream}; Mdreammanager.setdreamcomponents (Dream = =NULL?NULL: Dreams); }Catch(RemoteException e) {} String dreamenablecomponentnames ="com.skyworthdigital.filexplorer/com.skyworthdigital.weather.main/com.skyworthdigital.ihome.settings/ Com.study.pumpkinstudy/com.android.dreams.phototable "; Settings.System.putString (Mcontext.getcontentresolver (), Settings.System.DREAM_ENABLE_COMPONENT, Dreamenablecomponentnames);Try{LongCurrenttimeout = Settings.System.getLong (Mcontext.getcontentresolver (), screen_off_timeout);if(Currenttimeout <0) {Settings.System.putInt (Mcontext.getcontentresolver (), Screen_off_timeout,2147483646); } currenttimeout = Settings.System.getLong (Mcontext.getcontentresolver (), Screen_dream_time Out,-1);if(Currenttimeout <0) {Settings.System.putInt (Mcontext.getcontentresolver (), Screen_dream_timeout,240000); } }Catch(Settingnotfoundexception e) {E.printstacktrace (); } }//Enable automatic operation in background service Private void initenablerunningbackgroudcomponents() {Settings.Secure.putString (Mcontext.getcontentresolver (), Settings.Secure.ENABLE_RUNNING_BACKGROUD_COMPO Nents,"android/system/com.android/com.mipt/com.skyworth/com.google.android/com.skydigital/com.sky/ Com.starcor.hunan/com.explorer/com.slanissue.tv.erge/eu.chainfire.perfmon "); }//boot autorun Private void initenableautorunningcomponents() {Settings.Secure.putString (Mcontext.getcontentresolver (), Settings.Secure.ENABLE_AUTO_LAUNCH_COMPONENTS,"com.android/android/system/com.mipt/com.skyworth/com.mipt.metro.launcher/com.skydigital/com.sky/ Com.starcor.hunan "); }//Boot launcher Private void initlaunchercomponents() {Settings.Secure.putString (Mcontext.getcontentresolver (), Settings.Secure.ENABLE_LAUNCHER_COMPONENTS,"Com.mipt.metro.launcher"); }}
Android app Black and white list