Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d5e026e1 authored by Alessandra Loro's avatar Alessandra Loro Committed by Xin Li
Browse files

Resolve ro.debuggable at build time

Ignore-AOSP-First: cherry-pick for tm-qpr-dev
Test: n/a
Bug: 193912100
Bug: 243645021

Merged-In: I83b0021b91536335c63d19f8a65933bad1b26b4e
Change-Id: I42c4b1e81383d83c73a565c5e74ac22f17389faf
parent fc0ee916
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -14,9 +14,15 @@ cc_defaults {
        "-Wno-nullability-completeness",
        "-Os",
        "-fno-finite-loops",
        "-DANDROID_DEBUGGABLE=0",
    ],

    local_include_dirs: ["include"],
    product_variables: {
        debuggable: {
            cflags: ["-UANDROID_DEBUGGABLE", "-DANDROID_DEBUGGABLE=1"],
        }
    },
}

cc_library_headers {
+4 −3
Original line number Diff line number Diff line
@@ -62,10 +62,11 @@ void debuggerd_init(debuggerd_callbacks_t* callbacks);
#define DEBUGGER_SIGNAL BIONIC_SIGNAL_DEBUGGER

static void __attribute__((__unused__)) debuggerd_register_handlers(struct sigaction* action) {
  bool enabled = true;
#if ANDROID_DEBUGGABLE
  char value[PROP_VALUE_MAX] = "";
  bool enabled =
      !(__system_property_get("ro.debuggable", value) > 0 && !strcmp(value, "1") &&
        __system_property_get("debug.debuggerd.disable", value) > 0 && !strcmp(value, "1"));
  enabled = !(__system_property_get("debug.debuggerd.disable", value) > 0 && !strcmp(value, "1"));
#endif
  if (enabled) {
    sigaction(SIGABRT, action, nullptr);
    sigaction(SIGBUS, action, nullptr);