[Feature][ZXW-65]merged P49 base code

Change-Id: I3e09c0c3d47483bc645f02310380ecb7fc6f4041
diff --git a/ap/lib/libupi_ab/inc/upi_fotaflag_partition.h b/ap/lib/libupi_ab/inc/upi_fotaflag_partition.h
index f172b50..97c46c7 100755
--- a/ap/lib/libupi_ab/inc/upi_fotaflag_partition.h
+++ b/ap/lib/libupi_ab/inc/upi_fotaflag_partition.h
@@ -34,10 +34,10 @@
 /* Êý¾ÝÀàÐÍ */
 typedef enum
 {
-	SYSTEM_FLAG_FOTA_MAIN = 0,
-	SYSTEM_FLAG_FOTA_BACKUP,
+    SYSTEM_FLAG_FOTA_MAIN = 0,
+    SYSTEM_FLAG_FOTA_BACKUP,
 } E_SYSTEM_FLAG_DATA_TYPE;
-	
+
 
 
 /*******************************************************************************
@@ -54,48 +54,48 @@
 #define  DUALSYSTEM_STATUS_SUCCESSFUL			(0x5CCF)	/* Äܳɹ¦Æô¶¯ */
 #define  DUALSYSTEM_STATUS_UNBOOTABLE			(0xBABE)	/* ²»¿ÉÆô¶¯ */
 
-typedef struct 
+typedef struct
 {
-	int status;     /* bootable/successful/unbootable */
-	int try_cnt;
+    int status;     /* bootable/successful/unbootable */
+    int try_cnt;
 } T_DualSystem_Status;
 
 typedef enum
 {
-	DUAL_SYSTEM  = 0x875A,   /* µÚÒ»¸öϵͳ */
-	DUAL_SYSTEM2 = 0x986B,   /* µÚ¶þ¸öϵͳ */
+    DUAL_SYSTEM  = 0x875A,   /* µÚÒ»¸öϵͳ */
+    DUAL_SYSTEM2 = 0x986B,   /* µÚ¶þ¸öϵͳ */
 } T_BOOT_TARGET;
 
 /* ˫ϵͳÀàÐÍ */
 typedef enum
 {
-	DUALSYSTEM_RECOVERY = 0x7575,          /* normal-recovery˫ϵͳ */
-	DUALSYSTEM_AA       = 0xAAAA,          /* AA˫ϵͳ */
-	DUALSYSTEM_AB       = 0xABAB           /* AB˫ϵͳ */
+    DUALSYSTEM_RECOVERY = 0x7575,          /* normal-recovery˫ϵͳ */
+    DUALSYSTEM_AA       = 0xAAAA,          /* AA˫ϵͳ */
+    DUALSYSTEM_AB       = 0xABAB           /* AB˫ϵͳ */
 } T_BOOT_DUALSYSTEM_TYPE;
 
-typedef struct 
+typedef struct
 {
-	unsigned int			magic;          /* Êý¾ÝÓÐЧÐÔħÊõ×Ö */  
-	T_BOOT_TARGET			boot_to;        /* µ±Ç°Æô¶¯ÏµÍ³±êÖ¾*/
-	unsigned int			fota_status;    /* fota״̬ */    
-	T_DualSystem_Status		system;         /* µÚÒ»¸öϵͳ״̬ */
-	T_DualSystem_Status		system2;        /* µÚ¶þ¸öϵͳ״̬ */
+    unsigned int			magic;          /* Êý¾ÝÓÐЧÐÔħÊõ×Ö */
+    T_BOOT_TARGET			boot_to;        /* µ±Ç°Æô¶¯ÏµÍ³±êÖ¾*/
+    unsigned int			fota_status;    /* fota״̬ */
+    T_DualSystem_Status		system;         /* µÚÒ»¸öϵͳ״̬ */
+    T_DualSystem_Status		system2;        /* µÚ¶þ¸öϵͳ״̬ */
 } T_BOOT_FOTA_FLAG;
 
-typedef struct 
+typedef struct
 {
-	unsigned int					magic;           /* Êý¾ÝÓÐЧÐÔħÊõ×Ö */
-	T_BOOT_DUALSYSTEM_TYPE			dualsys_type;   /* ˫ϵͳÀàÐÍ */    
-	char system_boot_env[128];
-	char system2_boot_env[128];
+    unsigned int					magic;           /* Êý¾ÝÓÐЧÐÔħÊõ×Ö */
+    T_BOOT_DUALSYSTEM_TYPE			dualsys_type;   /* ˫ϵͳÀàÐÍ */
+    char system_boot_env[128];
+    char system2_boot_env[128];
 } T_BOOT_ENV;
 
 
-typedef struct 
+typedef struct
 {
-	T_BOOT_FOTA_FLAG 	boot_flag;
-	T_BOOT_ENV 			boot_env;
+    T_BOOT_FOTA_FLAG 	boot_flag;
+    T_BOOT_ENV 			boot_env;
 } T_FOTA_FLAG_INFO;
 
 
diff --git a/ap/lib/libupi_ab/inc/upi_hash.h b/ap/lib/libupi_ab/inc/upi_hash.h
index 9d8bc29..f511e53 100755
--- a/ap/lib/libupi_ab/inc/upi_hash.h
+++ b/ap/lib/libupi_ab/inc/upi_hash.h
@@ -36,9 +36,10 @@
  *                             Type definitions                                *
  ******************************************************************************/
 
