美文网首页
Android WMS--Window相关数据类

Android WMS--Window相关数据类

作者: android_coder | 来源:发表于2020-06-28 15:35 被阅读0次

WindowManagerService主要是负责管理WindowState和窗口动画的

1:WMS有关Window相关的数据结构

WMS数据结构.png
2:RootWindowContainer

RootWindowContainer的初始化是在WMS中完成的,其主要是用来管理显示屏幕的,其关联着一组DisplayContent,设备上的所有显示 屏幕都是其来管理

WindowList<E> mChildren,E代表的是DisplayContent
protected final SurfaceAnimator mSurfaceAnimator;//窗口动画
3:DisplayContent

DisplayContent代表的是一块显示屏幕,其被RootWindowContainer所管理,该显示屏上的窗口以栈的形式管理,DisplayContent有四种类型的container,分别用来存储不同类型的窗口:应用程序窗口,系统类型的窗口,输入法窗口和壁纸窗口,在addWindowToken中来决定需要加入到哪个Container中

/** Unique identifier of this stack. */
    private final int mDisplayId;
    /** The containers below are the only child containers the display can have. */
    // Contains all window containers that are related to apps (Activities)
    private final TaskStackContainers mTaskStackContainers = new TaskStackContainers(mService);
    // Contains all non-app window containers that should be displayed above the app containers
    // (e.g. Status bar)
    private final AboveAppWindowContainers mAboveAppWindowsContainers =
            new AboveAppWindowContainers("mAboveAppWindowsContainers", mService);
    // Contains all non-app window containers that should be displayed below the app containers
    // (e.g. Wallpaper).
    private final NonAppWindowContainers mBelowAppWindowsContainers =
            new NonAppWindowContainers("mBelowAppWindowsContainers", mService);
    // Contains all IME window containers. Note that the z-ordering of the IME windows will depend
    // on the IME target. We mainly have this container grouping so we can keep track of all the IME
    // window containers together and move them in-sync if/when needed. We use a subclass of
    // WindowContainer which is omitted from screen magnification, as the IME is never magnified.
    private final NonMagnifiableWindowContainers mImeWindowsContainers =
            new NonMagnifiableWindowContainers("mImeWindowsContainers", mService);
 // Mapping from a token IBinder to a WindowToken object on this display.
    private final HashMap<IBinder, WindowToken> mTokenMap = new HashMap();
4:TaskStack

用来管理Window的,形式就是栈的形式,对应AMS端的ActivityStack

   /** Unique identifier */
    final int mStackId;
    /** The display this stack sits under. */
    // TODO: Track parent marks like this in WindowContainer.
    private DisplayContent mDisplayContent;
    /** Application tokens that are exiting, but still on screen for animations. */
    final AppTokenList mExitingAppTokens = new AppTokenList();
    final AppTokenList mTmpAppTokens = new AppTokenList();
5:Task

Task可以理解成一个任务栈,用来管理AppWindowToken的,对应AMS端的TaskRecord

 TaskStack mStack;
 final int mTaskId;
 final int mUserId;
 //表明Task关联着一组AppWindowToken,WindowList<E> mChildren表示的是WindowList<AppWindowToken> mChildRen
 class Task extends WindowContainer<AppWindowToken>
6:AppWindowToken

AppWindowToken关联着一组有相同Token值的WindowState,WindowState并不是和Activity一一对应的,因为窗口有子窗口,系统窗口,应用程序窗口三种,子窗口和应用程序窗口共用相同的token值

 // Non-null only for application tokens.
 final IApplicationToken appToken;
 WindowList<WindowState> mChildren;存储的所有的WindowState
7:WindowState

WindowState代表是WMS端的窗口对象,WindowState是应用程序通过WindowManager.addView创建的,WindowState是有层级的,其层级是有layer来决定,最终是由窗口类型来决定的

 final Session mSession;
 final IWindow mClient;
 final WindowId mWindowId;
 WindowToken mToken;
 // The same object as mToken if this is an app window and null for non-app windows.
 AppWindowToken mAppToken;
 final int mBaseLayer;//baselayer
 final int mSubLayer;//sublayer
 final boolean mLayoutAttached;
 final boolean mIsImWindow;//输入法窗口
 final boolean mIsWallpaper;//壁纸窗口
 final WindowManager.LayoutParams mAttrs//窗口属性

相关文章

  • Android WMS--Window相关数据类

    WindowManagerService主要是负责管理WindowState和窗口动画的 1:WMS有关Windo...

  • Android AMS--Activity相关数据类

    AMS主要是负责四大组件的启动,进程调度以及在AMS中还会启动部分系统服务,主要是其他服务:startOtherS...

  • Android ViewModel

    Android ViewModel ViewModel 类旨在以注重生命周期的方式存储和管理界面的相关数据, vi...

  • LitePal学习(四)——表关联及相关查询

    前言 之前都是讲的单表查询,今天讲下类中包含类对象的情况,即表关联相关的知识参考文章:Android数据库高手秘籍...

  • Android 启动相关类

    Zygote进程Zygote进程启动之后,调用startSystemServer会启动SystemServer进程...

  • QT SQL

    数据库相关类 数据库相关类分为三个层次: 驱动层:QSqlDriver,QSqlDriverCreator,QSq...

  • 笔记:Android线程和线程池

    Android线程和线程池 Android中的线程操作相关的类有 AsyncTask IntentService ...

  • 安卓多用户学习笔记

    一.背景 多用户是Android4.2被引入的 二.用户相关操作(创建,切换,删除) 相关类(基于Android...

  • Android代码规范(自用)

    命名规范和排版 java成员类 基础类型优先排在上方 java相关类排在基础类型下方 android相关类排在ja...

  • Android-手写Handler

    Android消息机制相关类 Handler、Message、MessageQueue、Looper ZHandl...

网友评论

      本文标题:Android WMS--Window相关数据类

      本文链接:https://www.haomeiwen.com/subject/tjwifktx.html