MTK文档

MTK ANDROID8.0 O版自定义开关机动画


[DESCRIPTION]
O较前面的版本有更改,为方便自定义开关机动画我司,使用mtkbootanimation自定义开关机动画;
[SOLUTION]
 O版会根据配置生成bootanimation或者mtkbootanimation,只会生成一个;如果要自定义可以使用mtkbootanimation

1.
查询生成的是mtkbootanimation还是bootanimation

例如:
如果编译时执行的是:lunch full_k63v2_64_bsp_op01_vdo-userdebug
查看对应的工程配置:
/device/mediatekprojects/k63v2_64_bsp_op01_vdo/ProjectConfig.mk
OPTR_SPEC_SEG_DEF = OP01_SPEC0200_SEGC
……
MTK_BSP_PACKAGE = yes

(1)OPTR_SPEC_SEG_DEF前缀为OP01、OP02、OP09,并且$(MTK_BSP_PACKAGE)为true;生成mtkbootanimation
(2)除了第一种情况,全部编译为:bootanimation

注意:请不要随意改动OPTR_SPEC_SEG_DEF和MTK_BSP_PACKAGE的值

2.如果配置不支持,又想使用mtkbootanimation自定义开关机动画;
(1)
/frameworks/base/cmds/bootanimation/Android.mk
删除下面
ifeq (OP01,$(word 1,$(subst _, ,$(OPTR_SPEC_SEG_DEF))))
ifneq ($(strip $(MTK_BSP_PACKAGE)), yes)
include $(BUILD_EXECUTABLE)
endif
else ifeq (OP02,$(word 1,$(subst _, ,$(OPTR_SPEC_SEG_DEF))))
ifneq ($(strip $(MTK_BSP_PACKAGE)), yes)
include $(BUILD_EXECUTABLE)
endif
else ifeq (OP09,$(word 1,$(subst _, ,$(OPTR_SPEC_SEG_DEF))))
ifneq ($(strip $(MTK_BSP_PACKAGE)), yes)
include $(BUILD_EXECUTABLE)
endif
else
include $(BUILD_EXECUTABLE)
endif
……
ifeq (OP01,$(word 1,$(subst _, ,$(OPTR_SPEC_SEG_DEF))))
ifneq ($(strip $(MTK_BSP_PACKAGE)), yes)
include $(BUILD_SHARED_LIBRARY)
endif
else ifeq (OP02,$(word 1,$(subst _, ,$(OPTR_SPEC_SEG_DEF))))
ifneq ($(strip $(MTK_BSP_PACKAGE)), yes)
include $(BUILD_SHARED_LIBRARY)
endif
else ifeq (OP09,$(word 1,$(subst _, ,$(OPTR_SPEC_SEG_DEF))))
ifneq ($(strip $(MTK_BSP_PACKAGE)), yes)
include $(BUILD_SHARED_LIBRARY)
endif
else
include $(BUILD_SHARED_LIBRARY)
endif

(2)
/vendor/mediatek/proprietary/operator/frameworks/bootanimation/MtkBootanimation/Android.mk

include $(BUILD_EXECUTABLE)
替换下面的部分;
ifeq (OP01,$(word 1,$(subst _, ,$(OPTR_SPEC_SEG_DEF))))
ifeq ($(strip $(MTK_BSP_PACKAGE)), yes)
include $(BUILD_EXECUTABLE)
endif
else ifeq (OP02,$(word 1,$(subst _, ,$(OPTR_SPEC_SEG_DEF))))
ifeq ($(strip $(MTK_BSP_PACKAGE)), yes)
include $(BUILD_EXECUTABLE)
endif
else ifeq (OP09,$(word 1,$(subst _, ,$(OPTR_SPEC_SEG_DEF))))
ifeq ($(strip $(MTK_BSP_PACKAGE)), yes)
include $(BUILD_EXECUTABLE)
endif
endif


include $(BUILD_SHARED_LIBRARY)
替换下面的部分
ifeq (OP01,$(word 1,$(subst _, ,$(OPTR_SPEC_SEG_DEF))))
ifeq ($(strip $(MTK_BSP_PACKAGE)), yes)
include $(BUILD_SHARED_LIBRARY)
endif
else ifeq (OP02,$(word 1,$(subst _, ,$(OPTR_SPEC_SEG_DEF))))
ifeq ($(strip $(MTK_BSP_PACKAGE)), yes)
include $(BUILD_SHARED_LIBRARY)
endif
else ifeq (OP09,$(word 1,$(subst _, ,$(OPTR_SPEC_SEG_DEF))))
ifeq ($(strip $(MTK_BSP_PACKAGE)), yes)
include $(BUILD_SHARED_LIBRARY)
endif
endif

(3)
/vendor/mediatek/proprietary/frameworks/base/services/core/java/com/mediatek/server/MtkShutdownThread.java

private static boolean configShutdownAnimation(Context context) {
boolean mShutOffAnimation = false;
PowerManager pm = (PowerManager)
context.getSystemService(Context.POWER_SERVICE);

if (!bConfirmForAnimation && !pm.isScreenOn()) {
bPlayaudio = false;
} else {
bPlayaudio = true;
}
try {
mShutOffAnimation = isCustBootAnim();
mShutOffAnimation = true; //mtk add code
Log.i(TAG, “mShutOffAnimation =” + mShutOffAnimation);
} catch (Exception e) {
e.printStackTrace();
}
return mShutOffAnimation;
}

(4)
/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;
*/
/** MTK begin */
const char* resourcePath = initAudioPath();
/** MTK end */
status_t mediastatus = NO_ERROR;
if (resourcePath != NULL) {
bPlayMP3 = true;
ALOGD(“sound file path: %s”, resourcePath);
mediaplayer = new MediaPlayer();
……
}
……
}
(5)
在alps\device\mediatek\$(alps)\device.mk中无下面的赋值选项需添加
PRODUCT_PACKAGES += mtkbootanimation
PRODUCT_PACKAGES += libmtkbootanimation
$(alps)是对应的工程名,比如:6763
然后编译,编译前麻烦:make clean
其他可参考:
[FAQ03051] 非运营商定制项目如何客制化自己的开关机动画、开关机铃声
[FAQ06044] 制作开机动画(bootanimation.zip)注意事项