安卓11通过脚本修改相应板型系统属性

发布时间:2024年01月04日

安卓10以后rk的一套源码兼容很多板型,多种cpu型号都兼容了,这一点相比之前省心了很多,所以就诞生了需要一套代码兼容多种板子的需求,定制修改中需要经常修改系统属性,通过以下脚本一次实现:

#!/bin/bash
	
function gettop
{
    local TOPFILE=build/make/core/envsetup.mk
    if [ -n "$TOP" -a -f "$TOP/$TOPFILE" ] ; then
        # The following circumlocution ensures we remove symlinks from TOP.
        (cd $TOP; PWD= /bin/pwd)
    else
        if [ -f $TOPFILE ] ; then
            # The following circumlocution (repeated below as well) ensures
            # that we record the true directory name and not one that is
            # faked up with symlink names.
            PWD= /bin/pwd
        else
            local HERE=$PWD
            local T=
            while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
                \cd ..
                T=`PWD= /bin/pwd -P`
            done
            \cd $HERE
            if [ -f "$T/$TOPFILE" ]; then
                echo $T
            fi
        fi
    fi
}

function get_build_var()
{
    if [ "$BUILD_VAR_CACHE_READY" = "true" ]
    then
        eval "echo \"\${var_cache_$1}\""
    return
    fi

    local T=$(gettop)
    if [ ! "$T" ]; then
        echo "Couldn't locate the top of the tree.  Try setting TOP." >&2
        return
    fi
    (\cd $T; build/soong/soong_ui.bash --dumpvar-mode $1)
}

    product=$(get_build_var PRODUCT_MODEL)
    echo  "product=" $product 
        find device/ -name $product.mk  |xargs sed -i '$a PRODUCT_PROPERTY_OVERRIDES += persist.sys.navibar = 0'
        find device/ -name $product.mk  |xargs sed -i '$a PRODUCT_PROPERTY_OVERRIDES += persist.sys.statusbar = 0'
        find device/ -name $product.mk  |xargs sed -i '$a PRODUCT_PROPERTY_OVERRIDES += persist.sys.statebarslide = 0'
     find device/ -name $product.mk  |xargs sed -i '$a PRODUCT_PROPERTY_OVERRIDES += persist.sys.usb.config=mtp'

文章来源:https://blog.csdn.net/a_348647621/article/details/135380765
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。