How do I make an embedded Android OS with just one app?

前端 未结 2 408

I would like to make my own embedded system built on Android (ARM) just using devices distributed with Android but without their launcher.

OR

<
2条回答
  •  有刺的猬
    2020-12-23 02:17

    Essentially you're trying to have a custom build of the AOSP where the "Home" is your application. If you look into /packages/apps/Launcher2 you'll find the code for the default Home screen.

    If you look at the AndroidManifest.xml file in there, you'll see something like this:

         
            
                
                
                
                
            
        
    

    Essentialy, this says that this Activity reacts to the

    android.intent.category.HOME intent.

    When the system finishes booting (the ActivityManager more specifically), sends that intent. So, if you want your app to start instead of the Launcher, just create yourself an app with a similar intent filter and remove the default Launcher2 (take it out of the list in build/target/product/generic.mk and put yours instead). Also make sure the relevant .mk file has something like this:

    LOCAL_OVERRIDES_PACKAGES := Home
    

    So long as your app doesn't provide a way for the user to launch other apps using icons (like the Launcher does), no other app will be started; unless of course something sends an Activity-starting intent from some other path than the one controlled by your app - say by using the "am" command on the target's Android shell.

提交回复
热议问题