Merge "Add libdebugstore to palette" into main am: 6c461d76f7 am: 6a4a24db58
Original change: https://android-review.googlesource.com/c/platform/system/libartpalette/+/2853015
Change-Id: Ie8e14f420208c4123b67596cec56f86a6072eea4
Signed-off-by: Automerger Merge Worker <[email protected]>
diff --git a/Android.bp b/Android.bp
index 0669695..e938469 100644
--- a/Android.bp
+++ b/Android.bp
@@ -40,6 +40,7 @@
shared_libs: [
"libbase",
"libcutils",
+ "libdebugstore_cxx",
"liblog",
"libprocessgroup",
"libtombstoned_client",
@@ -68,6 +69,7 @@
"1",
"2",
"3",
+ "4",
],
symbol_file: "libartpalette.map.txt",
},
diff --git a/libartpalette.map.txt b/libartpalette.map.txt
index c79ddba..3727451 100644
--- a/libartpalette.map.txt
+++ b/libartpalette.map.txt
@@ -51,3 +51,9 @@
# --- VERSION 03 API ---
PaletteSetTaskProfiles; # systemapi
} LIBARTPALETTE_2;
+
+LIBARTPALETTE_4 { # introduced=36
+ global:
+ # --- VERSION 04 API ---
+ PaletteDebugStoreGetString; # systemapi
+} LIBARTPALETTE_3;
diff --git a/palette_android.cc b/palette_android.cc
index 6f27201..f9a7253 100644
--- a/palette_android.cc
+++ b/palette_android.cc
@@ -31,6 +31,7 @@
#include <android-base/macros.h>
#include <cutils/ashmem.h>
#include <cutils/trace.h>
+#include <debugstore/debugstore_cxx_bridge.rs.h>
#include <processgroup/processgroup.h>
#include <selinux/selinux.h>
#include <tombstoned/tombstoned.h>
@@ -259,3 +260,14 @@
}
return SetTaskProfiles(tid, p, false) ? PALETTE_STATUS_OK : PALETTE_STATUS_FAILED_CHECK_LOG;
}
+
+// Introduced in version 4 API, corresponding to SDK level 36.
+palette_status_t PaletteDebugStoreGetString(char* result, size_t max_size) {
+ if (result == nullptr || max_size == 0) {
+ return PALETTE_STATUS_INVALID_ARGUMENT;
+ }
+ std::string store_string = static_cast<std::string>(android::debugstore::debug_store_to_string());
+ strncpy(result, store_string.c_str(), max_size - 1);
+ result[max_size - 1] = '\0';
+ return PALETTE_STATUS_OK;
+}
\ No newline at end of file
diff --git a/palette_fake.cc b/palette_fake.cc
index e094936..08711b3 100644
--- a/palette_fake.cc
+++ b/palette_fake.cc
@@ -147,3 +147,10 @@
size_t profiles_len ATTRIBUTE_UNUSED) {
return PALETTE_STATUS_OK;
}
+
+// Introduced in version 4 API, corresponding to SDK level 36.
+palette_status_t PaletteDebugStoreGetString(char* result ATTRIBUTE_UNUSED,
+ size_t max_size ATTRIBUTE_UNUSED) {
+ result[0] = '\0';
+ return PALETTE_STATUS_OK;
+}
\ No newline at end of file