Android app blacklist and whitelist

Source: Internet
Author: User

Android app blacklist and whitelist
Android app blacklist and whitelist

When the Android device system works normally, many services run in the background. The background Service is automatically killed only when the system memory is insufficient.
During the development of the Android OTT box project, the network set-top box running memory of 512 MB/1 GB is insufficient. To improve the smoothness of the system, the app blacklist and whitelist function is added during firmware compilation.

After the Android system is turned on, A BroadcastReceiver boot broadcast is sent,
Add BootCompletedReceiverAML. java in the app

Public class BootCompletedReceiverAML extends BroadcastReceiver {public static final String TAG = "BootCompletedReceiverAML"; public void onReceive (Context context, Intent intent) {initScreenSaver (); resume (); initLauncherComponents ();} // enter the screen saver black/white list 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 {long currentTimeout = 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_TIMEOUT,-1); if (currentTimeout <0) {Settings. system. putInt (mContext. getContentResolver (), SCREEN_DREAM_TIMEOUT, 240000) ;}} catch (SettingNotFoundException e) {e. printStackTrace () ;}}// Enable Automatic Running of service private void initEnableRunningBackgroudComponents () {Settings. secure. putString (mContext. getContentResolver (), Settings. secure. ENABLE_RUNNING_BACKGROUD_COMPONENTS, "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 ");} // automatically run private void initEnableAutoRunningComponents () {Settings. secure. putString (mContext. getContentResolver (), Settings. secure. ENABLE_AUTO_LAUNCH_COMPONENTS, "com. 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 ");}}

Related Article

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.