summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbigbiff bigbiff <bigbiff@teamw.in>2016-07-30 03:18:13 +0200
committerbigbiff bigbiff <bigbiff@teamw.in>2016-12-02 01:00:02 +0100
commitbad332a3d175687a732cc6e94c34bd38bdef29b8 (patch)
tree67d82429e136f29edbb19e5ae3cb7f0c51c67722
parentImprove backup & wipe exclusion handling (diff)
downloadandroid_bootable_recovery-bad332a3d175687a732cc6e94c34bd38bdef29b8.tar
android_bootable_recovery-bad332a3d175687a732cc6e94c34bd38bdef29b8.tar.gz
android_bootable_recovery-bad332a3d175687a732cc6e94c34bd38bdef29b8.tar.bz2
android_bootable_recovery-bad332a3d175687a732cc6e94c34bd38bdef29b8.tar.lz
android_bootable_recovery-bad332a3d175687a732cc6e94c34bd38bdef29b8.tar.xz
android_bootable_recovery-bad332a3d175687a732cc6e94c34bd38bdef29b8.tar.zst
android_bootable_recovery-bad332a3d175687a732cc6e94c34bd38bdef29b8.zip
-rw-r--r--gui/action.cpp12
-rw-r--r--gui/theme/common/landscape.xml49
-rw-r--r--gui/theme/common/languages/en.xml6
-rw-r--r--gui/theme/common/portrait.xml49
-rw-r--r--gui/theme/common/watch.xml41
-rw-r--r--twrp-functions.cpp10
-rw-r--r--twrp-functions.hpp1
7 files changed, 136 insertions, 32 deletions
diff --git a/gui/action.cpp b/gui/action.cpp
index a96e15ac9..223d75e25 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -639,13 +639,19 @@ int GUIAction::copylog(std::string arg __unused)
operation_start("Copy Log");
if (!simulate)
{
- string dst;
+ string dst, curr_storage;
+ int copy_kernel_log = 0;
+
+ DataManager::GetValue("tw_include_kernel_log", copy_kernel_log);
PartitionManager.Mount_Current_Storage(true);
- dst = DataManager::GetCurrentStoragePath() + "/recovery.log";
+ curr_storage = DataManager::GetCurrentStoragePath();
+ dst = curr_storage + "/recovery.log";
TWFunc::copy_file("/tmp/recovery.log", dst.c_str(), 0755);
tw_set_default_metadata(dst.c_str());
+ if (copy_kernel_log)
+ TWFunc::copy_kernel_log(curr_storage);
sync();
- gui_msg(Msg("copy_log=Copied recovery log to {1}.")(DataManager::GetCurrentStoragePath()));
+ gui_msg(Msg("copy_log=Copied recovery log to {1}")(dst));
} else
simulate_progress_bar();
operation_end(0);
diff --git a/gui/theme/common/landscape.xml b/gui/theme/common/landscape.xml
index 5c92fccd3..3aed1981e 100644
--- a/gui/theme/common/landscape.xml
+++ b/gui/theme/common/landscape.xml
@@ -3132,6 +3132,45 @@
</action>
</page>
+ <page name="copylog">
+ <template name="page"/>
+
+ <text style="text_l">
+ <placement x="%col1_x_header%" y="%row3_header_y%"/>
+ <text>{@copying_log=Copy Logs to SD Card}</text>
+ </text>
+
+ <checkbox>
+ <placement x="%indent%" y="%row4_y%"/>
+ <text>{@include_kernel_log=Include Kernel Log}</text>
+ <data variable="tw_include_kernel_log" value="1"/>
+ </checkbox>
+
+ <slider>
+ <text>{@copying_log=Copy Logs to SD Card}</text>
+ <actions>
+ <action function="set">tw_back=advanced</action>
+ <action function="set">tw_action=copylog</action>
+ <action function="set">tw_action_text1={@copying_log=Copy Logs to SD Card}</action>
+ <action function="set">tw_complete_text1={@copy_log_complete=Logs Copy Completed}</action>
+ <action function="page">action_page</action>
+ </actions>
+ </slider>
+
+ <action>
+ <touch key="home"/>
+ <action function="page">main</action>
+ </action>
+
+ <action>
+ <touch key="back"/>
+ <actions>
+ <action function="page">advanced</action>
+ </actions>
+ </action>
+
+ </page>
+
<page name="advanced">
<template name="page"/>
@@ -3143,15 +3182,7 @@
<button style="main_button">
<placement x="%col1_x_left%" y="%row2_y%"/>
<text>{@copy_log_btn=Copy Log}</text>
- <actions>
- <action function="set">tw_back=advanced</action>
- <action function="set">tw_action=copylog</action>
- <action function="set">tw_text1={@copy_log_confirm=Copy Log to SD Card?}</action>
- <action function="set">tw_action_text1={@copying_log=Copying Log to SD Card...}</action>
- <action function="set">tw_complete_text1={@copy_log_complete=Log Copy Complete}</action>
- <action function="set">tw_slider_text={@swipe_to_confirm=Swipe to Confirm}</action>
- <action function="page">confirm_action</action>
- </actions>
+ <action function="page">copylog</action>
</button>
<button style="main_button">
diff --git a/gui/theme/common/languages/en.xml b/gui/theme/common/languages/en.xml
index 6b05a8613..f4344a05d 100644
--- a/gui/theme/common/languages/en.xml
+++ b/gui/theme/common/languages/en.xml
@@ -364,8 +364,8 @@
<string name="set_language_btn">Set Language</string>
<string name="advanced_hdr">Advanced</string>
<string name="copy_log_confirm">Copy Log to SD Card?</string>
- <string name="copying_log">Copying Log to SD Card...</string>
- <string name="copy_log_complete">Log Copy Complete</string>
+ <string name="copying_log" version="2">Copying Logs to SD Card...</string>
+ <string name="copy_log_complete" version="2">Logs Copy Complete</string>
<string name="fix_context_btn">Fix Contexts</string>
<string name="part_sd_btn">Partition SD Card</string>
<string name="part_sd_s_btn">SD Card</string>
@@ -673,5 +673,7 @@
<string name="adbbackup_control_error">Cannot write to adb control channel</string>
<string name="twrp_adbbu_option">--twrp option is required to enable twrp adb backup</string>
<string name="partition_not_found">path: {1} not found in partititon list</string>
+ <string name="copy_kernel_log">Copied kernel log to {1}</string>
+ <string name="include_kernel_log">Include Kernel Log</string>
</resources>
</language>
diff --git a/gui/theme/common/portrait.xml b/gui/theme/common/portrait.xml
index e9be654a6..11ae8740e 100644
--- a/gui/theme/common/portrait.xml
+++ b/gui/theme/common/portrait.xml
@@ -3216,6 +3216,45 @@
</action>
</page>
+ <page name="copylog">
+ <template name="page"/>
+
+ <text style="text_l">
+ <placement x="%col1_x_header%" y="%row3_header_y%"/>
+ <text>{@copying_log=Copy Logs to SD Card}</text>
+ </text>
+
+ <checkbox>
+ <placement x="%indent%" y="%row4_y%"/>
+ <text>{@include_kernel_log=Include Kernel Log}</text>
+ <data variable="tw_include_kernel_log" value="1"/>
+ </checkbox>
+
+ <slider>
+ <text>{@copying_log=Copy Logs to SD Card}</text>
+ <actions>
+ <action function="set">tw_back=advanced</action>
+ <action function="set">tw_action=copylog</action>
+ <action function="set">tw_action_text1={@copying_log=Copy Logs to SD Card}</action>
+ <action function="set">tw_complete_text1={@copy_log_complete=Logs Copy Completed}</action>
+ <action function="page">action_page</action>
+ </actions>
+ </slider>
+
+ <action>
+ <touch key="home"/>
+ <action function="page">main</action>
+ </action>
+
+ <action>
+ <touch key="back"/>
+ <actions>
+ <action function="page">advanced</action>
+ </actions>
+ </action>
+
+ </page>
+
<page name="advanced">
<template name="page"/>
@@ -3227,15 +3266,7 @@
<button style="main_button">
<placement x="%indent%" y="%row2a_y%"/>
<text>{@copy_log_btn=Copy Log}</text>
- <actions>
- <action function="set">tw_back=advanced</action>
- <action function="set">tw_action=copylog</action>
- <action function="set">tw_text1={@copy_log_confirm=Copy Log to SD Card?}</action>
- <action function="set">tw_action_text1={@copying_log=Copying Log to SD Card...}</action>
- <action function="set">tw_complete_text1={@copy_log_complete=Log Copy Complete}</action>
- <action function="set">tw_slider_text={@swipe_to_confirm=Swipe to Confirm}</action>
- <action function="page">confirm_action</action>
- </actions>
+ <action function="page">copylog</action>
</button>
<button style="main_button">
diff --git a/gui/theme/common/watch.xml b/gui/theme/common/watch.xml
index f1984091f..921e72c60 100644
--- a/gui/theme/common/watch.xml
+++ b/gui/theme/common/watch.xml
@@ -237,6 +237,37 @@
</button>
</page>
+ <page name="copylog">
+ <template name="page"/>
+
+ <checkbox>
+ <placement x="%indent%" y="%row1_y%"/>
+ <text>{@include_kernel_log=Include Kernel Log}</text>
+ <data variable="tw_include_kernel_log" value="1"/>
+ </checkbox>
+
+ <slider>
+ <text>{@swipe_confirm= Confirm}</text>
+ <actions>
+ <action function="set">tw_back=main3</action>
+ <action function="set">tw_action=copylog</action>
+ <action function="set">tw_action_text1={@copying_log=Copy Logs to SD Card}</action>
+ <action function="set">tw_complete_text1={@copy_log_complete=Logs Copy Completed}</action>
+ <action function="page">action_page</action>
+ </actions>
+ </slider>
+
+ <action>
+ <touch key="back"/>
+ <action function="page">main2</action>
+ </action>
+
+ <action>
+ <touch key="home"/>
+ <action function="page">main</action>
+ </action>
+ </page>
+
<page name="main3">
<template name="page"/>
@@ -261,15 +292,7 @@
<button style="main_button">
<placement x="%col1_x_right%" y="%row6_y%"/>
<text>{@copy_log_btn=Copy Log}</text>
- <actions>
- <action function="set">tw_back=main3</action>
- <action function="set">tw_action=copylog</action>
- <action function="set">tw_text1={@copy_log_confirm=Copy Log to SD Card?}</action>
- <action function="set">tw_action_text1={@copying_log=Copying Log to SD Card...}</action>
- <action function="set">tw_complete_text1={@copy_log_complete=Log Copy Complete}</action>
- <action function="set">tw_slider_text={@swipe_confirm= Confirm}</action>
- <action function="page">confirm_action</action>
- </actions>
+ <action function="page">copylog</action>
</button>
<button style="main_button">
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index cbf473016..72674ae69 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -1070,4 +1070,14 @@ unsigned long long TWFunc::IOCTL_Get_Block_Size(const char* block_device) {
return 0;
}
+void TWFunc::copy_kernel_log(string curr_storage) {
+ std::string dmesgDst = curr_storage + "/dmesg.log";
+ std::string dmesgCmd = "/sbin/dmesg";
+
+ std::string result;
+ Exec_Cmd(dmesgCmd, result);
+ write_file(dmesgDst, result);
+ gui_msg(Msg("copy_kernel_log=Copied kernel log to {1}")(dmesgDst));
+ tw_set_default_metadata(dmesgDst.c_str());
+}
#endif // ndef BUILD_TWRPTAR_MAIN
diff --git a/twrp-functions.hpp b/twrp-functions.hpp
index 550c946f0..ebbe99d10 100644
--- a/twrp-functions.hpp
+++ b/twrp-functions.hpp
@@ -94,6 +94,7 @@ public:
static void SetPerformanceMode(bool mode); // support recovery.perf.mode
static void Disable_Stock_Recovery_Replace(); // Disable stock ROMs from replacing TWRP with stock recovery
static unsigned long long IOCTL_Get_Block_Size(const char* block_device);
+ static void copy_kernel_log(string curr_storage); // Copy Kernel Log to Current Storage (PSTORE/KMSG)
private:
static void Copy_Log(string Source, string Destination);