Skip to content

Commit

Permalink
m7univ: Remove TARGET_UNIFIED_DEVICE usage
Browse files Browse the repository at this point in the history
* Use property_override() to set normally ro properties.
  • Loading branch information
mdmower committed Oct 29, 2017
1 parent c630561 commit 420c7ba
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
1 change: 0 additions & 1 deletion BoardConfig.mk
Expand Up @@ -87,7 +87,6 @@ BOARD_CHARGING_MODE_BOOTING_LPM := /sys/htc_lpm/lpm_mode
BOARD_SEPOLICY_DIRS += device/htc/m7univ/sepolicy

# Vendor Init
TARGET_UNIFIED_DEVICE := true
TARGET_INIT_VENDOR_LIB := libinit_m7univ

# TWRP
Expand Down
25 changes: 19 additions & 6 deletions recovery/init/init_m7univ.cpp
Expand Up @@ -28,25 +28,38 @@
*/

#include <stdlib.h>
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/_system_properties.h>

#include <string>

#include "property_service.h"
#include "vendor_init.h"

void property_override(char const prop[], char const value[]) {
prop_info *pi;

pi = (prop_info*) __system_property_find(prop);
if (pi)
__system_property_update(pi, value, strlen(value));
else
__system_property_add(prop, strlen(prop), value, strlen(value));
}

void vendor_load_properties() {
std::string platform = property_get("ro.board.platform");
if (platform != ANDROID_TARGET)
return;

std::string bootmid = property_get("ro.boot.mid");
if (bootmid.find("PN0720000") != std::string::npos) {
property_set("ro.product.device", "m7wls");
property_set("ro.build.product", "m7wls");
property_override("ro.product.device", "m7wls");
property_override("ro.build.product", "m7wls");
} else if (bootmid.find("PN0731000") != std::string::npos) {
property_set("ro.product.device", "m7wlv");
property_set("ro.build.product", "m7wlv");
property_override("ro.product.device", "m7wlv");
property_override("ro.build.product", "m7wlv");
} else {
property_set("ro.product.device", "m7");
property_set("ro.build.product", "m7");
property_override("ro.product.device", "m7");
property_override("ro.build.product", "m7");
}
}

0 comments on commit 420c7ba

Please sign in to comment.