【Android12】WindowManagerService架构分析
Android WindowManagerService架构分析
WindowManagerService(以下简称WMS) 是Android的核心服务。WMS管理所有应用程序窗口(Window)的Create、Display、Update、Destory。
因为Android系统中只有一个WMS(运行在SystemServer进程),可以称其为全局的WMS。其主要的任务有两个:
全局的窗口管理
应用程序的显示(在屏幕上看到应用)在WMS的协助下有序、有层次的输出给底层服务,最终显示到物理屏幕上。
全局的事件管理派发
WMS为Android输入系统(InputManagerService)提供窗口相关信息,让输入事件(比如touch、homekey等等)可派发给适合的应用(窗口)。
触摸屏:主流Android设备都使用了出触控屏,支持手势触控、多指触控。
鼠标:android系统加入鼠标,通过光标触发相应动作。
硬按键:Home、back、menu等等功能按键。
WMS的客户端WindowManager
WindowManager是WMS提供给使用者的API。Manager的命名方式遵循了Android通过的Service/Client框架的命名方法,即
Service端:XXXService
客户端API:XXXManager
WindowManager封装了WMS提供的AIDL对象,主要包括:
- IWindowManager.aidl:官方注释为**“System private interface to the window manager.”**,定义了WMS服务提供的能力接口。
//frameworks/base/core/java/android/view/IWindowManager.aidl/*
** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/package android.view;import com.android.internal.os.IResultReceiver;
import com.android.internal.policy.IKeyguardDismissCallback;
import com.android.internal.policy.IShortcutService;import android.app.IAssistDataReceiver;
import android.content.res.CompatibilityInfo;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.GraphicBuffer;
import android.graphics.Insets;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.Region;
import android.os.Bundle;
import android.os.IRemoteCallback;
import android.os.ParcelFileDescriptor;
import android.view.DisplayCutout;
import android.view.IApplicationToken;
import android.view.IAppTransitionAnimationSpecsFuture;
import android.view.ICrossWindowBlurEnabledListener;
import android.view.IDisplayWindowInsetsController;
import android.view.IDisplayWindowListener;
import android.view.IDisplayFoldListener;
import android.view.IDisplayWindowRotationController;
import android.view.IOnKeyguardExitResult;
import android.view.IPinnedTaskListener;
import android.view.IScrollCaptureResponseListener;
import android.view.RemoteAnimationAdapter;
import android.view.IRotationWatcher;
import android.view.ISystemGestureExclusionListener;
import android.view.IWallpaperVisibilityListener;
import android.view.IWindow;
import android.view.IWindowSession;
import android.view.IWindowSessionCallback;
import android.view.KeyEvent;
import android.view.InputEvent;
import android.view.InsetsState;
import android.view.MagnificationSpec;
import android.view.MotionEvent;
import android.view.InputChannel;
import android.view.InputDevice;
import android.view.IInputFilter;
import android.view.AppTransitionAnimationSpec;
import android.view.WindowContentFrameStats;
import android.view.WindowManager;
import android.view.SurfaceControl;
import android.view.displayhash.DisplayHash;
import android.view.displayhash.VerifiedDisplayHash;/*** System private interface to the window manager.** {@hide}*/
interface IWindowManager
{
// 省略
}
- IWindowSession.aidl:官方注释为“System private per-application interface to the window manager.”,同样定义WMS服务提供的能力接口。
//frameworks/base/core/java/android/view/IWindowSession.aidl
/* //device/java/android/android/view/IWindowSession.aidl
**
** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/package android.view;import android.content.ClipData;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.Region;
import android.os.Bundle;
import android.os.RemoteCallback;
import android.util.MergedConfiguration;
import android.view.DisplayCutout;
import android.view.InputChannel;
import android.view.IWindow;
import android.view.IWindowId;
import android.view.MotionEvent;
import android.view.WindowManager;
import android.view.InsetsSourceControl;
import android.view.InsetsState;
import android.view.Surface;
import android.view.SurfaceControl;
import android.view.SurfaceControl.Transaction;
import android.window.ClientWindowFrames;import java.util.List;/**
* System private per-application interface to the window manager.
*
* {@hide}
*/
interface IWindowSession {
// 省略
}
WindowManager常用的方法有三个addView、removeView、updateViewLayout,分别对应添加窗口、移除窗口、更新窗口布局功能。
// 获取WindowManager对象
WindowManager mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
// 构建布局
WindowManager.LayoutParams wmParams = new WindowManager.LayoutParams();
wmParams.xxx = xxx;
// 添加窗口到wms
mWindowManager.addView(xxxView,wmParams);
// 更新窗口布局
mWindowManager.updateViewLayout(xxxView, xxxWmParams)
// 从wms中移除窗口
mWindowmanager.remove(xxxView, wmParams);
Android支持多Display(多块物理屏或虚拟屏),在多Display情况下可以指定WindowManager绑定的Display,从而在指定的屏幕上显示内容。默认情况下,WindowManager绑定到DefaultDisplay。
// 获取DisplayManager对象
DisplayManager mDisplayManager;
mDisplayManager = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);// 获取指定DisplayID的Display,可以通过DisplayManager的getDisplays接口取得ID。
// 取得Display对象
Display display = mDisplayManager.getDisplay(displayId);
// 通过特定的Display创建Context
Context displayContext = mContext.createDisplayContext(display);
// 获取特定Display的WindowManager对象
WindowManager displayWindowManager = (WindowManager) displayContext.getSystemService(Context.WINDOW_SERVICE);
WMS提供的主要方法源码分析
这里针对WMS提供的主要方法,根据Android12源码进行分析。
获取WindowManager对象
在应用中可通过如下方法获取WindowManager对象。
// 获取WindowManager对象
WindowManager mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
调用context的getSystemService方法,其实现在ContextImpl.java中。
//frameworks/base/core/java/android/app/ContextImpl.java
@Override
public Object getSystemService(String name) {if (vmIncorrectContextUseEnabled()) {// Check incorrect Context usage.// 省略}return SystemServiceRegistry.getSystemService(this, name);
}
调用SystemServiceRegistry对象的getSystemService方法。name为window(Context.WINDOW_SERVICE对应的值)
//frameworks/base/core/java/android/app/SystemServiceRegistry.java
public static Object getSystemService(ContextImpl ctx, String name) {if (name == null) {return null;}// 从SYSTEM_SERVICE_FETCHERS(map)中取的Key为"Window"的valuefinal ServiceFetcher<?> fetcher = SYSTEM_SERVICE_FETCHERS.get(name);if (fetcher == null) {if (sEnableServiceNotFoundWtf) {Slog.wtf(TAG, "Unknown manager requested: " + name);}return null;}// 调用getService方法// CachedServiceFetcher<T>对应的getServicefinal Object ret = fetcher.getService(ctx);if (sEnableServiceNotFoundWtf && ret == null) {// 省略return null;}return ret;
}/*** Override this class when the system service constructor needs a* ContextImpl and should be cached and retained by that context.*/
static abstract class CachedServiceFetcher<T> implements ServiceFetcher<T> {private final int mCacheIndex;CachedServiceFetcher() {// Note this class must be instantiated only by the static initializer of the// outer class (SystemServiceRegistry), which already does the synchronization,// so bare access to sServiceCacheSize is okay here.mCacheIndex = sServiceCacheSize++;}@Override@SuppressWarnings("unchecked")public final T getService(ContextImpl ctx) {final Object[] cache = ctx.mServiceCache;final int[] gates = ctx.mServiceInitializationStateArray;boolean interrupted = false;T ret = null;for (;;) {boolean doInitialize = false;synchronized (cache) {// Return it if we already have a cached instance.// 如果有缓存,从缓存中取出来T service = (T) cache[mCacheIndex];if (service != null) {ret = service;// 跳出循环,直接返回break; // exit the for (;;)}// If we get here, there's no cached instance.// Grr... if gate is STATE_READY, then this means we initialized the service// once but someone cleared it.// We start over from STATE_UNINITIALIZED.// Similarly, if the previous attempt returned null, we'll retry again.if (gates[mCacheIndex] == ContextImpl.STATE_READY|| gates[mCacheIndex] == ContextImpl.STATE_NOT_FOUND) {gates[mCacheIndex] = ContextImpl.STATE_UNINITIALIZED;}// It's possible for multiple threads to get here at the same time, so// use the "gate" to make sure only the first thread will call createService().// At this point, the gate must be either UNINITIALIZED or INITIALIZING.if (gates[mCacheIndex] == ContextImpl.STATE_UNINITIALIZED) {doInitialize = true;gates[mCacheIndex] = ContextImpl.STATE_INITIALIZING;}}if (doInitialize) {// Only the first thread gets here.T service = null;@ServiceInitializationState int newState = ContextImpl.STATE_NOT_FOUND;try {// This thread is the first one to get here. Instantiate the service// *without* the cache lock held.// 创建新的对象。对于Context.WINDOW_SERVICE,创建的是WindowManagerImpl// 在SystemServiceRegistry初始化时,注册了各个服务对应的代理对象,感兴趣的可自行阅读源码。service = createService(ctx);newState = ContextImpl.STATE_READY;} catch (ServiceNotFoundException e) {onServiceNotFound(e);} finally {synchronized (cache) {cache[mCacheIndex] = service;gates[mCacheIndex] = newState;cache.notifyAll();}}ret = service;break; // exit the for (;;)}// 省略}if (interrupted) {Thread.currentThread().interrupt();}return ret;}public abstract T createService(ContextImpl ctx) throws ServiceNotFoundException;
}
上面创建了WindowManagerImpl对象,这个对象实现了 WindowManager接口类,是WMS提供的客户端代理真正实现类。
//frameworks/base/core/java/android/view/WindowManagerImpl.java
public final class WindowManagerImpl implements WindowManager {@UnsupportedAppUsageprivate final WindowManagerGlobal mGlobal = WindowManagerGlobal.getInstance();@UiContext@VisibleForTestingpublic final Context mContext;private final Window mParentWindow;/*** If {@link LayoutParams#token} is {@code null} and no parent window is specified, the value* of {@link LayoutParams#token} will be overridden to {@code mDefaultToken}.*/private IBinder mDefaultToken;/*** This token will be set to {@link LayoutParams#mWindowContextToken} and used to receive* configuration changes from the server side.*/@Nullableprivate final IBinder mWindowContextToken;public WindowManagerImpl(Context context) {this(context, null /* parentWindow */, null /* clientToken */);}private WindowManagerImpl(Context context, Window parentWindow,@Nullable IBinder windowContextToken) {mContext = context;mParentWindow = parentWindow;mWindowContextToken = windowContextToken;}
}
WindowManagerImpl构造时,会调用WindowManagerGlobal单例类的getInstance方法。WindowManagerGlobal持有IWindowManager对象。所以对应一个进程来讲,默认情况下只需要一个IWindowManager对象。
//frameworks/base/core/java/android/view/WindowManagerGlobal.javaprivate static IWindowManager sWindowManagerService;// 应用启动加载Activity时就会调用这个初始化。
@UnsupportedAppUsage
public static void initialize() {getWindowManagerService();
}@UnsupportedAppUsage
public static WindowManagerGlobal getInstance() {synchronized (WindowManagerGlobal.class) {if (sDefaultWindowManager == null) {sDefaultWindowManager = new WindowManagerGlobal();}return sDefaultWindowManager;}
}@UnsupportedAppUsage
public static IWindowManager getWindowManagerService() {synchronized (WindowManagerGlobal.class) {if (sWindowManagerService == null) {sWindowManagerService = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));try {if (sWindowManagerService != null) {ValueAnimator.setDurationScale(sWindowManagerService.getCurrentAnimatorScale());sUseBLASTAdapter = sWindowManagerService.useBLAST();}} catch (RemoteException e) {throw e.rethrowFromSystemServer();}}return sWindowManagerService;}
}
综上,getSystemService(Context.WINDOW_SERVICE)返回的实际上是WindowManagerImpl。WindowManagerImpl通过WindowManagerGlobal这个单例类获取IWindowManager。
WindowManager AddView
通过addView添加窗口到屏幕上,例如:
// 添加窗口到wms
mWindowManager.addView(xxxView,wmParams);
调用WindowManagerImpl的addView方法
@Override
public void addView(@NonNull View view, @NonNull ViewGroup.LayoutParams params) {applyTokens(params);mGlobal.addView(view, params, mContext.getDisplayNoVerify(), mParentWindow,mContext.getUserId());
}
直接调用WindowManagerGlobal的addView方法,在这个方法主要是创建了ViewRootImpl,更新了mViews和mRoots等变量。然后调用了ViewRootImpl的setView方法。
public void addView(View view, ViewGroup.LayoutParams params,Display display, Window parentWindow, int userId) {// 省略ViewRootImpl root;View panelParentView = null;synchronized (mLock) {// 创建ViewRoot// 一个Window对应一个ViewRootroot = new ViewRootImpl(view.getContext(), display);view.setLayoutParams(wparams);// mDyingViews:进程中所有要销毁的View// mViews:进程中所有View// mRoots:进程中所有ViewRootImplmViews.add(view);mRoots.add(root);mParams.add(wparams);// do this last because it fires off messages to start doing thingstry {root.setView(view, wparams, panelParentView, userId);} catch (RuntimeException e) {// BadTokenException or InvalidDisplayException, clean up.if (index >= 0) {removeViewLocked(index, true);}throw e;}}
}
ViewRootImpl的setView方法中,通过IWindowSession调用了WMS的addToDisplayAsUser方法,向WMS添加Window。WMS收到请求后,后创建WindowState与客户端的Window 一对一对应。
/*** We have one child*/
public void setView(View view, WindowManager.LayoutParams attrs, View panelParentView,int userId) {synchronized (this) {if (mView == null) {mView = view;// 省略try {// 调用IWindowSession,向WMS添加Windowres = mWindowSession.addToDisplayAsUser(mWindow, mWindowAttributes,getHostVisibility(), mDisplay.getDisplayId(), userId,mInsetsController.getRequestedVisibility(), inputChannel, mTempInsets,mTempControls);} catch (RemoteException e) {mAdded = false;mView = null;mAttachInfo.mRootView = null;mFallbackEventHandler.setView(null);unscheduleTraversals();setAccessibilityFocus(null, null);throw new RuntimeException("Adding window failed", e);} finally {if (restore) {attrs.restore();}}}
}
WMS架构
Window
- Window是一个窗口,很多图形系统都会有Window这个概念。比如CEGUI(天龙八部使用的UI系统)将Window作为最小的渲染单位,每个画面都是系列Window组成的二叉树。对于WMS来说,Window是最终呈现给用户的一块显示容器,是一系列View组成的一个画面。
- 实现上Window是一个抽象类,PhoneWindow是它的实现类。PhoneWindow对View进行管理。
- 一个Activity对应一个PhoneWindow,Activity启动时会创建与自身一一对应的PhoneWindow。
- Window是View的容器,View是Window的表现内容。
WindowManager
- WMS的接口类,继承ViewManager。用于给客户端管理窗口,它的实现类是WindowManagerImpl
InputManagerService
- 通过EventHub方式,从系统的输入Device节点中读取Input事件。通过WMS的协助派发给适当的应用。
SurfaceFlinger
- 分配应用程序需要的图形缓冲区,对系统整个图像窗口做Composition,最终图形窗口更新显示到Display。
WMS的主要功能:
- Surface管理:wms会为所有窗口分配Surface(通过surfaceFlinger创建Surface)。客户端向WMS添加窗口(addView)的过程,实质上是WMS为其分配一块Surface的过程。一系列Surface通过WMS进行管理,有序排布(z-order)。所以,View是表象、Window载体、Surface是本质。
- 窗口属性管理:显示层次、size、posotion等等属性管理,这些属性经过WMS的管理后最终反馈到SurfaceFlinger中。
- 窗口动画:进场、退场动画。
- 输入中转:WMS是窗口的管理者,IMS通过EventHub输入的系统Input事件,会经由WMS转发给恰当的应用(窗口)
WMS的启动
WMS在SystemServer的startOtherServices阶段启动。
WMS的构造方法
WMS添加窗口
通过调用WMS的addWindow添加窗口,WMS在添加窗口过程中,主要完成了以下内容
- 登记Window:创建WindowState,WindowState与客户端的ViewRoot/View一一对应,通过WindowState对象,WMS可以通知到客户端的ViewRoot。创建完成后,将WindowState加入到WindowMap中进行管理。
- 设置DisplayContent:一个屏幕对应一个DisplayContent,将窗口与对应的DisplayContent进行绑定。
- 申请Surface画布:WMS向SurfaceFligner申请一块Window画布(在SurfaceFlinger中是一个Layer),Surface画布对应着一块内存(fb buffer),Surface画面申请成功后View上的内容才可能显示到屏幕上。
如果View没有通过WindowManager.addView添加到WMS之前,View的onDraw是不会被调用的。View上绘制的内容与WMS无关,应用端可以会用接口直接告知SurfaceFlinger进行重绘。针对描画来讲,WMS只负责窗口的管理。
WMS与SurfaceFlinger的关系
如何调试WMS
可以通过以下几种方法调试WMS
- dumpsys windows: WMS提供了dump方式,可以通过dumpsys查看wms内部状态。对比WMS的实现源码,以进行相关问题调查。
//frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
private void doDump(FileDescriptor fd, PrintWriter pw, String[] args, boolean useProto){
}
- 使用dumpsys window -h查看支持的命令
- WMS的LogTag:TAG_WITH_CLASS_NAME可以让WMS以统一的Tag”WindowManager”输出。其配置在WindowManagerDebugConfig.java文件中。
// frameworks/base/services/core/java/com/android/server/wm/WindowManagerDebugConfig.java
/*** Common class for the various debug {@link android.util.Log} output configuration in the window* manager package.*/
public class WindowManagerDebugConfig {// All output logs in the window manager package use the {@link #TAG_WM} string for tagging// their log output. This makes it easy to identify the origin of the log message when sifting// through a large amount of log output from multiple sources. However, it also makes trying// to figure-out the origin of a log message while debugging the window manager a little// painful. By setting this constant to true, log messages from the window manager package// will be tagged with their class names instead fot the generic tag.static final boolean TAG_WITH_CLASS_NAME = false;// Default log tag for the window manager package.static final String TAG_WM = "WindowManager";
}
关于WMS的扩展探讨
大多数系统上WMS都是核心模块之一,拥有良好人机交互是系统流行的基础。WMS虽然与描画系统有关联,但其应属于AppFramework范畴。
考虑WMS,其通用性设计应该包括几个方面:
- 北向:提供稳定的API接口,提供窗口管理、层次管理、动画管理、输入管理等功能。应用通过北向接口,可以申请一块用于上屏的画布。
- 南向:封装并适配底层描画系统。
相关文章:

【Android12】WindowManagerService架构分析
Android WindowManagerService架构分析 WindowManagerService(以下简称WMS) 是Android的核心服务。WMS管理所有应用程序窗口(Window)的Create、Display、Update、Destory。 因为Android系统中只有一个WMS(运行在SystemServer进程),可以称其为…...

部署LVS的NET模式
实验准备 #负载调度器# 192.168.116.40 #内网 12.0.0.100 #外网 先添加双网卡 #web服务器# 192.168.116.20 #web1 192.168.116.30 #web2 #nfs共享服务# 192.168.116.10 #nfs systemctl stop firewalld setenforce 0 1.nfs共享文件 1…...

如何在Facebook Business Manager进行企业认证
Facebook Business Manager,简称BM,按照字面意思理解就是Facebook官方的商务管理平台,是供广告主团队去使用的一个管理工具。BM可以绑定Facebook公共主页、广告账户等一系列Facebook账号。通过BM,企业就可以在一个后台,…...

推荐一款好用的包含表格识别的OCR网站
在当今数字化的时代,文字和表格识别已经成为了许多行业的关键技术。无论是处理大量的纸质文档,还是从网络上收集数据,OCR(光学字符识别)技术都扮演着重要的角色。然而,对于许多用户来说,OCR软件…...
linux 块设备驱动程序介绍
Linux块设备驱动是Linux操作系统中用于处理块设备的设备驱动程序。块设备是指以固定大小的块单位进行访问的存储设备,例如硬盘、固态硬盘和USB存储设备等。 Linux块设备驱动负责管理块设备的读写操作,并将数据传输到相应的存储设备上。它还负责处理块设…...

知识付费小程序开发:构建个性化学习平台的技术实践
随着在线学习和知识付费的兴起,开发一款知识付费小程序成为了创新的热点之一。本文将通过使用Node.js、Express和MongoDB为例,演示如何构建一个基础的知识付费小程序后端,并实现用户认证和知识内容管理。 1. 初始化项目 首先,确…...

OpenCV极坐标变换函数warpPolar的使用
学更好的别人, 做更好的自己。 ——《微卡智享》 本文长度为1702字,预计阅读4分钟 前言 前阵子在做方案时,得了几张骨钉的图片,骨科耗材批号效期管理一直是比较麻烦的,贴RFID标签成本太高,所以一般考虑还是…...

类与接口常见面试题
抽象类和接口的对比 抽象类是用来捕捉子类的通用特性的。接口是抽象方法的集合。 从设计层面来说,抽象类是对类的抽象,是一种模板设计,接口是行为的抽象,是一种行为的规范。 相同点 接口和抽象类都不能实例化都位于继承的顶端…...

Windows mysql5.7 执行查询/开启/测试binlog---简易记录
前言:基于虚拟机mysql版本为5.7,增量备份测试那就要用到binlog… 简述:二进制日志(binnary log)以事件形式记录了对MySQL数据库执行更改的所有操作。 binlog是记录所有数据库表结构变更(例如CREATE、ALTER…...

文档安全加固:零容忍盗窃,如何有效预防重要信息外泄
文档安全保护不仅需要从源头着手,杜绝文档在使用和传播过程中产生的泄密风险,同时还需要对文档内容本身进行有效的保护。为了防范通过拷贝、截屏、拍照等手段盗窃重要文档内容信息的风险,迅软DSE加密软件提供了文档加密保护功能,能…...

前端如何设置模板参数
1.背景: 最近接到一个需求,在一个类似chatGpt的聊天工具中,要在对话框中设置模板,后端提供了很多模板参数,然后要求将后端返回的特殊字符转成按钮,编辑完成后在相应的位置拼接成字符串。 2.效果:…...
06 使用v-model实现双向数据绑定
概述 Vue achieves two-way data binding by creating a dedicated directive that watches a data property within your Vue component. The v-model directive triggers data updates when the target data property is modified on the UI. Vue 通过创建一个专用指令来观…...

【C++11特性篇】C++11中新增的initializer_list——初始化的小利器(2)
前言 大家好吖,欢迎来到 YY 滴C11系列 ,热烈欢迎! 本章主要内容面向接触过C的老铁 主要内容含: 欢迎订阅 YY滴C专栏!更多干货持续更新!以下是传送门! 目录 一.探究std::initializer_list是什么…...

计算机网络传输层(期末、考研)
计算机网络总复习链接🔗 目录 传输层的功能端口UDP协议UDP数据报UDP的首部格式UDP校验 TCP协议(必考)TCP报文段TCP连接的建立TCP连接的释放TCP的可靠传输TCP的流量控制零窗口探测报文段 TCP的拥塞控制慢开始和拥塞控制快重传和快恢复 TCP和U…...

【STM32入门】4.1中断基本知识
1.中断概览 在开展红外传感器遮挡计次的实验之前,有必要系统性的了解“中断”的基本知识. 中断是指:在主程序运行过程中,出现了特定的中断触发条件(中断源),使得CPU暂停当前正在运行的程序,转…...

HCIA-H12-811题目解析(3)
1、【单选题】 以下关于路由器的描述,说法错误的是? 2、【单选题】某网络工程师在输入命令行时提示如下信息:Error:Unrecognized command foun at position.对于该提示信息说法正确的是? 3、【单选题】如下图所示的网络…...

【异步绘制】UIView刷新原理 与 异步绘制
快捷目录 壹、 iOS界面刷新机制贰、浅谈UIView的刷新与绘制概述一.UIView 与 CALayer1. UIView 与 CALayer的关系2. CALayer的一些常用属性contents属性contentGravity属性contentsScale属性maskToBounds属性contentsRect属性 二.View的布局与显示1.图像显示原理2.布局layoutSu…...
[ERROR] ocp-server-ce-py_script_start_check-4.2.1 RuntimeError: ‘tenant_name‘
Oceanbase 安装成功后关闭OCP,在重新启动时报错 使用OBD 启动OCP报如下错误 [adminobd ~]$ obd cluster start ocp Get local repositories ok Search plugins ok Open ssh connection ok Load cluster param plugin ok Check before start ocp-server x [ERROR] …...

模拟实验中经常遇到的问题和常用技巧
简介 最近在进行新文章的数值模拟阶段。上一次已经跟读者们分享了模拟实验的大致流程,见:数值模拟流程记录和分享 。 本文是在前提下,汇总了小编在模拟实验中经常遇到的问题和常用技巧。 文章目录 简介1. 隐藏输出结果自动创建文件夹保存多…...
微信小程序(二) ——模版语法1
文章目录 wxml模板语法拼接字符数据绑定 wxml模板语法 拼接字符 <image src"{{test1src}}" mode""/>数据绑定 在data中定义数据,吧数据定义到data对象中在wxml中使用数据不论是绑定内容还是属性都是用 {{}} 语法 动态绑定内容 *声明…...

stm32G473的flash模式是单bank还是双bank?
今天突然有人stm32G473的flash模式是单bank还是双bank?由于时间太久,我真忘记了。搜搜发现,还真有人和我一样。见下面的链接:https://shequ.stmicroelectronics.cn/forum.php?modviewthread&tid644563 根据STM32G4系列参考手…...

css实现圆环展示百分比,根据值动态展示所占比例
代码如下 <view class""><view class"circle-chart"><view v-if"!!num" class"pie-item" :style"{background: conic-gradient(var(--one-color) 0%,#E9E6F1 ${num}%),}"></view><view v-else …...

JavaScript 中的 ES|QL:利用 Apache Arrow 工具
作者:来自 Elastic Jeffrey Rengifo 学习如何将 ES|QL 与 JavaScript 的 Apache Arrow 客户端工具一起使用。 想获得 Elastic 认证吗?了解下一期 Elasticsearch Engineer 培训的时间吧! Elasticsearch 拥有众多新功能,助你为自己…...
.Net Framework 4/C# 关键字(非常用,持续更新...)
一、is 关键字 is 关键字用于检查对象是否于给定类型兼容,如果兼容将返回 true,如果不兼容则返回 false,在进行类型转换前,可以先使用 is 关键字判断对象是否与指定类型兼容,如果兼容才进行转换,这样的转换是安全的。 例如有:首先创建一个字符串对象,然后将字符串对象隐…...

初探Service服务发现机制
1.Service简介 Service是将运行在一组Pod上的应用程序发布为网络服务的抽象方法。 主要功能:服务发现和负载均衡。 Service类型的包括ClusterIP类型、NodePort类型、LoadBalancer类型、ExternalName类型 2.Endpoints简介 Endpoints是一种Kubernetes资源…...
嵌入式常见 CPU 架构
架构类型架构厂商芯片厂商典型芯片特点与应用场景PICRISC (8/16 位)MicrochipMicrochipPIC16F877A、PIC18F4550简化指令集,单周期执行;低功耗、CIP 独立外设;用于家电、小电机控制、安防面板等嵌入式场景8051CISC (8 位)Intel(原始…...

ZYNQ学习记录FPGA(一)ZYNQ简介
一、知识准备 1.一些术语,缩写和概念: 1)ZYNQ全称:ZYNQ7000 All Pgrammable SoC 2)SoC:system on chips(片上系统),对比集成电路的SoB(system on board) 3)ARM:处理器…...

Neko虚拟浏览器远程协作方案:Docker+内网穿透技术部署实践
前言:本文将向开发者介绍一款创新性协作工具——Neko虚拟浏览器。在数字化协作场景中,跨地域的团队常需面对实时共享屏幕、协同编辑文档等需求。通过本指南,你将掌握在Ubuntu系统中使用容器化技术部署该工具的具体方案,并结合内网…...

密码学基础——SM4算法
博客主页:christine-rr-CSDN博客 专栏主页:密码学 📌 【今日更新】📌 对称密码算法——SM4 目录 一、国密SM系列算法概述 二、SM4算法 2.1算法背景 2.2算法特点 2.3 基本部件 2.3.1 S盒 2.3.2 非线性变换 编辑…...

react-pdf(pdfjs-dist)如何兼容老浏览器(chrome 49)
之前都是使用react-pdf来渲染pdf文件,这次有个需求是要兼容xp环境,xp上chrome最高支持到49,虽然说iframe或者embed都可以实现预览pdf,但为了后续的定制化需求,还是需要使用js库来渲染。 chrome 49测试环境 能用的测试…...