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

Android15默认开启无障碍服务

在wms、ams的systemReady()方法中调用此方法并传入要开启的无障碍服务即可实现自动开启

    /*** 开启无障碍服务** @param context              上下文* @param accessibilityService com.pranavpandey.rotation/com.pranavpandey.rotation.service.RotationService*/private static void enableAccessibilityService(Context context, String accessibilityService) {// 添加默认开启Rotation[com.pranavpandey.rotation]_V28.3.2无障碍服务 add by lywif (Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, 0) == 0) {Settings.Secure.putInt(context.getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, 1);Log.e(TAG, "----liyiwei---- 打开无障碍服务功能,写入1");} else {Log.e(TAG, "----liyiwei---- 无障碍服务功能已打开");}String currentServices = Settings.Secure.getString(context.getContentResolver(),Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);Log.e(TAG, "----liyiwei---- 当前开启的无障碍服务有: 【" + currentServices + "】");if (currentServices == null || currentServices.isEmpty()) {Settings.Secure.putString(context.getContentResolver(),Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,accessibilityService);Log.e(TAG, "----liyiwei---- 写入无障碍服务成功 不存在已有服务,直接写入:" + accessibilityService);} else {if (currentServices.contains(accessibilityService)) {Log.e(TAG, "----liyiwei---- 无障碍服务列表已包含,无须重复开启:" + currentServices);} else {Settings.Secure.putString(context.getContentResolver(),Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,currentServices + ":" + accessibilityService);Log.e(TAG, "----liyiwei---- 写入无障碍服务成功 存在服务,追加写入:" + accessibilityService);}}}

如果上面的东西对你有用,可否打赏一杯奶茶给在下
在这里插入图片描述

http://www.xdnf.cn/news/956377.html

相关文章:

  • ui框架-文件上传组件
  • 高密度ARM服务器的散热设计
  • JAVA开发工具箱
  • Easy Excel
  • Shell脚本 - 查看系统信息
  • 设计模式作业
  • Unity中的Time.fixedDeltaTime
  • 9. 线性表的顺序表示和实现(1)
  • TCP和UDP区别
  • 关于 WASM:1. WASM 基础原理
  • linux 下常用变更-8
  • VisualXML全新升级 | 新增数据库编辑功能
  • 怎么让Comfyui导出的图像不包含工作流信息,
  • 三网智能切换技术如何造富?拆解格行WiFi代理的管道收益模型
  • 直播APP平台中如何实现人脸美颜功能?美颜SDK技术详解
  • React第五十七节 Router中RouterProvider使用详解及注意事项
  • Unsafe Fileupload篇补充-木马的详细教程与木马分享(中国蚁剑方式)
  • PLC入门【4】基本指令2(SET RST)
  • 分布式系统简述
  • Appium下载安装配置保姆教程(图文详解)
  • 基于 Three.js 的数字雨波纹效果技术解析
  • 浏览器工作原理11 [#] this:从JavaScript执行上下文视角讲this
  • SpringBoot请求限流(RateLimiter)
  • 针对药品仓库的效期管理问题,如何利用WMS系统“破局”
  • align-items: start和align-items: flex-start的区别
  • 技术创新赋能产业升级:国际数字影像产业园引领变革浪潮
  • 【网络安全】开源系统getshell漏洞挖掘
  • UI 自动化测试工具推荐
  • [KCTF]CORE CrackMe v2.0
  • ​小学五年级的语言来解释符号​