Feature][ZXW-307] FOTA upgrade information recorded in the maintenance log
Only Configure: Yes
Affected branch: master
Affected module: fota
Is it affected on both ZXIC and MTK:only ZXIC
Self-test: yes
Doc Update:No
Change-Id: Iae4fa3d2c430446a4a2fd9489e3e741acf9dbfc4
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-fota/liblynq-qser-fota.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-fota/liblynq-qser-fota.bb
index d401000..34b067d 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-fota/liblynq-qser-fota.bb
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-fota/liblynq-qser-fota.bb
@@ -5,10 +5,11 @@
#LICENSE = "Mobiletek""
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = "file://LICENSE;md5=e1696b147d49d491bcb4da1a57173fff"
-DEPENDS += "bootchart liblynq-log libupi-ab openssl libflags liblynq-qser-autosuspend"
+DEPENDS += "bootchart liblynq-log libupi-ab openssl libflags liblynq-qser-autosuspend libdebug-info"
#inherit workonsrc
WORKONSRC = "${TOPDIR}/../src/lynq/lib/liblynq-qser-fota/"
+ZXIC_INC = "${TOPDIR}/../zxic_code/pub/include/infra/"
FILESEXTRAPATHS_prepend :="${TOPDIR}/../src/lynq/lib/:"
SRC_URI = " \
@@ -41,7 +42,7 @@
#INHIBIT_PACKAGE_STRIP = "1"
do_compile () {
- oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -Wl,--hash-style=gnu -DTELEPHONYWARE"
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} ZXIC_INCLUDE=${ZXIC_INC} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -Wl,--hash-style=gnu -DTELEPHONYWARE"
}
do_install () {
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/lynq-qser-fota.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/lynq-qser-fota.cpp
index 1c0ae3a..10f967a 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/lynq-qser-fota.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/lynq-qser-fota.cpp
@@ -28,7 +28,7 @@
#include "include/lynq-qser-fota.h"
#include "liblog/lynq_deflog.h"
#include "include/lynq-qser-autosuspend.h"
-
+#include "pub_debug_info.h"
#define FOTA_REBOOT_FLAG "/mnt/userdata/.fota_reboot_flag"
#define FOTA_FLAG_FILE "/mnt/userdata/.back_up_flag"
@@ -67,6 +67,7 @@
int total_size = 0;
int upgrade_size = 0;
+
typedef struct
{
int system;
@@ -140,6 +141,11 @@
int current_slot = 0;
int fota_sync_flag = 0;
int reboot_flg = NO_REBOOT;
+ time_t startTime;
+ time_t endTime;
+ struct tm *localTime;
+ double elapsed = 0;
+
FILE *fp = NULL;
fp = fopen(FOTA_FLAG_FILE,"w+");
if(fp == NULL)
@@ -185,15 +191,43 @@
LYINFLOG("Verify package failed exit upgrade");
return -1;
}
-
+
+ startTime = time(NULL);
+ if(startTime == (time_t)-1)
+ {
+ LYERRLOG("Failed to get the current time.\n");
+ }
LYINFLOG("-----Begin to upgrade ----");
ret = lynq_fota_upgrade();
+
+ endTime = time(NULL);
+ if(endTime == (time_t)-1)
+ {
+ LYERRLOG("Failed to get the current time.\n");
+ }
+ elapsed = difftime(endTime, startTime);
+ localTime = localtime(&endTime);
if(ret != 0)
{
- LYINFLOG("Fota upgrade failed!!!");
+ LYERRLOG("Upgrade failed");
+ ret = sc_debug_info_record(MODULE_ID_CAP_FOTA,"failed,spendtime: %.2lf seconds,package size:%d,finished time %s", elapsed,total_size,asctime(localTime));
+ if(ret <= 0)
+ {
+ LYERRLOG("lynq_record_debug_info failed");
+ }
return -1;
}
+ else
+ {
+ LYINFLOG("Upgrade success");
+ ret = sc_debug_info_record(MODULE_ID_CAP_FOTA,"success,spendtime: %.2lf seconds,package size:%d,finished time %s", elapsed,total_size,asctime(localTime));
+ if(ret <= 0)
+ {
+ LYERRLOG("lynq_record_debug_info failed");
+ }
+ }
+
ret = lynq_get_upgrade_status();
if(ret != LYNQ_UPGRADE_STATUS_UPDATE_SUCCESS)
@@ -209,12 +243,9 @@
return -1;
}
-
if(current_slot == atoi(SYSTEM_A))
{
LYINFLOG("current system is system a");
-
-
ret = lynq_set_boot_to_system((char *)SYSTEM_B);
if(ret != 0)
{
@@ -226,8 +257,6 @@
else if( current_slot == atoi(SYSTEM_B))
{
LYINFLOG("current system is system a");
-
-
ret = lynq_set_boot_to_system((char *)SYSTEM_A);
if(ret != 0)
{
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/makefile b/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/makefile
index 8f823e9..e211f81 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/makefile
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/makefile
@@ -14,6 +14,7 @@
LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0
endif
+LOCAL_CFLAGS += -D_USE_ZXIC_DEBUG_INFO
$(warning ################# rock ROOT: $(ROOT),includedir:$(includedir),)
@@ -27,7 +28,7 @@
-I$(ROOT)$(includedir)/glib-2.0 \
-I$(ROOT)$(libdir)/glib-2.0/include \
-I$(ROOT)$(includedir) \
-
+ -I$(ZXIC_INCLUDE) \
LOCAL_LIBS := \
@@ -41,6 +42,7 @@
-lflags \
-lzxiclzma \
-llynq-qser-autosuspend \
+ -ldebug_info \
SOURCES = $(wildcard *.cpp)