修改android系统关机动画
2016-07-12 08:47:21 u014379571 阅读数 5253

最近一直在修改关机充电动画的问题,我就把一些需要修改的东西,分享给大家

lk-cust_display.h这个文件是修改动画位置,下面以480*800为例


/*

// new animation parameters example:WVGA (480*800)
// A , start point of first number rectangle
// B , left_top point of battery_capacity fill_in rectangle
// c , left_bottom point of battery_capacity fill_in rectangle

// battery capacity rectangle
#define CAPACITY_LEFT                (172) // CAPACITY_LEFT = B.x = 172
#define CAPACITY_TOP                 (330) // CAPACITY_TOP = B.y = 330
#define CAPACITY_RIGHT               (307) // CAPACITY_RIGHT = B.x + fill_line.w = 172 + 135
#define CAPACITY_BOTTOM              (546) // CAPACITY_BOTTOM  = C.y = 546

// first number rectangle
#define NUMBER_LEFT                  (178) // NUMBER_LEFT = A.x
#define NUMBER_TOP                   (190) // NUMBER_TOP  = A.y
#define NUMBER_RIGHT                 (216) // NUMBER_RIGHT = A.x + num.w = 178 + 38
#define NUMBER_BOTTOM                (244) // NUMBER_BOTTOM = A.y + num.h = 190 + 54

// %  rectangle
#define PERCENT_LEFT                 (254) // PERCENT_LEFT = A.x + 2*num.w = 178 + 2*38
#define PERCENT_TOP                  (190) // PERCENT_TOP  = A.y
#define PERCENT_RIGHT                (302) // PERCENT_LEFT = A.x + 2*num.w +(%).w 
#define PERCENT_BOTTOM               (244) // PERCENT_BOTTOM = A.y + (%).h = 190 + 54

// top animation part
#define TOP_ANIMATION_LEFT           (172) // TOP_ANIMATION_LEFT = B.x
#define TOP_ANIMATION_TOP            (100) // 100 
#define TOP_ANIMATION_RIGHT          (307) // TOP_ANIMATION_LEFT = B.x + fill_line.w = 172 + 135
#define TOP_ANIMATION_BOTTOM         (124) // TOP_ANIMATION_BOTTOM = TOP_ANIMATION_TOP + fill_line.h = 100 + 24

*/


#ifndef __CUST_DISPLAY_H__
#define __CUST_DISPLAY_H__

// color
#define BAR_OCCUPIED_COLOR  (0x07E0)    // Green
#define BAR_EMPTY_COLOR     (0xFFFF)    // White
#define BAR_BG_COLOR        (0x0000)    // Black

// LOGO number
#define ANIM_V0_LOGO_NUM   5            // version 0: show 4 recatangle growing animation without battery number
#define ANIM_V1_LOGO_NUM   39           // version 1: show wave animation with  battery number 
#define ANIM_V2_LOGO_NUM   86           // version 2: show wireless charging animation      

// Common LOGO index
#define BOOT_LOGO_INDEX   0 
#define KERNEL_LOGO_INDEX   38 

#define ANIM_V0_BACKGROUND_INDEX   1 
#define ANIM_V1_BACKGROUND_INDEX   35
 
 
#define LOW_BATTERY_INDEX   2 
#define CHARGER_OV_INDEX   3 
#define FULL_BATTERY_INDEX   37 

// version 1: show wave animation with  battery number 

// NUMBER LOGO INDEX
#define NUMBER_PIC_START_0   4 
#define NUMBER_PIC_PERCENT   14 

// DYNAMIC ANIMATION LOGO INDEX
#define BAT_ANIM_START_0   15 

// LOW BATTERY(0~10%) ANIMATION LOGO
#define LOW_BAT_ANIM_START_0    25 

#define ANIM_LINE_INDEX   36 


// version 2: show wireless charging animation logo index

#define V2_NUM_START_0_INDEX  57  
#define V2_NUM_PERCENT_INDEX  67 
 
#define V2_BAT_0_10_START_INDEX     68  
#define V2_BAT_10_40_START_INDEX    72 
#define V2_BAT_40_80_START_INDEX    76 
#define V2_BAT_80_100_START_NDEX   80

#define V2_BAT_0_INDEX   84
#define V2_BAT_100_INDEX   85

// show fast charging animation logo index

#define FAST_CHARGING_BAT_100_INDEX   39
#define FAST_CHARGING_BAT_START_0_INDEX   40

#define FAST_CHARGING_NUM_START_0_INDEX   46
#define FAST_CHARGING_NUM_PERCENT_INDEX   56

#if defined(FHD) || defined(CU_FHD) || defined(CMCC_FHD) || defined(CT_FHD)
	// fhd 1080*1920
	
	// battery capacity rectangle
	#define CAPACITY_LEFT                (387) // battery capacity center
	#define CAPACITY_TOP                 (802)
	#define CAPACITY_RIGHT               (691)
	#define CAPACITY_BOTTOM              (1292)

	// first number rectangle
	#define NUMBER_LEFT                  (351+84) // number
	#define NUMBER_TOP                   (479)
	#define NUMBER_RIGHT                 (435+84)
	#define NUMBER_BOTTOM                (600)

	// %  rectangle
	#define PERCENT_LEFT                 (519+84) // percent number_left + 2*number_width
	#define PERCENT_TOP                  (479)
	#define PERCENT_RIGHT                (627+84)
	#define PERCENT_BOTTOM               (600)

	// top animation part
	#define TOP_ANIMATION_LEFT           (387) // top animation
	#define TOP_ANIMATION_TOP            (100)
	#define TOP_ANIMATION_RIGHT          (691)
	#define TOP_ANIMATION_BOTTOM         (152)

	// for old animation
	#define BAR_LEFT            (470)
	#define BAR_TOP             (356)
	#define BAR_RIGHT           (610)
	#define BAR_BOTTOM          (678)

#elif defined(WQHD) || defined(CU_WQHD) || defined(CMCC_WQHD) || defined(CT_WQHD)
	// hd720 720*1280

	// battery capacity rectangle
	#define CAPACITY_LEFT                (393) // battery capacity center
	#define CAPACITY_TOP                 (786)
	#define CAPACITY_RIGHT               (623)
	#define CAPACITY_BOTTOM              (1155)

	// first number rectangle
	#define NUMBER_LEFT                  (410) // number
	#define NUMBER_TOP                   (546)
	#define NUMBER_RIGHT                 (474)
	#define NUMBER_BOTTOM                (636)

	// %  rectangle
	#define PERCENT_LEFT                 (537) // percent number_left + 2*number_width
	#define PERCENT_TOP                  (546)
	#define PERCENT_RIGHT                (618)
	#define PERCENT_BOTTOM               (636)

	// top animation part
	#define TOP_ANIMATION_LEFT           (393) // top animation
	#define TOP_ANIMATION_TOP            (100)
	#define TOP_ANIMATION_RIGHT          (624)
	#define TOP_ANIMATION_BOTTOM         (182)

	// for old animation
	#define BAR_LEFT            (443)
	#define BAR_TOP             (337)
	#define BAR_RIGHT           (574)
	#define BAR_BOTTOM          (641)

#elif defined(HD720) || defined(CU_HD720) || defined(CMCC_HD720) || defined(CT_HD720)
	// hd720 720*1280

	// battery capacity rectangle
	#define CAPACITY_LEFT                (278) // battery capacity center
	#define CAPACITY_TOP                 (556)
	#define CAPACITY_RIGHT               (441)
	#define CAPACITY_BOTTOM              (817)

	// first number rectangle
	#define NUMBER_LEFT                  (290) // number
	#define NUMBER_TOP                   (386)
	#define NUMBER_RIGHT                 (335)
	#define NUMBER_BOTTOM                (450)

	// %  rectangle
	#define PERCENT_LEFT                 (380) // percent number_left + 2*number_width
	#define PERCENT_TOP                  (386)
	#define PERCENT_RIGHT                (437)
	#define PERCENT_BOTTOM               (450)

	// top animation part
	#define TOP_ANIMATION_LEFT           (278) // top animation
	#define TOP_ANIMATION_TOP            (100)
	#define TOP_ANIMATION_RIGHT          (441)
	#define TOP_ANIMATION_BOTTOM         (129)

	// for old animation
	#define BAR_LEFT            (313)
	#define BAR_TOP             (238)
	#define BAR_RIGHT           (406)
	#define BAR_BOTTOM          (453)

