summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-02-11 03:55:26 +0100
committerAndroid Git Automerger <android-git-automerger@android.com>2015-02-11 03:55:26 +0100
commite999d0071defdff7d9ee8f3553f2a9607bca8780 (patch)
tree7937dbb2ee729a62bbd68580a7cd34b3a98f50c2
parentam ec5c1c1e: am 99e084ca: Merge "Remove dead/unused code and realign some of the comments to make it more cleaner and easier to read" (diff)
parentresolved conflicts for merge of 35efcd27 to lmp-mr1-dev-plus-aosp (diff)
downloadandroid_bootable_recovery-e999d0071defdff7d9ee8f3553f2a9607bca8780.tar
android_bootable_recovery-e999d0071defdff7d9ee8f3553f2a9607bca8780.tar.gz
android_bootable_recovery-e999d0071defdff7d9ee8f3553f2a9607bca8780.tar.bz2
android_bootable_recovery-e999d0071defdff7d9ee8f3553f2a9607bca8780.tar.lz
android_bootable_recovery-e999d0071defdff7d9ee8f3553f2a9607bca8780.tar.xz
android_bootable_recovery-e999d0071defdff7d9ee8f3553f2a9607bca8780.tar.zst
android_bootable_recovery-e999d0071defdff7d9ee8f3553f2a9607bca8780.zip
Diffstat (limited to '')
-rw-r--r--adb_install.cpp4
-rw-r--r--common.h3
-rw-r--r--recovery.cpp9
3 files changed, 10 insertions, 6 deletions
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");
diff --git a/common.h b/common.h
index 768f499f9..4f1c099df 100644
--- a/common.h
+++ b/common.h
@@ -17,6 +17,7 @@
#ifndef RECOVERY_COMMON_H
#define RECOVERY_COMMON_H
+#include <stdbool.h>
#include <stdio.h>
#include <stdarg.h>
@@ -46,6 +47,8 @@ FILE* fopen_path(const char *path, const char *mode);
void ui_print(const char* format, ...);
+bool is_ro_debuggable();
+
#ifdef __cplusplus
}
#endif
diff --git a/recovery.cpp b/recovery.cpp
index 1d22b248a..e42474e73 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -169,6 +169,11 @@ fopen_path(const char *path, const char *mode) {
return fp;
}
+bool is_ro_debuggable() {
+ char value[PROPERTY_VALUE_MAX+1];
+ return (property_get("ro.debuggable", value, NULL) == 1 && value[0] == '1');
+}
+
static void redirect_stdio(const char* filename) {
// If these fail, there's not really anywhere to complain...
freopen(filename, "a", stdout); setbuf(stdout, NULL);
@@ -1111,9 +1116,7 @@ main(int argc, char **argv) {
// If this is an eng or userdebug build, then automatically
// turn the text display on if the script fails so the error
// message is visible.
- char buffer[PROPERTY_VALUE_MAX+1];
- property_get("ro.build.fingerprint", buffer, "");
- if (strstr(buffer, ":userdebug/") || strstr(buffer, ":eng/")) {
+ if (is_ro_debuggable()) {
ui->ShowText(true);
}
}