当前位置: 首页 > news >正文

深入分析TaskView源码之触摸相关

问题背景

hi,粉丝朋友们:
大家好!android 10以后TaskView作为替代ActivityView的容器,在课程的分屏pip自由窗口专题也进行了相关的详细介绍分析。
在这里插入图片描述
这里再补充一下相关的TaskView和桌面内嵌情况下的触摸分析

在这里插入图片描述

主要问题点:
1、明明TaskView属于CarLauncher的一个View,凭啥触摸自己的TaskView事件会让TaskView的Activity接收到
2、TaskView的Activity是怎么可以接收事件的呢?桌面怎么做到单独只排除TaskView其他地方都可以触摸呢?
哈哈,简单总结就是要搞清楚TaskView触摸响应原理。

问题分析切入点

一般说道触摸问题分析,一想到当然是窗口和input部分的dump信息分析
1、dumpsys activity containers

#1 DefaultTaskDisplayArea type=undefined mode=fullscreen override-mode=fullscreen requested-bounds=[0,0][0,0] bounds=[0,0][1408,792]#2 Task=1000011 type=standard mode=multi-window override-mode=multi-window requested-bounds=[404,76][1408,696] bounds=[404,76][1408,696]#0 ActivityRecord{38f55a5 u10 com.android.car.mapsplaceholder/.MapsPlaceholderActivity t1000011} type=standard mode=multi-window override-mode=undefined requested-bounds=[0,0][0,0] bounds=[404,76][1408,696]#0 60a6fdf com.android.car.mapsplaceholder/com.android.car.mapsplaceholder.MapsPlaceholderActivity type=standard mode=multi-window override-mode=undefined requested-bounds=[0,0][0,0] bounds=[404,76][1408,696]#1 Task=1 type=home mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1408,792]#0 Task=1000006 type=home mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1408,792]#0 ActivityRecord{185661 u10 com.android.car.carlauncher/.CarLauncher t1000006} type=home mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1408,792]#0 6845fdb com.android.car.carlauncher/com.android.car.carlauncher.CarLauncher type=home mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1408,792]

明显看到地图Activity的Task,windowmode属于multi-window
#2 Task=1000011 type=standard mode=multi-window override-mode=multi-window requested-bounds=[404,76][1408,696] bounds=[404,76][1408,696]
在CarLauncher 的Task ,windowmode为fullscreen
#1 Task=1 type=home mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1408,792]

注意一下地图的Task的bounds区域[404,76][1408,696] ,而CarLauncher的区域属于全屏的 bounds=[0,0][1408,792]
这么一看确实桌面的显示bound是包含了地图的Bound

所以这里可以初步理解为:

TaskView的地图是可以独立接受触摸时间的,因为它本身是独立的bounds区域,触摸到了这个区域就行
但是因为和CarLauncher有重叠,那么CarLauncher对这个TaskView部分的区域触摸是怎么处理的,会接受这一部分的触摸事件吗?毕竟这区域又是CarLauncher的一个TaskView区域,地图Activity也只是TaskView显示的内容而已
哈哈,这里就需要使用我们dumpsys input来解密

adb shell dumpsys input:

Input Dispatcher State:DispatchEnabled: trueDispatchFrozen: falseInputFilterEnabled: falseFocusedDisplayId: 0FocusedApplications:displayId=0, name='ActivityRecord{38f55a5 u10 com.android.car.mapsplaceholder/.MapsPlaceholderActivity t1000011}', dispatchingTimeout=5000msFocusedWindows:displayId=0, name='60a6fdf com.android.car.mapsplaceholder/com.android.car.mapsplaceholder.MapsPlaceholderActivity'FocusRequests:displayId=0, name='60a6fdf com.android.car.mapsplaceholder/com.android.car.mapsplaceholder.MapsPlaceholderActivity' result='OK'Pointer Capture Requested: falseCurrent Window with Pointer Capture: NoneTouchStates: <no displays touched>Display: 0logicalSize=1408x792transform (ROT_0) (IDENTITY)Windows:0: name='aa0d3fc BottomCarSystemBar', id=77, displayId=0, inputConfig=NOT_FOCUSABLE | TRUSTED_OVERLAY | WATCH_OUTSIDE_TOUCH, alpha=1.00, frame=[0,696][1408,792], globalScale=1.000000, applicationInfo.name=, applicationInfo.token=<null>, touchableRegion=[0,696][1408,792], ownerPid=1375, ownerUid=10150, dispatchingTimeout=5000ms, hasToken=0x7c04338b1ad0, touchOcclusionMode=BLOCK_UNTRUSTEDtransform (ROT_0) (TRANSLATE)1.0000  0.0000  -0.00000.0000  1.0000  -696.00000.0000  0.0000  1.00001: name='e8091e TopCarSystemBar', id=76, displayId=0, inputConfig=NOT_FOCUSABLE | TRUSTED_OVERLAY | WATCH_OUTSIDE_TOUCH, alpha=1.00, frame=[0,0][1408,76], globalScale=1.000000, applicationInfo.name=, applicationInfo.token=<null>, touchableRegion=[0,0][1408,76], ownerPid=1375, ownerUid=10150, dispatchingTimeout=5000ms, hasToken=0x7c04338d6310, touchOcclusionMode=BLOCK_UNTRUSTEDtransform (ROT_0) (IDENTITY)2: name='aff2cfa com.android.car.rotary', id=101, displayId=0, inputConfig=NOT_FOCUSABLE | PREVENT_SPLITTING | TRUSTED_OVERLAY | WATCH_OUTSIDE_TOUCH, alpha=1.00, frame=[1408,76][1408,76], globalScale=1.000000, applicationInfo.name=, applicationInfo.token=<null>, touchableRegion=<empty>, ownerPid=1871, ownerUid=1010088, dispatchingTimeout=5000ms, hasToken=0x7c04338e0bd0, touchOcclusionMode=USE_OPACITYtransform (ROT_0) (TRANSLATE)1.0000  0.0000  -1408.00000.0000  1.0000  -76.00000.0000  0.0000  1.00003: name='2cdb9e1 ActivityRecordInputSink com.aospinsight.dummyaidlapp/.MainActivity', id=194, displayId=0, inputConfig=NO_INPUT_CHANNEL | NOT_VISIBLE | NOT_FOCUSABLE | NOT_TOUCHABLE, alpha=1.00, frame=[0,0][0,0], globalScale=0.000000, applicationInfo.name=, applicationInfo.token=<null>, touchableRegion=[-14079,-7919][14080,7920], ownerPid=701, ownerUid=1000, dispatchingTimeout=0ms, hasToken=<null>, touchOcclusionMode=BLOCK_UNTRUSTEDtransform (ROT_0) (IDENTITY)4: name='6845fdb com.android.car.carlauncher/com.android.car.carlauncher.CarLauncher', id=205, displayId=0, inputConfig=TRUSTED_OVERLAY, alpha=1.00, frame=[0,0][1408,792], globalScale=1.000000, applicationInfo.name=ActivityRecord{185661 u10 com.android.car.carlauncher/.CarLauncher t1000006}, applicationInfo.token=0x7c04e3536310, touchableRegion=[0,0][1408,76]|[0,76][404,696]|[0,696][1408,792], ownerPid=1658, ownerUid=1010079, dispatchingTimeout=5000ms, hasToken=0x7c04338f3cd0, touchOcclusionMode=BLOCK_UNTRUSTEDtransform (ROT_0) (IDENTITY)5: name='60a6fdf com.android.car.mapsplaceholder/com.android.car.mapsplaceholder.MapsPlaceholderActivity', id=223, displayId=0, inputConfig=0x0, alpha=1.00, frame=[404,76][1408,696], globalScale=1.000000, applicationInfo.name=ActivityRecord{38f55a5 u10 com.android.car.mapsplaceholder/.MapsPlaceholderActivity t1000011}, applicationInfo.token=0x7c04e355be70, touchableRegion=[404,76][1408,696], ownerPid=22792, ownerUid=1010122, dispatchingTimeout=5000ms, hasToken=0x7c0433933dd0, touchOcclusionMode=BLOCK_UNTRUSTEDtransform (ROT_0) (TRANSLATE)1.0000  0.0000  -404.00000.0000  1.0000  -76.00000.0000  0.0000  1.00006: name='a9ab86e ActivityRecordInputSink com.android.car.mapsplaceholder/.MapsPlaceholderActivity', id=221, displayId=0, inputConfig=NO_INPUT_CHANNEL | NOT_FOCUSABLE, alpha=1.00, frame=[404,76][404,76], globalScale=0.000000, applicationInfo.name=, applicationInfo.token=<null>, touchableRegion=[404,76][1408,696], ownerPid=701, ownerUid=1000, dispatchingTimeout=0ms, hasToken=<null>, touchOcclusionMode=BLOCK_UNTRUSTEDtransform (ROT_0) (TRANSLATE)1.0000  0.0000  -404.00000.0000  1.0000  -76.00000.0000  0.0000  1.00007: name='c2d4eae ActivityRecordInputSink com.android.car.carlauncher/.CarLauncher', id=126, displayId=0, inputConfig=NO_INPUT_CHANNEL | NOT_FOCUSABLE, alpha=1.00, frame=[0,0][0,0], globalScale=0.000000, applicationInfo.name=, applicationInfo.token=<null>, touchableRegion=[-14079,-7919][14080,7920], ownerPid=701, ownerUid=1000, dispatchingTimeout=0ms, hasToken=<null>, touchOcclusionMode=BLOCK_UNTRUSTED