#elif defined(FWVGA) || defined(CU_FWVGA) || defined(CMCC_FWVGA) || defined(CT_FWVGA)
	// fwvga 480*854

	// battery capacity rectangle
	#define CAPACITY_LEFT                (172) // battery capacity center
	#define CAPACITY_TOP                 (357)
	#define CAPACITY_RIGHT               (307)
	#define CAPACITY_BOTTOM              (573)

	// first number rectangle
	#define NUMBER_LEFT                  (172) // number
	#define NUMBER_TOP                   (213)
	#define NUMBER_RIGHT                 (210)
	#define NUMBER_BOTTOM                (267)

	// %  rectangle
	#define PERCENT_LEFT                 (248) // percent number_left + 2*number_width
	#define PERCENT_TOP                  (213)
	#define PERCENT_RIGHT                (296)
	#define PERCENT_BOTTOM               (267)

	// top animation part
	#define TOP_ANIMATION_LEFT           (172) // top animation
	#define TOP_ANIMATION_TOP            (100)
	#define TOP_ANIMATION_RIGHT          (307)
	#define TOP_ANIMATION_BOTTOM         (124)

	// for old animation
	#define BAR_LEFT            (184)
	#define BAR_TOP             (227)
	#define BAR_RIGHT           (294)
	#define BAR_BOTTOM          (437)

#elif defined(QHD) || defined(CU_QHD) || defined(CMCC_QHD) || defined(CT_QHD)
	// qhd 540*960

	// battery capacity rectangle
	#define CAPACITY_LEFT                (202) // battery capacity center
	#define CAPACITY_TOP                 (410)
	#define CAPACITY_RIGHT               (337)
	#define CAPACITY_BOTTOM              (626)

	// first number rectangle
	#define NUMBER_LEFT                  (202) // number
	#define NUMBER_TOP                   (266)
	#define NUMBER_RIGHT                 (240)
	#define NUMBER_BOTTOM                (320)

	// %  rectangle
	#define PERCENT_LEFT                 (278) // percent number_left + 2*number_width
	#define PERCENT_TOP                  (266)
	#define PERCENT_RIGHT                (326)
	#define PERCENT_BOTTOM               (320)

	// top animation part
	#define TOP_ANIMATION_LEFT           (202) // top animation
	#define TOP_ANIMATION_TOP            (100)
	#define TOP_ANIMATION_RIGHT          (337)
	#define TOP_ANIMATION_BOTTOM         (124)

	// for old animation
	#define BAR_LEFT            (235)
	#define BAR_TOP             (179)
	#define BAR_RIGHT           (305)
	#define BAR_BOTTOM          (340)

#elif defined(WVGA) || defined(CU_WVGA) || defined(CMCC_WVGA) || defined(CT_WVGA)
	// default wvga 480*800

	// battery capacity rectangle
	#define CAPACITY_LEFT                (172) // battery capacity center
	#define CAPACITY_TOP                 (330)
	#define CAPACITY_RIGHT               (307)
	#define CAPACITY_BOTTOM              (546)

	// first number rectangle
	#define NUMBER_LEFT                  (178) // number
	#define NUMBER_TOP                   (190)
	#define NUMBER_RIGHT                 (216)
	#define NUMBER_BOTTOM                (244)

	// %  rectangle
	#define PERCENT_LEFT                 (254) // percent number_left + 2*number_width
	#define PERCENT_TOP                  (190)
	#define PERCENT_RIGHT                (302)
	#define PERCENT_BOTTOM               (244)

	// top animation part
	#define TOP_ANIMATION_LEFT           (172) // top animation
	#define TOP_ANIMATION_TOP            (100)
	#define TOP_ANIMATION_RIGHT          (307)
	#define TOP_ANIMATION_BOTTOM         (124)

	// for old animation
	#define BAR_LEFT            (209)
	#define BAR_TOP             (149)
	#define BAR_RIGHT           (271)
	#define BAR_BOTTOM          (282)

#elif defined(HVGA) || defined(CU_HVGA) || defined(CMCC_HVGA) || defined(CT_HVGA)

	// hvga 320*480

	// battery capacity rectangle
	#define CAPACITY_LEFT                (109) // battery capacity center
	#define CAPACITY_TOP                 (189)
	#define CAPACITY_RIGHT               (211)
	#define CAPACITY_BOTTOM              (350)

	// first number rectangle
	#define NUMBER_LEFT                  (126) // number
	#define NUMBER_TOP                   (95)
	#define NUMBER_RIGHT                 (153)
	#define NUMBER_BOTTOM                (131)

	// %  rectangle
	#define PERCENT_LEFT                 (180) // percent number_left + 2*number_width
	#define PERCENT_TOP                  (95)
	#define PERCENT_RIGHT                (212)
	#define PERCENT_BOTTOM               (131)

	// top animation part
	#define TOP_ANIMATION_LEFT           (109) // top animation
	#define TOP_ANIMATION_TOP            (100)
	#define TOP_ANIMATION_RIGHT          (211)
	#define TOP_ANIMATION_BOTTOM         (118)

	// for old animation
	#define BAR_LEFT            (129)
	#define BAR_TOP             (128)
	#define BAR_RIGHT           (190)
	#define BAR_BOTTOM          (245)
#elif defined(QVGA) || defined(CU_QVGA) || defined(CMCC_QVGA) || defined(CT_QVGA)

	// hvga 320*480

	// battery capacity rectangle
	#define CAPACITY_LEFT                (82) // battery capacity center
	#define CAPACITY_TOP                 (124)
	#define CAPACITY_RIGHT               (158)
	#define CAPACITY_BOTTOM              (241)

	// first number rectangle
	#define NUMBER_LEFT                  (93) // number
	#define NUMBER_TOP                   (50)
	#define NUMBER_RIGHT                 (109)
	#define NUMBER_BOTTOM                (73)

	// %  rectangle
	#define PERCENT_LEFT                 (125) // percent number_left + 2*number_width
	#define PERCENT_TOP                  (50)
	#define PERCENT_RIGHT                (145)
	#define PERCENT_BOTTOM               (73)

	// top animation part
	#define TOP_ANIMATION_LEFT           (82) // top animation
	#define TOP_ANIMATION_TOP            (100)
	#define TOP_ANIMATION_RIGHT          (158)
	#define TOP_ANIMATION_BOTTOM         (113)

	// for old animation
	#define BAR_LEFT            (97)
	#define BAR_TOP             (96)
	#define BAR_RIGHT           (140)
	#define BAR_BOTTOM          (184)
	
#elif defined(WSVGA)
	// wsvga 600*1024

	// battery capacity rectangle
	#define CAPACITY_LEFT                (232) // battery capacity center
	#define CAPACITY_TOP                 (442)
	#define CAPACITY_RIGHT               (367)
	#define CAPACITY_BOTTOM              (658)

	// first number rectangle
	#define NUMBER_LEFT                  (250) // number
	#define NUMBER_TOP                   (300)
	#define NUMBER_RIGHT                 (288)
	#define NUMBER_BOTTOM                (354)

	// %  rectangle
	#define PERCENT_LEFT                 (326) // percent number_left + 2*number_width
	#define PERCENT_TOP                  (300)
	#define PERCENT_RIGHT                (374)
	#define PERCENT_BOTTOM               (354)

	// top animation part
	#define TOP_ANIMATION_LEFT           (232) // top animation
	#define TOP_ANIMATION_TOP            (100)
	#define TOP_ANIMATION_RIGHT          (367)
	#define TOP_ANIMATION_BOTTOM         (124)

	// for old animation
	#define BAR_LEFT            (260)
	#define BAR_TOP             (190)
	#define BAR_RIGHT           (338)
	#define BAR_BOTTOM          (360)

