修改Android设备型号、版本号、去掉自定义版本显示

时间:2025-01-30 12:04:12

1、修改型号

源码位置 build/tools/

echo "="MTK6737_64_bsp""
echo "=$PRODUCT_BRAND"
echo "="MTK6737_64_bsp""
echo "="MTK6737_64_bsp""

将 MTK6737_64_bsp 对应的改为你需要显示的型号

2、修改版本号

源码位置 build\core\Makefile

# Display parameters shown under Settings -> About Phone
# ifeq ($(TARGET_BUILD_VARIANT),user)
#   # User builds should show:
#   # release build number or branch.buld_number non-release builds

#   # Dev. branches should have DISPLAY_BUILD_NUMBER set
#   ifeq (true,$(DISPLAY_BUILD_NUMBER))
#     BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER_FROM_FILE) $(BUILD_KEYS)
#   else
#     BUILD_DISPLAY_ID := $(BUILD_ID) $(BUILD_KEYS)
#   endif
# else
#   # Non-user builds should show detailed build information
#   BUILD_DISPLAY_ID := $(build_desc)
# endif
BUILD_DISPLAY_ID := "MTK6737_64_bsp_V1.01"

将ifeq到endif代码块注释,增加BUILD_DISPLAY_ID := “MTK6737_64_bsp_V1.01”, MTK6737_64_bsp_V1.01 对应的改为你需要显示的版本号

3、去掉自定义版本显示

自定义版本显示的版本号对应的源码位置在 device/eastaeon/aeon6737t_66_m0/

MTK_BUILD_VERNO=alps-mp-o1.mp1 可修改为你需要显示的版本号

以下为在Settings中关于设备中隐藏显示项

8.1版本

方法一

源码位置 vendor\mediatek\proprietary\packages\apps\MtkSettings\res\xml\device_info_settings.xml
直接注释以下代码块,不加载Preference,可能还需要查找对应java文件中是否有引用对应的key进行空指针判断

<!-- /// M: Custom build version -->
    <Preference
            android:key="custom_build_version"
            android:title="@string/custom_build_version"
            android:summary="@string/device_info_default"/>

方法二(推荐不容易报错)

源码位置 vendor\mediatek\proprietary\packages\apps\MtkSettings\src\com\mediatek\settings\deviceinfo\

在java代码中通过removePreference()移除自定义版本preference

+import .;

public class CustomizeBuildVersionPreferenceController  extends AbstractPreferenceController
    implements PreferenceControllerMixin {
     private static final String KEY_CUSTOM_BUILD_VERSION = "custom_build_version";
     private static final String CUSTOM_BUILD_VERSION_PROPERTY = "";
 
+    private PreferenceScreen mScreen;

     @Override
+    public void displayPreference(PreferenceScreen screen) {
+        mScreen = screen;
+        //mPreference = (getPreferenceKey());
+        (screen);
+    }

     @Override
     public void updateState(Preference preference) {
         (preference);
         ((CUSTOM_BUILD_VERSION_PROPERTY,
                 ().getString(.device_info_default)));

+        (preference);
     }
 
 }

6.0版本

源码位置 packages\apps\Settings\res\xml\device_info_settings.xml

直接注释以下代码块,不加载Preference

<!-- /// M: Custom build version -->
    <Preference
            android:key="custom_build_version"
            android:title="@string/custom_build_version"
            android:summary="@string/device_info_default"/>