这里我们只需要重点关注窗口4和窗口5:
–桌面Activity
4: name=‘6845fdb com.android.car.carlauncher/com.android.car.carlauncher.CarLauncher’, id=205, displayId=0, inputConfig=TRUSTED_OVERLAY, alpha=1.00, frame=[0,0][1408,792], globalScale=1.000000, applicationInfo.name=ActivityRecord{185661 u10 com.android.car.carlauncher/.CarLauncher t1000006}, applicationInfo.token=0x7c04e3536310, touchableRegion=[0,0][1408,76]|[0,76][404,696]|[0,696][1408,792], ownerPid=1658, ownerUid=1010079, dispatchingTimeout=5000ms, hasToken=0x7c04338f3cd0, touchOcclusionMode=BLOCK_UNTRUSTED
transform (ROT_0) (IDENTITY)
–地图Activity
5: name=‘60a6fdf com.android.car.mapsplaceholder/com.android.car.mapsplaceholder.MapsPlaceholderActivity’, id=223, displayId=0, inputConfig=0x0, alpha=1.00, frame=[404,76][1408,696], globalScale=1.000000, applicationInfo.name=ActivityRecord{38f55a5 u10 com.android.car.mapsplaceholder/.MapsPlaceholderActivity t1000011}, applicationInfo.token=0x7c04e355be70, touchableRegion=[404,76][1408,696], ownerPid=22792, ownerUid=1010122, dispatchingTimeout=5000ms, hasToken=0x7c0433933dd0, touchOcclusionMode=BLOCK_UNTRUSTED
transform (ROT_0) (TRANSLATE)
1.0000 0.0000 -404.0000
0.0000 1.0000 -76.0000
0.0000 0.0000 1.0000

明显发现触摸派发window层级方面还是以桌面为顶部window,地图为底下window,这样其实也可以理解,我们上面的说的情况一样,其实整个画面都是CarLauncher的,地图Activity也只是CarLauncher的一个View而已。所以当然把桌面作为顶部的派发事件window完全没有问题。
但是问题来了,桌面把fullscreen面积占了?那么怎么才可以轮到地图Activity

大家注意看看桌面的window的这个属性

touchableRegion=[0,0][1408,76]|[0,76][404,696]|[0,696][1408,792],
是不是有个touchableRegion,对他就是真相,他负责了划定CarLauncher这个window可以响应的触摸区域,这里明显看出,这个区域划分了看了如下部分:

[0,76][404,696]| ----排除TaskView的的地图Activity区域

正常地图Activity的区域是[404,76][1408,696]从404开始到屏幕最右
[0,76][404,696]| 明显是只从0到404就截止了

这里就说明了CarLauncher虽然在顶部,但是他的touchRegion根本没有包含地图Activity的区域,所以派发事件时候根本不会抢地图Activity的,即地图区域的事件不会派发到桌面
总结:
问题关键找到了,就是靠touchRegion来让CarLauncher不接受地图Activity的Region

哪里设置的TouchRegion呢?

这里如果直接寻找比较麻烦可以用dumpsys window windows命令看看window是不是带了
在这里插入图片描述

下面就来分析这个桌面的TouchRegion是在哪里设置的呢?来看看对应dump代码
frameworks/base/services/core/java/com/android/server/wm/WindowState.java

 if (dumpAll) {pw.println(prefix + "mGivenContentInsets=" + mGivenContentInsets.toShortString(sTmpSB)+ " mGivenVisibleInsets=" + mGivenVisibleInsets.toShortString(sTmpSB));if (mTouchableInsets != 0 || mGivenInsetsPending) {pw.println(prefix + "mTouchableInsets=" + mTouchableInsets+ " mGivenInsetsPending=" + mGivenInsetsPending);Region region = new Region();getTouchableRegion(region);pw.println(prefix + "touchable region=" + region);}pw.println(prefix + "mFullConfiguration=" + getConfiguration());pw.println(prefix + "mLastReportedConfiguration=" + getLastReportedConfiguration());}//再来看看getTouchableRegion方法/** Get the touchable region in global coordinates. */void getTouchableRegion(Region outRegion) {final Rect frame = mWindowFrames.mFrame;switch (mTouchableInsets) {default:case TOUCHABLE_INSETS_FRAME:outRegion.set(frame);break;case TOUCHABLE_INSETS_CONTENT:applyInsets(outRegion, frame, mGivenContentInsets);break;case TOUCHABLE_INSETS_VISIBLE:applyInsets(outRegion, frame, mGivenVisibleInsets);break;case TOUCHABLE_INSETS_REGION: {//走的是这里outRegion.set(mGivenTouchableRegion);if (frame.left != 0 || frame.top != 0) {outRegion.translate(frame.left, frame.top);}break;}}cropRegionToRootTaskBoundsIfNeeded(outRegion);subtractTouchExcludeRegionIfNeeded(outRegion);}

那么这里的mGivenTouchableRegion是哪里设置的呢?

frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java