#elif defined(WSVGANL)
	// wsvganl 1024*600

	// battery capacity rectangle
	#define CAPACITY_LEFT                (444) // battery capacity center
	#define CAPACITY_TOP                 (230)
	#define CAPACITY_RIGHT               (579) // 444 + 135
	#define CAPACITY_BOTTOM              (446)

	// first number rectangle
	#define NUMBER_LEFT                  (466) // number
	#define NUMBER_TOP                   (90)
	#define NUMBER_RIGHT                 (504) // 466 + 38
	#define NUMBER_BOTTOM                (144) // 90 + 54

	// %  rectangle
	#define PERCENT_LEFT                 (542) // percent number_left + 2*number_width
	#define PERCENT_TOP                  (90)
	#define PERCENT_RIGHT                (590)
	#define PERCENT_BOTTOM               (144)

	// top animation part
	#define TOP_ANIMATION_LEFT           (444) // top animation
	#define TOP_ANIMATION_TOP            (100)
	#define TOP_ANIMATION_RIGHT          (579)
	#define TOP_ANIMATION_BOTTOM         (124)

	// for old animation
	#define BAR_LEFT            (414)
	#define BAR_TOP             (186)
	#define BAR_RIGHT           (608)
	#define BAR_BOTTOM          (477)

#elif defined(WXGANL)
	// wxganl 1280*800

	// battery capacity rectangle
	#define CAPACITY_LEFT                (558) // battery capacity center
	#define CAPACITY_TOP                 (265)
	#define CAPACITY_RIGHT               (721) //558+163
	#define CAPACITY_BOTTOM              (525)

	#define NUMBER_LEFT                  (585) // number
	#define NUMBER_TOP                   (95)
	#define NUMBER_RIGHT                 (630)//585+45
	#define NUMBER_BOTTOM                (159) //95+64

	#define PERCENT_LEFT                 (675) // percent number_left + 2*number_width
	#define PERCENT_TOP                  (95)
	#define PERCENT_RIGHT                (732) //675+57
	#define PERCENT_BOTTOM               (159)

	#define TOP_ANIMATION_LEFT           (558) // top animation
	#define TOP_ANIMATION_TOP            (100)
	#define TOP_ANIMATION_RIGHT          (721)
	#define TOP_ANIMATION_BOTTOM         (129)

	// for old animation
	#define BAR_LEFT            (525)
	#define BAR_TOP             (250)
	#define BAR_RIGHT           (755)
	#define BAR_BOTTOM          (640)
	
#elif defined(WXGA)
	// wxga 800*1280

	// battery capacity rectangle
	#define CAPACITY_LEFT                (318) // battery capacity center
	#define CAPACITY_TOP                 (556)
	#define CAPACITY_RIGHT               (481) //318+163
	#define CAPACITY_BOTTOM              (815)

	#define NUMBER_LEFT                  (345) // number
	#define NUMBER_TOP                   (385)
	#define NUMBER_RIGHT                 (390) //345+45
	#define NUMBER_BOTTOM                (449) //385+64

	#define PERCENT_LEFT                 (435) // percent number_left + 2*number_width
	#define PERCENT_TOP                  (385)
	#define PERCENT_RIGHT                (492) //435+57
	#define PERCENT_BOTTOM               (449)

	#define TOP_ANIMATION_LEFT           (318) // top animation
	#define TOP_ANIMATION_TOP            (100)
	#define TOP_ANIMATION_RIGHT          (481)
	#define TOP_ANIMATION_BOTTOM         (129)

	// for old animation
	#define BAR_LEFT            (348)
	#define BAR_TOP             (238)
	#define BAR_RIGHT           (453)
	#define BAR_BOTTOM          (452)
	
#elif defined(WUXGANL)
	// wuxganl 1920*1200

	// battery capacity rectangle
	#define CAPACITY_LEFT                (806) // battery capacity center
	#define CAPACITY_TOP                 (443)
	#define CAPACITY_RIGHT               (1110)
	#define CAPACITY_BOTTOM              (929)

	#define NUMBER_LEFT                  (855) // number
	#define NUMBER_TOP                   (124)
	#define NUMBER_RIGHT                 (939) //855+84
	#define NUMBER_BOTTOM                (245)

	#define PERCENT_LEFT                 (1023) // percent number_left + 2*number_width
	#define PERCENT_TOP                  (124)
	#define PERCENT_RIGHT                (1131) //1023+108
	#define PERCENT_BOTTOM               (245)  //124+121

	#define TOP_ANIMATION_LEFT           (806) // top animation
	#define TOP_ANIMATION_TOP            (100)
	#define TOP_ANIMATION_RIGHT          (1110) //806+304
	#define TOP_ANIMATION_BOTTOM         (152)

	// for old animation
	#define BAR_LEFT            (890)
	#define BAR_TOP             (357)
	#define BAR_RIGHT           (1030)
	#define BAR_BOTTOM          (678)
	
#elif defined(WUXGA) || defined(CU_WUXGA)
	// wuxga 1200*1920

	// battery capacity rectangle
	#define CAPACITY_LEFT                (447) // battery capacity center
	#define CAPACITY_TOP                 (803)
	#define CAPACITY_RIGHT               (751)
	#define CAPACITY_BOTTOM              (1289)

	#define NUMBER_LEFT                  (494) // number
	#define NUMBER_TOP                   (481)
	#define NUMBER_RIGHT                 (578)//494+84
	#define NUMBER_BOTTOM                (602) //481+121

	#define PERCENT_LEFT                 (662) // percent number_left + 2*number_width
	#define PERCENT_TOP                  (481)
	#define PERCENT_RIGHT                (770) //662+108
	#define PERCENT_BOTTOM               (602) //481+121

	#define TOP_ANIMATION_LEFT           (447) // top animation
	#define TOP_ANIMATION_TOP            (100)
	#define TOP_ANIMATION_RIGHT          (751)
	#define TOP_ANIMATION_BOTTOM         (152)

	// for old animation
	#define BAR_LEFT            (529)
	#define BAR_TOP             (357)
	#define BAR_RIGHT           (672)
	#define BAR_BOTTOM          (680)
	
#elif defined(XGA)
	// xga 768*1024

	// battery capacity rectangle
	#define CAPACITY_LEFT                (316) // battery capacity center
	#define CAPACITY_TOP                 (442)
	#define CAPACITY_RIGHT               (451)
	#define CAPACITY_BOTTOM              (658)

	#define NUMBER_LEFT                  (338) // number
	#define NUMBER_TOP                   (300)
	#define NUMBER_RIGHT                 (376)
	#define NUMBER_BOTTOM                (354)

	#define PERCENT_LEFT                 (414) // percent number_left + 2*number_width
	#define PERCENT_TOP                  (300)
	#define PERCENT_RIGHT                (462)
	#define PERCENT_BOTTOM               (354)

	#define TOP_ANIMATION_LEFT           (316) // top animation
	#define TOP_ANIMATION_TOP            (100)
	#define TOP_ANIMATION_RIGHT          (451)
	#define TOP_ANIMATION_BOTTOM         (124)

	// for old animation
	#define BAR_LEFT            (334)
	#define BAR_TOP             (243)
	#define BAR_RIGHT           (434)
	#define BAR_BOTTOM          (463)
	
#elif defined(XGANL)
	// xganl 1024*768

	// battery capacity rectangle
	#define CAPACITY_LEFT                (444) // battery capacity center
	#define CAPACITY_TOP                 (314)	
	#define CAPACITY_RIGHT               (579)
	#define CAPACITY_BOTTOM              (530)

	#define NUMBER_LEFT                  (467) // number
	#define NUMBER_TOP                   (170)
	#define NUMBER_RIGHT                 (505)
	#define NUMBER_BOTTOM                (224)

	#define PERCENT_LEFT                 (543) // percent number_left + 2*number_width
	#define PERCENT_TOP                  (170)
	#define PERCENT_RIGHT                (591)
	#define PERCENT_BOTTOM               (224)

	#define TOP_ANIMATION_LEFT           (444) // top animation
	#define TOP_ANIMATION_TOP            (100)
	#define TOP_ANIMATION_RIGHT          (579)
	#define TOP_ANIMATION_BOTTOM         (124)

	// for old animation
	#define BAR_LEFT            (486)
	#define BAR_TOP             (292)
	#define BAR_RIGHT           (590)
	#define BAR_BOTTOM          (506) 

