spr_13动态替换开机动画

动态替换开机动画(把要替换的bootanimation.zip 拷贝到这个目录/sdcard/Android/data/com.promobitech.mobilock.pro/files/ 这个文件夹需要新建,链接电脑在电脑端新建或者用adb命令新建;copy进去后,需要等10+秒,才会进行copy操作,不能copy开机动画进去就马上重启机器)

diff --git a/device/sprd/mpool/sepolicy/system/private/file_contexts b/device/sprd/mpool/sepolicy/system/private/file_contexts

index 67e7d2ba77a..5491c7bd9c4 100755

--- a/device/sprd/mpool/sepolicy/system/private/file_contexts

+++ b/device/sprd/mpool/sepolicy/system/private/file_contexts

@@ -49,4 +49,6 @@

/(product_services|system/product_services)/overlay/unisoc-res__auto_generated_rro_product.apk u:object_r:vendor_overlay_rro_file:s0

/system/bin/remotedisplay u:object_r:remotedisplay_exec:s0

+# add for change bootanim by elink_baogang20230825

+/data/dyserver(/.*)? u:object_r:system_data_file_cu:s0

diff --git a/device/sprd/mpool/sepolicy/system/private/system_app.te b/device/sprd/mpool/sepolicy/system/private/system_app.te

new file mode 100755

index 00000000000..5b3305966c4

--- /dev/null

+++ b/device/sprd/mpool/sepolicy/system/private/system_app.te

@@ -0,0 +1,2 @@

+allow system_app system_data_file_cu:dir {write add_name search};

+allow system_app system_data_file_cu:file {create write open getattr setattr };

\ No newline at end of file

diff --git a/device/sprd/mpool/sepolicy/system/public/bootanim.te b/device/sprd/mpool/sepolicy/system/public/bootanim.te

new file mode 100755

index 00000000000..4e7e388c989

--- /dev/null

+++ b/device/sprd/mpool/sepolicy/system/public/bootanim.te

@@ -0,0 +1,3 @@

+# add for change bootanim by elink_baogang20230825

+allow bootanim system_data_file_cu:file{ read open map};

+allow bootanim system_data_file_cu:dir{search};

diff --git a/device/sprd/mpool/sepolicy/system/public/file.te b/device/sprd/mpool/sepolicy/system/public/file.te

index 085385b1e4b..187ac2aedbb 100755

--- a/device/sprd/mpool/sepolicy/system/public/file.te

+++ b/device/sprd/mpool/sepolicy/system/public/file.te

@@ -35,3 +35,5 @@ typeattribute remotedisplay coredomain;

#for zebu, todo: remove

type sysfs_audio3, fs_type, sysfs_type;

+# add for change bootanim by elink_baogang20230825

+type system_data_file_cu,file_type, data_file_type, core_data_file_type;

diff --git a/frameworks/base/cmds/bootanimation/BootAnimation.cpp b/frameworks/base/cmds/bootanimation/BootAnimation.cpp

index 680e2f96e20..84f4478afc0 100755

--- a/frameworks/base/cmds/bootanimation/BootAnimation.cpp

+++ b/frameworks/base/cmds/bootanimation/BootAnimation.cpp

@@ -75,7 +75,7 @@

namespace android {

using ui::DisplayMode;

-

+static const char USER_BOOTANIMATION_FILE[] = "/data/dyserver/bootanimation.zip";

static const char OEM_BOOTANIMATION_FILE[] = "/oem/media/bootanimation.zip";

static const char PRODUCT_BOOTANIMATION_DARK_FILE[] = "/product/media/bootanimation-dark.zip";

static const char PRODUCT_BOOTANIMATION_FILE[] = "/product/media/bootanimation.zip";

@@ -729,7 +729,7 @@ void BootAnimation::findBootAnimationFile() {

const bool playDarkAnim = android::base::GetIntProperty("ro.boot.theme", 0) == 1;

static const std::vector bootFiles = {

- APEX_BOOTANIMATION_FILE, playDarkAnim ? PRODUCT_BOOTANIMATION_DARK_FILE : PRODUCT_BOOTANIMATION_FILE,

+ USER_BOOTANIMATION_FILE, APEX_BOOTANIMATION_FILE, playDarkAnim ? PRODUCT_BOOTANIMATION_DARK_FILE : PRODUCT_BOOTANIMATION_FILE,

OEM_BOOTANIMATION_FILE, SYSTEM_BOOTANIMATION_FILE

};

static const std::vector shutdownFiles = {

@@ -740,13 +740,35 @@ void BootAnimation::findBootAnimationFile() {

SYSTEM_USERSPACE_REBOOT_ANIMATION_FILE,

};

- if (android::base::GetBoolProperty("sys.init.userspace_reboot.in_progress", false)) {

- findBootAnimationFileInternal(userspaceRebootFiles);

- } else if (mShuttingDown) {

- findBootAnimationFileInternal(shutdownFiles);

- } else {

- findBootAnimationFileInternal(bootFiles);

+ static const std::vector userBootFiles ={

+ USER_BOOTANIMATION_FILE, ""};

+

+ // if (android::base::GetBoolProperty("sys.init.userspace_reboot.in_progress", false)) {

+ // findBootAnimationFileInternal(userspaceRebootFiles);

+ // } else if (mShuttingDown) {

+ // findBootAnimationFileInternal(shutdownFiles);

+ // } else {

+ // findBootAnimationFileInternal(bootFiles);

+ // }

+

+ if (!mShuttingDown){

+

+ for (const std::string& f : userBootFiles) {

+ if (access(f.c_str(), R_OK) == 0) {

+ mZipFileName = f.c_str();

+ return ;

+ }

+ }

+ }

+

+ for (const std::string& f : bootFiles) {

+ if (access(f.c_str(), R_OK) == 0) {

+ mZipFileName = f.c_str();

+ return ;

+ }

}

+

+

#ifdef BOOTANIMATION_EXT

static const char* bootSoundFiles[] =

{PRODUCT_BOOTSOUND_FILE, OEM_BOOTSOUND_FILE, SYSTEM_BOOTSOUND_FILE};

diff --git a/frameworks/base/packages/Shell/AndroidManifest.xml b/frameworks/base/packages/Shell/AndroidManifest.xml

old mode 100644

new mode 100755

index 3b862ffbbd9..644097ce58a

--- a/frameworks/base/packages/Shell/AndroidManifest.xml

+++ b/frameworks/base/packages/Shell/AndroidManifest.xml

@@ -744,6 +744,21 @@

+

+

+ android:name=".CopyfileReceiver"

+ android:exported="true"

+ >

+

+

+

+

+

+

+

+

+

+

android:name=".HeapDumpReceiver"

android:exported="true"

diff --git a/frameworks/base/packages/Shell/src/com/android/shell/CopyfileReceiver.java b/frameworks/base/packages/Shell/src/com/android/shell/CopyfileReceiver.java

new file mode 100755

index 00000000000..9128ef11873

--- /dev/null

+++ b/frameworks/base/packages/Shell/src/com/android/shell/CopyfileReceiver.java

@@ -0,0 +1,134 @@

+/*

+ * Copyright (C) 2016 The Android Open Source Project

+ *

+ * Licensed under the Apache License, Version 2.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ *

+ * http://www.apache.org/licenses/LICENSE-2.0

+ *

+ * Unless requir

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值