adjust factory image identification

Adjust the way to identify factory bootloader to decide
whether SW is factory SW version.

When device in factory mode may be identified as factory version
in previous implementation.

Change-Id: I38b4fe9ea12d70b8e07416110c2d7e8a5bbf994a
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1616461
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Zhenxin Xi <xizx@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
yanyh2 2020-06-12 17:41:01 +08:00 • committed by Yonghua Yan
commit 7e2ed631f2

View file

@ -1349,6 +1349,7 @@ static bool mmi_factory_check(int type)
bool factory = false;
const char *bootargs = NULL;
char *bl_version = NULL;
char *end = NULL;
if (!np)
return factory;
@ -1359,12 +1360,16 @@ static bool mmi_factory_check(int type)
"mmi,factory-cable");
break;
case MMI_FACTORY_BUILD:
if (!of_property_read_string(np,
"bootargs", &bootargs)) {
bl_version = strstr(bootargs,
"androidboot.bootloader=");
if (bl_version && strstr(bl_version, "factory"))
if (!of_property_read_string(np, "bootargs", &bootargs)) {
bl_version = strstr(bootargs, "androidboot.bootloader=");
if (bl_version) {
end = strpbrk(bl_version, " ");
bl_version = strpbrk(bl_version, "=");
}
if (bl_version && end > bl_version &&
strnstr(bl_version, "factory", end - bl_version)) {
factory = true;
}
}
break;
default: