软件平台:Android11

硬件平台:高通

需求由来:项目中支持电磁笔,发现电磁笔接触屏幕的点系统都会显示黑色的鼠标小箭头,需要将这个屏蔽掉;

这种问题从资源名称着手比较好,而且这种全局的资源一般在SystemUI或者Framework的res目录下的概率较大,我们找到了类似鼠标图片资源的文件:pointer_arrow.png,搜索使用该素材的xml如下:

kongbo@kanyun-SA5112M5:~/qcom-android/LINUX/android/frameworks/base/core/res$ grep pointer_arrow -nrw .
./res/drawable/pointer_arrow_icon.xml:3:    android:bitmap="@drawable/pointer_arrow"

进而查找pointer_arrow_icon.xml的加载位置,

kongbo@kanyun-SA5112M5:~/qcom-android/LINUX/android/frameworks/base$ grep pointerIconArrow -nrw .
Binary file ./tools/aapt2/integration-tests/CommandTests/android-28.jar matches
./core/res/res/values/styles.xml:1356:        <item name="pointerIconArrow">@drawable/pointer_arrow_icon</item>
./core/res/res/values/styles.xml:1391:        <item name="pointerIconArrow">@drawable/pointer_arrow_large_icon</item>
./core/res/res/values/attrs.xml:8633:        <attr name="pointerIconArrow" format="reference" />
kongbo@kanyun-SA5112M5:~/qcom-android/LINUX/android/frameworks/base$ grep pointerIconArrow -nr .
Binary file ./tools/aapt2/integration-tests/CommandTests/android-28.jar matches
./config/hiddenapi-greylist-max-o.txt:96158:Lcom/android/internal/R$styleable;->Pointer_pointerIconArrow:I
./core/java/android/view/PointerIcon.java:550:                return com.android.internal.R.styleable.Pointer_pointerIconArrow;
./core/res/res/values/styles.xml:1356:        <item name="pointerIconArrow">@drawable/pointer_arrow_icon</item>
./core/res/res/values/styles.xml:1391:        <item name="pointerIconArrow">@drawable/pointer_arrow_large_icon</item>
./core/res/res/values/attrs.xml:8633:        <attr name="pointerIconArrow" format="reference" />

