Android系统(221)---O版自定义开关机动画

O版自定义开关机动画

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

 

注意:O版部分代码有问题,关机动画错使用成了开机动画,按照如下修改即可;

 

/vendor/mediatek/proprietary/operator/frameworks/bootanimation/MtkBootanimation/BootAnimation.cpp

status_t BootAnimation::readyToRun() {
……
if (bBootOrShutDown && encryptedAnimation &&
(access(SYSTEM_ENCRYPTED_BOOTANIMATION_FILE, R_OK) == 0)) {
mZipFileName = SYSTEM_ENCRYPTED_BOOTANIMATION_FILE;
return NO_ERROR;
}
static const char* bootFiles[] = {OEM_BOOTANIMATION_FILE, SYSTEM_BOOTANIMATION_FILE};
static const char* shutdownFiles[] =
{OEM_SHUTDOWNANIMATION_FILE, SYSTEM_SHUTDOWNANIMATION_FILE};

for (const char* f : (bBootOrShutDown ? bootFiles : shutdownFiles)) {
if (access(f, R_OK) == 0) {
mZipFileName = f;
return NO_ERROR;
}
}
……
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值