Skip to content

Commit d726bf6

Browse files
committed
update
1 parent 06883db commit d726bf6

4 files changed

Lines changed: 22 additions & 2 deletions

File tree

‎_posts/2015-01-04-小米01月第一周工作记录.md‎

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,31 @@ window 是在 `activity.attach(...)` 中使用 `mWindow = PolicyManager.makeNe
3131

3232
在 Activity.java 中使用 `mWindow.setWindowManager(...)` 将 Window 与 WindowManager 进行关联。而 `mWindowManager` 的真实类型是 LocalWindowManager ,LocalWindowManager 又使用代理 Proxy 模式,将任务委托给 WindowManagerImpl 处理。
3333

34-
![](/img/QQ20150104-2.png)
34+
![](/img/QQ20150104-3.png)
35+
36+
在 ActivityThread.java 的 `handleResumeActivity(IBinder token, boolean clearHide,boolean isForward)` 方法中使用 `wm.addView(decor,layoutParams)` 进行了DecorView与ViewManager关联。
37+
38+
在 `wm.addView(decor,layoutParams)` 中使用了 ViewRoot ,下面介绍 ViewRoot。
39+
40+
* ViewRoot 继承了 Hanlder ,能处理消息。
41+
42+
* ViewRoot 有一个 Surface 类型的成员变量 `mSurface`
43+
44+
* ViewRoot 还有一个用于 Binder 通信的 IWindow.Stub 类型和一个 View 类型的 `mView` 变量。
45+
46+
![](/img/QQ20150104-4.png)
47+
48+
Surface 就是实实在在的画布。
49+
50+
ViewRoot 生成函数中将建立 Activity 的 ViewRoot 和 WindowManagerService 的关系。之后会有和 WindowsManagerService 的跨进程通信,Activity 的显示不单纯是自己的事。
51+
52+
WindowManagerService 是由 System_Server 启动, SurfaceFlinger 服务也在这个进程中。
3553

36-
在 ActivityThread.java 的 `handleResumeActivity(IBinder token, boolean clearHide,boolean isForward)` 方法中进行了DecorView与ViewManager关联。
54+
Activity 的显示就是由 ViewRoot 在它的 performTraversals 函数中完成。
3755

56+
整个 Activity 的绘图流程就是从 `mSurface` 中lock一块 Canvas ,然后交给 `mView` 去自由发挥,完了unlock。
3857

58+
![](/img/QQ20150104-5.png)
3959

4060
---
4161

‎img/.DS_Store‎

0 Bytes
Binary file not shown.

‎img/QQ20150104-4.png‎

211 KB
Loading

‎img/QQ20150104-5.png‎

247 KB
Loading

0 commit comments

Comments
 (0)