android build类分析 hook静态字段

缘由: 使用xposed hook build类下 DEVICE MODEL VERSION MANUFACTURER等静态字段XposedHelpers.setStaticObjectField(android.os.Build.class, "MODEL", "null");hook 失败! <参考:http://blog.csdn.net/ccpat/article/details/44
摘要由CSDN通过智能技术生成

一、缘由:
使用xposed hook build类下 DEVICE MODEL VERSION MANUFACTURER等静态字段

使用XposedHelpers.setStaticObjectField() hook 失败!

XposedHelpers.setStaticObjectField(android.os.Build.class, "MODEL", null);

使用 反射 hook 失败!

 Field model = Build.class.getDeclaredField("MODEL");
 model.setAccessible(true);
 model.set(Build.class, pre.getString("model", null));

二、Build源码分析
打开build源码(/frameworks/base/core/Java/android/os/Build.java)
Build类中主要是一些成员属性

public class Build {
   
    /** Value used for when a build property is unknown. */
    public static final String UNKNOWN = "unknown";

    /** Either a changelist number, or a label like "M4-rc20". */
    public static final String ID = getString("ro.build.id");

    /** A build ID string meant for displaying to the user */
    public static final String DISPLAY = getString("ro.build.display.id");

    /** The name of the overall product. */
    public static final String PRODUCT = getString("ro.product.name");

    /** The name of the industrial design. */
    public static final String DEVICE = getString("ro.product.device");

    /** The name of the underlying board, like "goldfish". */
    public static final String BOARD = getString("ro.product.board");

    /** The name of the instruction set (CPU type + ABI convention) of native code. */
    public static final String CPU_ABI = getString("ro.product.cpu.abi");

    /** The name of the second instruction set (CPU type + ABI convention) of native code. */
    public static final String CPU_ABI2 = getString("ro.product.cpu.abi2");

    /** The manufacturer of the product/hardware. */
    public static final String MANUFACTURER = getString("ro.product.manufacturer");

    /** The brand (e.g., carrier) the software is customized for, if any. */
    public 
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值