// Name of the palette library present in the /system partition. static constexpr constchar* kPaletteSystemLibrary = "libartpalette-system.so";
// Generic method used when a dynamically loaded palette instance does not // support a method.
palette_status_t PaletteMethodNotSupported() { return PALETTE_STATUS_NOT_SUPPORTED;
}
// Declare type aliases for pointers to each function in the interface. #define PALETTE_METHOD_TYPE_ALIAS(Name, ...) \ using Name ## Method = palette_status_t(*)(__VA_ARGS__);
PALETTE_METHOD_LIST(PALETTE_METHOD_TYPE_ALIAS) #undef PALETTE_METHOD_TYPE_ALIAS
// Singleton class responsible for dynamically loading the palette library and // binding functions there to method pointers. class PaletteLoader { public: static PaletteLoader& Instance() { static PaletteLoader instance; return instance;
}
// Accessor methods to get instances of palette methods. #define PALETTE_LOADER_METHOD_ACCESSOR(Name, ...) \
Name ## Method Get ## Name ## Method() const { return Name ## Method ## _; }
PALETTE_METHOD_LIST(PALETTE_LOADER_METHOD_ACCESSOR) #undef PALETTE_LOADER_METHOD_ACCESSOR
// Handle to the palette library from dlopen(). void* palette_lib_;
// Fields to store pointers to palette methods. #define PALETTE_LOADER_METHOD_FIELD(Name, ...) \ const Name ## Method Name ## Method ## _;
PALETTE_METHOD_LIST(PALETTE_LOADER_METHOD_FIELD) #undef PALETTE_LOADER_METHOD_FIELD
DISALLOW_COPY_AND_ASSIGN(PaletteLoader);
};
void* PaletteLoader::OpenLibrary() { void* handle = dlopen(kPaletteSystemLibrary, RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); if (handle == nullptr) { // dlerror message includes details of error and file being opened.
__android_log_assert(nullptr, kLogTag, "%s", dlerror());
} return handle;
}
void* PaletteLoader::GetMethod(void* palette_lib, constchar* name) { void* method = nullptr; if (palette_lib != nullptr) {
method = dlsym(palette_lib, name);
} if (method == nullptr) { returnreinterpret_cast<void*>(PaletteMethodNotSupported);
} // TODO(oth): consider new GetMethodSignature() in the Palette API which // would allow checking the validity of the type signatures. return method;
}
palette_status_t PaletteNotifyStartDex2oatCompilation(int source_fd, int art_fd, int oat_fd, int vdex_fd) {
PaletteNotifyStartDex2oatCompilationMethod m =
PaletteLoader::Instance().GetPaletteNotifyStartDex2oatCompilationMethod(); return m(source_fd, art_fd, oat_fd, vdex_fd);
}
palette_status_t PaletteNotifyEndDex2oatCompilation(int source_fd, int art_fd, int oat_fd, int vdex_fd) {
PaletteNotifyEndDex2oatCompilationMethod m =
PaletteLoader::Instance().GetPaletteNotifyEndDex2oatCompilationMethod(); return m(source_fd, art_fd, oat_fd, vdex_fd);
}
// Introduced in version 3 API, corresponding to SDK level 34.
palette_status_t PaletteSetTaskProfiles(int32_t tid, constchar* const profiles[],
size_t profiles_len) {
PaletteSetTaskProfilesMethod m = PaletteLoader::Instance().GetPaletteSetTaskProfilesMethod(); return m(tid, profiles, profiles_len);
}
// Introduced in version 4 API, corresponding to SDK level 36.
palette_status_t PaletteDebugStoreGetString(char* result, size_t max_size) {
PaletteDebugStoreGetStringMethod m =
PaletteLoader::Instance().GetPaletteDebugStoreGetStringMethod(); return m(result, max_size);
}
// Introduced in version 5 API, corresponding to SDK level 36.1.
palette_status_t PaletteMapPriority(int32_t managed_priority, int* result) {
PaletteMapPriorityMethod m = PaletteLoader::Instance().GetPaletteMapPriorityMethod(); return m(managed_priority, result);
}
} // extern "C"
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.14Bemerkung:
(vorverarbeitet am 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.