#elif defined(QXGA)
	// qxga 1536x2048
	
		// battery capacity rectangle
	#define CAPACITY_LEFT                (605) // battery capacity center
	#define CAPACITY_TOP                 (857)	
	#define CAPACITY_RIGHT               (929)
	#define CAPACITY_BOTTOM              (1375)

	#define NUMBER_LEFT                  (662) // number
	#define NUMBER_TOP                   (517)
	#define NUMBER_RIGHT                 (756)
	#define NUMBER_BOTTOM                (647)

	#define PERCENT_LEFT                 (850) // percent number_left + 2*number_width
	#define PERCENT_TOP                  (517)
	#define PERCENT_RIGHT                (968)
	#define PERCENT_BOTTOM               (647)

	#define TOP_ANIMATION_LEFT           (605) // top animation
	#define TOP_ANIMATION_TOP            (100)
	#define TOP_ANIMATION_RIGHT          (929)
	#define TOP_ANIMATION_BOTTOM         (155)

	// for old animation
	#define BAR_LEFT            (693)
	#define BAR_TOP             (381)
	#define BAR_RIGHT           (844)
	#define BAR_BOTTOM          (725) 

#else 

	// default wvga 480*800

	// battery capacity rectangle背景范围
	#define CAPACITY_LEFT                (0)//155//(172) // battery capacity center
	#define CAPACITY_TOP                 (0)//154//(330)
	#define CAPACITY_RIGHT               (400)//245//(307)
	#define CAPACITY_BOTTOM              (400)//299//(546)

	// first number rectangle数字
	#define NUMBER_LEFT                  (168)//(178) // number
	#define NUMBER_TOP                   (56)//(190)
	#define NUMBER_RIGHT                 (196)//(216)
	#define NUMBER_BOTTOM              (93)  //(244)

	// %  rectangle百分比
	#define PERCENT_LEFT                (224)// (254) // percent number_left + 2*number_width
	#define PERCENT_TOP                  (56)//(190)
	#define PERCENT_RIGHT                (252)//(302)
	#define PERCENT_BOTTOM              (93)// (244)

	// top animation part动画更新部分
	#define TOP_ANIMATION_LEFT           (0)//155//(172) // top animation
	#define TOP_ANIMATION_TOP            (100)
	#define TOP_ANIMATION_RIGHT          (400)//245//(307)
	#define TOP_ANIMATION_BOTTOM         (145)//116

	// for old animation
	#define BAR_LEFT            (176)	
	#define BAR_TOP             (128)
	#define BAR_RIGHT           (224)
	#define BAR_BOTTOM          (244)

#endif

/* The option of new charging animation */
#define ANIMATION_NEW

#endif // __CUST_DISPLAY_H__

mediatek\external\libshowlogo\show_animation_common.c这个文件是具体实现的文件,它有分为几个方法,下面以fill_animation_battery_ver_1()为例

/* Copyright Statement:
 *
 * This software/firmware and related documentation ("MediaTek Software") are
 * protected under relevant copyright laws. The information contained herein is
 * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
 * the prior written permission of MediaTek inc. and/or its licensors, any
 * reproduction, modification, use or disclosure of MediaTek Software, and
 * information contained herein, in whole or in part, shall be strictly
 * prohibited.
 *
 * MediaTek Inc. (C) 2010. All rights reserved.
 *
 * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
 * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
 * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
 * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
 * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
 * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
 * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
 * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
 * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
 * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
 * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
 * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
 * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
 * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
 * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
 * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
 * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
 * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
 *
 * The following software/firmware and/or related documentation ("MediaTek
 * Software") have been modified by MediaTek Inc. All revisions are subject to
 * any receiver's applicable license agreements with MediaTek Inc.
 */


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "show_animation_common.h"
#include "show_logo_log.h"
#include "fast_charging_common.h"
  
static int charging_low_index = 0;
static int charging_animation_index = 0;


#define CHECK_LOGO_BIN_OK  0
#define CHECK_LOGO_BIN_ERROR  -1


static unsigned short  number_pic_addr[(NUMBER_RIGHT - NUMBER_LEFT)*(NUMBER_BOTTOM - NUMBER_TOP)*2] = {0x0}; //addr
static unsigned short  line_pic_addr[(TOP_ANIMATION_RIGHT - TOP_ANIMATION_LEFT)*2] = {0x0};
static unsigned short  percent_pic_addr[(PERCENT_RIGHT - PERCENT_LEFT)*(PERCENT_BOTTOM - PERCENT_TOP)*2] = {0x0};
static unsigned short  top_animation_addr[(TOP_ANIMATION_RIGHT - TOP_ANIMATION_LEFT)*(TOP_ANIMATION_BOTTOM - TOP_ANIMATION_TOP)*2] = {0x0};



/*
 * Check logo.bin address if valid, and get logo related info
 *
 */ 
int check_logo_index_valid(unsigned int index, void * logo_addr, LOGO_PARA_T * logo_info)
{  
    unsigned int *pinfo = (unsigned int*)logo_addr;
    logo_info->logonum = pinfo[0];
    
    LOG_ANIM("[show_animation_common: %s %d]logonum =%d, index =%d\n", __FUNCTION__,__LINE__,logo_info->logonum, index);
    if (index >= logo_info->logonum)
    {
        LOG_ANIM("[show_animation_common: %s %d]unsupported logo, index =%d\n", __FUNCTION__,__LINE__, index);
        return CHECK_LOGO_BIN_ERROR;
    
    }   
   // LOG_ANIM("show_animation_common, pinfo[1]=%d,  pinfo[2+index]=%d, pinfo[3+index]=%d, pinfo[3+index] - pinfo[2+index]= %d, pinfo[1] - pinfo[2+index] =%d \n", 
   //            pinfo[1],pinfo[2+index],pinfo[3+index], pinfo[3+index] - pinfo[2+index],pinfo[1] - pinfo[2+index]); 
    
    if(index < logo_info->logonum - 1)
		logo_info->logolen = pinfo[3+index] - pinfo[2+index];
	else
		logo_info->logolen = pinfo[1] - pinfo[2+index];

    logo_info->inaddr = (unsigned int)logo_addr + pinfo[2+index];
    LOG_ANIM("show_animation_common, in_addr=0x%08x,  logolen=%d\n", 
                logo_info->inaddr,  logo_info->logolen);

    return CHECK_LOGO_BIN_OK;                
}


/*
 * Fill a screen size buffer with logo content 
 *
 */ 
void fill_animation_logo(unsigned int index, void *fill_addr, void * dec_logo_addr, void * logo_addr, LCM_SCREEN_T phical_screen)
{
    LOGO_PARA_T logo_info;
    int logo_width;
    int logo_height;
    if(check_logo_index_valid(index, logo_addr, &logo_info) != CHECK_LOGO_BIN_OK)
        return; 
              
    decompress_logo((void*)logo_info.inaddr, dec_logo_addr, logo_info.logolen, phical_screen.fb_size);
    //RECT_REGION_T rect = {0, 0, phical_screen.width, phical_screen.height};   
    logo_width =phical_screen.width;
    logo_height = phical_screen.height;
    if (phical_screen.rotation == 270 || phical_screen.rotation == 90) {
        logo_width =phical_screen.height;
        logo_height = phical_screen.width;
    }
    RECT_REGION_T rect = {0, 0, logo_width, logo_height};   
    
    fill_rect_with_content(fill_addr, rect, (unsigned short *)dec_logo_addr, phical_screen);

    
}

/*
 * Fill a rectangle size address with special color 
 *
 */ 
