【问题标题】:Android Custom Launcher doesn't stop the BootAnimationAndroid 自定义启动器不会停止 BootAnimation
【发布时间】:2015-07-24 19:11:41
【问题描述】:

我正在使用 BBBAndroid(beagleboneblack 的 android v4.4.4 w/ kernel 3.8)的项目中为 Android 定制启动器: 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");

【问题讨论】:

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


    【解决方案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;
                }
    

    我还注意到,packages/wallpapers 中的壁纸 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 源,则此解决方案有效。

    【讨论】:

      【解决方案2】:

      我认为问题不在于您的启动器应用程序,在这种情况下,您会在应用程序的 logcat 错误中看到。当 SystemUI 无法启动(由于故障)时,通常会挂起启动动画。

      启动器应用本身不会停止启动动画,它没有此功能。

      您可能禁用了一些破坏启动工作流程的关键组件。是的,壁纸会影响它。我建议将所有内容放回您的 .mk 文件中,检查它是否可以构建和启动,然后仅将启动器替换为您的应用程序。然后您可以进一步剪切 mk 文件以检查哪个模块产生了问题。

      我不记得确切但Browser 模块可能包含许多组件使用的webview 组件。

      您应该发布完整的 logcat 输出,也可以是 dmesg 输出。

      【讨论】:

      • 我了解删除某些模块可能会破坏启动工作流程,但在当前状态下 Launcher2 启动器可以正常工作。我找到了解决此问题的方法,并且壁纸似乎是问题所在。
      • 我看到你对壁纸服务进行了很好的研究,为你的答案投票。我知道frameworks/base/core/res/res/values/config.xml,我也为我的ROM定制了它,但我不记得它处理的所有东西。
      猜你喜欢
      • 2017-01-18
      • 2014-11-11
      • 1970-01-01
      • 2021-06-24
      • 2018-01-01
      • 1970-01-01
      • 2014-02-27
      • 1970-01-01
      • 2011-10-29
      相关资源
      最近更新 更多