日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Android >内容正文

Android

MTK Android 13平台开关机动画铃声客制化

發(fā)布時間:2024/1/1 Android 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 MTK Android 13平台开关机动画铃声客制化 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

MTK Android 13平臺開關(guān)機動畫鈴聲客制化

Android T和S的差異很大

主要是MtkShutdownThread.java和ShutdownThread.java差異

未完,待更新,填坑

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.bp to Android.bp-

2.Configure MtkBootanimation Android.mk

vendor/mediatek/proprietary/operator/frameworks/bootanimation/MtkBootanimation/Android.mk

直接覆蓋原來mk文件即可
?

bootanimation_CommonCFlags = -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES #####add by tom for Bootanimation start #bootanimation_CommonCFlags += -Wall -Werror -Wunused -Wunreachable-code bootanimation_CommonCFlags += -Wall -Werror -Wunused -Wunreachable-code -Wno-deprecated-declarations# bootanimation executable # =========================================================LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS)LOCAL_CFLAGS += ${bootanimation_CommonCFlags}LOCAL_SHARED_LIBRARIES := \libOpenSLES \libandroidfw \libbase \libbinder \libmtkbootanimation \libcutils \liblog \libutils \LOCAL_SRC_FILES:= \BootAnimationUtil.cpp \#ifeq ($(PRODUCT_IOT),true) #LOCAL_SRC_FILES += \ # iot/iotbootanimation_main.cpp \ # iot/BootAction.cpp#LOCAL_SHARED_LIBRARIES += \ # libandroidthings \ # libbase \ # libbinder#LOCAL_STATIC_LIBRARIES += cpufeatures#elseLOCAL_SRC_FILES += \bootanimation_main.cpp \audioplay.cpp \#endif # PRODUCT_IOTLOCAL_MODULE:= mtkbootanimationLOCAL_INIT_RC := mtkbootanim.rcifdef TARGET_32_BIT_SURFACEFLINGER LOCAL_32_BIT_ONLY := true endif #####add by songhui for Bootanimation start 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 #### #####add by songhui for Bootanimation end# libbootanimation # ===========================================================include $(CLEAR_VARS) LOCAL_MODULE := libmtkbootanimation LOCAL_CFLAGS += ${bootanimation_CommonCFlags}LOCAL_SRC_FILES:= \BootAnimation.cpp# add by songhui # ifdef MSSI_MTK_CARRIEREXPRESS_PACK # ifneq ($(strip $(MSSI_MTK_CARRIEREXPRESS_PACK)), no) # LOCAL_CFLAGS += -DMSSI_MTK_CARRIEREXPRESS_PACK # LOCAL_CPPFLAGS += -DMSSI_MTK_CARRIEREXPRESS_PACK # endif # endifLOCAL_CFLAGS += ${bootanimation_CommonCFlags} LOCAL_C_INCLUDES += \external/tinyalsa/include \frameworks/wilhelm/include#### merge from frameworks/base/cmds/bootanimation by tom ###libhwui ----> libjnigraphics LOCAL_SHARED_LIBRARIES := \libcutils \liblog \libandroidfw \libutils \libbinder \libui \libjnigraphics \libEGL \libETC1 \libGLESv2 \libmedia \libGLESv1_CM \libgui \libtinyalsa \libbaseLOCAL_SHARED_LIBRARIES += libterservice LOCAL_C_INCLUDES += $(MTK_PATH_SOURCE)/hardware/terservice/include/LOCAL_C_INCLUDES += $(TOP)/$(MTK_ROOT)/frameworks-ext/native/include LOCAL_C_INCLUDES += external/skia/include ifdef TARGET_32_BIT_SURFACEFLINGER LOCAL_32_BIT_ONLY := true endif##### add by songhui for Bootanimation start 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 ##### #####add by songhui for Bootanimation end

3.vendor/mediatek/proprietary/frameworks/bootanimation/MtkBootanimation/BootAnimation.cpp?

