vender下创建文件夹 res,添加文件,并创建一个install.mk(mk文件名称可以随意起)
install.mk按如下编译
LOCAL_PATH := $(my-dir)
MY_PATH := vendor/res
SYSTEM_OUTDIR=out/target/product/k61v1_64_bsp/system
MEDIA_OUTPUT=$(SYSTEM_OUTDIR)/media
$(shell mkdir -p $(MEDIA_OUTPUT))
$(shell cp -r $(MY_PATH)/*.zip $(MEDIA_OUTPUT))
$(shell cp -r $(MY_PATH)/*.mp3 $(MEDIA_OUTPUT))
$(call inherit-product, vendor/res/install.mk)
/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
/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)
生成自定义bootanimation.zip和shutanimation.zip,并修改Makefile将resource文件放至目录system\media\,参考写法:
$(LOCAL_PATH)/bootanimation.zip:system/media/bootanimation.zip
$(LOCAL_PATH)/shutanimation.zip:system/media/shutanimation.zip
/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 }
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;
--- 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();
……
}
……
}
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