void fill_animation_prog_bar(RECT_REGION_T rect_bar,
                       unsigned int fgColor, 
                       unsigned int start_div, unsigned int occupied_div,
                       void *fill_addr, LCM_SCREEN_T phical_screen)
{
    unsigned int div_size  = (rect_bar.bottom - rect_bar.top) / (ANIM_V0_REGIONS);
    unsigned int draw_size = div_size - (ANIM_V0_SPACE_AFTER_REGION);
    
    unsigned int i;
    
    for (i = start_div; i < start_div + occupied_div; ++ i)
    {
        unsigned int draw_bottom = rect_bar.bottom - div_size * i - (ANIM_V0_SPACE_AFTER_REGION);
        unsigned int draw_top    = draw_bottom - draw_size;
        
        RECT_REGION_T rect = {rect_bar.left, draw_top, rect_bar.right, draw_bottom};

        fill_rect_with_color(fill_addr, rect, fgColor, phical_screen);

    }
}


/*
 * Fill a rectangle with logo content 
 *
 */ 
void fill_animation_dynamic(unsigned int index, RECT_REGION_T rect, void *fill_addr, void * dec_logo_addr, void * logo_addr, LCM_SCREEN_T phical_screen)
{
    LOGO_PARA_T logo_info;
    if(check_logo_index_valid(index, logo_addr, &logo_info) != CHECK_LOGO_BIN_OK)
        return; 
                    
    decompress_logo((void*)logo_info.inaddr, (void*)dec_logo_addr, logo_info.logolen, (rect.right-rect.left)*(rect.bottom-rect.top)*2);
    fill_rect_with_content(fill_addr, rect, (unsigned short *)dec_logo_addr, phical_screen);            
}


/*
 * Fill a rectangle  with number logo content 
 *
 * number_position: 0~1st number, 1~2nd number 
 */
void fill_animation_number(unsigned int index, unsigned int number_position, void *fill_addr,  void * logo_addr, LCM_SCREEN_T phical_screen)
{
    LOG_ANIM("[show_animation_common: %s %d]index= %d, number_position = %d\n",__FUNCTION__,__LINE__, index, number_position);

    LOGO_PARA_T logo_info;
    if(check_logo_index_valid(index, logo_addr, &logo_info) != CHECK_LOGO_BIN_OK)
        return;                 

    // draw default number rect,
    decompress_logo((void*)logo_info.inaddr, (void*)number_pic_addr, logo_info.logolen, number_pic_size);

    //static RECT_REGION_T number_location_rect = {NUMBER_LEFT,NUMBER_TOP,NUMBER_RIGHT,NUMBER_BOTTOM};    
    RECT_REGION_T battery_number_rect = {NUMBER_LEFT + (NUMBER_RIGHT - NUMBER_LEFT)*number_position,
                            NUMBER_TOP,
                            NUMBER_RIGHT + (NUMBER_RIGHT - NUMBER_LEFT)*number_position,
                            NUMBER_BOTTOM};   
                                                     
    fill_rect_with_content(fill_addr, battery_number_rect, (unsigned short *)number_pic_addr,phical_screen);            
}

/*
 * Fill a line with special color 
 *
 */ 
void fill_animation_line(unsigned int index, unsigned int capacity_grids, void *fill_addr,  void * logo_addr, LCM_SCREEN_T phical_screen)
{    
    LOGO_PARA_T logo_info;
    if(check_logo_index_valid(index, logo_addr, &logo_info) != CHECK_LOGO_BIN_OK)
        return; 
                
    decompress_logo((void*)logo_info.inaddr, (void*)line_pic_addr, logo_info.logolen, line_pic_size);

    RECT_REGION_T rect = {CAPACITY_LEFT, CAPACITY_TOP, CAPACITY_RIGHT, CAPACITY_BOTTOM}; 
    int i = capacity_grids;
    for(; i < CAPACITY_BOTTOM; i++)
    {      
        rect.top = i;
        rect.bottom = i+1;                                             
        fill_rect_with_content(fill_addr, rect, (unsigned short *)line_pic_addr, phical_screen);

    }
}



/*
 * Show charging animation version 0
 *
 */
void fill_animation_battery_ver_0(unsigned int capacity,  void *fill_addr, void * dec_logo_addr, void * logo_addr,
                       LCM_SCREEN_T phical_screen)
{

    unsigned int capacity_grids = 0;

    if (capacity > 100) capacity = 100;

    capacity_grids = (capacity * (ANIM_V0_REGIONS)) / 100;
    
    LOG_ANIM("[show_animation_common: %s %d]capacity =%d, capacity_grids = %d\n",__FUNCTION__,__LINE__, capacity, capacity_grids);
    

    //show_logo(1);
    fill_animation_logo(ANIM_V0_BACKGROUND_INDEX, fill_addr, dec_logo_addr, logo_addr,phical_screen);
    // Fill Occupied Color

    //RECT_REGION_T bar_rect = {BAR_LEFT, BAR_TOP, BAR_RIGHT, BAR_BOTTOM};    
    RECT_REGION_T rect_bar = {bar_rect.left + 1, bar_rect.top + 1, bar_rect.right, bar_rect.bottom};
    
//    RECT_REGION_T rect_bar = {BAR_LEFT + 1, BAR_TOP + 1,BAR_RIGHT, BAR_BOTTOM};
    
    fill_animation_prog_bar(rect_bar,
                       (unsigned int)(BAR_OCCUPIED_COLOR), 
                       0,  capacity_grids,
                       fill_addr, phical_screen);                              

    fill_animation_prog_bar(rect_bar,
                      (unsigned int)(BAR_EMPTY_COLOR),
                      capacity_grids, ANIM_V0_REGIONS - capacity_grids,
                      fill_addr, phical_screen); 

}

/*
 * Show charging animation version 1
 *
 */
void fill_animation_battery_ver_1(unsigned int capacity, void *fill_addr, void * dec_logo_addr, void * logo_addr, LCM_SCREEN_T phical_screen)
{
    LOG_ANIM("[show_animation_common: %s %d]capacity : %d\n",__FUNCTION__,__LINE__, capacity);
    
    if (capacity >= 100) {
        //show_logo(37); // battery 100
        fill_animation_logo(FULL_BATTERY_INDEX, fill_addr, dec_logo_addr, logo_addr,phical_screen);
     
    } else if (capacity < 10) {
        LOG_ANIM("[show_animation_common: %s %d]charging_low_index = %d\n",__FUNCTION__,__LINE__, charging_low_index);  
        charging_low_index ++ ;
                
        fill_animation_logo(LOW_BAT_ANIM_START_0 + charging_low_index, fill_addr, dec_logo_addr, logo_addr,phical_screen);
        fill_animation_number(NUMBER_PIC_START_0 + capacity, 1, fill_addr, logo_addr, phical_screen);
        fill_animation_dynamic(NUMBER_PIC_PERCENT, percent_location_rect, fill_addr, percent_pic_addr, logo_addr, phical_screen);
        
        if (charging_low_index >= 9) charging_low_index = 0;

    } else {

        unsigned int capacity_grids = 0;
        //static RECT_REGION_T battery_rect = {CAPACITY_LEFT,CAPACITY_TOP,CAPACITY_RIGHT,CAPACITY_BOTTOM};
        capacity_grids = CAPACITY_BOTTOM /*- (CAPACITY_BOTTOM - CAPACITY_TOP) * (capacity - 10) / 90*/;
        LOG_ANIM("[show_animation_common: %s %d]capacity_grids : %d,charging_animation_index = %d\n",__FUNCTION__,__LINE__, capacity_grids,charging_animation_index);   

        //background 
        fill_animation_logo(ANIM_V1_BACKGROUND_INDEX, fill_addr, dec_logo_addr, logo_addr,phical_screen);
        
        //fill_animation_line(ANIM_LINE_INDEX, capacity_grids, fill_addr,  logo_addr, phical_screen);
        //fill_animation_number(NUMBER_PIC_START_0 + (capacity/10), 0, fill_addr, logo_addr, phical_screen);
        //fill_animation_number(NUMBER_PIC_START_0 + (capacity%10), 1, fill_addr, logo_addr, phical_screen);
        //fill_animation_dynamic(NUMBER_PIC_PERCENT, percent_location_rect, fill_addr, dec_logo_addr, logo_addr, phical_screen);                
        
        
        // if (capacity <= 90)
         //{//动画范围
            RECT_REGION_T top_animation_rect = {TOP_ANIMATION_LEFT, /*capacity_grids - (TOP_ANIMATION_BOTTOM - TOP_ANIMATION_TOP)*/0, TOP_ANIMATION_RIGHT, capacity_grids};
            //top_animation_rect.bottom = capacity_grids;
            //top_animation_rect.top = capacity_grids - top_animation_height;
            charging_animation_index++;        
            //show_animation_dynamic(15 + charging_animation_index, top_animation_rect, top_animation_addr);
			//动画
		   fill_animation_dynamic(BAT_ANIM_START_0 + charging_animation_index, top_animation_rect, fill_addr, dec_logo_addr, logo_addr, phical_screen);
			//十位数字
			fill_animation_number(NUMBER_PIC_START_0 + (capacity/10), 0, fill_addr, logo_addr, phical_screen);
			//个位数字
			fill_animation_number(NUMBER_PIC_START_0 + (capacity%10), 1, fill_addr, logo_addr, phical_screen);
			//%
			fill_animation_dynamic(NUMBER_PIC_PERCENT, percent_location_rect, fill_addr, dec_logo_addr, logo_addr, phical_screen); 
            if (charging_animation_index >= 9) charging_animation_index = 0;
         //}
    }

}

