Android O强制修改安兔兔跑分中的参数

一开始的时候在 setText() 方法中作的修改,但是在最新的antutu中不管用了,反编译发现最新的antutu中不再使用 setText() 来设置字符串了,而是把字符串分割成了单个的字符再append()到TextView中,应该是发现有太多的厂商强行修改这些参数,然而这并难不倒我们,修改方法如下。

public void append(CharSequence text, int start, int end) {
     
    if (!(mText instanceof Editable)) {
     
        setText(mText, BufferType.EDITABLE);
    }

    ((Editable) mText).append(text, start, end);

    //modified begin
    if (getContext() != null) {
     
        String packageName = getContext().getPackageName();
        if ("com.antutu.ABenchMark".equalsIgnoreCase(packageName)) {
     
            int textViewId = getContext().getResources().getIdentifier("item_hardware_text_desc", "id", "com.antutu.ABenchMark");
            if (textViewId == getId()) {
     
                String sizeStr = getContext().getResources().getString(getContext().getResources().getIdentifier("size_panel", "string", "com.antutu.ABenchMark"));
                if (mText.toString().contains(sizeStr)) {
     
                    mText = "5.45 " + sizeStr;
                    setText(mText);
                }
            }
        }
    }
    //modified end

    if (mAutoLinkMask != 0) {
     
        boolean linksWereAdded = Linkify.addLinks((Spannable) mText, mAutoLinkMask);
        // Do not change the movement method for text that support text selection as it
        // would prevent an arbitrary cursor displacement.
        if (linksWereAdded && mLinksClickable && !textCanBeSelected()) {
     
            setMovementMethod(LinkMovementMethod.getInstance());
        }
    }
}

太无赖了~

你可能感兴趣的:(mtk,android,java)