Android 自定义启动器不会停止 BootAnimation

标签 android android-4.4-kitkat android-source android-launcher boot-animation

我正在使用 BBBAndroid 的项目中开发 Android 的自定义启动器(beagleboneblack 的 android v4.4.4 w/kernel 3.8): http://bbbandroid.sourceforge.net

我创建了aosp_stripped.mk删除一些不需要的 Android 软件包,并用我的 CustomLauncher 替换 Launcher2 和 HOME 软件包。这个启动器主要是一个普通的应用程序,在其 AndroidManifest.xml 中添加了 LAUNCHER 和 HOME 类别:

<?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>

它有效地取代了 Launcher2,但启动动画直到 40 秒后才停止,logcat 显示:

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

所以我的启动器一定缺少一些东西来告诉启动动画停止。我在这里找到了一些提示:http://forum.xda-developers.com/showthread.php?t=2485118

确实,我在 logcat 中遇到了一些缺少壁纸类的错误,但我没有删除 SystemUI 包。我注意到,当使用 Launcher2/Home 时,此错误仅在第一次启动时发生。使用我的自定义启动器,每次启动都会发生这种情况。除了这个错误之外,我没有发现任何差异:

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!

我在packages/wallpapers/Basic (AOSP) 的LiveWallpapers 包中找到了这个类。它已添加到 PRODUCT_PACKAGES 中,但此包不在 out/target/product/beagleboneblack/中:(

现在我正在研究 Launcher2 和 WallPaperManager,看看什么可以触发 BootAnimation 停止...

提前致谢!

更新

我还尝试使用系统属性停止启动动画,但直到 BOOT_TIMEOUT 事件发生后触摸屏才可用:

    import android.os.SystemProperties;

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

最佳答案

追踪BOOT TIMEOUT问题,它来自于WindowManagerService performEnableScreen()等待壁纸被设置/激活,否则启动不被认为完成:

            // 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;
            }

我还注意到包/壁纸中的壁纸 apk 不是为目标构建的,因为 bbbandroid 存储库目前缺乏 opengl 支持。

我当前解决此问题的方法是通过其内部 config.xml 文件禁用 WallpaperService:

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,

如果您不介意使用修改后的 Android 源,则此解决方案有效。

关于Android 自定义启动器不会停止 BootAnimation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31618101/

相关文章:

java - 解析 JSON 数据时出现 ArrayIndexOutOfBoundsException 错误

android - 某些快捷方式在 Ubuntu 中的 Android Studio 中不起作用

java - 在 Realm 中过滤父级和子级 - Android

java - Android kitkat API 19,Intent.ACTION_VIEW 不起作用

android - picasso 在尝试在 Android 上加载图像时从不调用完成处理程序

java - 如何向 Android 构建添加额外的二进制文件?

android - 尽管有错误,是否可以强制 Eclipse 运行?

android - 进程终止后重新启动 Android 应用程序

android - 当 SystemUI 在 Android Boot 中加载时