/*
 * Show charging animation version 2:wireless ui
 * total 29 logo:from 39 ~ 68 
 * less(0<10): 50-53 , low(<30):54-57 ,middle(<60):58-61 , high():62-75 , o:66, full:67,num (0-9):39-48, %:49
 *
 */

 void fill_animation_battery_ver_2(unsigned int capacity, void *fill_addr, void * dec_logo_addr, void * logo_addr, LCM_SCREEN_T phical_screen)
{
    LOG_ANIM("[show_animation_common: %s %d]capacity : %d\n",__FUNCTION__,__LINE__, capacity);
//    RECT_REGION_T wireless_bgd_rect = {0, 0, phical_screen.width, phical_screen.height};
    
    charging_low_index >= 3? charging_low_index = 0:charging_low_index++;
    LOG_ANIM("[show_animation_common: %s %d]charging_low_index = %d\n",__FUNCTION__,__LINE__, charging_low_index); 
    
    if (capacity >= 100) {
         // battery 100
        fill_animation_logo(V2_BAT_100_INDEX, fill_addr, dec_logo_addr, logo_addr,phical_screen);
    } else if (capacity <= 0) {
        fill_animation_logo(V2_BAT_0_INDEX, fill_addr, dec_logo_addr, logo_addr,phical_screen);
    } else {
        int bg_index = V2_BAT_0_10_START_INDEX; //capacity > 0 && capacity < 10
        if (capacity >= 10 && capacity < 40) {
            bg_index = V2_BAT_10_40_START_INDEX;               
        } else if (capacity >= 40 && capacity < 80) {            
            bg_index = V2_BAT_40_80_START_INDEX;
        } else if (capacity >= 80 && capacity < 100) {      
            bg_index = V2_BAT_80_100_START_NDEX;
        }        
        fill_animation_logo(bg_index + charging_low_index, fill_addr, dec_logo_addr, logo_addr,phical_screen);    
        RECT_REGION_T tmp_rect = {(int)phical_screen.width * 4/10, 
                        (int) phical_screen.height * 1/6,
                        (int)phical_screen.width* 5/10,
                        (int)phical_screen.height*16/60};  
        unsigned short tmp_num_addr[(int)phical_screen.width * phical_screen.height/100]; //addr
                                     
        if (capacity >= 10) {
            LOG_ANIM("[show_animation_common: %s %d]tmp_rect left = %d, right = %d,top = %d,bottom = %d,\n",__FUNCTION__,__LINE__, 
                        tmp_rect.left,tmp_rect.right,tmp_rect.top,tmp_rect.bottom);                         
            fill_animation_dynamic(V2_NUM_START_0_INDEX + (capacity/10), tmp_rect, fill_addr, tmp_num_addr, logo_addr, phical_screen);
            tmp_rect.left += (int)phical_screen.width /10;
            tmp_rect.right += (int)phical_screen.width /10;
        }
        
        LOG_ANIM("[show_animation_common: %s %d]tmp_rect left = %d, right = %d,top = %d,bottom = %d,\n",__FUNCTION__,__LINE__, 
                tmp_rect.left,tmp_rect.right,tmp_rect.top,tmp_rect.bottom);                  
        fill_animation_dynamic(V2_NUM_START_0_INDEX + (capacity%10), tmp_rect, fill_addr, tmp_num_addr, logo_addr, phical_screen);                   
        
        tmp_rect.left += (int)phical_screen.width /10;
        tmp_rect.right += (int)phical_screen.width /10;

        LOG_ANIM("[show_animation_common: %s %d]tmp_rect left = %d, right = %d,top = %d,bottom = %d,\n",__FUNCTION__,__LINE__, 
                        tmp_rect.left,tmp_rect.right,tmp_rect.top,tmp_rect.bottom);                                         
        fill_animation_dynamic(V2_NUM_PERCENT_INDEX, tmp_rect, fill_addr, tmp_num_addr, logo_addr, phical_screen);  
        
    }
}

/*
 * Pump charging aniamtion 
 * index 39: 100%, 40~45 : animation logo, 46~55: number logo, 56: % logo
 *
 */
void fill_animation_battery_fast_charging(unsigned int capacity, void *fill_addr, void * dec_logo_addr, void * logo_addr, LCM_SCREEN_T phical_screen)
{
    int display_width = phical_screen.width;
    int display_height = phical_screen.height;
    int curr_left = 0;
    int num_width = 0;
    int num_height = 0;
    int top_margin_height = 0;
    if (0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "90", 2) ||
        0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "270", 3)) {
        display_width = phical_screen.height;
        display_height = phical_screen.width;
    }
    num_width = LOGO_NUM_WIDTH(display_width);
    num_height = LOGO_NUM_HEIGHT(display_height);
    top_margin_height = LOGO_TOP_MARGIN(display_height);
    LOG_ANIM("[show_animation_common: %s %d]capacity : %d, num_width:%d, num_height:%d, top_margin_height:%d\n", __FUNCTION__,__LINE__, capacity, num_width, num_height, top_margin_height);

    charging_low_index >= 5? charging_low_index = 0:charging_low_index++;
    LOG_ANIM("[show_animation_common: %s %d]charging_low_index = %d\n",__FUNCTION__,__LINE__, charging_low_index);

    LOG_ANIM("[show_animation_common: %s %d]capacity : %d\n",__FUNCTION__,__LINE__, capacity);
    if (capacity <= 0) {
        return;
    } else if (capacity >= 100) {
        fill_animation_logo(FAST_CHARGING_BAT_100_INDEX, fill_addr, dec_logo_addr, logo_addr, phical_screen);
    } else {
        fill_animation_logo(FAST_CHARGING_BAT_START_0_INDEX + charging_low_index, fill_addr, dec_logo_addr, logo_addr, phical_screen);

        curr_left = (display_width - num_width * 2) >> 1;
        unsigned short tmp_num_addr[(int)phical_screen.width * phical_screen.height/50];
		
        if (capacity > 10) {
            curr_left = (display_width - num_width * 3) >> 1;
            RECT_REGION_T tmp_rect_1 = {curr_left, top_margin_height, curr_left + num_width, top_margin_height + num_height};
            LOG_ANIM("[show_animation_common: %s %d]capacity = %d, show 1nd num : %d\n",__FUNCTION__,__LINE__, capacity, capacity/10);
            fill_animation_dynamic(FAST_CHARGING_NUM_START_0_INDEX + (capacity/10), tmp_rect_1, fill_addr, tmp_num_addr, logo_addr, phical_screen);
            curr_left += num_width;
        }
        RECT_REGION_T tmp_rect_2 = {curr_left, top_margin_height, curr_left + num_width, top_margin_height + num_height};
        LOG_ANIM("[show_animation_common: %s %d]capacity = %d, show 2st num : %d\n",__FUNCTION__,__LINE__, capacity, capacity%10);
        fill_animation_dynamic(FAST_CHARGING_NUM_START_0_INDEX + (capacity%10), tmp_rect_2, fill_addr, tmp_num_addr, logo_addr, phical_screen);

        curr_left += num_width;
        RECT_REGION_T tmp_rect_3 = {curr_left, top_margin_height, curr_left + num_width, top_margin_height + num_height};
        LOG_ANIM("[show_animation_common: %s %d]show percent \n",__FUNCTION__,__LINE__);
        fill_animation_dynamic(FAST_CHARGING_NUM_PERCENT_INDEX, tmp_rect_3, fill_addr, tmp_num_addr, logo_addr, phical_screen);
    }
	
}

