How to fix launcher on Android system

Source: Internet
Author: User

When it comes to developing an Android system, there are times when you encounter a need to:

Because it is an independent brand, also involves a service in the push, so hope launcher can be fixed, third party can install, but press the home key, must return the system default launcher

Through the analysis of the home key process, found that can be very simple to do, and now share with you:

Path: Frameworks\base\policy\src\com\android\internal\policy\impl\phonewindowmanager.java

<pre name= "code" class= "java" >public void init (context context, Iwindowmanager WindowManager,            Windowmanagerfuncs Windowmanagerfuncs) {....        Mhomeintent =  New Intent (Intent.action_main, null);        Mhomeintent.addcategory (intent.category_home);        Mhomeintent.addflags (Intent.flag_activity_new_task                | intent.flag_activity_reset_task_if_needed);.}


Modified to:

public void init (context context, Iwindowmanager WindowManager,            windowmanagerfuncs windowmanagerfuncs) {.... ComponentName mhomecom = new ComponentName ("Com.android.launcher3", "Com.android.launcher3.Launcher");        Mhomeintent =  New Intent (Intent.action_main, null);        Mhomeintent.addcategory (intent.category_home);        Mhomeintent.setcomponent (mhomecom);        Mhomeintent.addflags (Intent.flag_activity_new_task                | intent.flag_activity_reset_task_if_needed);.}

That is to add a setcomponent condition in this, componentname needs to be changed to what you need.


Proven, completely ready to handle

How to fix launcher on Android system

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.