android修改getprop读取到的ro.build.fingerprint属性

在build/tools/buildinfo.sh中定义ro.build.fingerprint=$BUILD_FINGERPRINT.

然后在build/core/Makefile中给BUILD_FINGERPRINT赋值

但这里确定的是手机system/build.prop中的ro.build.fingerprint,是编译时决定的

 

getprop读取到的ro.build.fingerprint的值,是运行时决定的,在frameworks/base/core/java/android/os/Build.java 中:

923 /** A string that uniquely identifies this build.  Do not attempt to parse this value. */
924    public static final String FINGERPRINT = deriveFingerprint();
925
926    /**
927     * Some devices split the fingerprint components between multiple
928     * partitions, so we might derive the fingerprint at runtime.
929     */
930    private static String deriveFingerprint() {
931        Stringfinger = SystemProperties.get("ro.build.fingerprint");
932        if (TextUtils.isEmpty(finger)) {
933            finger = getString("ro.product.brand") + '/' +
934                    getString("ro.product.name") + '/' +
935                    getString("ro.product.device") + ':' +
936                    getString("ro.build.version.release") + '/' +
937                    getString("ro.build.id") + '/' +
938                    getString("ro.build.version.incremental") + ':' +
939                    getString("ro.build.type") + '/' +
940                    getString("ro.build.tags");
941        }
942        return finger;
943    }
 

posted @ 2019-01-31 10:45  leo21sun  阅读(9788)  评论(0编辑  收藏  举报