Android14 WMS-IWindow介绍

发布时间:2026/10/21 18:33:26
Android14 WMS-IWindow介绍 IWindow是很重要的官方介绍是API back to a client window that the Window Manager uses to inform it of interesting things happening.也就是说是是用于WMS回调客户端的当窗口有一些改变时WMS及时调用客户端接口让客户端窗口立即更新。IWindow.aidl - OpenGrok cross reference for /frameworks/base/core/java/android/view/IWindow.aidl/** * API back to a client window that the Window Manager uses to inform it of * interesting things happening. * * {hide} */ oneway interface IWindow { /** * NOTICE * The first method must remain the first method. Scripts * and tools rely on their transaction number to work properly. */ /** * Invoked by the view server to tell a window to execute the specified * command. Any response from the receiver must be sent through the * specified file descriptor. */ void executeCommand(String command, String parameters, in ParcelFileDescriptor descriptor); void resized(in ClientWindowFrames frames, boolean reportDraw, in MergedConfiguration newMergedConfiguration, in InsetsState insetsState, boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId, int syncSeqId, boolean dragResizing); /** * Called when this window retrieved control over a specified set of insets sources. */ void insetsControlChanged(in InsetsState insetsState, in InsetsSourceControl[] activeControls); /** * Called when a set of insets source window should be shown by policy. * * param types internal insets types (WindowInsets.Type.InsetsType) to show * param fromIme true if this request originated from IME (InputMethodService). * param statsToken the token tracking the current IME show request or {code null} otherwise. */ void showInsets(int types, boolean fromIme, in nullable ImeTracker.Token statsToken); /** * Called when a set of insets source window should be hidden by policy. * * param types internal insets types (WindowInsets.Type.InsetsType) to hide * param fromIme true if this request originated from IME (InputMethodService). * param statsToken the token tracking the current IME hide request or {code null} otherwise. */ void hideInsets(int types, boolean fromIme, in nullable ImeTracker.Token statsToken); void moved(int newX, int newY); void dispatchAppVisibility(boolean visible); void dispatchGetNewSurface(); void closeSystemDialogs(String reason); /** * Called for wallpaper windows when their offsets or zoom level change. */ void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, float zoom, boolean sync); void dispatchWallpaperCommand(String action, int x, int y, int z, in Bundle extras, boolean sync); /** * Drag/drop events */ void dispatchDragEvent(in DragEvent event); /** * Pointer icon events */ void updatePointerIcon(float x, float y); /** * Called for non-application windows when the enter animation has completed. */ void dispatchWindowShown(); /** * Called when Keyboard Shortcuts are requested for the window. */ void requestAppKeyboardShortcuts(IResultReceiver receiver, int deviceId); /** * Called when Scroll Capture support is requested for a window. * * param callbacks to receive responses */ void requestScrollCapture(in IScrollCaptureResponseListener callbacks); }IWindow是怎么赋值并一步步传入WMS端的呢由下面代码可以看出它是在ViewRootImpl中进行赋值的//定义 ​ final W mWindow; ... public ViewRootImpl(UiContext Context context, Display display, IWindowSession session, WindowLayout windowLayout) { ... mWindow new W(this); ... } W如下 static class W extends IWindow.Stub { private final WeakReferenceViewRootImpl mViewAncestor; private final IWindowSession mWindowSession; W(ViewRootImpl viewAncestor) { mViewAncestor new WeakReferenceViewRootImpl(viewAncestor); mWindowSession viewAncestor.mWindowSession; } ... public void setView(View view, WindowManager.LayoutParams attrs, View panelParentView, int userId) { //此时将mWindow传入这个方法会一步步调用到Server端WMS中 res mWindowSession.addToDisplayAsUser(mWindow, mWindowAttributes, getHostVisibility(), mDisplay.getDisplayId(), userId, mInsetsController.getRequestedVisibleTypes(), inputChannel, mTempInsets, mTempControls, attachedFrame, compatScale); ​

关于本文作者

来自尧图内容编辑团队

尧图内容编辑团队 内容团队

尧图内容编辑团队

本文由尧图网络内容编辑团队执笔。团队由资深项目经理、前端工程师与设计师组成,所有内容均来自亲手交付的真实项目,先讲清问题、再给出可落地的解法。尧图深耕北京网站建设十年,服务过京华建材集团、智造科技等各行业客户,把一线经验沉淀为可复用的行业观察。

  • 十年建站经验,覆盖建材、制造、服务、文创等
  • 项目经理把关选题与事实准确性
  • 工程师与设计师联合撰写专业细节
  • 统一编辑规范,保证文风与排版一致
  • 每月复盘转化数据,迭代选题方向

延伸阅读

相关资讯与近期热门内容

深度阅读推荐

建站决策前值得细读的三篇

网站改版的5个关键决策
2024-08-12

网站改版的5个关键决策

什么时候该改版、改到什么程度、如何避免流量掉光,京华建材集团改版复盘给出答案。

获取专属建站方案

看完文章,把您的行业与预算告诉我们,免费获取一份量身定制的官网建设方案与报价。

立即免费咨询