Snap for 7442307 from b966fbf05518cc31ad3b6e3cefd85287e85661a5 to sc-v2-release
Change-Id: Idd998579e54a43147827cca0fb23858608450ea2
diff --git a/Android.bp b/Android.bp
index 1ce239b..b6a685d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -32,7 +32,10 @@
host_supported: true,
target: {
android: {
- srcs: ["palette_android.cc"],
+ srcs: [
+ "palette_android.cc",
+ "palette_android_partner.cc",
+ ],
header_libs: ["libbase_headers"],
shared_libs: [
"libbase",
diff --git a/libartpalette.map.txt b/libartpalette.map.txt
index d1c4147..31526d1 100644
--- a/libartpalette.map.txt
+++ b/libartpalette.map.txt
@@ -26,8 +26,15 @@
PaletteTraceIntegerValue; # apex
PaletteAshmemCreateRegion; # apex
PaletteAshmemSetProtRegion; # apex
- PaletteGetHooks; # apex
PaletteCreateOdrefreshStagingDirectory; # apex
+ PaletteShouldReportDex2oatCompilation; #apex
+ PaletteNotifyStartDex2oatCompilation; #apex
+ PaletteNotifyEndDex2oatCompilation; #apex
+ PaletteNotifyDexFileLoaded; #apex
+ PaletteNotifyOatFileLoaded; #apex
+ PaletteShouldReportJniInvocations; #apex
+ PaletteNotifyBeginJniInvocation; #apex
+ PaletteNotifyEndJniInvocation; #apex
local:
*;
diff --git a/palette_android.cc b/palette_android.cc
index 35929e5..42c4960 100644
--- a/palette_android.cc
+++ b/palette_android.cc
@@ -152,8 +152,8 @@
return status;
}
-palette_status_t PaletteTraceEnabled(/*out*/ int32_t* enabled) {
- *enabled = (ATRACE_ENABLED() != 0) ? 1 : 0;
+palette_status_t PaletteTraceEnabled(/*out*/ bool* enabled) {
+ *enabled = (ATRACE_ENABLED() != 0) ? true : false;
return PALETTE_STATUS_OK;
}
@@ -231,11 +231,6 @@
return PALETTE_STATUS_OK;
}
-palette_status_t PaletteGetHooks(PaletteHooks** hooks) {
- *hooks = nullptr;
- return PALETTE_STATUS_NOT_SUPPORTED;
-}
-
palette_status_t PaletteCreateOdrefreshStagingDirectory(const char** staging_dir) {
static constexpr const char* kStagingDirectory = "/data/misc/apexdata/com.android.art/staging";
diff --git a/palette_android_partner.cc b/palette_android_partner.cc
new file mode 100644
index 0000000..f74a5a9
--- /dev/null
+++ b/palette_android_partner.cc
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "palette/palette.h"
+
+#include <android-base/macros.h>
+#include <stdbool.h>
+
+palette_status_t PaletteShouldReportDex2oatCompilation(bool* value) {
+ *value = 0;
+ return PALETTE_STATUS_OK;
+}
+
+palette_status_t PaletteNotifyStartDex2oatCompilation(int source_fd ATTRIBUTE_UNUSED,
+ int art_fd ATTRIBUTE_UNUSED,
+ int oat_fd ATTRIBUTE_UNUSED,
+ int vdex_fd ATTRIBUTE_UNUSED) {
+ return PALETTE_STATUS_OK;
+}
+
+palette_status_t PaletteNotifyEndDex2oatCompilation(int source_fd ATTRIBUTE_UNUSED,
+ int art_fd ATTRIBUTE_UNUSED,
+ int oat_fd ATTRIBUTE_UNUSED,
+ int vdex_fd ATTRIBUTE_UNUSED) {
+ return PALETTE_STATUS_OK;
+}
+
+palette_status_t PaletteNotifyDexFileLoaded(const char* path ATTRIBUTE_UNUSED) {
+ return PALETTE_STATUS_OK;
+}
+
+palette_status_t PaletteNotifyOatFileLoaded(const char* path ATTRIBUTE_UNUSED) {
+ return PALETTE_STATUS_OK;
+}
+
+palette_status_t PaletteShouldReportJniInvocations(bool* value) {
+ *value = 0;
+ return PALETTE_STATUS_OK;
+}
+
+palette_status_t PaletteNotifyBeginJniInvocation(JNIEnv* env ATTRIBUTE_UNUSED) {
+ return PALETTE_STATUS_OK;
+}
+
+palette_status_t PaletteNotifyEndJniInvocation(JNIEnv* env ATTRIBUTE_UNUSED) {
+ return PALETTE_STATUS_OK;
+}
diff --git a/palette_fake.cc b/palette_fake.cc
index 5c1fd08..5d6e4e5 100644
--- a/palette_fake.cc
+++ b/palette_fake.cc
@@ -18,6 +18,7 @@
#include <map>
#include <mutex>
+#include <stdbool.h>
#include <android-base/logging.h>
#include <android-base/macros.h> // For ATTRIBUTE_UNUSED
@@ -53,8 +54,8 @@
return PALETTE_STATUS_OK;
}
-palette_status_t PaletteTraceEnabled(/*out*/ int32_t* enabled) {
- *enabled = 0;
+palette_status_t PaletteTraceEnabled(/*out*/ bool* enabled) {
+ *enabled = false;
return PALETTE_STATUS_OK;
}
@@ -81,12 +82,47 @@
return PALETTE_STATUS_NOT_SUPPORTED;
}
-palette_status_t PaletteGetHooks(PaletteHooks** hooks) {
- *hooks = nullptr;
- return PALETTE_STATUS_NOT_SUPPORTED;
-}
-
palette_status_t PaletteCreateOdrefreshStagingDirectory(const char** staging_dir) {
*staging_dir = nullptr;
return PALETTE_STATUS_NOT_SUPPORTED;
}
+
+palette_status_t PaletteShouldReportDex2oatCompilation(bool* value) {
+ *value = false;
+ return PALETTE_STATUS_OK;
+}
+
+palette_status_t PaletteNotifyStartDex2oatCompilation(int source_fd ATTRIBUTE_UNUSED,
+ int art_fd ATTRIBUTE_UNUSED,
+ int oat_fd ATTRIBUTE_UNUSED,
+ int vdex_fd ATTRIBUTE_UNUSED) {
+ return PALETTE_STATUS_OK;
+}
+
+palette_status_t PaletteNotifyEndDex2oatCompilation(int source_fd ATTRIBUTE_UNUSED,
+ int art_fd ATTRIBUTE_UNUSED,
+ int oat_fd ATTRIBUTE_UNUSED,
+ int vdex_fd ATTRIBUTE_UNUSED) {
+ return PALETTE_STATUS_OK;
+}
+
+palette_status_t PaletteNotifyDexFileLoaded(const char* path ATTRIBUTE_UNUSED) {
+ return PALETTE_STATUS_OK;
+}
+
+palette_status_t PaletteNotifyOatFileLoaded(const char* path ATTRIBUTE_UNUSED) {
+ return PALETTE_STATUS_OK;
+}
+
+palette_status_t PaletteShouldReportJniInvocations(bool* value) {
+ *value = false;
+ return PALETTE_STATUS_OK;
+}
+
+palette_status_t PaletteNotifyBeginJniInvocation(JNIEnv* env ATTRIBUTE_UNUSED) {
+ return PALETTE_STATUS_OK;
+}
+
+palette_status_t PaletteNotifyEndJniInvocation(JNIEnv* env ATTRIBUTE_UNUSED) {
+ return PALETTE_STATUS_OK;
+}