Search code examples
androidandroid-4.4-kitkatandroid-sourceandroid-launcherboot-animation

Android Custom Launcher doesn't stop the BootAnimation


I am working on a custom launcher for Android, in a project using BBBAndroid (android v4.4.4 w/ kernel 3.8 for the beagleboneblack): http://bbbandroid.sourceforge.net

I created aosp_stripped.mk to strip some unneeded Android packages and replace the Launcher2 and the HOME packages with my CustomLauncher. This launcher is mostly an normal app with the LAUNCHER and HOME category added in its AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="test.customlauncher" >

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_people"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <uses-library
            android:name="test.service.lib"
            android:required="true" />
        <activity
            android:launchMode="singleTask"
            android:stateNotNeeded="true"
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.HOME" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
    </application>

</manifest>

It effectively replaces Launcher2, but the boot animation doesn't stop until 40 seconds later, logcat shows:

W/WindowManager(  591): ***** BOOT TIMEOUT: forcing display enabled
I/PowerManagerService(  591): Boot animation finished.

So my launcher must be missing something to tell the boot animation to stop. I found some hints here: http://forum.xda-developers.com/showthread.php?t=2485118

Indeed, I have some missing Wallpaper classes errors in logcat, but I didn't remove the SystemUI package. I noticed that when using Launcher2/Home, this error only happens on the first boot. Using my custom launcher, it happens on every boot. Besides this error, I didn't find any differences:

W/WallpaperService(  591): Attempted wallpaper ComponentInfo{com.android.wallpaper/com.android.wallpaper.fall.FallWallpaper} is unavailable
W/WallpaperService(  591): Failure starting previous wallpaper
W/WallpaperService(  591): Attempted wallpaper ComponentInfo{com.android.wallpaper/com.android.wallpaper.fall.FallWallpaper} is unavailable
E/WallpaperService(  591): Default wallpaper component not found!

I found this class in the package LiveWallpapers in packages/wallpapers/Basic (AOSP). It is already added in PRODUCT_PACKAGES, but this package is nowhere in out/target/product/beagleboneblack/ :(

Right now I am digging in Launcher2 and WallPaperManager to see what could trigger the BootAnimation to stop...

Thanks in advance !

Update

I also tried to stop the bootanimation using system properties, but the touchscreen is not usable until the BOOT_TIMEOUT event:

    import android.os.SystemProperties;

    // inside a Service with system privileges
    SystemProperties.set("service.bootanim.exit", "1");

Solution

  • Tracing the BOOT TIMEOUT problem, it comes from WindowManagerService performEnableScreen() waiting for a wallpaper to be set/active, the boot isn't considered done otherwise:

                // If we are turning on the screen after the boot is completed
                // normally, don't do so until we have the application and
                // wallpaper.
                if (mSystemBooted && ((!haveApp && !haveKeyguard) ||
                        (wallpaperEnabled && !haveWallpaper))) {
                    return;
                }
    

    I also noticed that the wallpapers apks in packages/wallpapers are not built for the target because the bbbandroid repo lacks opengl support for now.

    My current workaround for this problem is to disable the WallpaperService via its internal config.xml file:

    diff --git a/frameworks/base/core/res/res/values/config.xml b/frameworks/base/core/res/res/values/config.xml
    index 6efb4a4..0c873b7 100644
    --- a/frameworks/base/core/res/res/values/config.xml
    +++ b/frameworks/base/core/res/res/values/config.xml
    @@ -701,7 +701,7 @@
         <string name="default_wallpaper_component" translatable="false">@null</string>
    
         <!-- True if WallpaperService is enabled -->
    -    <bool name="config_enableWallpaperService">true</bool>
    +    <bool name="config_enableWallpaperService">false</bool>
    
         <!-- Whether to enable network location overlay which allows network
              location provider to be replaced by an app at run-time. When disabled,
    

    This solution works if you don't mind using modified android sources.