void setInsetsWindow(Session session, IWindow client, int touchableInsets, Rect contentInsets,Rect visibleInsets, Region touchableRegion) {int uid = Binder.getCallingUid();int pid = Binder.getCallingPid();final long origId = Binder.clearCallingIdentity();try {synchronized (mGlobalLock) {WindowState w = windowForClientLocked(session, client, false);if (DEBUG_LAYOUT) Slog.d(TAG, "setInsetsWindow " + w+ ", contentInsets=" + w.mGivenContentInsets + " -> " + contentInsets+ ", visibleInsets=" + w.mGivenVisibleInsets + " -> " + visibleInsets+ ", touchableRegion=" + w.mGivenTouchableRegion + " -> " + touchableRegion+ ", touchableInsets " + w.mTouchableInsets + " -> " + touchableInsets);if (w != null) {w.mGivenInsetsPending = false;w.mGivenContentInsets.set(contentInsets);w.mGivenVisibleInsets.set(visibleInsets);w.mGivenTouchableRegion.set(touchableRegion);//这里进行的设置w.mTouchableInsets = touchableInsets;if (w.mGlobalScale != 1) {w.mGivenContentInsets.scale(w.mGlobalScale);w.mGivenVisibleInsets.scale(w.mGlobalScale);w.mGivenTouchableRegion.scale(w.mGlobalScale);}w.setDisplayLayoutNeeded();w.updateSourceFrame(w.getFrame());mWindowPlacerLocked.performSurfacePlacement();w.getDisplayContent().getInputMonitor().updateInputWindowsLw(true);// We need to report touchable region changes to accessibility.if (mAccessibilityController.hasCallbacks()) {mAccessibilityController.onSomeWindowResizedOrMovedWithCallingUid(uid, w.getDisplayContent().getDisplayId());}}}} finally {Binder.restoreCallingIdentity(origId);}}

那么接下来再看看谁进行的setInsetsWindow调用:
frameworks/base/services/core/java/com/android/server/wm/Session.java

  @Overridepublic void setInsets(IWindow window, int touchableInsets,Rect contentInsets, Rect visibleInsets, Region touchableArea) {mService.setInsetsWindow(this, window, touchableInsets, contentInsets,visibleInsets, touchableArea);}

那么是谁调用了setInsets呢?

frameworks/base/libs/WindowManager/Shell/src/com/android/wm/shell/TaskView.java

    public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo inoutInfo) {// TODO(b/176854108): Consider to move the logic into gatherTransparentRegions since this//   is dependent on the order of listener.// If there are multiple TaskViews, we'll set the touchable area as the root-view, then// subtract each TaskView from it.if (inoutInfo.touchableRegion.isEmpty()) {inoutInfo.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);View root = getRootView();root.getLocationInWindow(mTmpLocation);mTmpRootRect.set(mTmpLocation[0], mTmpLocation[1], root.getWidth(), root.getHeight());inoutInfo.touchableRegion.set(mTmpRootRect);}getLocationInWindow(mTmpLocation);mTmpRect.set(mTmpLocation[0], mTmpLocation[1],mTmpLocation[0] + getWidth(), mTmpLocation[1] + getHeight());inoutInfo.touchableRegion.op(mTmpRect, Region.Op.DIFFERENCE);if (mObscuredTouchRegion != null) {inoutInfo.touchableRegion.op(mObscuredTouchRegion, Region.Op.UNION);}}

然后在调用对于的setInsets
在 performTraversals() 中进行相关的调用操作
frameworks/base/core/java/android/view/ViewRootImpl.java
在这里插入图片描述

setInsets
在这里插入图片描述

更多framework干货课程如下(需要的可以私聊马哥 获取优惠 +V :androidframework007):
在这里插入图片描述

相关文章:

深入分析TaskView源码之触摸相关

问题背景 hi&#xff0c;粉丝朋友们&#xff1a; 大家好&#xff01;android 10以后TaskView作为替代ActivityView的容器&#xff0c;在课程的分屏pip自由窗口专题也进行了相关的详细介绍分析。 这里再补充一下相关的TaskView和桌面内嵌情况下的触摸分析 主要问题点&#xff…...

键盘快捷键工具Keyboard Maestro mac中文版介绍

Keyboard Maestro mac是一款键盘快捷键工具&#xff0c;它可以帮助用户通过自定义快捷键来快速完成各种操作&#xff0c;提高工作效率。Keyboard Maestro支持多种快捷键组合&#xff0c;包括单键、双键、三键、四键组合等&#xff0c;用户可以根据自己的习惯进行设置。此外&…...

Dubbo开发系列

一、概述 以上是 Dubbo 的工作原理图&#xff0c;从抽象架构上分为两层&#xff1a;服务治理抽象控制面 和 Dubbo 数据面 。 服务治理控制面。服务治理控制面不是特指如注册中心类的单个具体组件&#xff0c;而是对 Dubbo 治理体系的抽象表达。控制面包含协调服务发现的注册中…...

周赛372(正难则反、枚举+贪心、异或位运算、离线+单调栈)

文章目录 周赛372[2937. 使三个字符串相等](https://leetcode.cn/problems/make-three-strings-equal/)模拟&#xff08;正难则反&#xff09; [2938. 区分黑球与白球](https://leetcode.cn/problems/separate-black-and-white-balls/)枚举 贪心 [2939. 最大异或乘积](https:/…...

存储区域网络(SAN)之FC-SAN和IP-SAN的比较

存储区域网络(Storage Area Network&#xff0c;SAN)用于将多个系统连接到存储设备和子系统。 早期FC-SAN&#xff1a; 采用光纤通道(Fibre Channel&#xff0c;FC)技术&#xff0c;通过光纤通道交换机连接存储阵列和服务器主机&#xff0c;建立专用于数据存储的区域网络。 传…...

Leetcode_45:跳跃游戏 II

题目描述&#xff1a; 给定一个长度为 n 的 0 索引整数数组 nums。初始位置为 nums[0]。 每个元素 nums[i] 表示从索引 i 向前跳转的最大长度。换句话说&#xff0c;如果你在 nums[i] 处&#xff0c;你可以跳转到任意 nums[i j] 处: 0 < j < nums[i] i j < n 返…...

给新手教师的成长建议

随着教育的不断发展和进步&#xff0c;越来越多的新人加入到教师这个行列中来。从学生到教师&#xff0c;这是一个华丽的转身&#xff0c;需要我们不断地学习和成长。作为一名新手老师&#xff0c;如何才能快速成长呢&#xff1f;以下是一名老师教师给的几点建议&#xff1a; 一…...

新手教师如何迅速成长

对于许多新手教师来说&#xff0c;迈出教学的第一步可能会感到非常困难。不过&#xff0c;通过一些关键的策略和技巧&#xff0c;还是可以快速提升教学能力的&#xff0c;我将为大家提供一些实用的建议&#xff0c;帮助各位在教育领域迅速成长。 深入了解学科知识 作为一名老师…...

竞赛选题 深度学习验证码识别 - 机器视觉 python opencv

文章目录 0 前言1 项目简介2 验证码识别步骤2.1 灰度处理&二值化2.2 去除边框2.3 图像降噪2.4 字符切割2.5 识别 3 基于tensorflow的验证码识别3.1 数据集3.2 基于tf的神经网络训练代码 4 最后 0 前言 &#x1f525; 优质竞赛项目系列&#xff0c;今天要分享的是 &#x…...

提升工作效率,使用AnyTXT Searcher实现远程办公速查公司电脑文件——“cpolar内网穿透”

文章目录 前言1. AnyTXT Searcher1.1 下载安装AnyTXT Searcher 2. 下载安装注册cpolar3. AnyTXT Searcher设置和操作3.1 AnyTXT结合cpolar—公网访问搜索神器3.2 公网访问测试 4. 固定连接公网地址 前言 你是否遇到过这种情况&#xff0c;异地办公或者不在公司&#xff0c;想找…...

mybatis使用foreach标签实现union集合操作

最近遇到一个场景就是Java开发中&#xff0c;需要循环多个表名&#xff0c;然后用同样的查询操作分别查表&#xff0c;最终得到N个表中查询的结果集合。在查询内容不一致时Java中跨表查询常用的是遍历表名集合循环查库&#xff0c;比较耗费资源&#xff0c;效率较低。在查询内容…...

请问DasViewer是否支持与业务系统集成,将业务的动态的数据实时的展示到三维模型上?

答&#xff1a;一般这种是以平台的方式来展示&#xff0c;云端地球实景三维建模云平台是专门做这一块的&#xff0c;可前往云端地球官网免费使用。 DasViewer是由大势智慧自主研发的免费的实景三维模型浏览器,采用多细节层次模型逐步自适应加载技术,让用户在极低的电脑配置下,…...

[ruby on rails]rack-cors, rack-attack

gem rack-attack gem rack-cors1. rack-attack 可以根据ip、域名等设置黑名单、设置访问频率 设置黑名单 # 新增 config/initializers/rack_attack.rb # 请求referer如果匹配不上设置的allowed_origins&#xff0c;返回403 forbidden Rack::Attack.blocklist(block bad domai…...

猫12分类:使用多线程爬取图片的Python程序

本文目标 对于猫12目标检测部分的数据集&#xff0c;采用网络爬虫来制作数据集。 在网络爬虫中&#xff0c;经常需要下载大量的图片。为了提高下载效率&#xff0c;可以使用多线程来并发地下载图片。本文将介绍如何使用Python编写一个多线程爬虫程序&#xff0c;用于爬取图片…...

《深度学习500问》外链笔记

1.这个是什么意思...

机器学习技术栈—— 概率学基础

机器学习技术栈—— 概率学基础 先验概率、后验概率、似然概率总体标准差和样本标准差 先验概率、后验概率、似然概率 首先 p ( w ∣ X ) p ( X ∣ w ) ∗ p ( w ) p ( X ) p(w|X) \frac{ p(X|w)*p(w)}{p(X)} p(w∣X)p(X)p(X∣w)∗p(w)​ 也就有 p ( w ∣ X ) ∝ p ( X ∣ …...

使用Redis实现分布式锁

Hi, I’m Shendi 使用Redis实现分布式锁 需求场景 需要使用到分布式锁的场景非常多&#xff0c;例如抢单等并发场景&#xff0c;这里举一个例子。 有一个商品&#xff0c;限量出售100个&#xff0c;一个用户下单&#xff0c;数量就减少一个&#xff0c;当剩下最后一个时&…...

linux 服务器进程、端口查找,nginx 配置日志查找,lsof 命令详解

一 、根据端口号 查看文件的部署位置 1.1 使用查看端口号对应的进程信息 方式一 &#xff1a; 使用netstat命令 netstat -tuln | grep 端口号-t&#xff1a;显示TCP连接 -u&#xff1a;显示UDP连接 -l&#xff1a;仅显示监听状态的连接 -n&#xff1a;以数字形式显示端口…...

汽车标定技术--A2L格式分析

目录 1.A2L由来 2.A2L格式 2.1 PROJECT 2.2 MODULE中包含的内容 3. INCA和CANape兼容吗&#xff1f; 最近有朋友用Vector ASAP2Editor编译的A2L文件在INCA7.4中无法识别&#xff0c;我记得以前做的时候是可以识别的&#xff0c;难不成最近有什么变动吗&#xff1f;出于好…...

Linux操作系统使用及C高级编程-D9D10Linux 服务搭建与使用

TFTP服务器 TFTP&#xff08;Trivial File Transfer Protocol&#xff09;即简单文件传输协议&#xff0c;是TCP/IP协议中一个用来在客户机与服务器之间进行简单文件传输的协议&#xff0c;提供不复杂、开销不大的文件传输服务。端口号为69 1、使用客户服务器方式和使用UDP数据…...

git下载安装配置及Git在Gitee上拉取和上传代码教程

一、Git下载安装和配置 Git是一个分布式版本控制系统&#xff0c;用于跟踪文件的变化并协作开发。以下是安装和配置Git的简单步骤&#xff1a; 安装Git 下载Git安装程序&#xff1a;Git下载地址。 运行安装程序&#xff0c;按照提示进行安装。 在安装过程中&#xff0c;选择…...

ospf路由选路及路由汇总

一、知识补充 1、ABR和ASBR 1.1 ABR ABR指的是边界路由&#xff0c;通常位于两个或多个区域之间&#xff0c;用于在不同的OSPF区域之间传递信息。当一个路由器同时连接到两个或多个区域时&#xff0c;它就成为了ABR&#xff0c;它需要维护每个区域的拓扑信息和路由表&#x…...

Oracle 11g 多数据库环境下的TDE设置

19c的TDE wallet的设置是在数据库中设置的&#xff0c;也就是粒度为数据库&#xff0c;因此不会有冲突。 而11g的设置是在sqlnet.ora中&#xff0c;因此有可能产生冲突。 这里先将一个重要概念&#xff0c;按照文档的说法&#xff0c;wallet是不能被数据库共享的。 If there …...

vue3使用pinia实现数据缓存

文章目录 前言一、pinia是什么&#xff1f;二、安装pinia三、注册pinia四、使用pinia定义数据及方法使用 优化如有启发&#xff0c;可点赞收藏哟~ 前言 vue2以前一直使用vuex实现状态管理 vue3之后推出了pinia… 一、pinia是什么&#xff1f; 直观、类型安全、轻便灵活的Vue …...

【CSS】min 和 max 函数(设置最大最小值)

文章目录 min() 函数&#xff1a;允许你从逗号分隔符表达式中选择一个最小值作为 CSS 的属性值 width: min(1vw, 4em, 80px);max() 函数&#xff1a;让你可以从一个逗号分隔的表达式列表中选择最大&#xff08;正方向&#xff09;的值作为属性的值 width: max(10vw, 4em, 80p…...

ip地址跟wifi有关系吗

​你可能已经听说过IP地址和Wi-Fi这两个词&#xff0c;但你有没有想过它们之间是否有关系呢&#xff1f;在这篇文章中&#xff0c;我们将深入探讨IP地址与Wi-Fi之间的密切联系。从基本概念到应用实例&#xff0c;虎观代理小二二将为您解答这个问题。 首先&#xff0c;让我们来了…...

[算法学习笔记](超全)概率与期望

引子 先来讲个故事 话说在神奇的OI大陆上&#xff0c;有一只paper mouse 有一天&#xff0c;它去商场购物&#xff0c;正好是11.11&#xff0c;商店有活动 它很荣幸被选上给1832抽奖 在抽奖箱里&#xff0c;有3个篮蓝球&#xff0c;12个红球 paper mouse能抽3次 蒟蒻的p…...

SpringCloud相关

文章目录 Gateway动态路由灰度策略 FeignRibbon SpringCloud五大组件分别对应&#xff08;1&#xff09;服务注册与发现&#xff08;2&#xff09;客服端负载均衡&#xff08;3&#xff09;断路器&#xff08;4&#xff09;服务网关&#xff08;5&#xff09;分布式配置 Gatewa…...

在 Linux 和 Windows 系统下查看 CUDA 和 cuDNN 版本的方法,包括使用 nvcc 命令

一直都比较头疼cuda与cudnn版本查看问题&#xff0c;两个系统不一样也不好查看&#xff0c;命令不通用 Linux 查看 CUDA 版本 方法一&#xff1a; nvcc --version或 nvcc -V如果 nvcc 没有安装&#xff0c;那么用方法二。 方法二&#xff1a; 去安装目录下查看&#xff…...

4.10每日一题(二元函数极值相关重要性质,反复学习)

...