1 /*
2 * Copyright (C) 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include "palette/palette.h"
18
19 #include <android-base/macros.h>
20 #include <stdbool.h>
21
22 // Unless explicitly mentioned otherwise, the following methods have been
23 // introduced in version 1 API, corresponding to SDK level 31.
24
PaletteShouldReportDex2oatCompilation(bool * value)25 palette_status_t PaletteShouldReportDex2oatCompilation(bool* value) {
26 *value = 0;
27 return PALETTE_STATUS_OK;
28 }
29
PaletteNotifyStartDex2oatCompilation(int source_fd ATTRIBUTE_UNUSED,int art_fd ATTRIBUTE_UNUSED,int oat_fd ATTRIBUTE_UNUSED,int vdex_fd ATTRIBUTE_UNUSED)30 palette_status_t PaletteNotifyStartDex2oatCompilation(int source_fd ATTRIBUTE_UNUSED,
31 int art_fd ATTRIBUTE_UNUSED,
32 int oat_fd ATTRIBUTE_UNUSED,
33 int vdex_fd ATTRIBUTE_UNUSED) {
34 return PALETTE_STATUS_OK;
35 }
36
PaletteNotifyEndDex2oatCompilation(int source_fd ATTRIBUTE_UNUSED,int art_fd ATTRIBUTE_UNUSED,int oat_fd ATTRIBUTE_UNUSED,int vdex_fd ATTRIBUTE_UNUSED)37 palette_status_t PaletteNotifyEndDex2oatCompilation(int source_fd ATTRIBUTE_UNUSED,
38 int art_fd ATTRIBUTE_UNUSED,
39 int oat_fd ATTRIBUTE_UNUSED,
40 int vdex_fd ATTRIBUTE_UNUSED) {
41 return PALETTE_STATUS_OK;
42 }
43
PaletteNotifyDexFileLoaded(const char * path ATTRIBUTE_UNUSED)44 palette_status_t PaletteNotifyDexFileLoaded(const char* path ATTRIBUTE_UNUSED) {
45 return PALETTE_STATUS_OK;
46 }
47
PaletteNotifyOatFileLoaded(const char * path ATTRIBUTE_UNUSED)48 palette_status_t PaletteNotifyOatFileLoaded(const char* path ATTRIBUTE_UNUSED) {
49 return PALETTE_STATUS_OK;
50 }
51
PaletteShouldReportJniInvocations(bool * value)52 palette_status_t PaletteShouldReportJniInvocations(bool* value) {
53 *value = 0;
54 return PALETTE_STATUS_OK;
55 }
56
PaletteNotifyBeginJniInvocation(JNIEnv * env ATTRIBUTE_UNUSED)57 palette_status_t PaletteNotifyBeginJniInvocation(JNIEnv* env ATTRIBUTE_UNUSED) {
58 return PALETTE_STATUS_OK;
59 }
60
PaletteNotifyEndJniInvocation(JNIEnv * env ATTRIBUTE_UNUSED)61 palette_status_t PaletteNotifyEndJniInvocation(JNIEnv* env ATTRIBUTE_UNUSED) {
62 return PALETTE_STATUS_OK;
63 }
64
65 // Introduced in version 2 API, corresponding to SDK level 33.
PaletteReportLockContention(JNIEnv * env ATTRIBUTE_UNUSED,int32_t wait_ms ATTRIBUTE_UNUSED,const char * filename ATTRIBUTE_UNUSED,int32_t line_number ATTRIBUTE_UNUSED,const char * method_name ATTRIBUTE_UNUSED,const char * owner_filename ATTRIBUTE_UNUSED,int32_t owner_line_number ATTRIBUTE_UNUSED,const char * owner_method_name ATTRIBUTE_UNUSED,const char * proc_name ATTRIBUTE_UNUSED,const char * thread_name ATTRIBUTE_UNUSED)66 palette_status_t PaletteReportLockContention(
67 JNIEnv* env ATTRIBUTE_UNUSED, int32_t wait_ms ATTRIBUTE_UNUSED,
68 const char* filename ATTRIBUTE_UNUSED, int32_t line_number ATTRIBUTE_UNUSED,
69 const char* method_name ATTRIBUTE_UNUSED, const char* owner_filename ATTRIBUTE_UNUSED,
70 int32_t owner_line_number ATTRIBUTE_UNUSED, const char* owner_method_name ATTRIBUTE_UNUSED,
71 const char* proc_name ATTRIBUTE_UNUSED, const char* thread_name ATTRIBUTE_UNUSED) {
72 return PALETTE_STATUS_OK;
73 }
74