#define SUCCESS 0
#define FAIL -1
-const char* kChromiumMountReady = "/tmp/.chromium_mount.ready";
+const char* kChromiumUpdateOrPreloadMountReady =
+ "/tmp/.chromium_update_or_preload_mount.ready";
+const char* kChromiumUpgradeMountReady = "/tmp/.chromium_upgrade_mount.ready";
+const char* kChromiumUpgradeTPKExists = "/tmp/.chromium_upgrade_tpk.exists";
const char* kColdBootRequester = "chromium-efl";
const char* kLaunchFail = "rtc/memory/WebApp/LaunchFail";
const char* kPSAgentReady = "/run/ps_agent.pid";
return FAIL;
}
- if (LwipcEventDone(kChromiumMountReady) < 0) {
- // The Lwipc api simply calls the ioctl() inside the function.
- // Failure of this API means that there are some kernel issues.
- LOG(ERROR) << kChromiumMountReady << " Event Failed.";
- }
-
return SUCCESS;
}
int result = FAIL;
if (!access(LIB_RO_ROOT_DIR "/version", F_OK)) {
LOG(INFO) << LIB_RO_ROOT_DIR "/version file already exists.";
- if (LwipcEventDone(kChromiumMountReady) < 0) {
+ if (LwipcEventDone(kChromiumUpdateOrPreloadMountReady) < 0) {
// The Lwipc api simply calls the ioctl() inside the function.
// Failure of this API means that there are some kernel issues.
- LOG(ERROR) << kChromiumMountReady << " Event Failed.";
+ LOG(ERROR) << kChromiumUpdateOrPreloadMountReady << " Event Failed.";
}
return SUCCESS;
}
LOG(INFO) << PATH_UPDATED_CHROMIUM_EFL_IMG << " exists.";
kTargetTPK = "WebEngine Updated TPK ";
result = mount(true, MOUNT_ARGS_UPDATED_CHROMIUM);
+
+ if (LwipcEventDone(kChromiumUpdateOrPreloadMountReady) < 0) {
+ // The Lwipc api simply calls the ioctl() inside the function.
+ // Failure of this API means that there are some kernel issues.
+ LOG(ERROR) << kChromiumUpdateOrPreloadMountReady << " Event Failed.";
+ }
}
if (result != SUCCESS && !access(PATH_PRELOAD_CHROMIUM_EFL_IMG, F_OK)) {
LOG(INFO) << PATH_PRELOAD_CHROMIUM_EFL_IMG << " exists.";
kTargetTPK = "WebEngine Preload TPK ";
result = mount(true, MOUNT_ARGS_PRELOAD_CHROMIUM);
+
+ if (LwipcEventDone(kChromiumUpdateOrPreloadMountReady) < 0) {
+ // The Lwipc api simply calls the ioctl() inside the function.
+ // Failure of this API means that there are some kernel issues.
+ LOG(ERROR) << kChromiumUpdateOrPreloadMountReady << " Event Failed.";
+ }
}
return result;
}
+static void AlertUpgradeTPK() {
+ if (!access(PATH_UPGRADE_CHROMIUM_EFL_IMG, F_OK)) {
+ LOG(INFO) << PATH_UPGRADE_CHROMIUM_EFL_IMG << " exists.";
+
+ if (LwipcEventDone(kChromiumUpgradeTPKExists) < 0) {
+ // The Lwipc api simply calls the ioctl() inside the function.
+ // Failure of this API means that there are some kernel issues.
+ LOG(ERROR) << kChromiumUpgradeTPKExists << " Event Failed.";
+ }
+ } else {
+ LOG(INFO) << "No WebEngine Upgrade TPK found";
+ }
+}
+
static void MountUpgradeTPK() {
if (!access(LIB_UPGRADE_ROOT_DIR "/version", F_OK)) {
RequestColdBoot();
LOG(INFO) << PATH_UPGRADE_CHROMIUM_EFL_IMG << " exists.";
kTargetTPK = "WebEngine Upgrade TPK ";
mount(true, MOUNT_ARGS_UPGRADE_CHROMIUM);
+ if (LwipcEventDone(kChromiumUpgradeMountReady) < 0) {
+ // The Lwipc api simply calls the ioctl() inside the function.
+ // Failure of this API means that there are some kernel issues.
+ LOG(ERROR) << kChromiumUpgradeMountReady << " Event Failed.";
+ }
} else {
LOG(INFO) << "No WebEngine Upgrade TPK found";
}
}
if (option == InstallTpk) { // InstallTpk
+ AlertUpgradeTPK();
// TV does not install tpk. Built-in installer installs.
// To avoid concurrency problem, a lock must be shared with installer.
//
#if BUILDFLAG(IS_TIZEN_TV)
bool g_upgrade_lib = false; // conservative policy
const char* kChromiumMountReady = "/tmp/.chromium_mount.ready";
-
+const char* kChromiumUpdateOrPreloadMountReady =
+ "/tmp/.chromium_update_or_preload_mount.ready";
+const char* kChromiumUpgradeMountReady = "/tmp/.chromium_upgrade_mount.ready";
+const char* kChromiumUpgradeTPKExists = "/tmp/.chromium_upgrade_tpk.exists";
+const unsigned int kUpgradeMountTimeout = 10000;
#if defined(ENABLE_WRT_JS)
#define SQUASHFS_MAGIC 0x73717368
#endif // TIZEN_VERSION_AT_LEAST(8, 0, 0) && defined(TIZEN_VD_ENTERPRISE_FEATURE)
}
+inline bool upgradeTPKExists() {
+ if (LwipcIsDone(kChromiumUpgradeTPKExists) > 0) {
+ LOG(INFO) << "Upgrade TPK exists";
+ return true;
+ }
+
+ LOG(INFO) << "Upgrade TPK does not exist";
+ return false;
+}
+
+inline bool upgradeTPKMounted() {
+ bool result = !access(CHROMIUM_UPGRADE_LIB_PATH, F_OK);
+ LOG(INFO) << "path: " << CHROMIUM_UPGRADE_LIB_PATH << ", result: " << result;
+
+ if (!result)
+ LOG(INFO) << "error reason: " << strerror(errno);
+
+ return result;
+}
+
void SetPriority(int absolute) {
setpriority(PRIO_PROCESS, 0, absolute);
LOG(INFO) << "Set process priority : " << absolute;
return g_impl_lib_handle;
#if BUILDFLAG(IS_TIZEN_TV)
- g_upgrade_lib = (g_upgrade_lib && !access(CHROMIUM_UPGRADE_LIB_PATH, F_OK));
+ bool apply_upgrade = false;
+ if (g_upgrade_lib && upgradeTPKExists()) {
+ LOG(INFO) << "policy: " << g_upgrade_lib
+ << ", RW TPK found, attempt to mount RW TPK";
+ if (upgradeTPKMounted()) {
+ LOG(INFO) << "RW TPK mount already done. Load RW package.";
+ apply_upgrade = true;
+ } else {
+ LOG(INFO) << "Waiting for RW TPK mount done. Max wait: "
+ << kUpgradeMountTimeout << "ms";
+ int ret =
+ LwipcWaitEvent(kChromiumUpgradeMountReady, kUpgradeMountTimeout);
+ if (ret != 0) {
+ LOG(INFO) << "RW TPK exists, but mount failed. Load RO package.";
+ apply_upgrade = false;
+ } else {
+ LOG(INFO) << "RW TPK mount done. Load RW package.";
+ apply_upgrade = true;
+ }
+ }
+ }
const char* path =
- g_upgrade_lib ? CHROMIUM_UPGRADE_LIB_PATH : CHROMIUM_PRELOAD_LIB_PATH;
+ apply_upgrade ? CHROMIUM_UPGRADE_LIB_PATH : CHROMIUM_PRELOAD_LIB_PATH;
#else
const char* path = CHROMIUM_PRELOAD_LIB_PATH;
#endif
#if BUILDFLAG(IS_TIZEN_TV)
LOG(INFO) << "ewk_wait_chromium_ready called. timeout : " << timeout_msec;
- int ret = LwipcWaitEvent(kChromiumMountReady, timeout_msec);
+ int ret = LwipcWaitEvent(kChromiumUpdateOrPreloadMountReady, timeout_msec);
if (ret == 0) {
- LOG(INFO) << "chromium mount is done.";
+ LOG(INFO) << "update or preload chromium mount is done.";
return true;
}
+
LOG(ERROR) << "chromium mount is not ready yet: "
<< (ret > 0 ? "timeout" : "fail");
#else
#if BUILDFLAG(IS_TIZEN_TV)
LOG(INFO) << "ewk_check_chromium_ready called.";
- if (LwipcIsDone(kChromiumMountReady) > 0) {
- LOG(INFO) << "chromium mount is done.";
+ if (LwipcIsDone(kChromiumUpdateOrPreloadMountReady) > 0) {
+ LOG(INFO) << "update or preload chromium mount is done.";
return true;
}
LOG(ERROR) << "chromium mount is not ready yet.";