/*
 * Show charging animation by version
 *
 */
void fill_animation_battery_by_ver(unsigned int capacity,void *fill_addr, void * dec_logo_addr, void * logo_addr,
                        LCM_SCREEN_T phical_screen, int version)
{
    LOG_ANIM("[show_animation_common: %s %d]version : %d\n",__FUNCTION__,__LINE__, version);
    switch (version)
    {
        case 0:
            fill_animation_battery_ver_0(capacity, fill_addr, dec_logo_addr, logo_addr, phical_screen);
            
            break;
        case 1:
            fill_animation_battery_ver_1(capacity, fill_addr, dec_logo_addr, logo_addr, phical_screen);
            
            break;
        case WIRELESS_CHARGING_ANIM_VER:
            fill_animation_battery_ver_2(capacity, fill_addr, dec_logo_addr, logo_addr, phical_screen);
            
            break;            
        default:
            fill_animation_battery_ver_0(capacity, fill_addr, dec_logo_addr, logo_addr, phical_screen);
            
            break;   
    }                     
}                       
现在知道在哪里具体实现了,那在哪里调用呢?下面是具体文件及方法
mediatek\external\ipod\bootlogo.cpp

 show_battery_capacity(capacity);


2019-07-12 17:28:03 yangfan1571397878 阅读数 14

问题一:关机充电动画客制化以及错位调整

1,关机充电logo图片都在alps/vendor/mediatek/proprietary/bootable/bootloader/lk/dev/logo目录下,在这里可以看到多个包含不同size图片的子目录,具体使用哪个子目录下的图片由${BOOT_LOGO}决定。

    note:如果客户想要使用客制化的背景图片,可以直接替换子目录下对应编号的图片

2,需要根据实际情况修改alps/device/mediatek/${PROJECT}/ProjectConfig.mk中配置,修改屏幕大小等,例如:    
    LCM_WIDTH = 720      
    LCM_HEIGHT = 1280   
    BOOT_LOGO = hd720

3,绘制代码流程:

(1)关机充电 service kpoc_charger里面创建了一个draw_thread_routine()线程用于绘制Logo。

(2)draw_thread_routine()线程通过draw_with_interval() -> bootlogo_show_charging()最终调用libshowlogo里面的show_battery_capacity()函数每隔1秒绘制一次图片(间隔时间可客制化)。

4,show_battery_capacity中提供四种不同的动画绘制方案,客户可以根据自己的需要选择动画方案:

(1)old version动画效果

       四方格增长式,动画效果如下图所示。

       对应填充函数fill_animation_battery_old()。

       note:如果要使能这种动画方案,需注释掉ANIMATION_NEW 

       

(2)new version动画效果

      填充区height和电量对应固定,顶部曲线浮动型,动画效果如下;

      对应填充函数 fill_animation_battery_new()。

        

(3)快充动画效果

       循环替换增长式,动画效果如下;

       对应函数 fill_animation_battery_fast_charging()。

       note:如若要使能快充动画效果,需define快充相关宏,且保证快充TA连接;

       快充相关宏:MTK_PUMP_EXPRESS_PLUS_SUPPORT/ MTK_PUMP_EXPRESS_PLUS_20_SUPPORT/ MTK_PUMP_EXPRESS_PLUS_30_SUPPORT

  需修改makefile文件:
  /device/mediatek/${PROJECT_NAME}/ProjectConfig.mk 
  /vendor/mediatek/proprietary/external/libshowlogo/Android.mk
  /vendor/mediatek/proprietary/bootable/bootloader/lk/project/project_name.mk
  /vendor/mediatek/proprietary/bootable/bootloader/lk/dev/logo/rules.mk

(4)无线充电动画效果

  需使能wireless charging 相关宏;

二、充电动画图片错位

      出现图片错位的情况,多数都是因为图形绘制点和屏幕尺寸不匹配导致的.

      客户可以根据自己的实际情况,调整cust_display.h中位置参数:

      AndroidM后:/vendor/mediatek/proprietary/external/libshowlogo/cust_display.h

      AndroidM前: /vendor/mediatek/proprietary/bootable/bootloader/lk/target/${PROJECT}/include/target/cust_display.h

1 ,使用old version动画方案的调整如下设置,

   #define BAR_LEFT   (215)
   #define BAR_TOP   (156)
   #define BAR_RIGHT   (265)
   #define BAR_BOTTOM   (278)
   可以用windows的画图软件打开第1点里提到的图片,根据电池边框的像素来调整。

   这里坐标的参考原点是左上角,背景图片的左上角是(0,0),这四个值都是相对于左上角的坐标来确定的,因此RIGHT > LEFT,BOTTOM > TOP
   小技巧:1)打开画图软件,选择 查看->缩放->自定义,将图片放到到800%
               2)选择 查看->缩放->显示网格
               这样就可以看到一个一个的像素
2,使用new version动画方案调整如下设置:

    #define CAPACITY_LEFT (278) 
    #define CAPACITY_TOP (556)
    #define CAPACITY_RIGHT (441)
    #define CAPACITY_BOTTOM (817)

调试技巧:

mmm vendor/mediatek/proprietary/external/libshowlogo/libshowlogoTest/  

如果无法编译,可能是libshowlogoTest里面的Android.mk被注释掉了,打开即可

编完之后执行

adb shell libshowlogotest charging sf new

这样就可以看到自己的改动,不用每次remake

问题二:

关机充电动画,将普通充电修改为高压(快速)充电

如果直接替换图片是不行的,动画流程不一样,可以在调用正常充电动画时,修改为高压充电

vendor\mediatek\proprietary\external\libshowlogo目录下charging_animation.cpp

showlogo

 

 

 

2016-05-06 09:13:15 u011467537 阅读数 3076
android开机动画制作与播放原理简介
   谁都想拥有一个华丽漂亮的开机动画,这让人心情舒畅,android是怎么来实现的?怎么制作一个自己的开机动画?这里揭开android开机动画的神秘面纱。

 1、制作开关机动画

1.1 开机动画的位置

   system/media/bootanimation.zip,要修改开机动画就是修改bootanimation这个压缩文件。如果不存在该压缩包,使用原生自带的资源,其路径在system/framework/framework-res.apk/assets/images(Android-logo-mask.png,android-logo-shine.png),但是比较难看,比较常见的就是“android”。所以要定制自己的开关机动画一般都是在system/media/目录下放置bootanimation.zip和shutanimation.zip.这里以开机动画为例,关机动画和开机动画其原理一样。

1.2 bootanimation.zip文件结构

  bootanimation里面主要包含一个desc.txt以及N个文件夹。而文件夹里面放着的就是开机动画的图片资源。decs.txt的作用就是指导系统如何去执行开机动画。

   desc.txt编写规范,例如开机动画需要用到2个文件夹,分别是folder1和folder2,开机的时候,先把folder1里面的图片都播放一遍,然后再循环播放folder2里面的文件,直到进入系统,decs.txt文档的内容如下:

  1. 320 480 12  
  2. p 1 0 folder1  
  3. p 0 0 folder2  
320 480是代表屏幕的分辨率,12表示12帧每秒,简单地说12代表一秒钟播放12张图片;
p 1 0 part1:p就是play。1是播放一次,0是无限次。0代表阶段间隔帧数为0folder1就是说,这条指令是针对folder1这个文件夹的;
p 0 0 part2:第一个0这里是代表循环播放,第二个0和上面第二条指令一样。folder2就是第二个文件夹。
总结规则如下:
第一条指令:[屏幕的分辨率] [播放频率]
第二条指令:[p] [播放次数] [间隔帧数] [文件夹]
第N条指令: 同上

1.3 压缩包

   把需要用到的folder文件夹跟decs.txt打包成zip格式,必须是zip,不能是rar,且打包的时压缩方式选择“存储”模式。然后改名成为bootanimation.zip,最后将制作好的zip包push到/system/media目录下。

注意:bootanimation不能太大,一般最好不要超过3M。

1.4 查看动画

 在终端中输入命令:

     adb shell---> cd /system/bin--->bootanimation 或者bootanimation shut

 这样不用重启即可查看定制的动画,方便。

1.5 硬性条件

   手机必须有root权限,否则我们制作好的图片资源没办法push到/system/media目录,另外执行bootanimaiton也有可能没有权限,所以这里要定制自己的手机必须有root权限,当然了至于使用什么样的方式大家可以根据自己的爱好,各显神通。

 2、播放原理

   通过上面的准备开机资源已经制作好了,那android是怎么来实现播放的。首先对于开关机动画的播放,android专门使用了一个 native service来实现播放(/system/bin/bootanimation),包括开机铃声的实现也是用该service来实现的。

2.1 bootanimation的启动

    Android系统在init.rc中定义了很多Service,具体定义格式可以参考《Android Platform Developer’s Guide》中的“Android Init Language”。Init.rc中定义的Service将会被Init进程创建,其中已经定义的服务就包含bootanimation。

   每一项服务必须在/init.rc中定义.Android系统启动时,init守护进程将解析init.rc和启动属性服务,属性“ ctl.start ”和“ctl.stop ”是用来启动和停止服务的。一旦收到设置“ ctrl.start ”属性的请求,属性服务将使用该属性值作为服务名找到该服务,启动该服务。这项服务的启动结果将会放入“ init.svc.<服务名>“属性中 。

  1. service bootanim /system/bin/bootanimation  
  2.     user graphics  
  3.     group graphics system audio qcom_oncrpc  
  4.     disabled  
  5.     oneshot  

定义了一个bootanim的服务,对应执行/system/bin/bootanimation

disabled 表示init进程创建只是创建它,但不立刻执行;

oneshot 表示该服务只执行一次;

2.2 开机动画调用

通过上面可知,bootanimation的调用同故宫clt.start 和ctl.stop来实现的,当我们开机启动时,系统内核起来后,启动android,这时就会启动开机动画具体是在

SurfaceFlinger.cpp的readyToRun方法中调用,为什么会在这调用,请回顾一下开机流程。

  1. status_t SurfaceFlinger::readyToRun()   
  2. {  
  3.     // start boot animation service  
  4.     property_set("ctl.start", "bootanim");//  
  5.      
  6. }  
当android启动完成后,关闭掉开机动画
  1. void SurfaceFlinger::bootFinished()   
  2. {  
  3.     //stop bootanim service  
  4.     property_set("ctl.stop", "bootanim");  
  5. }  

2.3 bootanimation 源码分析

代码所在位置:/frameworks/base/cmds/bootanimation,其主要包含以下三个文件
  1. BootAnimation_main.cpp  
  2. BootAnimation.h  
  3. bootAnimation.cpp  

2.3.1 Bootanimation_main.cpp

该文件是主入口文件;

  1. int main(int argc, char** argv)  
  2. {  
  3. #if defined(HAVE_PTHREADS)  
  4.     setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_DISPLAY);  
  5. #endif  
  6.     char value[PROPERTY_VALUE_MAX];  
  7.     property_get("debug.sf.nobootanimation", value, "0");  
  8.     int noBootAnimation = atoi(value);  
  9.     LOGI_IF(noBootAnimation,  "boot animation disabled");  
  10.     if (!noBootAnimation) {  
  11.         sp<ProcessState> proc(ProcessState::self());  
  12.         ProcessState::self()->startThreadPool();  
  13.         // create the boot animation object  
  14.         bool setBoot = true;  
  15.         bool setRotated = false;  
  16.         bool sePaly = true;  
  17.         if(argc > 1){  
  18.            if(!strcmp(argv[1],"shut"))  
  19.             setBoot = false;  
  20.         }  
  21.         if(argc > 2){  
  22.             if(!strcmp(argv[2],"nomp3"))  
  23.             sePaly = false;  
  24.         }  
  25.           
  26.         if(argc > 3){  
  27.             if(!strcmp(argv[3],"rotate"))  
  28.             setRotated = true;  
  29.         }  
  30.         char volume[PROPERTY_VALUE_MAX];  
  31.         property_get("persist.sys.mute.state", volume, "-1");  
  32.         int nVolume = -1;  
  33.         nVolume = atoi(volume);  
  34.         if(nVolume == 0 || nVolume == 1 ){  
  35.             sePaly = false;  
  36.         }  
  37.         sp<BootAnimation> boot = new BootAnimation(setBoot,sePaly,setRotated);  
  38.   
  39.         IPCThreadState::self()->joinThreadPool();  
  40.   
  41.     }  
  42.     return 0;  
  43. }  
   其主要的功能是根据传进来的参数决定是是要播放开机还是关机动画/铃音,并且启动BootAnimation;

2.3.2 BootAnimation.cpp

   BootAnimation.cpp集成自Thread,在创建时会调用readyToRun()->threadLoop()。

  1. status_tBootAnimation::readyToRun() {  
  2. ……………省略………………………  
  3. mAndroidAnimation = false;  
  4.       if(bBootOrShutDown){  
  5.    status_t err = mZip.open("/data/local/bootanimation.zip");  
  6.    if (err != NO_ERROR) {  
  7.        err =mZip.open("/system/media/bootanimation.zip");  
  8.        if (err != NO_ERROR) {  
  9.            mAndroidAnimation = true;  
  10.        }  
  11.     }  
  12.       }else {  
  13.           if(!bShutRotate){  
  14.             status_terr = mZip.open("/data/local/shutanimation.zip");  
  15.          if (err != NO_ERROR) {  
  16.             err =mZip.open("/system/media/shutanimation.zip");  
  17.             if (err != NO_ERROR) {  
  18.                 mAndroidAnimation = true;  
  19.             }  
  20.             }  
  21.           }  
  22.       }  
  23. return NO_ERROR;  
  24. }  
readyToRun() 方法判断/system/media/bootanimation.zip(shutanimaion.zip)是否存在,如果存在,则将 mAndroidAnimation 设置false,这个变量决定threadLoop中调用android()还是movie()来具体实现动画的播放。

  1. boolBootAnimation::threadLoop()  
  2. {  
  3.          ........省略........  
  4.       if(!bBootOrShutDown){  
  5.             pSoundFileName="/data/local/shutaudio.mp3";  
  6.             pBackupSoundFileName="/system/media/shutaudio.mp3";  
  7.       } else {  
  8.             pSoundFileName="/data/local/bootaudio.mp3";  
  9.             pBackupSoundFileName="/system/media/bootaudio.mp3";  
  10.       }  
  11.            if (mAndroidAnimation)  
  12.           r = android();  
  13.             } else {  
  14.           r = movie();  
  15.            }  
  16. }  

    threadLoop()方法根据 mAndroidAnimation 变量调用android()/movie(). 如果system/media/shutanimation.zip/bootanimation.zip存在的话,调用movie(),该接口会解析zip文件中的desc.txt文件,根据txt文件中的配置来播放动画。否则就调用android来播放原生自带的资源。

3、总结

      对于图片资源时如何绘制的,我想这不是本文的重点,有兴趣的同学可以继续深究
2012-12-01 09:41:16 iteye_1411 阅读数 94
修改mediatek/custom/$prj/uboot/inc/cust_display.h中的
#define BAR_LEFT (215)
#define BAR_TOP (156)
#define BAR_RIGHT (265)
#define BAR_BOTTOM (278)
这几个值
2017-03-31 09:10:43 baiyuanwei 阅读数 2344

1、重点内容先试用“完美ROOT”软件root手机
2、安装“RE文件管理器”到手机,可以安装复制开机动画和关机动画到相应的文件位置
3、具体步骤可以查看博客http://blog.csdn.net/cyj5366/article/details/9923871

没有更多推荐了,返回首页