diff options
-rw-r--r-- | data.cpp | 53 | ||||
-rw-r--r-- | data.hpp | 5 | ||||
-rw-r--r-- | gui/theme/common/languages/cz.xml | 2 | ||||
-rw-r--r-- | gui/theme/common/languages/de.xml | 2 | ||||
-rw-r--r-- | gui/theme/common/languages/el.xml | 2 | ||||
-rw-r--r-- | gui/theme/common/languages/fr.xml | 8 | ||||
-rw-r--r-- | gui/theme/common/languages/it.xml | 4 | ||||
-rw-r--r-- | gui/theme/common/languages/nl.xml | 26 | ||||
-rw-r--r-- | gui/theme/common/languages/pl.xml | 2 | ||||
-rw-r--r-- | gui/theme/common/languages/pt_BR.xml | 4 | ||||
-rw-r--r-- | gui/theme/common/languages/sv.xml | 3 | ||||
-rw-r--r-- | gui/theme/common/languages/tr.xml | 4 | ||||
-rw-r--r-- | partition.cpp | 12 | ||||
-rw-r--r-- | prebuilt/Android.mk | 3 | ||||
-rw-r--r-- | twrp-functions.cpp | 63 | ||||
-rw-r--r-- | twrp-functions.hpp | 2 |
16 files changed, 137 insertions, 58 deletions
@@ -230,7 +230,7 @@ int DataManager::ResetDefaults() int DataManager::LoadValues(const string& filename) { - string str, dev_id; + string dev_id; if (!mInitialized) SetDefaultValues(); @@ -263,6 +263,44 @@ int DataManager::LoadValues(const string& filename) return 0; } +int DataManager::LoadPersistValues(void) +{ + static bool loaded = false; + string dev_id; + + // Only run this function once, and make sure normal settings file has not yet been read + if (loaded || !mBackingFile.empty() || !TWFunc::Path_Exists(PERSIST_SETTINGS_FILE)) + return -1; + + LOGINFO("Attempt to load settings from /persist settings file...\n"); + + if (!mInitialized) + SetDefaultValues(); + + GetValue("device_id", dev_id); + mPersist.SetFile(PERSIST_SETTINGS_FILE); + mPersist.SetFileVersion(FILE_VERSION); + + // Read in the file, if possible + pthread_mutex_lock(&m_valuesLock); + mPersist.LoadValues(); + +#ifndef TW_NO_SCREEN_TIMEOUT + blankTimer.setTime(mPersist.GetIntValue("tw_screen_timeout_secs")); +#endif + + update_tz_environment_variables(); + TWFunc::Set_Brightness(GetStrValue("tw_brightness")); + + pthread_mutex_unlock(&m_valuesLock); + + /* Don't set storage nor backup paths this early */ + + loaded = true; + + return 0; +} + int DataManager::Flush() { return SaveValues(); @@ -271,6 +309,15 @@ int DataManager::Flush() int DataManager::SaveValues() { #ifndef TW_OEM_BUILD + if (PartitionManager.Mount_By_Path("/persist", false)) { + mPersist.SetFile(PERSIST_SETTINGS_FILE); + mPersist.SetFileVersion(FILE_VERSION); + pthread_mutex_lock(&m_valuesLock); + mPersist.SaveValues(); + pthread_mutex_unlock(&m_valuesLock); + LOGINFO("Saved settings file values to %s\n", PERSIST_SETTINGS_FILE); + } + if (mBackingFile.empty()) return -1; @@ -284,7 +331,7 @@ int DataManager::SaveValues() pthread_mutex_unlock(&m_valuesLock); tw_set_default_metadata(mBackingFile.c_str()); - LOGINFO("Saved settings file values\n"); + LOGINFO("Saved settings file values to '%s'\n", mBackingFile.c_str()); #endif // ifdef TW_OEM_BUILD return 0; } @@ -353,7 +400,7 @@ int DataManager::GetValue(const string& varName, float& value) return 0; } -unsigned long long DataManager::GetValue(const string& varName, unsigned long long& value) +int DataManager::GetValue(const string& varName, unsigned long long& value) { string data; @@ -23,6 +23,8 @@ #include <pthread.h> #include "infomanager.hpp" +#define PERSIST_SETTINGS_FILE "/persist/.twrps" + using namespace std; class DataManager @@ -30,13 +32,14 @@ class DataManager public: static int ResetDefaults(); static int LoadValues(const string& filename); + static int LoadPersistValues(void); static int Flush(); // Core get routines static int GetValue(const string& varName, string& value); static int GetValue(const string& varName, int& value); static int GetValue(const string& varName, float& value); - static unsigned long long GetValue(const string& varName, unsigned long long& value); + static int GetValue(const string& varName, unsigned long long& value); // Helper functions static string GetStrValue(const string& varName); diff --git a/gui/theme/common/languages/cz.xml b/gui/theme/common/languages/cz.xml index bb9fff930..479562217 100644 --- a/gui/theme/common/languages/cz.xml +++ b/gui/theme/common/languages/cz.xml @@ -511,7 +511,7 @@ <string name="done">Hotovo.</string> <string name="start_partition_sd">Dělení SD karty...</string> <string name="partition_sd_locate">Nelze najít zařízení na rozdělení.</string> - <string name="ext_swap_size">Velikost EXT + Swap je větší jako velikost SD-karty.</string> + <string name="ext_swap_size">Velikost EXT + Swap je větší jako velikost SD karty.</string> <string name="remove_part_table">Vymazávání tabulky rozdělení...</string> <string name="unable_rm_part">Nelze vymazat tabulku rozdělení.</string> <string name="create_part">Vytváření oddílu {1}...</string> diff --git a/gui/theme/common/languages/de.xml b/gui/theme/common/languages/de.xml index 9d953a784..e629ec37d 100644 --- a/gui/theme/common/languages/de.xml +++ b/gui/theme/common/languages/de.xml @@ -464,7 +464,7 @@ <string name="swipe_to_sideload">ADB Sideload starten</string> <string name="swipe_sideload">Start</string> <string name="sideload_confirm">ADB Sideload</string> - <string name="sideload_usage">Syntax: adb sideload Dateiname.zip</string> + <string name="sideload_usage">Syntax: adb sideload dateiname.zip</string> <string name="sideload_complete">ADB Sideload abgeschlossen</string> <string name="fix_contexts_hdr">SELinux Kontexte</string> <string name="fix_contexts_note1">Das Korrigieren der Kontexte wird selten benötigt!</string> diff --git a/gui/theme/common/languages/el.xml b/gui/theme/common/languages/el.xml index 2af1a8ff6..271b08721 100644 --- a/gui/theme/common/languages/el.xml +++ b/gui/theme/common/languages/el.xml @@ -17,7 +17,7 @@ <string name="data_backup">Data (εκτός αποθ. χώρου)</string> <string name="sdcard">Κάρτα SD</string> <string name="internal">Εσωτερικός χώρος αποθήκευσης</string> - <string name="microsd">Micro SDCard</string> + <string name="microsd">Κάρτα Micro SD</string> <string name="usbotg">USB OTG</string> <string name="android_secure">Android secure</string> <string name="dalvik">Dalvik / ART Cache</string> diff --git a/gui/theme/common/languages/fr.xml b/gui/theme/common/languages/fr.xml index 9768a6ab2..80e781a62 100644 --- a/gui/theme/common/languages/fr.xml +++ b/gui/theme/common/languages/fr.xml @@ -16,7 +16,7 @@ <string name="data">Données</string> <string name="sdcard">Carte SD</string> <string name="internal">Mémoire interne</string> - <string name="microsd">Carte microSD</string> + <string name="microsd">Carte micro SD</string> <string name="usbotg">USB OTG</string> <string name="android_secure">Android Sécurisé</string> <string name="dalvik">Cache Dalvik / ART</string> @@ -61,7 +61,7 @@ <string name="adb_sideload_btn">Transfert via ADB</string> <string name="install_hdr">Installer</string> <string name="select_storage_hdr">Sélectionner l'emplacement</string> - <string name="select_storage_btn">Sélectionner l'emplacement</string> + <string name="select_storage_btn">Sélect. l'emplacement</string> <string name="queue_hdr">Mettre en file d'attente</string> <string name="zip_queue_count">%tw_zip_queue_count% de max de 10 fichiers en file d'attente</string> <string name="zip_queue_count_s">Fichier %tw_zip_queue_count% sur 10 :</string> @@ -228,7 +228,7 @@ <string name="restore_try_decrypt_s">Tentative de décryptage</string> <string name="restore_backup_date">Sauvegarde effectuée sur %tw_restore_file_date%</string> <string name="restore_sel_part">Sélectionner les Partitions à restaurer :</string> - <string name="restore_enable_digest_chk" version="2">Activer la vérification Digest des fichiers de sauvegarde</string> + <string name="restore_enable_digest_chk" version="2">Activer la vérif. Digest des fichiers de sauvegarde</string> <string name="restore_completed">Restauration terminée</string> <string name="swipe_restore">Glisser pour Restaurer</string> <string name="swipe_restore_s">Restaurer</string> @@ -290,7 +290,7 @@ <string name="ctr_navbar_rdo">Centrer les Boutons de la barre de navigation</string> <string name="lft_navbar_rdo">Aligner les boutons de la barre de navigation à gauche</string> <string name="rht_navbar_rdo">Aligner les boutons de barre de navigation à droite</string> - <string name="restore_defaults_btn">Rétablir les paramètres par défaut</string> + <string name="restore_defaults_btn">Rétablir les param. par défaut</string> <string name="settings_tz_btn">Fuseau horaire</string> <string name="settings_screen_btn">Écran</string> <string name="settings_screen_bright_btn">Luminosité</string> diff --git a/gui/theme/common/languages/it.xml b/gui/theme/common/languages/it.xml index 57cbe9ae0..71f7636b3 100644 --- a/gui/theme/common/languages/it.xml +++ b/gui/theme/common/languages/it.xml @@ -20,9 +20,9 @@ <string name="cache">Cache</string> <string name="data">Data</string> <string name="data_backup">Data (escl. archivio)</string> - <string name="sdcard">SDCard</string> + <string name="sdcard">Scheda SD</string> <string name="internal">Archivio interno</string> - <string name="microsd">Micro SD</string> + <string name="microsd">Scheda Micro SD</string> <string name="usbotg">USB OTG</string> <string name="android_secure">Android Secure</string> <string name="dalvik">Dalvik / ART Cache</string> diff --git a/gui/theme/common/languages/nl.xml b/gui/theme/common/languages/nl.xml index d4dd7bfee..e716a91a3 100644 --- a/gui/theme/common/languages/nl.xml +++ b/gui/theme/common/languages/nl.xml @@ -19,9 +19,9 @@ <string name="recovery">Recovery</string> <string name="cache">Cache</string> <string name="data">Data</string> - <string name="sdcard">SD Kaart</string> + <string name="sdcard">SD kaart</string> <string name="internal">Interne opslag</string> - <string name="microsd">Micro SDCard</string> + <string name="microsd">Micro SD kaart</string> <string name="usbotg">USB OTG</string> <string name="android_secure">Android Secure</string> <string name="dalvik">Dalvik / ART Cache</string> @@ -300,7 +300,7 @@ <string name="ctr_navbar_rdo">Navbar knoppen centreren</string> <string name="lft_navbar_rdo">Navbar knoppen links uitlijnen</string> <string name="rht_navbar_rdo">Navbar knoppen rechts uitlijnen</string> - <string name="restore_defaults_btn">Standaardwaarden herstellen</string> + <string name="restore_defaults_btn">Standaardwaarden herst.</string> <string name="settings_tz_btn">Tijdzone</string> <string name="settings_screen_btn">Scherm</string> <string name="settings_screen_bright_btn">Scherm helderheid</string> @@ -363,12 +363,12 @@ <string name="sel_lang_btn">Taal selecteren</string> <string name="set_language_btn">Taal instellen</string> <string name="advanced_hdr">Geavanceerd</string> - <string name="copy_log_confirm">Log naar SD-kaart kopiëren?</string> - <string name="copying_log">Log naar SD-kaart kopiëren...</string> + <string name="copy_log_confirm">Log naar SD kaart kopiëren?</string> + <string name="copying_log">Log naar SD kaart kopiëren...</string> <string name="copy_log_complete">Log kopie voltooid</string> <string name="fix_context_btn">Context repareren</string> - <string name="part_sd_btn">SD-kaart Partitioneren</string> - <string name="part_sd_s_btn">SD-kaart</string> + <string name="part_sd_btn">SD kaart Partitioneren</string> + <string name="part_sd_s_btn">SD kaart</string> <string name="file_manager_btn">Bestandsbeheer</string> <string name="language_hdr">Taal</string> <string name="terminal_btn">Terminal</string> @@ -379,9 +379,9 @@ <string name="injecting_twrp">TWRP Opnieuw injecteren...</string> <string name="inject_twrp_complete">TWRP injectie voltooid</string> <string name="swipe_to_confirm">Veeg om te bevestigen</string> - <string name="part_sd_hdr">SD-kaart Partitioneren</string> + <string name="part_sd_hdr">SD kaart Partitioneren</string> <string name="invalid_partsd_sel">U moet een verwisselbaar apparaat selecteren</string> - <string name="part_sd_lose">U verliest alle bestanden op uw SD-kaart!</string> + <string name="part_sd_lose">U verliest alle bestanden op uw SD kaart!</string> <string name="part_sd_undo">Deze actie kan niet ongedaan gemaakt worden!</string> <string name="part_sd_ext_sz">EXT-grootte:</string> <string name="part_sd_swap_sz">Swap grootte:</string> @@ -390,7 +390,7 @@ <string name="file_system">Bestandsysteem:</string> <string name="swipe_part_sd">Veeg om te partitioneren</string> <string name="swipe_part_sd_s">Partitie</string> - <string name="partitioning_sd">SD-kaart partitioneren...</string> + <string name="partitioning_sd">SD kaart partitioneren...</string> <string name="partitioning_sd2">Dit duurt een paar minuten.</string> <string name="part_sd_complete">Partitionering voltooid</string> <string name="dumlock_hdr">HTC Dumlock</string> @@ -471,7 +471,7 @@ <string name="swipe_su_install"> Installeren</string> <string name="su_installing">Installeren van SuperSU</string> <string name="sel_storage_list">Selecteer opslag</string> - <string name="ok_btn">Oké</string> + <string name="ok_btn">OK</string> <!-- Various console messages - these consist of user displayed messages, oftentimes errors --> <string name="no_kernel_selinux">Kernel heeft geen ondersteuning voor het lezen van SELinux contexten.</string> @@ -536,9 +536,9 @@ <string name="no_crypto_support">Er is geen crypto ondersteuning gecompileerd in deze build.</string> <string name="decrypt_success_dev">Data succesvol gedecodeerd, nieuw block device: \'{1}\'</string> <string name="done">Gereed.</string> - <string name="start_partition_sd">SD-kaart partitioneren...</string> + <string name="start_partition_sd">SD kaart partitioneren...</string> <string name="partition_sd_locate">Kan apparaat om te partitioneren niet vinden.</string> - <string name="ext_swap_size">EXT + Swap grootte zijn groter dan de sd-kaart.</string> + <string name="ext_swap_size">EXT + Swap grootte zijn groter dan de sd kaart.</string> <string name="remove_part_table">Partitie-tabel word verwijderd...</string> <string name="unable_rm_part">Kan partitie-tabel niet verwijderen.</string> <string name="create_part">Partitie {1} aanmaken...</string> diff --git a/gui/theme/common/languages/pl.xml b/gui/theme/common/languages/pl.xml index 46fe43de2..77a6aa84f 100644 --- a/gui/theme/common/languages/pl.xml +++ b/gui/theme/common/languages/pl.xml @@ -21,7 +21,7 @@ <string name="data">Data</string> <string name="sdcard">Karta SD</string> <string name="internal">Pamięć Wewnętrzna</string> - <string name="microsd">Karta MicroSD</string> + <string name="microsd">Karta Micro SD</string> <string name="usbotg">USB OTG</string> <string name="android_secure">Android Secure</string> <string name="dalvik">Dalvik / ART Cache</string> diff --git a/gui/theme/common/languages/pt_BR.xml b/gui/theme/common/languages/pt_BR.xml index 7e301f157..fa7fa099f 100644 --- a/gui/theme/common/languages/pt_BR.xml +++ b/gui/theme/common/languages/pt_BR.xml @@ -17,9 +17,9 @@ <string name="recovery">Recuperação</string> <string name="cache">Cache</string> <string name="data">Dados</string> - <string name="sdcard">SDCard</string> + <string name="sdcard">Cartão SD</string> <string name="internal">Armazenamento interno</string> - <string name="microsd">Micro SDCard</string> + <string name="microsd">Cartão Micro SD</string> <string name="usbotg">USB OTG</string> <string name="android_secure">Android Seguro</string> <string name="dalvik">Dalvik / Cache de arte</string> diff --git a/gui/theme/common/languages/sv.xml b/gui/theme/common/languages/sv.xml index 73a6e4581..076ee0b5e 100644 --- a/gui/theme/common/languages/sv.xml +++ b/gui/theme/common/languages/sv.xml @@ -13,8 +13,9 @@ <string name="vendor">Leverantör</string> <string name="cache">Cache</string> <string name="data">Data</string> - <string name="sdcard">SDCard</string> + <string name="sdcard">SD-kort</string> <string name="internal">Intern lagring</string> + <string name="microsd">Micro SD-kort</string> <string name="usbotg">USB OTG</string> <string name="dalvik">Dalvik / ART Cache</string> <string name="sdext">SD-EXT</string> diff --git a/gui/theme/common/languages/tr.xml b/gui/theme/common/languages/tr.xml index 4c3ee2cc7..6ae1c25da 100644 --- a/gui/theme/common/languages/tr.xml +++ b/gui/theme/common/languages/tr.xml @@ -19,7 +19,7 @@ <string name="data">Veri</string> <string name="sdcard">SD Kart</string> <string name="internal">Dahili Depolama</string> - <string name="microsd">Micro SDCard</string> + <string name="microsd">Micro SD Kart</string> <string name="usbotg">USB OTG</string> <string name="android_secure">Android Secure</string> <string name="dalvik">Dalvik / ART Önbelleği</string> @@ -450,7 +450,7 @@ <string name="swipe_su_install"> Yükle</string> <string name="su_installing">SuperSU Yükleniyor</string> <string name="sel_storage_list">Depolama Seç</string> - <string name="ok_btn">Tamam</string> + <string name="ok_btn">OK</string> <string name="no_kernel_selinux">Kernel SELinux içeriklerini okuma desteğine sahip değil.</string> <string name="full_selinux">Tam SELinux desteği mevcut.</string> <string name="no_selinux">SELinux desteği yok (libselinux yok).</string> diff --git a/partition.cpp b/partition.cpp index 3957c6542..59bd16831 100644 --- a/partition.cpp +++ b/partition.cpp @@ -581,6 +581,18 @@ bool TWPartition::Process_Fstab_Line(const char *fstab_line, bool Display_Error, Process_TW_Flags(flagptr, Display_Error, 1); // Forcing the fstab to ver 1 because this data is coming from the /etc/twrp.flags which should be using the TWRP v1 flags format } } + + if (Mount_Point == "/persist" && Can_Be_Mounted) { + bool mounted = Is_Mounted(); + if (mounted || Mount(false)) { + // Read the backup settings file + DataManager::LoadPersistValues(); + TWFunc::Fixup_Time_On_Boot("/persist/time/"); + if (!mounted) + UnMount(false); + } + } + return true; } diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk index 7b950fcef..b54dda288 100644 --- a/prebuilt/Android.mk +++ b/prebuilt/Android.mk @@ -34,6 +34,9 @@ RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/pigz RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/fsck.fat RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/fatlabel RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/mkfs.fat +ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 27; echo $$?),0) + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/adbd +endif RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/e2fsck RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/mke2fs RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/tune2fs diff --git a/twrp-functions.cpp b/twrp-functions.cpp index 5df44c69a..b7bcebe2d 100644 --- a/twrp-functions.cpp +++ b/twrp-functions.cpp @@ -881,9 +881,12 @@ void TWFunc::Auto_Generate_Backup_Name() { } } -void TWFunc::Fixup_Time_On_Boot() +void TWFunc::Fixup_Time_On_Boot(const string& time_paths /* = "" */) { #ifdef QCOM_RTC_FIX + static bool fixed = false; + if (fixed) + return; LOGINFO("TWFunc::Fixup_Time: Pre-fix date and time: %s\n", TWFunc::Get_Current_Date().c_str()); @@ -904,6 +907,7 @@ void TWFunc::Fixup_Time_On_Boot() if (tv.tv_sec > 1405209403) { // Anything older then 12 Jul 2014 23:56:43 GMT will do nicely thank you ;) LOGINFO("TWFunc::Fixup_Time: Date and time corrected: %s\n", TWFunc::Get_Current_Date().c_str()); + fixed = true; return; } @@ -925,22 +929,28 @@ void TWFunc::Fixup_Time_On_Boot() // Like, ats_1 is for modem and ats_2 is for TOD (time of day?). // Look at file time_genoff.h in CodeAurora, qcom-opensource/time-services - static const char *paths[] = { "/data/system/time/", "/data/time/" }; + std::vector<std::string> paths; // space separated list of paths + if (time_paths.empty()) { + paths = Split_String("/data/system/time/ /data/time/", " "); + if (!PartitionManager.Mount_By_Path("/data", false)) + return; + } else { + // When specific path(s) are used, Fixup_Time needs those + // partitions to already be mounted! + paths = Split_String(time_paths, " "); + } FILE *f; offset = 0; struct dirent *dt; std::string ats_path; - if (!PartitionManager.Mount_By_Path("/data", false)) - return; - // Prefer ats_2, it seems to be the one we want according to logcat on hammerhead // - it is the one for ATS_TOD (time of day?). // However, I never saw a device where the offset differs between ats files. - for (size_t i = 0; i < (sizeof(paths)/sizeof(paths[0])); ++i) + for (size_t i = 0; i < paths.size(); ++i) { - DIR *d = opendir(paths[i]); + DIR *d = opendir(paths[i].c_str()); if (!d) continue; @@ -950,34 +960,38 @@ void TWFunc::Fixup_Time_On_Boot() continue; if (ats_path.empty() || strcmp(dt->d_name, "ats_2") == 0) - ats_path = std::string(paths[i]).append(dt->d_name); + ats_path = paths[i] + dt->d_name; } closedir(d); } - if (ats_path.empty()) - { + if (ats_path.empty()) { LOGINFO("TWFunc::Fixup_Time: no ats files found, leaving untouched!\n"); - return; - } - - f = fopen(ats_path.c_str(), "r"); - if (!f) - { + } else if ((f = fopen(ats_path.c_str(), "r")) == NULL) { LOGINFO("TWFunc::Fixup_Time: failed to open file %s\n", ats_path.c_str()); - return; - } - - if (fread(&offset, sizeof(offset), 1, f) != 1) - { + } else if (fread(&offset, sizeof(offset), 1, f) != 1) { LOGINFO("TWFunc::Fixup_Time: failed load uint64 from file %s\n", ats_path.c_str()); fclose(f); - return; + } else { + fclose(f); + + LOGINFO("TWFunc::Fixup_Time: Setting time offset from file %s, offset %llu\n", ats_path.c_str(), (unsigned long long) offset); + DataManager::SetValue("tw_qcom_ats_offset", (unsigned long long) offset, 1); + fixed = true; } - fclose(f); - LOGINFO("TWFunc::Fixup_Time: Setting time offset from file %s, offset %llu\n", ats_path.c_str(), offset); + if (!fixed) { + // Failed to get offset from ats file, check twrp settings + unsigned long long value; + if (DataManager::GetValue("tw_qcom_ats_offset", value) < 0) { + return; + } else { + offset = (uint64_t) value; + LOGINFO("TWFunc::Fixup_Time: Setting time offset from twrp setting file, offset %llu\n", (unsigned long long) offset); + // Do not consider the settings file as a definitive answer, keep fixed=false so next run will try ats files again + } + } gettimeofday(&tv, NULL); @@ -993,7 +1007,6 @@ void TWFunc::Fixup_Time_On_Boot() settimeofday(&tv, NULL); LOGINFO("TWFunc::Fixup_Time: Date and time corrected: %s\n", TWFunc::Get_Current_Date().c_str()); - #endif } diff --git a/twrp-functions.hpp b/twrp-functions.hpp index 9c149ea18..a1f67f237 100644 --- a/twrp-functions.hpp +++ b/twrp-functions.hpp @@ -88,7 +88,7 @@ public: static string System_Property_Get(string Prop_Name); // Returns value of Prop_Name from reading /system/build.prop static string Get_Current_Date(void); // Returns the current date in ccyy-m-dd--hh-nn-ss format static void Auto_Generate_Backup_Name(); // Populates TW_BACKUP_NAME with a backup name based on current date and ro.build.display.id from /system/build.prop - static void Fixup_Time_On_Boot(); // Fixes time on devices which need it + static void Fixup_Time_On_Boot(const string& time_paths = ""); // Fixes time on devices which need it (time_paths is a space separated list of paths to check for ats_* files) static std::vector<std::string> Split_String(const std::string& str, const std::string& delimiter, bool removeEmpty = true); // Splits string by delimiter static bool Create_Dir_Recursive(const std::string& path, mode_t mode = 0755, uid_t uid = -1, gid_t gid = -1); // Create directory and it's parents, if they don't exist. mode, uid and gid are set to all _newly_ created folders. If whole path exists, do nothing. static int Set_Brightness(std::string brightness_value); // Well, you can read, it does what it says, passing return int from TWFunc::Write_File ;) |