【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"的value
	final ServiceFetcher<?> fetcher = SYSTEM_SERVICE_FETCHERS.get(name);
	if (fetcher == null) {
		if (sEnableServiceNotFoundWtf) {
			Slog.wtf(TAG, "Unknown manager requested: " + name);
		}
		return null;
	}
	// 调用getService方法
	// CachedServiceFetcher<T>对应的getService
	final 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 {
    @UnsupportedAppUsage
    private final WindowManagerGlobal mGlobal = WindowManagerGlobal.getInstance();
    @UiContext
    @VisibleForTesting
    public 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.
     */
    @Nullable
    private 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.java
 private 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对应一个ViewRoot
		root = new ViewRootImpl(view.getContext(), display);

		view.setLayoutParams(wparams);
		// mDyingViews:进程中所有要销毁的View
		// mViews:进程中所有View
		// mRoots:进程中所有ViewRootImpl
		mViews.add(view);
		mRoots.add(root);
		mParams.add(wparams);

		// do this last because it fires off messages to start doing things
		try {
			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添加Window
				res = 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接口,提供窗口管理、层次管理、动画管理、输入管理等功能。应用通过北向接口,可以申请一块用于上屏的画布。
  • 南向:封装并适配底层描画系统。
    在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/251358.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

TCP报文头(首部)详解

本篇文章基于 RFC 9293: Transmission Control Protocol (TCP) 对TCP报头进行讲解&#xff0c;部分内容会与旧版本有些许区别。 TCP协议传输的数据单元是报文段&#xff0c;一个报文段由TCP首部&#xff08;报文头&#xff09;和TCP数据两部分组成&#xff0c;其中TCP首部尤其重…

用Flask搭建简单的web模型部署服务

目录结构如下&#xff1a; 分类模型web部署 classification.py import os import cv2 import numpy as np import onnxruntime from flask import Flask, render_template, request, jsonifyapp Flask(__name__)onnx_session onnxruntime.InferenceSession("mobilen…

ES6 面试题 | 14.精选 ES6 面试题

&#x1f90d; 前端开发工程师&#xff08;主业&#xff09;、技术博主&#xff08;副业&#xff09;、已过CET6 &#x1f368; 阿珊和她的猫_CSDN个人主页 &#x1f560; 牛客高级专题作者、在牛客打造高质量专栏《前端面试必备》 &#x1f35a; 蓝桥云课签约作者、已在蓝桥云…

NoSQL 数据库有哪些典型应用?

前面的内容介绍了数据库读写分离和分库分表相关知识&#xff0c;都是针对关系型数据库的&#xff0c;即通常说的 RDBMS。除了关系型数据库&#xff0c;NoSQL 在项目开发中也有着越来越重要的作用&#xff0c;与此同时&#xff0c;NoSQL 相关的内容也是面试的常客。今天我们一起…

单链表详解(附图解,结尾附全部源码)

下面开始带大家对单链表的增删查改进行图解 首先给大家介绍一下链表 链表就是每一个结构体中包含一个数据和一个结构体指针&#xff0c;这个指针就相当于锁链的作用将下一个结构体给锁住&#xff0c;但是每个结构体的空间是相对独立的。 图解&#xff1a; 1 首先实现尾插 如果…

智能优化算法应用:基于热交换算法3D无线传感器网络(WSN)覆盖优化 - 附代码

智能优化算法应用&#xff1a;基于热交换算法3D无线传感器网络(WSN)覆盖优化 - 附代码 文章目录 智能优化算法应用&#xff1a;基于热交换算法3D无线传感器网络(WSN)覆盖优化 - 附代码1.无线传感网络节点模型2.覆盖数学模型及分析3.热交换算法4.实验参数设定5.算法结果6.参考文…

服务端监控工具:Nmon使用方法

一、认识nmon 1、简介 nmon是一种在AIX与各种Linux操作系统上广泛使用的监控与分析工具&#xff0c;它能在系统运行过程中实时地捕捉系统资源的使用情况&#xff0c;记录的信息比较全面&#xff0c; 并且能输出结果到文件中&#xff0c;然后通过nmon_analyzer工具产生数据文件…

spring 笔记九 Spring AOP

Spring 的 AOP 简介 什么是AOP AOP 为Aspect Oriented Programming 的缩写&#xff0c;意思为面向切面编程&#xff0c;是通过预编译方式和运行期动态代理实现程序功能的统一维护的一种技术。 AOP 是OOP 的延续&#xff0c;是软件开发中的一个热点&#xff0c;也是Spring框架…

10 新字符设备驱动文件

一、新字符设备驱动原理 因为 register_chrdev 和 unregister_chrdev 两个函数是老版本驱动文件&#xff0c;现在可以用新字符设备驱动 API 函数。 1. 分配和和释放设备号 使用 register_chrdev 函数注册字符设备的时候只需要给定一个主设备号即可&#xff0c;但是这样会带来两…

【Kubernetes】存储类StorageClass

存储类StorageClass 一、StorageClass介绍二、安装nfs provisioner&#xff0c;用于配合存储类动态生成pv2.1、创建运行nfs-provisioner需要的sa账号2.2、对sa授权2.3、安装nfs-provisioner程序 三、创建storageclass&#xff0c;动态供给pv四、创建pvc&#xff0c;通过storage…

Mybatis-plus是使用,告别繁琐的CRUD编写,自动生成直接使用

目录 一、简介 1. 是什么 2. 特性 3. 框架结构 4. 常用注解 二、搭建使用 1. 依赖 2. 生成器 3. 生成 4. 引用 5. 路径访问 三、测试 四、雪花ID 每篇一获 Mybatis-plus&#xff08;简称 MP&#xff09;是一个 MyBatis (opens new window)的增强工具&#xff0c;…

贪心算法:买卖股票的最佳时机II 跳跃游戏 跳跃游戏II

122.买卖股票的最佳时机II 思路&#xff1a; 想要获得利润&#xff0c;至少要以两天为一个交易单元&#xff0c;因为两天才会有股价差。因此可以将最终利润进行分解&#xff0c;如prices[3] - prices[0] (prices[3] - prices[2]) (prices[2] - prices[1]) (prices[1] - pr…

运筹学经典问题(二):最短路问题

问题描述 给定一个图&#xff08;有向图或无向图&#xff09; G ( V , E ) G (V, E) G(V,E)&#xff0c; V V V是图中点的集合&#xff0c; E E E是图中边的集合&#xff0c;图中每条边 ( i , j ) ∈ E (i, j) \in E (i,j)∈E都对应一个权重 c i j c_{ij} cij​&#xff08;…

nodejs+vue+微信小程序+python+PHP技术下的音乐推送系统-计算机毕业设计推荐

3.2.1前台用户功能 前台注册用户的功能如下&#xff1a; 注册登录&#xff1a;用户填写个人信息&#xff0c;并验证手机号码进行账户注册&#xff0c;注册成功后方可登录系统。 歌手介绍&#xff1a;用户可以在线进行歌手介绍信息查看等。 音乐库&#xff1a;用户可以在音乐库查…

【QT】非常简单的登录界面实现

本系列是作者自学实践过程的记录 本文是关于登录界面设计 有问题欢迎讨论 效果图&#xff1a; 一、创建项目和主界面 创建Qt Widget Application 这里我们使用qmake而不是cmake 这是主界面&#xff0c;登录界面等后面再创建&#xff0c;这里要勾选上generate form&#xff0…

网站转换APP源代码 WebAPP源代码 网站生成APP源代码 Flutter项目 带控制端

源码介绍 一款网站转换成APP的源代码,开发语言使用Flutter,开发工具使用的是AndroidStudio,你只需要在APP源代码里面填写你的域名,即可生成即可生成APP,包括安卓或者苹果,与此同时我们提供了APP的控制端.你可以通过控制端设置APP的颜色、添加APP的图标、添加APP的菜单栏目。 …

mybatis-plus使用达梦数据库处理枚举类型报错的问题

使用mybatis-plus连接达梦数据库&#xff0c;枚举类型无法读取 枚举类&#xff1a; 实体&#xff1a; 数据库字段&#xff1a; mybatis-plus枚举包配置&#xff1a; 调用查询方法&#xff1a; List<QualityRuleTemplate> qualityRuleTemplates ruleTemplateServic…

C#教程(三):字符串的各种用法

在C#中&#xff0c;字符串&#xff08;string 类型&#xff09;是一种常用的数据类型&#xff0c;用于存储和操作文本数据。以下是一些C#中字符串的常见用法 1、输出任意的字符串长度 代码 #region 输出任意的字符串长度 Console.WriteLine("请输入你心中想到的名字&…

玩转树莓派之系统安装篇

介绍 树莓派是树莓派基金会下的一个明星产品&#xff08;单板计算机&#xff09;&#xff0c;已经迭代到第五代了&#xff1b;它性能强大、开源、拓展性强、体积小&#xff0c;搞物联网开发的人基本都听说过这个玩意&#xff01;笔者手上刚好有一块4B的板子&#xff0c;让我们…

系统安全-应用威胁风险检查项及预防方案

系统安全-应用威胁风险检查项及预防方案 1、欺骗&#xff08;认证&#xff09; 2、篡改&#xff08;授权和加密&#xff09; 3、抵赖&#xff08;日志记录和数字签名&#xff09; 4、信息泄露&#xff08;敏感信息保护&#xff09; 5、特权提升 6、拒绝服务&#xff08;数据稀释…
最新文章