index 9a6706a..a23d62b 100644 @@ -16,6 +16,7 @@#define LOG_NDEBUG 0#define LOG_TAG "MtkBootAnimation" +#include <vector>#include <stdint.h>#include <inttypes.h> @@ -30,9 +31,10 @@#include <time.h>#include <string.h>- +#include <cutils/atomic.h>#include <cutils/properties.h>+#include <android/imagedecoder.h>#include <androidfw/AssetManager.h>#include <binder/IPCThreadState.h>#include <utils/Atomic.h> @@ -45,18 +47,16 @@#include <ui/PixelFormat.h>#include <ui/Rect.h>#include <ui/Region.h> -#include <ui/DisplayInfo.h> +#include <ui/DisplayMode.h>#include <gui/ISurfaceComposer.h> +#include <gui/DisplayEventReceiver.h>#include <gui/Surface.h>#include <gui/SurfaceComposerClient.h>// TODO: Fix Skia.#pragma GCC diagnostic push#pragma GCC diagnostic ignored "-Wunused-parameter" -#include <SkBitmap.h> -#include <SkImage.h> -#include <SkStream.h>#pragma GCC diagnostic pop#include <GLES/gl.h> @@ -76,8 +76,11 @@#include <binder/Parcel.h>#define PATH_COUNT 3 - - +// add by songhui +#include <binder/IServiceManager.h> +#include "ITerService.h" +#define REGIONAL_BOOTANIM_GET_MNC "persist.vendor.bootanim.mnc" +// add by songhui#ifdef MSSI_MTK_CARRIEREXPRESS_PACK#define GLOBAL_DEVICE_BOOTANIM_OPTR_NAME "persist.vendor.operator.optr"#define PATH_COUNT_USP 2 @@ -123,6 +126,9 @@ static const char* mResourcePath[MNC_COUNT][PATH_COUNT] =namespace android {+// merge from frameworks/base/cmds/bootanimation by tom +using ui::DisplayMode; +static const char CUSTOM_BOOTANIMATION_FILE[] = "/custom/media/bootanimation.zip";static const char USER_BOOTANIMATION_FILE[] = "/data/local/bootanimation.zip";static const char SYSTEM_SHUTANIMATION_FILE[] = "/system/media/shutanimation.zip"; @@ -277,22 +283,52 @@ void BootAnimation::binderDied(const wp<IBinder>&)requestExit();}+// merge from frameworks/base/cmds/bootanimation by tom +static void* decodeImage(const void* encodedData, size_t dataLength, AndroidBitmapInfo* outInfo) { + AImageDecoder* decoder = nullptr; + AImageDecoder_createFromBuffer(encodedData, dataLength, &decoder); + if (!decoder) { + return nullptr; + } + + const AImageDecoderHeaderInfo* info = AImageDecoder_getHeaderInfo(decoder); + outInfo->width = AImageDecoderHeaderInfo_getWidth(info); + outInfo->height = AImageDecoderHeaderInfo_getHeight(info); + outInfo->format = AImageDecoderHeaderInfo_getAndroidBitmapFormat(info); + outInfo->stride = AImageDecoder_getMinimumStride(decoder); + outInfo->flags = 0; + + const size_t size = outInfo->stride * outInfo->height; + void* pixels = malloc(size); + int result = AImageDecoder_decodeImage(decoder, pixels, outInfo->stride, size); + AImageDecoder_delete(decoder); + + if (result != ANDROID_IMAGE_DECODER_SUCCESS) { + free(pixels); + return nullptr; + } + return pixels; +} +status_t BootAnimation::initTexture(Texture* texture, AssetManager& assets,const char* name) {Asset* asset = assets.open(name, Asset::ACCESS_BUFFER); - if (asset == NULL) + if (asset == nullptr)return NO_INIT; - SkBitmap bitmap; - sk_sp<SkData> data = SkData::MakeWithoutCopy(asset->getBuffer(false), - asset->getLength()); - sk_sp<SkImage> image = SkImage::MakeFromEncoded(data); - image->asLegacyBitmap(&bitmap, SkImage::kRO_LegacyBitmapMode); + + AndroidBitmapInfo bitmapInfo; + void* pixels = decodeImage(asset->getBuffer(false), asset->getLength(), &bitmapInfo); + auto pixelDeleter = std::unique_ptr<void, decltype(free)*>{ pixels, free }; +asset->close();delete asset;- const int w = bitmap.width(); - const int h = bitmap.height(); - const void* p = bitmap.getPixels(); + if (!pixels) { + return NO_INIT; + } + + const int w = bitmapInfo.width; + const int h = bitmapInfo.height;GLint crop[4] = { 0, h, w, -h };texture->w = w; @@ -301,22 +337,22 @@ status_t BootAnimation::initTexture(Texture* texture, AssetManager& assets,glGenTextures(1, &texture->name);glBindTexture(GL_TEXTURE_2D, texture->name);- switch (bitmap.colorType()) { - case kAlpha_8_SkColorType: + switch (bitmapInfo.format) { + case ANDROID_BITMAP_FORMAT_A_8:glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_ALPHA, - GL_UNSIGNED_BYTE, p); + GL_UNSIGNED_BYTE, pixels);break; - case kARGB_4444_SkColorType: + case ANDROID_BITMAP_FORMAT_RGBA_4444:glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, - GL_UNSIGNED_SHORT_4_4_4_4, p); + GL_UNSIGNED_SHORT_4_4_4_4, pixels);break; - case kN32_SkColorType: + case ANDROID_BITMAP_FORMAT_RGBA_8888:glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, - GL_UNSIGNED_BYTE, p); + GL_UNSIGNED_BYTE, pixels);break; - case kRGB_565_SkColorType: + case ANDROID_BITMAP_FORMAT_RGB_565:glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, - GL_UNSIGNED_SHORT_5_6_5, p); + GL_UNSIGNED_SHORT_5_6_5, pixels);break;default:break; @@ -333,20 +369,21 @@ status_t BootAnimation::initTexture(Texture* texture, AssetManager& assets,status_t BootAnimation::initTexture(FileMap* map, int* width, int* height){ - SkBitmap bitmap; - sk_sp<SkData> data = SkData::MakeWithoutCopy(map->getDataPtr(), - map->getDataLength()); - sk_sp<SkImage> image = SkImage::MakeFromEncoded(data); - image->asLegacyBitmap(&bitmap, SkImage::kRO_LegacyBitmapMode); + AndroidBitmapInfo bitmapInfo; + void* pixels = decodeImage(map->getDataPtr(), map->getDataLength(), &bitmapInfo); + auto pixelDeleter = std::unique_ptr<void, decltype(free)*>{ pixels, free };// FileMap memory is never released until application exit.// Release it now as the texture is already loaded and the memory used for// the packed resource can be released.delete map;- const int w = bitmap.width(); - const int h = bitmap.height(); - const void* p = bitmap.getPixels(); + if (!pixels) { + return NO_INIT; + } + + const int w = bitmapInfo.width; + const int h = bitmapInfo.height;GLint crop[4] = { 0, h, w, -h };int tw = 1 << (31 - __builtin_clz(w)); @@ -354,28 +391,28 @@ status_t BootAnimation::initTexture(FileMap* map, int* width, int* height)if (tw < w) tw <<= 1;if (th < h) th <<= 1;- switch (bitmap.colorType()) { - case kN32_SkColorType: + switch (bitmapInfo.format) { + case ANDROID_BITMAP_FORMAT_RGBA_8888:if (!mUseNpotTextures && (tw != w || th != h)) {glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tw, th, 0, GL_RGBA, - GL_UNSIGNED_BYTE, 0); + GL_UNSIGNED_BYTE, nullptr);glTexSubImage2D(GL_TEXTURE_2D, 0, - 0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, p); + 0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixels);} else {glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, - GL_UNSIGNED_BYTE, p); + GL_UNSIGNED_BYTE, pixels);}break;- case kRGB_565_SkColorType: + case ANDROID_BITMAP_FORMAT_RGB_565:if (!mUseNpotTextures && (tw != w || th != h)) {glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, tw, th, 0, GL_RGB, - GL_UNSIGNED_SHORT_5_6_5, 0); + GL_UNSIGNED_SHORT_5_6_5, nullptr);glTexSubImage2D(GL_TEXTURE_2D, 0, - 0, 0, w, h, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, p); + 0, 0, w, h, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, pixels);} else {glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, - GL_UNSIGNED_SHORT_5_6_5, p); + GL_UNSIGNED_SHORT_5_6_5, pixels);}break;default: @@ -412,19 +449,20 @@ status_t BootAnimation::readyToRun() {mAssets.addDefaultAssets();- sp<IBinder> dtoken(SurfaceComposerClient::getBuiltInDisplay( - ISurfaceComposer::eDisplayIdMain)); - DisplayInfo dinfo; - status_t status = SurfaceComposerClient::getDisplayInfo(dtoken, &dinfo); + sp<IBinder> dtoken = SurfaceComposerClient::getInternalDisplayToken(); + DisplayMode displayMode; + status_t status = SurfaceComposerClient::getActiveDisplayMode(dtoken, &displayMode);if (status)return -1; + ui::Size resolution = displayMode.resolution;/// M: The tablet rotation maybe 90/270 degrees, so set the lcm config for tablet//SurfaceComposerClient::setDisplayProjection(dtoken, DisplayState::eOrientationDefault, Rect(dinfo.w, dinfo.h), Rect(dinfo.w, dinfo.h)); - t.setDisplayProjection(dtoken, DisplayState::eOrientationDefault, Rect(dinfo.w, dinfo.h), Rect(dinfo.w, dinfo.h)); + t.setDisplayProjection(dtoken, ui::ROTATION_0, Rect(resolution.getWidth(), resolution.getHeight()), + Rect(resolution.getWidth(), resolution.getHeight()));t.apply();// create the native surfacesp<SurfaceControl> control = session()->createSurface(String8("BootAnimation"), - dinfo.w, dinfo.h, PIXEL_FORMAT_RGB_565); + resolution.getWidth(), resolution.getHeight(), PIXEL_FORMAT_RGB_565);/*SurfaceComposerClient::openGlobalTransaction(); @@ -538,7 +576,8 @@ bool BootAnimation::threadLoop()// We have no bootanimation file, so we use the stock android logo// animation.sp<MediaPlayer> mediaplayer; - const char* resourcePath = NULL; + // add by songhui + const char* resourcePath = initAudioPath();status_t mediastatus = NO_ERROR;if (resourcePath != NULL) {bPlayMP3 = true; @@ -1510,6 +1549,8 @@ const char* BootAnimation::initAudioPath() {void BootAnimation::initBootanimationZip() {ZipFileRO* zipFile = NULL;String8 ZipFileName; + // add by songhui + char BootanimFileName[PROPERTY_VALUE_MAX];#ifdef MSSI_MTK_CARRIEREXPRESS_PACKchar OPTR[PROPERTY_VALUE_MAX];// ter-service

關(guān)于作者
地球邊 ?微信號 ywysh1018

總結(jié)

以上是生活随笔為你收集整理的MTK Android 13平台开关机动画铃声客制化的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。