How do I set the default launcher in an AOSP build?
Asked Answered
C

4

17

I am modifying the AOSP source code because my app needs to run in a kiosk environment.

I want Android to boot directly into the app. I've excluded launcher2 from generic_no_telephony.mk, and added the app there. Now Android prompts me all the time to choose default launcher.

The two choices that are available on the pop-up:

  1. Home Sample
  2. My app.

How can I exclude the Android Home Sample Launcher? Or is there another way to set the default launcher in an AOSP build?

Conscionable answered 7/4, 2014 at 11:30 Comment(0)
H
18

Instead of modifying the AOSP make files (which is annoying because then you need to track your changes) it is easier to add a LOCAL_OVERRIDES_PACKAGES line to your app's make file.

For instance:

LOCAL_OVERRIDES_PACKAGES := Launcher2 Launcher3

added to your Android.mk file will ensure that those packages are not added to any build where this package is added.

Following that, you should do a

make installclean

and then start your build the same way you always make your build. The make installclean is important to remove the packages that are left behind by the previous build.

I also just found a nice answer to how to do this in another question, see: How would I make an embedded Android OS with just one app?

Harmonious answered 7/4, 2014 at 15:27 Comment(2)
I added LOCAL_OVERRIDES_PACKAGES := Launcher2 Launcher3. My application is installed. But it always installs Launcher2 as well. After boot i get a prompt to choose my launcher. When i delete Launcher2 in generic_no_telephony.mk, Launcher2 will not be installed, but i get a prompt to choose between my launcher and home sampleEndear
This answer is not working for me either. Despite overriding Home Launcher2 Launcher3 I am still being shown a menu on startup with Home and MyApp.... any ideas?Guitar
F
4

Unless you do the following steps, you will be prompted for selecting which home launcher you would like to choose.

If you would like to have your home launcher truly overwrite the others without having to delete the others from your build, follow these steps.

Add an override for all other home launchers on your device, to your custom home launcher's Android.mk: (You may have others to override, but here's what were included in mine)

`LOCAL_OVERRIDES_PACKAGES := Home Launcher2 Launcher3`

Add your custom home launcher application module to the list of product packages. There are multiple files that add modules to the list of product packages. They are located in...

"/your-aosp-root/build/target/product/"

The file I chose to edit and add my module to was "Core.mk".

Add your module to the product packages list:

    PRODUCT_PACKAGES += \
         BasicDreams \
         Browser \
         Calendar \
         .
         .
         .
         MmsService \
         YourModuleHere

Call this to clean out your out directory of any old modules/images(doesn't delete all of out directory):

make installclean

Call your build script

Feathery answered 31/5, 2018 at 19:1 Comment(0)
C
3

The above answer is correct. LOCAL_OVERRIDES_PACKAGES works. But to address one of the comments; I had to do LOCAL_OVERRIDES_PACKAGES := Home Launcher2 Launcher3

Home is the sample Home app which serves as Launcher if Lancher2 is also not available.

Only after removing these 3 stock launchers; was I able to see my custom launcher launch by default without any dialog box asking user to choose.

(my test OS is Android N, ymmv)

Cotterell answered 11/8, 2017 at 23:13 Comment(0)
B
0

As first Answer does, But in Android 9 I use: LOCAL_OVERRIDES_PACKAGES := Home Launcher2 Launcher3 Launcher3QuickStep

And it works as expected.

Breakfast answered 14/5, 2020 at 10:35 Comment(1)
Hi YongRuei, please refer to writing an answer before writing your next one. Happy coding!Wolters

© 2022 - 2024 — McMap. All rights reserved.