Commit 75aa6157 authored by Ethan Yonker's avatar Ethan Yonker

Make legacy props an option disabled by default

Change-Id: Id0bb17ebd11e120b4676c41d6553e6a830ac7ee9
parent 8373cfe2
...@@ -833,15 +833,20 @@ void DataManager::SetDefaultValues() ...@@ -833,15 +833,20 @@ void DataManager::SetDefaultValues()
#else #else
mConst.SetValue("tw_has_boot_slots", "0"); mConst.SetValue("tw_has_boot_slots", "0");
#endif #endif
#ifdef TW_NO_LEGACY_PROPS
LOGINFO("TW_NO_LEGACY_PROPS := true\n");
mConst.SetValue("tw_enable_legacy_props", "0");
#endif
#ifdef TW_OEM_BUILD #ifdef TW_OEM_BUILD
LOGINFO("TW_OEM_BUILD := true\n"); LOGINFO("TW_OEM_BUILD := true\n");
mConst.SetValue("tw_oem_build", "1"); mConst.SetValue("tw_oem_build", "1");
mConst.SetValue("tw_enable_legacy_props", "0");
#else #else
mConst.SetValue("tw_oem_build", "0"); mConst.SetValue("tw_oem_build", "0");
mPersist.SetValue("tw_app_prompt", "1"); mPersist.SetValue("tw_app_prompt", "1");
mPersist.SetValue("tw_app_install_system", "1"); mPersist.SetValue("tw_app_install_system", "1");
mData.SetValue("tw_app_install_status", "0"); // 0 = no status, 1 = not installed, 2 = already installed mData.SetValue("tw_app_install_status", "0"); // 0 = no status, 1 = not installed, 2 = already installed
mPersist.SetValue("tw_enable_legacy_props", "0");
#endif #endif
pthread_mutex_unlock(&m_valuesLock); pthread_mutex_unlock(&m_valuesLock);
......
...@@ -447,6 +447,12 @@ ...@@ -447,6 +447,12 @@
<data variable="tw_install_reboot"/> <data variable="tw_install_reboot"/>
</checkbox> </checkbox>
<checkbox>
<placement x="%col1_x_right%" y="%row13a_y%"/>
<text>{@enable_legacy_props_chk=Enable legacy properties for old zips}</text>
<data variable="tw_enable_legacy_props"/>
</checkbox>
<button style="main_button_half_width"> <button style="main_button_half_width">
<placement x="%col1_x_left%" y="%row15a_y%"/> <placement x="%col1_x_left%" y="%row15a_y%"/>
<text>{@zip_add_btn=Add more Zips}</text> <text>{@zip_add_btn=Add more Zips}</text>
......
...@@ -82,6 +82,7 @@ ...@@ -82,6 +82,7 @@
<string name="folder">Folder:</string> <string name="folder">Folder:</string>
<string name="file">File:</string> <string name="file">File:</string>
<string name="zip_sig_chk">Zip signature verification</string> <string name="zip_sig_chk">Zip signature verification</string>
<string name="enable_legacy_props_chk">Enable legacy properties for old zips</string>
<string name="inject_twrp_chk">Inject TWRP after install</string> <string name="inject_twrp_chk">Inject TWRP after install</string>
<string name="install_reboot_chk">Reboot after installation is complete</string> <string name="install_reboot_chk">Reboot after installation is complete</string>
<string name="options_hdr">Options</string> <string name="options_hdr">Options</string>
......
...@@ -393,8 +393,14 @@ ...@@ -393,8 +393,14 @@
</checkbox> </checkbox>
<checkbox> <checkbox>
<condition var1="tw_has_injecttwrp" var2="1"/>
<placement x="%indent%" y="%row15_y%"/> <placement x="%indent%" y="%row15_y%"/>
<text>{@enable_legacy_props_chk=Enable legacy properties for old zips}</text>
<data variable="tw_enable_legacy_props"/>
</checkbox>
<checkbox>
<condition var1="tw_has_injecttwrp" var2="1"/>
<placement x="%indent%" y="%row16a_y%"/>
<text>{@inject_twrp_chk=Inject TWRP after install}</text> <text>{@inject_twrp_chk=Inject TWRP after install}</text>
<data variable="tw_inject_after_zip"/> <data variable="tw_inject_after_zip"/>
</checkbox> </checkbox>
......
...@@ -555,6 +555,12 @@ ...@@ -555,6 +555,12 @@
<data variable="tw_install_reboot"/> <data variable="tw_install_reboot"/>
</checkbox> </checkbox>
<checkbox>
<placement x="%indent%" y="%row5a_y%"/>
<text>{@enable_legacy_props_chk=Enable legacy properties for old zips}</text>
<data variable="tw_enable_legacy_props"/>
</checkbox>
<button> <button>
<placement x="%col1_x_left%" y="%row11_y%"/> <placement x="%col1_x_left%" y="%row11_y%"/>
<highlight color="%highlight_color%"/> <highlight color="%highlight_color%"/>
......
...@@ -60,7 +60,6 @@ extern "C" { ...@@ -60,7 +60,6 @@ extern "C" {
} }
#define AB_OTA "payload_properties.txt" #define AB_OTA "payload_properties.txt"
//#define TW_NO_LEGACY_PROPS 1
static const char* properties_path = "/dev/__properties__"; static const char* properties_path = "/dev/__properties__";
static const char* properties_path_renamed = "/dev/__properties_kk__"; static const char* properties_path_renamed = "/dev/__properties_kk__";
...@@ -174,11 +173,13 @@ static int Run_Update_Binary(const char *path, ZipWrap *Zip, int* wipe_cache, zi ...@@ -174,11 +173,13 @@ static int Run_Update_Binary(const char *path, ZipWrap *Zip, int* wipe_cache, zi
FILE* child_data; FILE* child_data;
#ifndef TW_NO_LEGACY_PROPS #ifndef TW_NO_LEGACY_PROPS
/* Set legacy properties */ if (DataManager::GetIntValue("tw_enable_legacy_props") != 0) {
if (switch_to_legacy_properties() != 0) { /* Set legacy properties */
LOGERR("Legacy property environment did not initialize successfully. Properties may not be detected.\n"); if (switch_to_legacy_properties() != 0) {
} else { LOGERR("Legacy property environment did not initialize successfully. Properties may not be detected.\n");
LOGINFO("Legacy property environment initialized.\n"); } else {
LOGINFO("Legacy property environment initialized.\n");
}
} }
#endif #endif
...@@ -259,12 +260,14 @@ static int Run_Update_Binary(const char *path, ZipWrap *Zip, int* wipe_cache, zi ...@@ -259,12 +260,14 @@ static int Run_Update_Binary(const char *path, ZipWrap *Zip, int* wipe_cache, zi
int waitrc = TWFunc::Wait_For_Child(pid, &status, "Updater"); int waitrc = TWFunc::Wait_For_Child(pid, &status, "Updater");
#ifndef TW_NO_LEGACY_PROPS #ifndef TW_NO_LEGACY_PROPS
/* Unset legacy properties */ if (DataManager::GetIntValue("tw_enable_legacy_props") != 0) {
if (legacy_props_path_modified) { /* Unset legacy properties */
if (switch_to_new_properties() != 0) { if (legacy_props_path_modified) {
LOGERR("Legacy property environment did not disable successfully. Legacy properties may still be in use.\n"); if (switch_to_new_properties() != 0) {
} else { LOGERR("Legacy property environment did not disable successfully. Legacy properties may still be in use.\n");
LOGINFO("Legacy property environment disabled.\n"); } else {
LOGINFO("Legacy property environment disabled.\n");
}
} }
} }
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment