瑞芯微Rockchip开发者社区
直播中

王飞

7年用户 1155经验值
私信 关注
[问答]

RK3322 Android 8.1是如何为自己的APK服务开启无障碍权限的

RK3322 Android 8.1是如何为自己的APK服务开启无障碍权限的?求解

回帖(1)

张林

2022-2-17 09:30:42
源码文件:packages/apps/Setting/src/com/android/settings/accessibility/AccessibilitySettings.java

diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
old mode 100644
new mode 100755
index 51b676d..5b44dd5
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -549,6 +549,14 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
             PreferenceScreen screen = getPreferenceScreen();
             screen.removePreference(downloadedServicesCategory);
         }
+               
+                final String enabledServicesBuilder =
+                                "包名/类名";
+
+                Settings.Secure.putString(getContentResolver(),
+                                Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,enabledServicesBuilder.toString());
+        Settings.Secure.putInt(getContentResolver(),
+                                Settings.Secure.ACCESSIBILITY_ENABLED, true ? 1 : 0);
     }

     private void initializePreBundledServicesMapFromArray(String categoryKey, int key) {
举报

更多回帖

发帖
×
20
完善资料,
赚取积分