android_view_DisplayListCanvas
How does SWT work? (part2)
Important logs
adb shell showmap -s [pid]
adb shell procmem [pid]
adb shell cat /proc/[pid]/smaps
adb shell cat /proc/[pid]/maps
adb shell dumpsys meminfo
Step1: Generate NE manually
Step2: Parse
LOCAL_STATIC_LIBRARIES
LOCAL_WHOLE_STATIC_LIBRARIES
LOCAL_MULTILIB
Example
Reference
http://androidxref.com/5.0.0_r2/xref/system/core/include/utils/Thread.h
CloseGuard 只是保護機制,用來檢查fd有沒有正常被上層釋放, 如果上層沒有呼叫 close, 一旦 ParcelFileDescriptor 生命週期結束,VM 回收物件的時候會呼叫 finalize, 此時 finalize 裡面會檢查 close guard 的狀態, 發現該 fd 沒有正常 close, 就會印出這些訊息.
從 VM 的實作 來說,finalize 時間點不固定,而且 VM 會希望object finalize 不要做太多事情, 原本只是希望做一個通知的動作.
exec
execl(), execlp(), and execle()
execv(), execvp(), and execvpe()
Reference
exec family
System call fork() is used to create processes. It takes no arguments and returns a process ID. The purpose of fork() is to create a new process, which becomes the child process of the caller. After a new child process is created, both processes will execute the next instruction following the fork() system call. Therefore, we have to distinguish the parent from the child. This can be done by testing the returned value of fork().
一個進程調用fork()函數後,系統先给新的進程分配資源,例如存儲數據和代碼的空間。然後把原來的進程的所有值都
复制到新的新進程中,只有少數值與原來的進程的值不同。相當於克隆了一個自己。
在fork()/execve()過程中,假設子程序結束時父程序仍存在,而父程序fork()之前既沒設置SIGCHLD信號處理函數調用waitpid()等待子進程結束,又沒有設置忽略該信號,則子程序成為僵屍程序,無法正常結束,即使是root身份kill -9也不能殺死僵屍程序。且此zombie process會占用process table, 除非父程序結束或有wait child process才可以。
zombies are the living dead. Zombie processes have died (either from a signal or because they exited), and the parent process has not yet executed a wait() for the process. The zombie is dead, but still occupies a process table slot and will continue to do so until its parent waits for it, or the parent exits. If the parent exits, the child will be inherited by the init process (usually PID 1), and one of the main purposes of that process (if not the only one) is to wait for children to die.
Solution
<sys/wait.h>
pid_t wait (int *status);
pid_t waitpid (pid_t pid, int *status, int options);
How to use handler
process和process之間,用binder,會用到fd,
buffer queue 的 deqeue 和 acquire,就是用 binder,所以它會用到fd,
然後buffer自己也會化成一個fd來傳, 所以光是dequeue,就可能要兩個fd,
fence本身也會化成一個fd,
buffer通常會帶兩個fence,所以多耗用兩個fd,
所以光一塊buffer身上就用了3個fd了,
上面這些釐清了fd是從哪邊來的...
btw, fence的話其實是確保buffer的讀寫.
然後會process在用binder傳遞資料時,
會去檢查兩邊process有沒有足夠的fd可以用,
如果A process fd用光了,binder就會傳一個error過去給 B process, B process自己決定要如何處理這error.
eg. A process是 SF & B process是system_server, SF fd用光了,所以 B 收到 error, 對這error的處理就是直接abort
所以一個dequebuffer 傳送端需要3個fd for buffer, 2個fd for deque and binder send,
A把fd傳過去 B就要用fd接, 所以B也會用到, B就需要共5個fd.
/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);
http://androidxref.com/4.4.2_r1/xref/frameworks/base/core/java/android/content/pm/PackageParser.java
AOSP -> alps\device\mediatek[proj]\system.prop (USE_OPENGL_RENDERER)
To turn off HWUI support, USE_OPENGL_RENDERER = false
ProjectConfig will inheritance, flavor project will inherit base project's setting.
If the load is builded, inheritence result will be put at "alps\out\target\product\$(proj)\obj\CUSTGEN\config\ProjectConfig.mk"
Output path:
alps\out\target\product[product]\data\app\HwAccelerationTest.apk
#include <utils/CallStack.h>
CallStack stack(LOG_TAG)
联系客服