-typedef enum E_HASH_TYPE{
-	HASH_SHA512 = 0,
-	HASH_SHA526 = 1
+typedef enum E_HASH_TYPE
+{
+    HASH_SHA512 = 0,
+    HASH_SHA526 = 1
 } hash_type_e;
 
 /*******************************************************************************
@@ -51,9 +52,11 @@
  ******************************************************************************/
 int check_image_hash(partition_mtd_info_t *mtd_info, int len, char * digest);
 
-int get_hash_from_fd(int hash_type, int fd, unsigned int offset, unsigned int len, unsigned int read_size_per_time, unsigned char* digest);
+int get_hash_from_fd(int hash_type, int fd, unsigned int offset, unsigned int len, unsigned int read_size_per_time,
+                     unsigned char* digest);
 
-int get_hash_from_file_path_segment(int hash_type, const char* file_path, unsigned int offset, unsigned int len, unsigned char* digest);
+int get_hash_from_file_path_segment(int hash_type, const char* file_path, unsigned int offset, unsigned int len,
+                                    unsigned char* digest);
 
 
 /*******************************************************************************
diff --git a/ap/lib/libupi_ab/inc/upi_img_interface.h b/ap/lib/libupi_ab/inc/upi_img_interface.h
index 2a0ea67..895dde1 100755
--- a/ap/lib/libupi_ab/inc/upi_img_interface.h
+++ b/ap/lib/libupi_ab/inc/upi_img_interface.h
@@ -3,15 +3,16 @@
 
 
 
-typedef struct {
-	unsigned int mtd_totalsize;				// mtd device total size
-	unsigned int mtd_pageperblock;			// mtd device page per block
-	unsigned int mtd_blocksize;				// mtd device block size
-	unsigned int mtd_pagesize;				// mtd device page size
-	unsigned int mtd_oobsize;				// mtd device oob size
-//	char mtd_path[256];			// mtd path
-	int parti_file_desc;					// partition update file description
-}partition_mtd_info_t;
+typedef struct
+{
+    unsigned int mtd_totalsize;				// mtd device total size
+    unsigned int mtd_pageperblock;			// mtd device page per block
+    unsigned int mtd_blocksize;				// mtd device block size
+    unsigned int mtd_pagesize;				// mtd device page size
+    unsigned int mtd_oobsize;				// mtd device oob size
+    //	char mtd_path[256];			// mtd path
+    int parti_file_desc;					// partition update file description
+} partition_mtd_info_t;
 
 #if 0
 int ZXIC_GetBlockSize(partition_mtd_info_t *mtd_info, int *block_size);
@@ -26,17 +27,17 @@
 
 int ZXIC_ReadImageSeg(
     partition_mtd_info_t *mtd_info,
-    unsigned char *buffer,			
-    int start_address,		
-    int stop_address,		
-    int  index, 
+    unsigned char *buffer,
+    int start_address,
+    int stop_address,
+    int  index,
     int size) ;
 
 
 int ZXIC_WriteBlockSeg(
     partition_mtd_info_t *mtd_info,
     int start_address,
-    int stop_address,		
+    int stop_address,
     int index,
     unsigned char *buffer,
     int size);
diff --git a/ap/lib/libupi_ab/inc/upi_mtd.h b/ap/lib/libupi_ab/inc/upi_mtd.h
index a856ffb..95d2b4a 100755
--- a/ap/lib/libupi_ab/inc/upi_mtd.h
+++ b/ap/lib/libupi_ab/inc/upi_mtd.h
@@ -25,11 +25,12 @@
  *                             Type definitions                                *
  ******************************************************************************/
 
-typedef enum {
-	DEVICE_MTD = 0,
-	DEVICE_ZFTL = 1,
-	DEVICE_MTD_BLOCK,
-	DEVICE_UNKNOWN,
+typedef enum
+{
+    DEVICE_MTD = 0,
+    DEVICE_ZFTL = 1,
+    DEVICE_MTD_BLOCK,
+    DEVICE_UNKNOWN,
 } device_type_t;
 
 /*******************************************************************************
diff --git a/ap/lib/libupi_ab/inc/upi_public.h b/ap/lib/libupi_ab/inc/upi_public.h
index 0ade3d3..a0bbb09 100755
--- a/ap/lib/libupi_ab/inc/upi_public.h
+++ b/ap/lib/libupi_ab/inc/upi_public.h
@@ -58,7 +58,7 @@
 #define EXTRA_NAME_LEN							(32)
 
 
- 
+
 #define FOTA_AB_UPGRADE_STATUS           "fota_ab_upgrade_status"
 
 #define FOTA_AB_UPGRADE_TOTAL_SIZE       "fota_ab_upgrade_total_size"
@@ -93,24 +93,26 @@
  *                             Type definitions                                *
  ******************************************************************************/
 
-typedef enum {
-	HASH_TYPE_SHA_512 = 0,
-	HASH_TYPE_SHA_256
+typedef enum
+{
+    HASH_TYPE_SHA_512 = 0,
+    HASH_TYPE_SHA_256
 } Hash_type_s;
 
 
 /**
 * @brief							ϵͳ·ÖÇøÐÅϢͷ
-* @param	magic					ħÊõ×Ö				
+* @param	magic					ħÊõ×Ö
 * @param	plat					ƽ̨: 0 - V3T, 1 - 8501
 * @param	plat_partition_num		ƽ̨·ÖÇøÊý
 * @param	oem_partition_num		oem·ÖÇøÊý
 */
-typedef struct {
-	char				magic[SYSTEM_UPGRADE_PARTITION_INFO_HEAD_MAGIC_LEN];
-	int					plat;
-	int					plat_partition_num;
-	int					oem_partition_num;
+typedef struct
+{
+    char				magic[SYSTEM_UPGRADE_PARTITION_INFO_HEAD_MAGIC_LEN];
+    int					plat;
+    int					plat_partition_num;
+    int					oem_partition_num;
 } system_partition_info_head_t;
 
 
@@ -120,10 +122,11 @@
 * @param	system_type			ËùÊôϵͳÀàÐÍ - 0 ƽ̨ÀàÐÍ, 1 oem
 * @param	partition_type		·ÖÇøÀàÐÍ
 */
-typedef struct {
-	char				name[PARTITION_NAME_LEN];
-	int					system_type;
-	int					partition_type;
+typedef struct
+{
+    char				name[PARTITION_NAME_LEN];
+    int					system_type;
+    int					partition_type;
 } platform_partition_info_t;
 
 
@@ -133,10 +136,11 @@
 * @param	system_type			ËùÊôϵͳÀàÐÍ - 0 ƽ̨ÀàÐÍ, 1 oem
 * @param	partition_type		·ÖÇøÀàÐÍ
 */
-typedef struct {
-	char				name[PARTITION_NAME_LEN];
-	int					system_type;
-	int					partition_type;
+typedef struct
+{
+    char				name[PARTITION_NAME_LEN];
+    int					system_type;
+    int					partition_type;
 } oem_partition_info_t;
 
 
@@ -145,16 +149,18 @@
 * @param	platform_partition_info			ƽ̨¿ÉÉý¼¶·ÖÇøÐÅÏ¢
 * @param	oem_partition_info				oem¿ÉÉý¼¶·ÖÇøÐÅÏ¢
 */
-typedef struct {
-	system_partition_info_head_t system_partition_info_head;
-	platform_partition_info_t *platform_partition_info;
-	oem_partition_info_t *oem_partition_info;
+typedef struct
+{
+    system_partition_info_head_t system_partition_info_head;
+    platform_partition_info_t *platform_partition_info;
+    oem_partition_info_t *oem_partition_info;
 } system_upgrade_partition_info_t;
 
 
 /*******************************************************************************
  *                       Global variable declarations                          *
  ******************************************************************************/
+extern char FOTA_PACKAGE_FILE[128];
 
 
 /*******************************************************************************
diff --git a/ap/lib/libupi_ab/inc/upi_sync_system.h b/ap/lib/libupi_ab/inc/upi_sync_system.h
index 9ca0409..598aa3c 100755
--- a/ap/lib/libupi_ab/inc/upi_sync_system.h
+++ b/ap/lib/libupi_ab/inc/upi_sync_system.h
@@ -25,10 +25,11 @@
 /*******************************************************************************

  *                             Type definitions                                *

  ******************************************************************************/

-typedef enum {

-	SYNC_STATUS_FAIL = -1,

-	SYNC_STATUS_SUCCESS = 0,

-	SYNC_STATUS_SYNCING

+typedef enum

+{

+    SYNC_STATUS_FAIL = -1,

+    SYNC_STATUS_SUCCESS = 0,

+    SYNC_STATUS_SYNCING

 } sync_status_t;

 

 

diff --git a/ap/lib/libupi_ab/inc/upi_update.h b/ap/lib/libupi_ab/inc/upi_update.h
index 486707e..255d47b 100755
--- a/ap/lib/libupi_ab/inc/upi_update.h
+++ b/ap/lib/libupi_ab/inc/upi_update.h
@@ -16,38 +16,42 @@
 #include "zxic_fota_ab_upgrade.h"
 
 
-#define  FOTA_PACKAGE_FILE    "/cache/zte_fota_ab/upgrade.package"
+// #define  FOTA_PACKAGE_FILE    "/cache/zte_fota_ab/upgrade.package"
 
-typedef enum {
-	UPGRADE_STATUS_UNKNOWN = -1,
-	UPGRADE_STATUS_VERIFING = 0,
-	UPGRADE_STATUS_VERIFY_SUCCESS,
-	UPGRADE_STATUS_VERIFY_FAIL,
-	UPGRADE_STATUS_UPDATING,
-	UPGRADE_STATUS_UPDATE_SUCCESS,
-	UPGRADE_STATUS_UPDATE_FAIL,
-	UPGRADE_STATUS_NO_NEED_UPDATE,
-	UPGRADE_STATUS_NEED_UPDATE
+
+typedef enum
+{
+    UPGRADE_STATUS_UNKNOWN = -1,
+    UPGRADE_STATUS_VERIFING = 0,
+    UPGRADE_STATUS_VERIFY_SUCCESS,
+    UPGRADE_STATUS_VERIFY_FAIL,
+    UPGRADE_STATUS_UPDATING,
+    UPGRADE_STATUS_UPDATE_SUCCESS,
+    UPGRADE_STATUS_UPDATE_FAIL,
+    UPGRADE_STATUS_NO_NEED_UPDATE,
+    UPGRADE_STATUS_NEED_UPDATE
 } upgrade_status_s_type;
 
-typedef struct {
-	int upgrage_package_file_desc;			// upgrade package file description
-	unsigned int upgrade_data_offset;		// upgrade package offset in file
-	unsigned int upgrade_file_size;			// upgrade package file size
-}partition_upgrade_package_info_t;
+typedef struct
+{
+    int upgrage_package_file_desc;			// upgrade package file description
+    unsigned int upgrade_data_offset;		// upgrade package offset in file
+    unsigned int upgrade_file_size;			// upgrade package file size
+} partition_upgrade_package_info_t;
 
 
-typedef struct {
-	char 								partition_name[PARTITION_NAME_LEN];
-	int									partition_type;
-	long long							len;
-	int									offset;
-	int									zipped;
-	char								hash[HASH_MAX_LEN];
-	int									index;
-	int									partition_total_count;
-	partition_upgrade_package_info_t	pkg_info;
-	partition_mtd_info_t				mtd_info;
+typedef struct
+{
+    char 								partition_name[PARTITION_NAME_LEN];
+    int									partition_type;
+    long long							len;
+    int									offset;
+    int									zipped;
+    char								hash[HASH_MAX_LEN];
+    int									index;
+    int									partition_total_count;
+    partition_upgrade_package_info_t	pkg_info;
+    partition_mtd_info_t				mtd_info;
 } device_data_t;
 
 int upi_update(z_upgrade_flush_status_t* flush_status);
diff --git a/ap/lib/libupi_ab/inc/upi_upgrade_package.h b/ap/lib/libupi_ab/inc/upi_upgrade_package.h
index b4604dc..0fb5c38 100755
--- a/ap/lib/libupi_ab/inc/upi_upgrade_package.h
+++ b/ap/lib/libupi_ab/inc/upi_upgrade_package.h
@@ -48,20 +48,21 @@
 
 
 
-typedef struct {
-	char							magic_word[UPGRADE_PACKAGE_HEAD_MAGIC_LEN];
-	int								upgrade_package_version;
-	int								plat;
-	int								upgrade_package_type;
-	int								upgrade_type;
-	int								partition_num;
-	int								extra_num;
-	int								hash_type;
-	int								block_size;
-	char							version_src[VERSION_LEN];
-	char							version_dst[VERSION_LEN];
-	unsigned char					hash[HASH_MAX_LEN];
-	char							reserve[28];
+typedef struct
+{
+    char							magic_word[UPGRADE_PACKAGE_HEAD_MAGIC_LEN];
+    int								upgrade_package_version;
+    int								plat;
+    int								upgrade_package_type;
+    int								upgrade_type;
+    int								partition_num;
+    int								extra_num;
+    int								hash_type;
+    int								block_size;
+    char							version_src[VERSION_LEN];
+    char							version_dst[VERSION_LEN];
+    unsigned char					hash[HASH_MAX_LEN];
+    char							reserve[28];
 } upgrade_package_head_info_t;
 
 /**
@@ -74,14 +75,15 @@
 * @param	reserve:			±£Áô
 * @param	hash:				ÖÆ×÷²î·Ö·ÖÇøµÄÔ´·ÖÇøÎļþmd5
 */
-typedef struct {
-	char				name[PARTITION_NAME_LEN];
-	int					len;
-	int					offset;
-	int					partition_type;
-	int					zipped;
-	char				reserve[16];
-	unsigned char		hash[HASH_MAX_LEN];
+typedef struct
+{
+    char				name[PARTITION_NAME_LEN];
+    int					len;
+    int					offset;
+    int					partition_type;
+    int					zipped;
+    char				reserve[16];
+    unsigned char		hash[HASH_MAX_LEN];
 } partition_head_info_t;
 
 
@@ -93,13 +95,14 @@
 * @param	hash:		ÎļþhashÖµ
 * @param	reserve:	Ô¤ÁôÐÅÏ¢
 */
-typedef struct {
-	char				name[EXTRA_NAME_LEN];
-	int					len;
-	int					offset;
-	char				reserve_1[8];
-	unsigned char		hash[HASH_MAX_LEN];
-	char				reserve_2[8];
+typedef struct
+{
+    char				name[EXTRA_NAME_LEN];
+    int					len;
+    int					offset;
+    char				reserve_1[8];
+    unsigned char		hash[HASH_MAX_LEN];
+    char				reserve_2[8];
 } extra_head_info_t;
 
 
@@ -113,15 +116,16 @@
 * @param	upgrade_package_file_desc:	Îļþ¾ä±ú
 * @param	upgrade_package_file_size:	Îļþ³¤¶È
 */
-typedef struct {
-	upgrade_package_head_info_t			*head;
-//	int									partition_num;
-	partition_head_info_t				*partition_info;
-//	int									extra_num;
-	extra_head_info_t					*extra_info;
-	int									upgrade_package_file_desc;
-	unsigned int						upgrade_package_file_size;
-}upgrade_package_info_t;
+typedef struct
+{
+    upgrade_package_head_info_t			*head;
+    //	int									partition_num;
+    partition_head_info_t				*partition_info;
+    //	int									extra_num;
+    extra_head_info_t					*extra_info;
+    int									upgrade_package_file_desc;
+    unsigned int						upgrade_package_file_size;
+} upgrade_package_info_t;
 
 
 
diff --git a/ap/lib/libupi_ab/inc/zxic_fota_ab_upgrade.h b/ap/lib/libupi_ab/inc/zxic_fota_ab_upgrade.h
index bea70b8..3757f91 100755
--- a/ap/lib/libupi_ab/inc/zxic_fota_ab_upgrade.h
+++ b/ap/lib/libupi_ab/inc/zxic_fota_ab_upgrade.h
@@ -59,7 +59,7 @@
 /*******************************************************************************
  *                             Type definitions                                *
  ******************************************************************************/
- 
+
 
 
 /*
@@ -71,11 +71,12 @@
  * ³¤¶ÈÐÅÏ¢½öÔÚÉý¼¶×´Ì¬ÎªUPGRADE_STATUS_UPDATINGʱÓÐЧ£¬ÆäËü״̬²ÎÊýÖµÎÞʵ¼ÊÒâÒå
  */
 
-typedef struct {
-	int					upgrade_status;
-	int					total_size;
-	int					upgraded_size;
-}z_upgrade_status_info_t;
+typedef struct
+{
+    int					upgrade_status;
+    int					total_size;
+    int					upgraded_size;
+} z_upgrade_status_info_t;
 
 
 /*
@@ -86,11 +87,12 @@
  * ×¢Ò⣺
  * ³¤¶ÈÐÅÏ¢½öÔÚÉý¼¶×´Ì¬ÎªUPGRADE_STATUS_UPDATINGʱÓÐЧ£¬ÆäËü״̬²ÎÊýÖµÎÞʵ¼ÊÒâÒå
  */
-typedef struct {
-	int		system;
-	int		status;     /* bootable/successful/unbootable */
-	int		try_cnt;
-}z_system_info_t;
+typedef struct
+{
+    int		system;
+    int		status;     /* bootable/successful/unbootable */
+    int		try_cnt;
+} z_system_info_t;
 
 
 /*
@@ -99,20 +101,21 @@
  * system_1:ϵͳ1״̬
  * system_2:ϵͳ2״̬
  * ×¢Ò⣺
- * 
+ *
  */
-typedef struct 
+typedef struct
 {
-	int						boot_to;        /* µ±Ç°Æô¶¯ÏµÍ³±êÖ¾*/
-	int						fota_status;
-	z_system_info_t			system_1;
-	z_system_info_t			system_2;
-}z_upgrade_system_info_t;
+    int						boot_to;        /* µ±Ç°Æô¶¯ÏµÍ³±êÖ¾*/
+    int						fota_status;
+    z_system_info_t			system_1;
+    z_system_info_t			system_2;
+} z_upgrade_system_info_t;
 
 
-typedef struct {
-	z_upgrade_status_info_t *status;
-	void(* status_cb)(z_upgrade_status_info_t *status);
+typedef struct
+{
+    z_upgrade_status_info_t *status;
+    void(* status_cb)(z_upgrade_status_info_t *status);
 } z_upgrade_flush_status_t;
 
 
@@ -127,33 +130,33 @@
 /*******************************************************************************
  *                       Global function declarations                          *
  ******************************************************************************/
- 
+
 /********************************************************************************
  *	º¯ÊýÃû:	zxic_dual_verify
- * ¹¦ÄÜÃèÊö:Éý¼¶°üºÏ·¨ÐÔУÑé		
- * ²ÎÊý˵Ã÷£º	
- * 	ÊäÈë²ÎÊý£ºÎÞ	
+ * ¹¦ÄÜÃèÊö:Éý¼¶°üºÏ·¨ÐÔУÑé
+ * ²ÎÊý˵Ã÷£º
+ * 	ÊäÈë²ÎÊý£ºÎÞ
  * 	Êä³ö²ÎÊý:ÎÞ
- * ·µ»ØÖµ£º	
+ * ·µ»ØÖµ£º
  * 	Z_FOTA_SUCCESS		УÑé³É¹¦
  *		Z_FOTA_FAILУÑéʧ°Ü
- *	×¢Òâ:		
+ *	×¢Òâ:
  *		ͬ²½½Ó¿Ú£¬½¨ÒéÒì²½µ÷ÓÃ
  ********************************************************************************/
-int zxic_dual_verify();	
+int zxic_dual_verify();
 
 
 /********************************************************************************
- * º¯ÊýÃû:	zxic_dual_upgrade		
+ * º¯ÊýÃû:	zxic_dual_upgrade
  * ¹¦ÄÜÃèÊö:¿ªÊ¼Éý¼¶
  * ²ÎÊý˵Ã÷£º
  * 	ÊäÈë²ÎÊý£º
  *		flush_upgrade_status ״̬»Øµ÷½Ó¿Ú
- * 	Êä³ö²ÎÊý:ÎÞ	
+ * 	Êä³ö²ÎÊý:ÎÞ
  * ·µ»ØÖµ£º
  * 	Z_FOTA_SUCCESS		Éý¼¶³É¹¦
  * 	Z_FOTA_FAILÉý¼¶Ê§°Ü
- * ×¢Òâ:	
+ * ×¢Òâ:
  *		ͬ²½½Ó¿Ú£¬½¨ÒéÒì²½µ÷Ó㬱ÜÃâ×èÈû
  *		״̬»Øµ÷½Ó¿ÚÖнûÖ¹×ö¸´ÔÓ²Ù×÷£¬½¨Òé½ö½øÐÐ״̬Êä³ö
 ********************************************************************************/
@@ -165,38 +168,38 @@
 
 /********************************************************************************
  * º¯ÊýÃû:	zxic_dual_get_upgrade_status
- * ¹¦ÄÜÃèÊö:Éý¼¶×´Ì¬»ñÈ¡		
+ * ¹¦ÄÜÃèÊö:Éý¼¶×´Ì¬»ñÈ¡
  * ²ÎÊý˵Ã÷£º
  * 	ÊäÈë²ÎÊý£ºÎÞ
- * 	Êä³ö²ÎÊý:	
- * 		upgrade_info_t *upgrade_info	 Éý¼¶×´Ì¬	
+ * 	Êä³ö²ÎÊý:
+ * 		upgrade_info_t *upgrade_info	 Éý¼¶×´Ì¬
  * ·µ»ØÖµ£º
  * 	Z_FOTA_SUCCESS		Éý¼¶³É¹¦
  * 	Z_FOTA_FAILÉý¼¶Ê§°Ü
- * ×¢Òâ:	
+ * ×¢Òâ:
 ********************************************************************************/
 int zxic_dual_get_upgrade_status(z_upgrade_status_info_t *upgrade_info);
 
 /********************************************************************************
  * º¯ÊýÃû:	zxic_dual_get_current_system
- * ¹¦ÄÜÃèÊö:»ñÈ¡µ±Ç°ÔËÐÐϵͳ	
- * ²ÎÊý˵Ã÷£º					
- * 	ÊäÈë²ÎÊý£ºÎÞ			
- * 	Êä³ö²ÎÊý:ÎÞ				
- * ·µ»ØÖµ£º					
- * 	µ±Ç°ÔËÐÐϵͳ			
+ * ¹¦ÄÜÃèÊö:»ñÈ¡µ±Ç°ÔËÐÐϵͳ
+ * ²ÎÊý˵Ã÷£º
+ * 	ÊäÈë²ÎÊý£ºÎÞ
+ * 	Êä³ö²ÎÊý:ÎÞ
+ * ·µ»ØÖµ£º
+ * 	µ±Ç°ÔËÐÐϵͳ
  * ×¢Òâ:
 ********************************************************************************/
 int zxic_dual_get_current_system();
 
 /********************************************************************************
  * º¯ÊýÃû:	zxic_dual_get_boot_to_system
- * ¹¦ÄÜÃèÊö:»ñÈ¡ÖØÆôºóÄ¿±êÆô¶¯ÏµÍ³	
- * ²ÎÊý˵Ã÷£º					
- * 	ÊäÈë²ÎÊý£ºÎÞ			
- * 	Êä³ö²ÎÊý:ÎÞ				
- * ·µ»ØÖµ£º					
- * 	µ±Ç°ÔËÐÐϵͳ			
+ * ¹¦ÄÜÃèÊö:»ñÈ¡ÖØÆôºóÄ¿±êÆô¶¯ÏµÍ³
+ * ²ÎÊý˵Ã÷£º
+ * 	ÊäÈë²ÎÊý£ºÎÞ
+ * 	Êä³ö²ÎÊý:ÎÞ
+ * ·µ»ØÖµ£º
+ * 	µ±Ç°ÔËÐÐϵͳ
  * ×¢Òâ:
 ********************************************************************************/
 int zxic_dual_get_boot_to_system();
@@ -205,49 +208,49 @@
 
 /********************************************************************************
  * º¯ÊýÃû:	zxic_dual_set_boot_to_system
- * ¹¦ÄÜÃèÊö:ÉèÖÃÄ¿±êÔËÐÐϵͳ	
+ * ¹¦ÄÜÃèÊö:ÉèÖÃÄ¿±êÔËÐÐϵͳ
  * ²ÎÊý˵Ã÷£º
  * 	ÊäÈë²ÎÊý£º
  *		system:Ä¿±êϵͳ
  *		reboot_flag:ÉèÖÃÍê±ÏºóÊÇ·ñÁ¢¼´ÖØÆô 0:²»ÖØÆô,1:ÖØÆô
- * 	Êä³ö²ÎÊý:	
- * 		ϵͳ״̬ÐÅÏ¢		
+ * 	Êä³ö²ÎÊý:
+ * 		ϵͳ״̬ÐÅÏ¢
  * ·µ»ØÖµ£º
  * 	Z_FOTA_SUCCESS		»ñÈ¡ÐÅÏ¢³É¹¦
  * 	Z_FOTA_FAIL»ñÈ¡ÐÅϢʧ°Ü
  * ×¢Òâ:
  * 	·µ»ØÖµ£ºÖ»ÔÚ²»ÐèÒªÖØÆôʱÓÐЧ
 ********************************************************************************/
-int zxic_dual_set_boot_to_system(int system, int reboot_flag);	
+int zxic_dual_set_boot_to_system(int system, int reboot_flag);
 
 
 /********************************************************************************
  * º¯ÊýÃû:	zxic_dual_get_system_status
- * ¹¦ÄÜÃèÊö:²éѯABϵͳ״̬		
+ * ¹¦ÄÜÃèÊö:²éѯABϵͳ״̬
  * ²ÎÊý˵Ã÷£º
  * 	ÊäÈë²ÎÊý£ºÎÞ
- * 	Êä³ö²ÎÊý:	
- * 		system_info ϵͳ״̬ÐÅÏ¢		
+ * 	Êä³ö²ÎÊý:
+ * 		system_info ϵͳ״̬ÐÅÏ¢
  * ·µ»ØÖµ£º
- * 	Z_FOTA_SUCCESS		»ñÈ¡ÐÅÏ¢³É¹¦	
- * 	Z_FOTA_FAIL»ñÈ¡ÐÅϢʧ°Ü	
- * ×¢Òâ:	
+ * 	Z_FOTA_SUCCESS		»ñÈ¡ÐÅÏ¢³É¹¦
+ * 	Z_FOTA_FAIL»ñÈ¡ÐÅϢʧ°Ü
+ * ×¢Òâ:
 ********************************************************************************/
 int zxic_dual_get_system_status(z_upgrade_system_info_t *system_info);
 
 
 /********************************************************************************
  * º¯ÊýÃû:	zxic_dual_set_system_status
- * ¹¦ÄÜÃèÊö:ÉèÖÃϵͳ״̬		
+ * ¹¦ÄÜÃèÊö:ÉèÖÃϵͳ״̬
  * ²ÎÊý˵Ã÷£º
  * ÊäÈë²ÎÊý£º
  * 		system:´ýÉèÖÃϵͳ
  * 		status:ÉèÖÃϵͳ״̬
  * Êä³ö²ÎÊý:ÎÞ
- * ·µ»ØÖµ£º	
- * 	Z_FOTA_SUCCESS		»ñÈ¡ÐÅÏ¢³É¹¦	
- * 	Z_FOTA_FAIL»ñÈ¡ÐÅϢʧ°Ü	
- * ×¢Òâ:	
+ * ·µ»ØÖµ£º
+ * 	Z_FOTA_SUCCESS		»ñÈ¡ÐÅÏ¢³É¹¦
+ * 	Z_FOTA_FAIL»ñÈ¡ÐÅϢʧ°Ü
+ * ×¢Òâ:
 ********************************************************************************/
 int zxic_dual_set_system_status(int system, int status);
 
@@ -262,10 +265,10 @@
  * ²ÎÊý˵Ã÷£º
  * ÊäÈë²ÎÊý:ÎÞ
  * Êä³ö²ÎÊý:ÎÞ
- * ·µ»ØÖµ£º	
- * 	Z_FOTA_SUCCESS		»ñÈ¡ÐÅÏ¢³É¹¦	
- * 	Z_FOTA_FAIL»ñÈ¡ÐÅϢʧ°Ü	
- * ×¢Òâ:	
+ * ·µ»ØÖµ£º
+ * 	Z_FOTA_SUCCESS		»ñÈ¡ÐÅÏ¢³É¹¦
+ * 	Z_FOTA_FAIL»ñÈ¡ÐÅϢʧ°Ü
+ * ×¢Òâ:
 ********************************************************************************/
 
 int zxic_init_flag_partition();
@@ -275,12 +278,12 @@
 
 /********************************************************************************
  * º¯ÊýÃû:	zxic_dual_get_fota_status_for_nv
- * ¹¦ÄÜÃèÊö:»ñȡϵͳNVÊÇ·ñͬ²½±êÖ¾	
- * ²ÎÊý˵Ã÷£º					
- * 	ÊäÈë²ÎÊý£ºÎÞ			
- * 	Êä³ö²ÎÊý:ÎÞ				
- * ·µ»ØÖµ£º					
- * 	״̬±êÖ¾ 0£º²»ÐèҪͬ²½£¬1£ºÐèҪͬ²½			
+ * ¹¦ÄÜÃèÊö:»ñȡϵͳNVÊÇ·ñͬ²½±êÖ¾
+ * ²ÎÊý˵Ã÷£º
+ * 	ÊäÈë²ÎÊý£ºÎÞ
+ * 	Êä³ö²ÎÊý:ÎÞ
+ * ·µ»ØÖµ£º
+ * 	״̬±êÖ¾ 0£º²»ÐèҪͬ²½£¬1£ºÐèҪͬ²½
  * ×¢Òâ:
 ********************************************************************************/
 int zxic_dual_get_fota_status_for_nv();
@@ -289,15 +292,15 @@
 
 /********************************************************************************
  * º¯ÊýÃû:	zxic_dual_set_fota_status_for_nv
- * ¹¦ÄÜÃèÊö:ÉèÖÃϵͳNVÊÇ·ñͬ²½±êÖ¾		
+ * ¹¦ÄÜÃèÊö:ÉèÖÃϵͳNVÊÇ·ñͬ²½±êÖ¾
  * ²ÎÊý˵Ã÷£º
  * ÊäÈë²ÎÊý£º
  * 		status:״̬±êÖ¾£¬0£º²»ÐèҪͬ²½£¬1£ºÐèҪͬ²½
  * Êä³ö²ÎÊý:ÎÞ
- * ·µ»ØÖµ£º	
- * 	Z_FOTA_SUCCESS		ÉèÖóɹ¦	
- * 	Z_FOTA_FAIL			ÉèÖÃʧ°Ü	
- * ×¢Òâ:	
+ * ·µ»ØÖµ£º
+ * 	Z_FOTA_SUCCESS		ÉèÖóɹ¦
+ * 	Z_FOTA_FAIL			ÉèÖÃʧ°Ü
+ * ×¢Òâ:
 ********************************************************************************/
 int zxic_dual_set_fota_status_for_nv(int status);
 int dual_AB_set_fota_status_for_nv(int status);
@@ -305,30 +308,30 @@
 
 /********************************************************************************
  * º¯ÊýÃû:	zxic_dual_sync_system
- * ¹¦ÄÜÃèÊö: AB-AAϵͳͬ²½		
- * ²ÎÊý˵Ã÷£º	
- * ÊäÈë²ÎÊý£ºÎÞ	
+ * ¹¦ÄÜÃèÊö: AB-AAϵͳͬ²½
+ * ²ÎÊý˵Ã÷£º
+ * ÊäÈë²ÎÊý£ºÎÞ
  * Êä³ö²ÎÊý: ÎÞ
- * ·µ»ØÖµ£º	
+ * ·µ»ØÖµ£º
  * 	 Z_FOTA_SUCCESS	ͬ²½³É¹¦
  *	 Z_FOTA_FAIL ͬ²½Ê§°Ü
- * ×¢Òâ:		
+ * ×¢Òâ:
  ********************************************************************************/
-int zxic_dual_sync_system(void);	
+int zxic_dual_sync_system(void);
 
 
 /********************************************************************************
  * º¯ÊýÃû:	zxic_dual_get_upgrade_type
  * ¹¦ÄÜÃèÊö: »ñÈ¡Éý¼¶ÀàÐÍ
- * ²ÎÊý˵Ã÷£º	
- * ÊäÈë²ÎÊý£ºÎÞ	
+ * ²ÎÊý˵Ã÷£º
+ * ÊäÈë²ÎÊý£ºÎÞ
  * Êä³ö²ÎÊý: ÎÞ
- * ·µ»ØÖµ£º	
+ * ·µ»ØÖµ£º
  * 	 Z_UPGRADE_TYPE_ALL	È«°æ±¾ÀàÐÍ
  *   Z_UPGRADE_TYPE_PLATFORM ƽ̨ÀàÐÍ
  *   Z_UPGRADE_TYPE_OEM OEMÀàÐÍ
  *	 Z_UPGRADE_TYPE_INVALID ÎÞЧÀàÐÍ
- * ×¢Òâ:		
+ * ×¢Òâ:
  ********************************************************************************/
 int zxic_dual_get_upgrade_type(void);
 
@@ -336,12 +339,12 @@
 /********************************************************************************
  * º¯ÊýÃû:	zxic_dual_get_sync_status
  * ¹¦ÄÜÃèÊö: »ñȡͬ²½×´Ì¬
- * ²ÎÊý˵Ã÷£º	
- * ÊäÈë²ÎÊý£ºÎÞ	
- * Êä³ö²ÎÊý: 
+ * ²ÎÊý˵Ã÷£º
+ * ÊäÈë²ÎÊý£ºÎÞ
+ * Êä³ö²ÎÊý:
  *	 sync_status ͬ²½×´Ì¬
  * ·µ»ØÖµ£ºÎÞ
- * ×¢Òâ:		
+ * ×¢Òâ:
  ********************************************************************************/
 void zxic_dual_get_sync_status(int *sync_status);
 
@@ -349,18 +352,33 @@
 /********************************************************************************
  * º¯ÊýÃû:	zxic_dual_set_sync_status
  * ¹¦ÄÜÃèÊö: ÉèÖÃͬ²½×´Ì¬
- * ²ÎÊý˵Ã÷£º	
+ * ²ÎÊý˵Ã÷£º
  * ÊäÈë²ÎÊý£º
  *	 sync_status ͬ²½×´Ì¬
  * Êä³ö²ÎÊý: ÎÞ
  * ·µ»ØÖµ£º
  *	 Z_FOTA_SUCCESS ÉèÖóɹ¦
  *	 Z_FOTA_FAIL ÉèÖÃʧ°Ü
- * ×¢Òâ:		
+ * ×¢Òâ:
  ********************************************************************************/
 int zxic_dual_set_sync_status(int sync_status);
 
 
+/********************************************************************************
+ * º¯ÊýÃû:	zxic_dual_config_package_path
+ * ¹¦ÄÜÃèÊö: ÉèÖÃÉý¼¶°ü·¾¶
+ * ²ÎÊý˵Ã÷£º
+ * ÊäÈë²ÎÊý£º
+ *	 upgrade_package_path Éý¼¶°ü·¾¶
+ *	 length Éý¼¶°ü·¾¶³¤¶È
+ * Êä³ö²ÎÊý: ÎÞ
+ * ·µ»ØÖµ£º
+ *	 Z_FOTA_SUCCESS ÉèÖóɹ¦
+ *	 Z_FOTA_FAIL ÉèÖÃʧ°Ü
+ * ×¢Òâ:
+ ********************************************************************************/
+int zxic_dual_config_package_path(char *upgrade_package_path, int length);
+
 
 #endif // ZXIC_FOTA_AB_UPGRADE_H
 
diff --git a/ap/lib/libupi_ab/libupi_ab.a b/ap/lib/libupi_ab/libupi_ab.a
index e7fac0f..d29cd1b 100644
--- a/ap/lib/libupi_ab/libupi_ab.a
+++ b/ap/lib/libupi_ab/libupi_ab.a
Binary files differ
diff --git a/ap/lib/libupi_ab/libupi_ab.so b/ap/lib/libupi_ab/libupi_ab.so
index 4047d48..bccd145 100755
--- a/ap/lib/libupi_ab/libupi_ab.so
+++ b/ap/lib/libupi_ab/libupi_ab.so
Binary files differ