diff options
author | Anatoly Smaznov <mrjavum@gmail.com> | 2013-02-12 07:33:40 +0100 |
---|---|---|
committer | Dees_Troy <dees_troy@teamw.in> | 2013-02-19 18:20:04 +0100 |
commit | 10c11f67cfe2b2a398a4bde5deb355b58f833002 (patch) | |
tree | 31b01f3f307a69ccf9d1bd6cfde22749c2dd8e7b | |
parent | Minor fix for listbox code (diff) | |
download | android_bootable_recovery-10c11f67cfe2b2a398a4bde5deb355b58f833002.tar android_bootable_recovery-10c11f67cfe2b2a398a4bde5deb355b58f833002.tar.gz android_bootable_recovery-10c11f67cfe2b2a398a4bde5deb355b58f833002.tar.bz2 android_bootable_recovery-10c11f67cfe2b2a398a4bde5deb355b58f833002.tar.lz android_bootable_recovery-10c11f67cfe2b2a398a4bde5deb355b58f833002.tar.xz android_bootable_recovery-10c11f67cfe2b2a398a4bde5deb355b58f833002.tar.zst android_bootable_recovery-10c11f67cfe2b2a398a4bde5deb355b58f833002.zip |
-rw-r--r-- | Android.mk | 6 | ||||
-rw-r--r-- | data.cpp | 28 |
2 files changed, 32 insertions, 2 deletions
diff --git a/Android.mk b/Android.mk index 7582bb11d..1ad1e0dc9 100644 --- a/Android.mk +++ b/Android.mk @@ -222,9 +222,11 @@ ifeq ($(TW_INCLUDE_JB_CRYPTO), true) LOCAL_SRC_FILES += crypto/jb/cryptfs.c LOCAL_C_INCLUDES += system/extras/ext4_utils external/openssl/include endif - +ifeq ($(TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID), true) + LOCAL_CFLAGS += -DTW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID +endif ifeq ($(TARGET_BOARD_PLATFORM),rk30xx) -LOCAL_CFLAGS += -DRK3066 + LOCAL_CFLAGS += -DRK3066 endif include $(BUILD_EXECUTABLE) @@ -41,6 +41,10 @@ #include "partitions.hpp" #include "twrp-functions.hpp" +#ifdef TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID + #include "cutils/properties.h" +#endif + extern "C" { #include "common.h" @@ -90,6 +94,30 @@ void DataManager::get_device_id(void) { // Assign a blank device_id to start with device_id[0] = 0; + +#ifdef TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID + // Now we'll use product_model_hardwareid as device id + char model_id[PROPERTY_VALUE_MAX]; + property_get("ro.product.model", model_id, "error"); + if (strcmp(model_id,"error") != 0) { + LOGI("=> product model: '%s'\n", model_id); + // Replace spaces with underscores + for(int i = 0; i < strlen(model_id); i++) { + if(model_id[i] == ' ') + model_id[i] = '_'; + } + strcpy(device_id, model_id); + if (hardware_id[0] != 0) { + strcat(device_id, "_"); + strcat(device_id, hardware_id); + } + sanitize_device_id((char *)device_id); + mConstValues.insert(make_pair("device_id", device_id)); + LOGI("=> using device id: '%s'\n", device_id); + return; + } +#endif + #ifndef TW_FORCE_CPUINFO_FOR_DEVICE_ID // First, try the cmdline to see if the serial number was supplied fp = fopen("/proc/cmdline", "rt"); |