RK3326 Android 8.1 为自己的APK的服务默认开启无障碍权限,避免使用时还是有一个小跳转:设置的无障碍选项

源码文件: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) {

参考

https://blog.csdn.net/qq_30699731/article/details/90311625

问题

刷完机后,第一次使用服务的时候,还是会跳到设置里对应的无障碍选项

你可能感兴趣的:(Android系统开发,rockchip)