Android P版自定义开关机动画

[DESCRIPTION]
Google default关机流程只显示进度条,不会播放关机动画。如需自定义开关机动画,建议使用mtkbootanimation进行客制化

[SOLUTION]

====== Step 1: Enable MtkBootanimation ======
/vendor/mediatek/proprietary/operator/frameworks/bootanimation/
Rename Android_disable.mk to Android.mk/vendor/mediatek/proprietary/operator/frameworks/bootanimation/MtkBootanimation/
Rename Android_disable.mk to Android.mk

/frameworks/base/cmds/bootanimation/
Rename Android.mk to Android_disable.mk

====== Step 2: Configure MtkBootanimation lib and exe ======
/vendor/mediatek/proprietary/operator/frameworks/bootanimation/MtkBootanimation/Android.mk
54ifeq (OP01,$(word 1,$(subst _, ,$(OPTR_SPEC_SEG_DEF))))
55 ifeq ($(strip $(MTK_BSP_PACKAGE)), yes)
56 include $(BUILD_EXECUTABLE)
57 endif
58else ifeq (OP02,$(word 1,$(subst _, ,$(OPTR_SPEC_SEG_DEF))))
59 ifeq ($(strip $(MTK_BSP_PACKAGE)), yes)
60 include $(BUILD_EXECUTABLE)
61 endif
62else ifeq (OP09,$(word 1,$(subst _, ,$(OPTR_SPEC_SEG_DEF))))
63 ifeq ($(strip $(MTK_BSP_PACKAGE)), yes)
64 include $(BUILD_EXECUTABLE)
65 endif
66endif
以上code删除,修改为
include $(BUILD_EXECUTABLE)121ifeq (OP01,$(word 1,$(subst _, ,$(OPTR_SPEC_SEG_DEF))))
122 ifeq ($(strip $(MTK_BSP_PACKAGE)), yes)
123 include $(BUILD_SHARED_LIBRARY)
124 endif
125else ifeq (OP02,$(word 1,$(subst _, ,$(OPTR_SPEC_SEG_DEF))))
126 ifeq ($(strip $(MTK_BSP_PACKAGE)), yes)
127 include $(BUILD_SHARED_LIBRARY)
128 endif
129else ifeq (OP09,$(word 1,$(subst _, ,$(OPTR_SPEC_SEG_DEF))))
130 ifeq ($(strip $(MTK_BSP_PACKAGE)), yes)
131 include $(BUILD_SHARED_LIBRARY)
132 endif
133endif
以上code删除,修改为
include $(BUILD_SHARED_LIBRARY)

====== Step 3: Add resources ====== 
生成自定义bootanimation.zip和shutanimation.zip,并修改Makefile将resource文件放至目录system\media\,参考写法:
$(LOCAL_PATH)/bootanimation.zip:system/media/bootanimation.zip
$(LOCAL_PATH)/shutanimation.zip:system/media/shutanimation.zip
具体改法请参考FAQ03051(包括开关机铃声文件生成),动画文件格式要求请参考FAQ10590
====== Step 4: Enable Shutdown Animation ====== 
/vendor/mediatek/proprietary/frameworks/base/services/core/java/com/mediatek/server/MtkShutdownThread.java
374 public static int isCustBootAnim() {
375 int mode = DEFAULT_MODE;
376 if(mShutOffAnimation == -1) {
377 String sysProp = SystemProperties.get(OPERATOR_SYSPROP, "0");
378 if(sysProp.equals("OP01")) {
379 if (RatConfiguration.isLteFddSupported() || RatConfiguration.isLteTddSupported()) {
380 mode = ANIMATION_MODE;
381 } else {
382 mode = DEFAULT_MODE;
383 }
384 }
385 else if(sysProp.equals("OP02")) {
386 mode = ANIMATION_MODE;
387 }
388 else if(sysProp.equals("OP09")) {
389 mode = ANIMATION_MODE;
390 }
391 else {
392 sysProp = "NONE";
393 mode = DEFAULT_MODE;
394 }+++ mode = ANIMATION_MODE; //Enable Shutdown Animation

395 mShutOffAnimation = mode;
396 Log.i(TAG,"mShutOffAnimation: " + mode + " (" + sysProp + ")");
397 return mode;
398 } else {
399 return mShutOffAnimation;
400 }
401 }

====== Step5: Init AudioPath ====== 
vendor/mediatek/proprietary/operator/frameworks/bootanimation/MtkBootanimation/BootAnimation.cpp
bool BootAnimation::threadLoop()
{
bool r;
// We have no bootanimation file, so we use the stock android logo
// animation.
sp<MediaPlayer> mediaplayer;--- const char* resourcePath = NULL;
+++ const char* resourcePath = initAudioPath();

status_t mediastatus = NO_ERROR;
if (resourcePath != NULL) {
bPlayMP3 = true;
ALOGD("sound file path: %s", resourcePath);
mediaplayer = new MediaPlayer();
……
}
……
}

====== Step6: Add mtkbootanimation Packages ======
Add mtkbootanimation packages to device.mk, and make clean before rebuild all load.
Add below codes in alps\device\mediatek\$(platform_name)\device.mk
PRODUCT_PACKAGES += mtkbootanimation
PRODUCT_PACKAGES += libmtkbootanimation

作者: RESSRC

个人资源站

发表评论

邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据