f6176009b1
Stages TWRP's GUI engine and standalone tooling as PawletOS-owned modules instead of a bootable/recovery fork, per the plugin-architecture finding in NOTES-ota-recovery-ab.md: stock recovery_main.cpp already dlopen()s librecovery_ui_ext.so and dlsym()s make_device() from it at runtime, so the UI layer doesn't require touching stock bootable/recovery at all. Confirmed via source grep that recovery.cpp/install.cpp have zero references into the partition manager/backup engine/GUI code and vice versa. recovery_ui/: TWRP's gui/, minuitwrp/, libpixelflinger/ (copied verbatim, GPL-3.0), plus a new device/ providing PawletTwrpUI (a ScreenRecoveryUI subclass) and make_device() — written from scratch against stock's RecoveryUI/ScreenRecoveryUI virtual-method contract, since TWRP's own fork never ships a make_device() (every real TWRP device provides its own, and no reference device tree was available to copy from). Top-level Android.bp defines librecovery_ui_pawlet_twrp, the module TARGET_RECOVERY_UI_LIB should point at. gui/Android.bp and minuitwrp/Android.bp had their include_dirs rewritten for the new paths. recovery_toolkit/: partition manager, backup engine (tar/digest/adbbu/apex), filesystem/format support (exfat/dosfstools/gpt/fuse/mtp/crypto), scripting (openrecoveryscript/orscmd/twrpinstall), shared helpers. Source only, no Android.bp yet for any of it. Known gap blocking recovery_ui from actually linking: gui/'s libguitwrp depends on libaosprecovery, built from recovery_toolkit/helpers/twrp.cpp via a Go Soong plugin (libaosprecovery_defaults.go) not yet ported. Neither repo has been build-tested — no local AOSP build environment available in this workspace. See each directory's README.md for a precise done/not-done breakdown.
208 lines
4.7 KiB
C
208 lines
4.7 KiB
C
//
|
|
// Copyright 2005 The Android Open Source Project
|
|
//
|
|
// C/C++ logging functions. See the logging documentation for API details.
|
|
//
|
|
// We'd like these to be available from C code (in case we import some from
|
|
// somewhere), so this has a C interface.
|
|
//
|
|
// The output will be correct when the log file is shared between multiple
|
|
// threads and/or multiple processes so long as the operating system
|
|
// supports O_APPEND. These calls have mutex-protected data structures
|
|
// and so are NOT reentrant. Do not use LOG in a signal handler.
|
|
//
|
|
#ifndef _MINZIP_LOG_H
|
|
#define _MINZIP_LOG_H
|
|
|
|
#include <stdio.h>
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
|
/*
|
|
* Normally we strip LOGV (VERBOSE messages) from release builds.
|
|
* You can modify this (for example with "#define LOG_NDEBUG 0"
|
|
* at the top of your source file) to change that behavior.
|
|
*/
|
|
#ifndef LOG_NDEBUG
|
|
#ifdef NDEBUG
|
|
#define LOG_NDEBUG 1
|
|
#else
|
|
#define LOG_NDEBUG 0
|
|
#endif
|
|
#endif
|
|
|
|
/*
|
|
* This is the local tag used for the following simplified
|
|
* logging macros. You can change this preprocessor definition
|
|
* before using the other macros to change the tag.
|
|
*/
|
|
#ifndef LOG_TAG
|
|
#define LOG_TAG NULL
|
|
#endif
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
|
/*
|
|
* Simplified macro to send a verbose log message using the current LOG_TAG.
|
|
*/
|
|
#ifndef LOGV
|
|
#if LOG_NDEBUG
|
|
#define LOGV(...) ((void)0)
|
|
#else
|
|
#define LOGV(...) ((void)LOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
|
|
#endif
|
|
#endif
|
|
|
|
#define CONDITION(cond) (__builtin_expect((cond)!=0, 0))
|
|
|
|
#ifndef LOGV_IF
|
|
#if LOG_NDEBUG
|
|
#define LOGV_IF(cond, ...) ((void)0)
|
|
#else
|
|
#define LOGV_IF(cond, ...) \
|
|
( (CONDITION(cond)) \
|
|
? ((void)LOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \
|
|
: (void)0 )
|
|
#endif
|
|
#endif
|
|
|
|
#define LOGVV LOGV
|
|
#define LOGVV_IF LOGV_IF
|
|
|
|
/*
|
|
* Simplified macro to send a debug log message using the current LOG_TAG.
|
|
*/
|
|
#ifndef LOGD
|
|
#define LOGD(...) ((void)LOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__))
|
|
#endif
|
|
|
|
#ifndef LOGD_IF
|
|
#define LOGD_IF(cond, ...) \
|
|
( (CONDITION(cond)) \
|
|
? ((void)LOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \
|
|
: (void)0 )
|
|
#endif
|
|
|
|
/*
|
|
* Simplified macro to send an info log message using the current LOG_TAG.
|
|
*/
|
|
#ifndef LOGI
|
|
#define LOGI(...) ((void)LOG(LOG_INFO, LOG_TAG, __VA_ARGS__))
|
|
#endif
|
|
|
|
#ifndef LOGI_IF
|
|
#define LOGI_IF(cond, ...) \
|
|
( (CONDITION(cond)) \
|
|
? ((void)LOG(LOG_INFO, LOG_TAG, __VA_ARGS__)) \
|
|
: (void)0 )
|
|
#endif
|
|
|
|
/*
|
|
* Simplified macro to send a warning log message using the current LOG_TAG.
|
|
*/
|
|
#ifndef LOGW
|
|
#define LOGW(...) ((void)LOG(LOG_WARN, LOG_TAG, __VA_ARGS__))
|
|
#endif
|
|
|
|
#ifndef LOGW_IF
|
|
#define LOGW_IF(cond, ...) \
|
|
( (CONDITION(cond)) \
|
|
? ((void)LOG(LOG_WARN, LOG_TAG, __VA_ARGS__)) \
|
|
: (void)0 )
|
|
#endif
|
|
|
|
/*
|
|
* Simplified macro to send an error log message using the current LOG_TAG.
|
|
*/
|
|
#ifndef LOGE
|
|
#define LOGE(...) ((void)LOG(LOG_ERROR, LOG_TAG, __VA_ARGS__))
|
|
#endif
|
|
|
|
#ifndef LOGE_IF
|
|
#define LOGE_IF(cond, ...) \
|
|
( (CONDITION(cond)) \
|
|
? ((void)LOG(LOG_ERROR, LOG_TAG, __VA_ARGS__)) \
|
|
: (void)0 )
|
|
#endif
|
|
|
|
|
|
/*
|
|
* Conditional based on whether the current LOG_TAG is enabled at
|
|
* verbose priority.
|
|
*/
|
|
#ifndef IF_LOGV
|
|
#if LOG_NDEBUG
|
|
#define IF_LOGV() if (false)
|
|
#else
|
|
#define IF_LOGV() IF_LOG(LOG_VERBOSE, LOG_TAG)
|
|
#endif
|
|
#endif
|
|
|
|
/*
|
|
* Conditional based on whether the current LOG_TAG is enabled at
|
|
* debug priority.
|
|
*/
|
|
#ifndef IF_LOGD
|
|
#define IF_LOGD() IF_LOG(LOG_DEBUG, LOG_TAG)
|
|
#endif
|
|
|
|
/*
|
|
* Conditional based on whether the current LOG_TAG is enabled at
|
|
* info priority.
|
|
*/
|
|
#ifndef IF_LOGI
|
|
#define IF_LOGI() IF_LOG(LOG_INFO, LOG_TAG)
|
|
#endif
|
|
|
|
/*
|
|
* Conditional based on whether the current LOG_TAG is enabled at
|
|
* warn priority.
|
|
*/
|
|
#ifndef IF_LOGW
|
|
#define IF_LOGW() IF_LOG(LOG_WARN, LOG_TAG)
|
|
#endif
|
|
|
|
/*
|
|
* Conditional based on whether the current LOG_TAG is enabled at
|
|
* error priority.
|
|
*/
|
|
#ifndef IF_LOGE
|
|
#define IF_LOGE() IF_LOG(LOG_ERROR, LOG_TAG)
|
|
#endif
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
|
/*
|
|
* Basic log message macro.
|
|
*
|
|
* Example:
|
|
* LOG(LOG_WARN, NULL, "Failed with error %d", errno);
|
|
*
|
|
* The second argument may be NULL or "" to indicate the "global" tag.
|
|
*
|
|
* Non-gcc probably won't have __FUNCTION__. It's not vital. gcc also
|
|
* offers __PRETTY_FUNCTION__, which is rather more than we need.
|
|
*/
|
|
#ifndef LOG
|
|
#define LOG(priority, tag, ...) \
|
|
LOG_PRI(ANDROID_##priority, tag, __VA_ARGS__)
|
|
#endif
|
|
|
|
/*
|
|
* Log macro that allows you to specify a number for the priority.
|
|
*/
|
|
#ifndef LOG_PRI
|
|
#define LOG_PRI(priority, tag, ...) \
|
|
printf(tag ": " __VA_ARGS__)
|
|
#endif
|
|
|
|
/*
|
|
* Conditional given a desired logging priority and tag.
|
|
*/
|
|
#ifndef IF_LOG
|
|
#define IF_LOG(priority, tag) \
|
|
if (1)
|
|
#endif
|
|
|
|
#endif // _MINZIP_LOG_H
|