Android app Black and white list

Source: Internet
Author: User

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

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.