锁定是在PointerIcon.java中控制显示的,进入到PointerIcon类中详细分析,该类中主要的方法有getNullIcon() 获取空图标 ;getDefaultIcon()获取默认图标;getSystemIcon()获取系统图标等,认真读几遍代码,不难发现获取鼠标的方法最终都会调用到getSystemIcon()这个方法里

   /** * Gets a system pointer icon for the given type.* If typeis not recognized, returns the default pointer icon.** @param context The context.* @param type The pointer icon type.* @return The pointer icon.** @throws IllegalArgumentException if context is null.*/public static PointerIcon getSystemIcon(@NonNull Context context, int type) {if (context == null) {throw new IllegalArgumentException("context must not be null");}   if (true) {                                                                          return gNullIcon;}   if (type == TYPE_NULL) {return gNullIcon;}   if (sDisplayListener == null) {registerDisplayListener(context);}   final int displayId = context.getDisplayId();SparseArray<PointerIcon> systemIcons = gSystemIconsByDisplay.get(displayId);if (systemIcons == null) {systemIcons = new SparseArray<>();gSystemIconsByDisplay.put(displayId, systemIcons);}   PointerIcon icon = systemIcons.get(type);// Reload if not in the same display.if (icon != null) {return icon;}   int typeIndex = getSystemIconTypeIndex(type);if (typeIndex == 0) {typeIndex = getSystemIconTypeIndex(TYPE_DEFAULT);}   int defStyle = sUseLargeIcons ?com.android.internal.R.style.LargePointer : com.android.internal.R.style.Pointer;TypedArray a = context.obtainStyledAttributes(null,com.android.internal.R.styleable.Pointer,0, defStyle);int resourceId = a.getResourceId(typeIndex, -1);

逻辑上,该方法返回空即可,具体改动如下:

index 18d0d7b98a4..c00c3836e92 100644
--- a/core/java/android/view/PointerIcon.java
+++ b/core/java/android/view/PointerIcon.java
@@ -215,6 +215,10 @@ public final class PointerIcon implements Parcelable {throw new IllegalArgumentException("context must not be null");}+        if (true) {
+            return gNullIcon;
+        }
+if (type == TYPE_NULL) {return gNullIcon;}

编译验证即可。

隐藏Android11系统的鼠标相关推荐

  1. php更换鼠标指针详细,window_Win7系统鼠标指针怎么更改?Win7系统更换鼠标指针的方法,  Win7系统鼠标指针怎么更改 - phpStudy...

    Win7系统鼠标指针怎么更改?Win7系统更换鼠标指针的方法 Win7系统鼠标指针怎么更改?相信有很多电脑用户使用鼠标时都是用默认的鼠标指针,也从来没有想过要去更换鼠标指针,但其实,鼠标指针是可以更换 ...

  2. win10显示桌面计算机图标怎么删除,怎么设置显示或隐藏win10系统桌面上的我的电脑图标...

    怎么设置显示或隐藏win10系统桌面上的我的电脑图标 今天给大家介绍一下怎么设置显示或隐藏win10系统桌面上的我的电脑图标的具体操作步骤. 1. 打开电脑,进入桌面,空白位置,右键,选择个性化选项 ...

  3. 隐藏Windows系统托盘图标

    曾经写过一篇Windows下的任务栏图标编程 ,其实那篇文章讲的是如何将我们自己的程序最小化到托盘并进行操作的编程方法.前两天看到论坛 里有人讨论如何隐藏托盘图标,记得从前为朋友写过一个隐藏大智慧软件 ...

  4. 删除Win7隐藏的系统分区

    删除Win7隐藏的系统分区  有一台SONY VAIO VPCEA28EC小本,发现原装的分区为: 第1个分区:隐藏分区,13GB,用于存放系统恢复文件 第2个分区:隐藏分区,100MB,用于存放启动 ...

  5. Synergy工具 共享Windows系统电脑Linux系统电脑 鼠标键盘

    Synergy工具 共享Windows系统电脑Linux系统电脑 鼠标键盘 相关软件相关文章发表评论 来源:西西整理时间:2014/11/6 15:03:11字体大小:A-A+ 作者:西西点击:24评 ...

  6. 网站选择按钮点击无反应?_Win10系统电脑鼠标左键单击没有反应的解决办法

    Win10系统鼠标左键单击没有反应是怎么回事?最近一个用户在用电脑的时候,突然遇到鼠标左键单击没有反应的问题,是鼠标坏了吗?还是系统问题呢?今天就给大家分析Win10系统电脑鼠标左键单击没有反应的可能 ...

  7. Android11更新包,Android11系统

    Android11系统是安卓系统最新推出的系列版本的更新包,本次更新主要是以优化用户体验为主,加强的私密管理等等方面,想要第一时间了解到最新安卓系统的功能吗,那么赶紧来下载这款Android11系统安 ...

  8. 桌面计算机图标无响应,win7系统电脑鼠标点击桌面图标没反应怎么办【图文】...

    win7系统电脑鼠标点击桌面图标没反应怎么办?小编最近逛论坛发现有用户反映,关电脑还是正常的,再打开电脑就出现了问题,鼠标可以移动,但是鼠标点击电脑桌面图标的时候却没有任何反应.这是什么情况呢?据分析 ...

  9. Win10系统电脑鼠标左键不灵敏、有延迟怎么办

    具体方法如下: 1.单机windows键,选择设置: 2.在设置界面,选择设备: 3.在左方,选择鼠标和触摸板: 4.把这一项改成无延迟即可. 参考链接 : Win10系统电脑鼠标左键不灵敏.有延迟怎 ...

最新文章

  1. redis五大数据类型使用场景
  2. yii2多mysql配置文件_yii2使用多个数据库的案例
  3. 最新|TensorFlow开源的序列到序列框架
  4. 解决stamp mismatch with graph file
  5. 使用onnx包将pth文件转换为onnx文件
  6. MYSQL数据库导入数据时出现乱码的解决办法
  7. Fiori elements执行过程解析:When click go in table list, odata service is sent
  8. js基础-20-js对象赋值时的key值问题
  9. 华硕电脑桌面没有计算机图标 怎么弄出来,笔记本电脑开机蓝屏没桌面图标的方法...
  10. axure rp8学习回忆
  11. 地统计之检查空间自相关
  12. 阿里云轻量级应用服务器设置外网访问端口
  13. 数据库导出换行mysql_数据库导出excel 换行
  14. 带有风的诗词_带有风的诗句
  15. 函数6:lambda 表达式
  16. RPA---Uipath Try Catch
  17. android 5.0合并分区,中兴天极2 S291合并分区刷Android 5.1刷机教程
  18. Jmeter之常用断言总结篇
  19. css动态特效 @keyframes
  20. vue3使用笛卡尔积算法生成sku表格

热门文章

  1. Windows同步消息和异步消息的使用
  2. 学习记录1Python初识
  3. MyBatis 整合Oracle 报错:java.sql.SQLException: ORA-01008: 并非所有变量都已绑定
  4. ICS:链接与ELF头
  5. html 中 css 中 使背景照片覆盖全屏
  6. 私域流量+小程序,电商引流新机会
  7. 『开发』网页端展示深度学习模型|Gradio上手教程
  8. 从小雪球滚起——大公司的创业故事
  9. titanic生存大挑战--建模
  10. HttpServletResponse对象、HttpServletResponse应用、请求重定向