close

Enable or disable HWUI in PMS

 

# cat frameworks/base/core/java/android/content/pm/PackageParser.java
...
Line 1973 : control whether to enable HWUI
boolean hardwareAccelerated = sa.getBoolean(
com.android.internal.R.styleable.AndroidManifestApplication_hardwareAccelerated,
owner.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.ICE_CREAM_SANDWICH);
...

 

 Android 4.0 Ice Cream Sandwich (API level 14)
請參考 http://androidxref.com/4.4.2_r1/xref/frameworks/base/core/java/android/content/pm/PackageParser.java 以及 http://shooting.logdown.com/posts/180440-hwui
 

 

BoardConfig.mk

 

...
USE_OPENGL_RENDERER := true
...

 

請參考 https://android.googlesource.com/device/ti/panda/+/jb-dev/BoardConfig.mk

 


adb service 的用法

 

$ service -h
Usage: service [-h|-?]
       service list
       service check SERVICE
       service call SERVICE CODE [i32 INT | s16 STR] ...
Options:
   i32: Write the integer INT into the send parcel.
   s16: Write the UTF-16 string STR into the send parcel.

 

for example:
 

$ service list
Found 111 services:
0       SYSSCOPE: [com.sec.android.app.sysscope.service.ISysScopeService]
1       sip: [android.net.sip.ISipService]
2       phoneext: [com.android.internal.telephony.ITelephonyExt]
3       phone: [com.android.internal.telephony.ITelephony]
...

 


Force to enable Hwui

 

adb shell setprop persist.sys.ui.hw true
...
adb shell service call activity 1599295570
...

 


RUNTIME 顯示硬體層更新 ON

 

adb setprop debug.hwui.profile visual_bars
...
adb shell service call activity 1599295570
...

 

profile_gpu_rendering_0.jpg


 

profile_gpu_rendering_1.jpg

 


RUNTIME 顯示硬體層更新 OFF

 

adb setprop debug.hwui.profile ""
...
adb shell service call activity 1599295570
...

 

profile_gpu_rendering_off_0.jpg


 

profile_gpu_rendering_off_1.jpg
 



debug.hwui.profile

 

# cat frameworks/base/libs/hwui/DrawProfiler.cpp
...
#define PROPERTY_PROFILE_VISUALIZE_BARS "visual_bars"
...
DrawProfiler::ProfileType DrawProfiler::loadRequestedProfileType() {
    ProfileType type = kNone;
    char buf[PROPERTY_VALUE_MAX] = {'\0',};
    if (property_get(PROPERTY_PROFILE, buf, "") > 0) {
        if (!strcmp(buf, PROPERTY_PROFILE_VISUALIZE_BARS)) {
            type = kBars;
        } else if (!strcmp(buf, "true")) {
            type = kConsole;
        }
    }
    return type;
}
...

 

其中 PROPERTY_PROFILE_VISUALIZE_BARS 為 visual_bars ;  PROPERTY_PROFILE 則為 debug.hwui.profile . 

請參考

 

https://android.googlesource.com/platform/frameworks/base/+/android-5.0.0_r2/libs/hwui/DrawProfiler.cpp
 

 

SYSPROPS_TRANSACTION

 

# cat frameworks/native/include/binder/IBinder.h
...
SYSPROPS_TRANSACTION    = B_PACK_CHARS('_', 'S', 'P', 'R'),  // ('_'<<24)|('S'<<16)|('P'<<8)|'R
...

 

請參考

 

https://android.googlesource.com/platform/frameworks/native/+/kitkat-release/include/binder/IBinder.h

 

以及

 

https://github.com/dhelleberg/android-scripts/blob/master/src/devtools.groovy#L121

 

上述的 1599295570 就是 IBinder.h 裡的 SYSPROPS_TRANSACTION

 

 

 

 

z.png
如果你覺得這篇文章對你有幫助, 請於留言板留個言, 以茲鼓勵. 謝謝! Email: jasonc@mail2000.com.tw

 

 

 


 


 

arrow
arrow
    創作者介紹
    創作者 Lexra 的頭像
    Lexra

    Lexra Pixnet

    Lexra 發表在 痞客邦 留言(0) 人氣()