recovery: Move bldrmsg offset symbols to bootloader_message.cpp

* bootloader_message.cpp is the only file using
  BOOTLOADER_MESSAGE_OFFSET_IN_MISC and WIPE_PACKAGE_OFFSET_IN_MISC,
  so we can move their definitions to the cpp.
  This prevents the need to set BOARD_RECOVERY_BLDRMSG_OFFSET
  in every module that includes the header.

* Global cflags are no longer supported Oreo and up,
  so set the BOARD_RECOVERY_BLDRMSG_OFFSET via make variable

* Simplify logic, always set BOARD_RECOVERY_BLDRMSG_OFFSET.

Change-Id: I2b902bcce7f5ca13472e0ac30ac01b4991294dbe
diff --git a/bootloader_message_twrp/Android.mk b/bootloader_message_twrp/Android.mk
index e7a3ea0..932cd04 100644
--- a/bootloader_message_twrp/Android.mk
+++ b/bootloader_message_twrp/Android.mk
@@ -31,5 +31,10 @@
 ifeq ($(TW_IGNORE_MISC_WIPE_DATA), true)
     LOCAL_CFLAGS += -DIGNORE_MISC_WIPE_DATA
 endif
+ifeq ($(BOOTLOADER_MESSAGE_OFFSET),)
+    LOCAL_CFLAGS += -DBOARD_RECOVERY_BLDRMSG_OFFSET=0
+else
+    LOCAL_CFLAGS += -DBOARD_RECOVERY_BLDRMSG_OFFSET=$(BOOTLOADER_MESSAGE_OFFSET)
+endif
 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
 include $(BUILD_SHARED_LIBRARY)
diff --git a/bootloader_message_twrp/bootloader_message.cpp b/bootloader_message_twrp/bootloader_message.cpp
index a06ad9a..b97f66e 100644
--- a/bootloader_message_twrp/bootloader_message.cpp
+++ b/bootloader_message_twrp/bootloader_message.cpp
@@ -28,6 +28,16 @@
 #include <string>
 #include <vector>
 
+// Spaces used by misc partition are as below:
+// 0   - 2K     For bootloader_message
+// 2K  - 16K    Used by Vendor's bootloader (the 2K - 4K range may be optionally used
+//              as bootloader_message_ab struct)
+// 16K - 64K    Used by uncrypt and recovery to store wipe_package for A/B devices
+// Note that these offsets are admitted by bootloader,recovery and uncrypt, so they
+// are not configurable without changing all of them.
+static const size_t BOOTLOADER_MESSAGE_OFFSET_IN_MISC = BOARD_RECOVERY_BLDRMSG_OFFSET;
+static const size_t WIPE_PACKAGE_OFFSET_IN_MISC = 16 * 1024 + BOOTLOADER_MESSAGE_OFFSET_IN_MISC;
+
 static std::string misc_blkdev;
 
 void set_misc_device(const char* name) {
diff --git a/bootloader_message_twrp/include/bootloader_message_twrp/bootloader_message.h b/bootloader_message_twrp/include/bootloader_message_twrp/bootloader_message.h
index 52c1b86..d8d955e 100644
--- a/bootloader_message_twrp/include/bootloader_message_twrp/bootloader_message.h
+++ b/bootloader_message_twrp/include/bootloader_message_twrp/bootloader_message.h
@@ -21,21 +21,6 @@
 #include <stddef.h>
 #include <stdint.h>
 
-// Spaces used by misc partition are as below:
-// 0   - 2K     For bootloader_message
-// 2K  - 16K    Used by Vendor's bootloader (the 2K - 4K range may be optionally used
-//              as bootloader_message_ab struct)
-// 16K - 64K    Used by uncrypt and recovery to store wipe_package for A/B devices
-// Note that these offsets are admitted by bootloader,recovery and uncrypt, so they
-// are not configurable without changing all of them.
-#ifdef BOARD_RECOVERY_BLDRMSG_OFFSET
-static const size_t BOOTLOADER_MESSAGE_OFFSET_IN_MISC = BOARD_RECOVERY_BLDRMSG_OFFSET;
-static const size_t WIPE_PACKAGE_OFFSET_IN_MISC = 16 * 1024 + BOOTLOADER_MESSAGE_OFFSET_IN_MISC;
-#else
-static const size_t BOOTLOADER_MESSAGE_OFFSET_IN_MISC = 0;
-static const size_t WIPE_PACKAGE_OFFSET_IN_MISC = 16 * 1024;
-#endif
-
 /* Bootloader Message (2-KiB)
  *
  * This structure describes the content of a block in flash