Make the TWRP Unified
authormauronofrio matarrese <poronofrio@gmail.com>
Mon, 17 Jun 2019 21:27:57 +0000 (23:27 +0200)
committermauronofrio matarrese <poronofrio@gmail.com>
Mon, 17 Jun 2019 21:27:57 +0000 (23:27 +0200)
BoardConfig.mk
init/init_oneplus7pro.cpp

index d997493b0124bacc0abc69b8b35a86676707771b..2e2ec1f6386d89961ce32b1ef7ab0d883d11a789 100644 (file)
@@ -106,6 +106,8 @@ AB_OTA_UPDATER := true
 TW_INPUT_BLACKLIST := "hbtp_vm"
 TW_MAX_BRIGHTNESS := 1023
 TW_DEFAULT_BRIGHTNESS := 420
+TW_Y_OFFSET := 80
+TW_H_OFFSET := -80
 TW_THEME := portrait_hdpi
 TARGET_RECOVERY_DEVICE_MODULES += android.hardware.boot@1.0
 TARGET_USE_CUSTOM_LUN_FILE_PATH := /config/usb_gadget/g1/functions/mass_storage.0/lun.%d/file
index 4fb0a8f02706199f3f30228f1e84a9569d20c8c9..5f23b9d28839e796c705015b49c7e804fb3e5a2e 100644 (file)
@@ -47,10 +47,6 @@ void load_op7pro(const char *model) {
     property_set("ro.display.series", "OnePlus 7 Pro");
 }
 
-static bool file_exist (const std::string& name) {
-    return ( access( name.c_str(), F_OK ) == 0 );
-}
-
 void load_op7pro5g(const char *model) {
     property_set("ro.product.model", model);
     property_set("ro.build.product", "OnePlus7ProNR");
@@ -59,39 +55,73 @@ void load_op7pro5g(const char *model) {
     property_set("ro.display.series", "OnePlus 7 Pro 5G");
 }
 
+void load_op7(const char *model) {
+    property_set("ro.product.model", model);
+    property_set("ro.build.product", "OnePlus7");
+    property_set("ro.product.device", "OnePlus7");
+    property_set("ro.vendor.product.device", "OnePlus7");
+    property_set("ro.display.series", "OnePlus 7");
+}
+
 void vendor_load_properties() {
+    int project_name = stoi(android::base::GetProperty("ro.boot.project_name", ""));
     int rf_version = stoi(android::base::GetProperty("ro.boot.rf_version", ""));
-
-    switch (rf_version) {
-    case 1:
-        if (file_exist("/dev/block/bootdevice/by-name/5gdump")){
-            /* 5g Europe */
-            load_op7pro5g("GM1920");
-            break;
-            } else {
-            /* China */
-            load_op7pro("GM1910");
-            break;
-            }
-    case 2:
-        /* T-Mobile */
-        load_op7pro("GM1915");
-        break;
-    case 3:
-        /* India*/
-        load_op7pro("GM1911");
-        break;
-    case 4:
-        /* Europe */
-        load_op7pro("GM1913");
-        break;
-    case 5:
-        /* Global / US Unlocked */
-        load_op7pro("GM1917");
-        break;
-    default:
-        LOG(ERROR) << __func__ << ": unexcepted rf version!";
-    }
+    switch(project_name){
+               case 18821:
+                       switch (rf_version){
+                               case 1:
+                                       /* China*/
+                                       load_op7pro("GM1910");
+                                       break;
+                               case 3:
+                                       /* India*/
+                                       load_op7pro("GM1911");
+                                       break;
+                               case 4:
+                                       /* Europe */
+                                       load_op7pro("GM1913");
+                                       break;
+                               case 5:
+                                       /* Global / US Unlocked */
+                                       load_op7pro("GM1917");
+                                       break;
+                               default:
+                                       /* Generic*/
+                                       load_op7pro("GM1917");
+                                       break;
+                       }
+               case 18831:
+                       /* T-Mobile */
+                       load_op7pro("GM1915");
+                       break;
+               case 18827:
+                       /* 5g Europe */
+                       load_op7pro5g("GM1920");
+                       break;
+               case 18857:
+                       switch (rf_version){
+                               case 1:
+                                       /* China*/
+                                       load_op7("GM1900");
+                                       break;
+                               case 3:
+                                       /* India*/
+                                       load_op7("GM1901");
+                                       break;
+                               case 4:
+                                       /* Europe */
+                                       load_op7("GM1903");
+                                       break;
+                               case 5:
+                                       /* Global / US Unlocked */
+                                       load_op7("GM1907");
+                                       break;
+                               default:
+                                       /* Generic */
+                                       load_op7("GM1907");
+                                       break;
+                       }
+       }
 }
 
 }  // namespace init