Add lock unlock fastboot commnad to skip ui check
Root cause:N/A
How to fix:N/A
Feature:Add lock unlock fastboot commnad to skip ui check for fastboot download
RiskArea: Download,Security
Change-Id: I2270dc433697641761cb849cf799f685fd247186
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index edcd171..0052726 100755
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -3312,6 +3312,36 @@
//<2018/10/16-EricLin
}
+/*[TracyChui] Add lock unlock fastboot commnad to skip ui check 20200611 start*/
+#if defined(ENABLE_LOCK_UNLOCK_SKIP_UI_CHECK)
+static void set_device_unlock_skip_ui_check(int type, bool status)
+{
+ int is_unlocked = -1;
+ char response[MAX_RSP_SIZE];
+
+ /* check device unlock status if it is as expected */
+ if (type == UNLOCK)
+ is_unlocked = device.is_unlocked;
+#if VERIFIED_BOOT || VERIFIED_BOOT_2
+ if(VB_M <= target_get_vb_version() &&
+ type == UNLOCK_CRITICAL)
+ {
+ is_unlocked = device.is_unlock_critical;
+ }
+#endif
+ if (is_unlocked == status) {
+ snprintf(response, sizeof(response), "\tDevice already : %s", (status ? "unlocked!" : "locked!"));
+ fastboot_info(response);
+ fastboot_okay("");
+ return;
+ }
+
+ set_device_unlock_value(type, status);
+ fastboot_okay("");
+}
+#endif
+/*[TracyChui] Add lock unlock fastboot commnad to skip ui check 20200611 end */
+
static bool critical_flash_allowed(const char * entry)
{
uint32_t i = 0;
@@ -4981,6 +5011,15 @@
set_device_unlock(UNLOCK, TRUE);
}
+/*[TracyChui] Add lock unlock fastboot commnad to skip ui check 20200611 start*/
+#if defined(ENABLE_LOCK_UNLOCK_SKIP_UI_CHECK)
+void cmd_oem_unlock_skip_ui_check(const char *arg, void *data, unsigned sz)
+{
+ set_device_unlock_skip_ui_check(UNLOCK, TRUE);
+}
+#endif
+/*[TracyChui] Add lock unlock fastboot commnad to skip ui check 20200611 end */
+
void cmd_oem_unlock_go(const char *arg, void *data, unsigned sz)
{
if(!device.is_unlocked) {
@@ -5032,6 +5071,15 @@
set_device_unlock(UNLOCK, FALSE);
}
+/*[TracyChui] Add lock unlock fastboot commnad to skip ui check 20200611 start*/
+#if defined(ENABLE_LOCK_UNLOCK_SKIP_UI_CHECK)
+void cmd_oem_lock_skip_ui_check(const char *arg, void *data, unsigned sz)
+{
+ set_device_unlock_skip_ui_check(UNLOCK, FALSE);
+}
+#endif
+/*[TracyChui] Add lock unlock fastboot commnad to skip ui check 20200611 end */
+
void cmd_oem_devinfo(const char *arg, void *data, unsigned sz)
{
char response[MAX_RSP_SIZE];
@@ -5436,6 +5484,12 @@
{"oem unlock", cmd_oem_unlock},
{"oem unlock-go", cmd_oem_unlock_go},
{"oem lock", cmd_oem_lock},
+/*[TracyChui] Add lock unlock fastboot commnad to skip ui check 20200611 start */
+#if defined(ENABLE_LOCK_UNLOCK_SKIP_UI_CHECK)
+ {"oem 8901_unlock", cmd_oem_unlock_skip_ui_check},
+ {"oem 8901_lock", cmd_oem_lock_skip_ui_check},
+#endif
+/*[TracyChui] Add lock unlock fastboot commnad to skip ui check 20200611 end */
{"flashing unlock", cmd_oem_unlock},
{"flashing lock", cmd_oem_lock},
{"flashing lock_critical", cmd_flashing_lock_critical},
diff --git a/makefile b/makefile
index eb88f91..ac825df 100755
--- a/makefile
+++ b/makefile
@@ -85,6 +85,10 @@
CFLAGS += -DENABLE_PRODINFO_ACCESS=1
#[20200605][TracyChui] Implement get Serial Number end
+#[TracyChui] Add lock unlock fastboot commnad to skip ui check 20200611 start
+CFLAGS += -DENABLE_LOCK_UNLOCK_SKIP_UI_CHECK=1
+#[TracyChui] Add lock unlock fastboot commnad to skip ui check 20200611 end
+
# setup toolchain prefix
TOOLCHAIN_PREFIX ?= arm-eabi-
CFLAGS += -fstack-protector-all