From f14af80a1418acdc0ae6fea3da0285a357d57182 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 10 Feb 2015 14:46:14 -0800 Subject: recovery: Properly detect userdebug or eng builds The recovery system behaves a little bit differently on userdebug or eng builds by presenting error reports to the user in the ui. This is controlled by checking the build fingerprint for the string :userdebug/ or :eng/. But with AOSP version numbers most AOSP builds blows the 92 char limit of ro.build.fingerprint and therefore the property is not set, so this condition will always be evaluated to false, for most builds. Instead of depending on the flaky ro.build.fingerprint this change uses ro.debuggable. Change-Id: I74bc00c655ac596aaf4b488ecea58f0a8de9c26b --- adb_install.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'adb_install.cpp') diff --git a/adb_install.cpp b/adb_install.cpp index be3b9a063..e3289608f 100644 --- a/adb_install.cpp +++ b/adb_install.cpp @@ -61,9 +61,7 @@ stop_adbd() { static void maybe_restart_adbd() { - char value[PROPERTY_VALUE_MAX+1]; - int len = property_get("ro.debuggable", value, NULL); - if (len == 1 && value[0] == '1') { + if (is_ro_debuggable()) { ui->Print("Restarting adbd...\n"); set_usb_driver(true); property_set("ctl.start", "adbd"); -- cgit v1.2.3 From 145d86146084b199e64c3b2db21a22c05aa30098 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Wed, 25 Mar 2015 15:51:15 -0700 Subject: Factor out option variables from int to bool types Change-Id: Ia897aa43e44d115bde6de91789b35723826ace22 --- adb_install.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'adb_install.cpp') diff --git a/adb_install.cpp b/adb_install.cpp index e3289608f..6d6dbb165 100644 --- a/adb_install.cpp +++ b/adb_install.cpp @@ -73,7 +73,7 @@ maybe_restart_adbd() { #define ADB_INSTALL_TIMEOUT 300 int -apply_from_adb(RecoveryUI* ui_, int* wipe_cache, const char* install_file) { +apply_from_adb(RecoveryUI* ui_, bool* wipe_cache, const char* install_file) { ui = ui_; stop_adbd(); -- cgit v1.2.3 From 682c34bbc32f3a9f007dd949282651ed35d4f6e3 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Tue, 7 Apr 2015 17:16:35 -0700 Subject: Rotate logs only when there are actual operations Currently it rotates the log files every time it boots into the recovery mode. We lose useful logs after ten times. This CL changes the rotation condition so that it will rotate only if it performs some actual operations that modify the flash (installs, wipes, sideloads and etc). Bug: 19695622 Change-Id: Ie708ad955ef31aa500b6590c65faa72391705940 --- adb_install.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'adb_install.cpp') diff --git a/adb_install.cpp b/adb_install.cpp index 6d6dbb165..ed15938e2 100644 --- a/adb_install.cpp +++ b/adb_install.cpp @@ -74,6 +74,8 @@ maybe_restart_adbd() { int apply_from_adb(RecoveryUI* ui_, bool* wipe_cache, const char* install_file) { + modified_flash = true; + ui = ui_; stop_adbd(); -- cgit v1.2.3 From 018ed31c515de2c840dedaebb078ab455bf37ae8 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 8 Apr 2015 16:51:36 -0700 Subject: Enable printf format argument checking. The original attempt missed the fact that Print is a member function, so the first argument is the implicit 'this'. Change-Id: I963b668c5432804c767f0a2e3ef7dea5978a1218 --- adb_install.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'adb_install.cpp') diff --git a/adb_install.cpp b/adb_install.cpp index ed15938e2..9e605e2d5 100644 --- a/adb_install.cpp +++ b/adb_install.cpp @@ -109,7 +109,7 @@ apply_from_adb(RecoveryUI* ui_, bool* wipe_cache, const char* install_file) { sleep(1); continue; } else { - ui->Print("\nTimed out waiting for package.\n\n", strerror(errno)); + ui->Print("\nTimed out waiting for package.\n\n"); result = INSTALL_ERROR; kill(child, SIGKILL); break; -- cgit v1.2.3 From 20531ef60524e6205b1d9a6c12a8335c5d97e311 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 10 Apr 2015 13:59:19 -0700 Subject: Switch minadb over to C++. Change-Id: I5afaf70caa590525627c676c88b445d3162de33e --- adb_install.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'adb_install.cpp') diff --git a/adb_install.cpp b/adb_install.cpp index 9e605e2d5..ebd4cac00 100644 --- a/adb_install.cpp +++ b/adb_install.cpp @@ -30,10 +30,8 @@ #include "install.h" #include "common.h" #include "adb_install.h" -extern "C" { #include "minadbd/fuse_adb_provider.h" #include "fuse_sideload.h" -} static RecoveryUI* ui = NULL; -- cgit v1.2.3 From 2f5feedf1d705b53e5bf90c8b5207dd91f4522f1 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 28 Apr 2015 17:24:24 -0700 Subject: Check all lseek calls succeed. Also add missing TEMP_FAILURE_RETRYs on read, write, and lseek. Bug: http://b/20625546 Change-Id: I03b198e11c1921b35518ee2dd005a7cfcf4fd94b (cherry picked from commit 7bad7c4646ee8fd8d6e6ed0ffd3ddbb0c1b41a2f) --- adb_install.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'adb_install.cpp') diff --git a/adb_install.cpp b/adb_install.cpp index ebd4cac00..e3b94ea59 100644 --- a/adb_install.cpp +++ b/adb_install.cpp @@ -42,7 +42,7 @@ set_usb_driver(bool enabled) { ui->Print("failed to open driver control: %s\n", strerror(errno)); return; } - if (write(fd, enabled ? "1" : "0", 1) < 0) { + if (TEMP_FAILURE_RETRY(write(fd, enabled ? "1" : "0", 1)) == -1) { ui->Print("failed to set driver control: %s\n", strerror(errno)); } if (close(fd) < 0) { -- cgit v1.2.3