我该如何开始我的Andr​​oid应用程序的辅助功能设置页面?我的、我该、应用程序、辅助功能

2023-09-07 08:40:33 作者:别来无恙你还猪模狗样

我开发一个Android应用程序的基础上辅助功能。因为它不能以编程方式启用/禁用辅助服务在Android中(见How以编程方式启用/禁用辅助服务在Android中),所以我引导用户可访问设置页面(如图1),通过下面的code:

I am developing an Android APP based on Accessibility feature. As it can't programmatically Enable/Disable Accessibility Service in Android(See How to Programmatically Enable/Disable Accessibility Service in Android) , So I guide the user to Accessibility Settings Page(Pic 1) via the code below:

public static boolean gotoAccessibilitySettings(Context context) {
    Intent settingsIntent = new Intent(
            Settings.ACTION_ACCESSIBILITY_SETTINGS);
    if (!(context instanceof Activity)) {
        settingsIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    }
    boolean isOk = true;
    try {
        context.startActivity(settingsIntent);
    } catch (ActivityNotFoundException e) {
        isOk = false;
    }
    return isOk;
}

,然后将用户需要找出我的应用程序的子设置标签,单击它,现在的辅助功能设置页面中我的应用程序显示(如图2)。

And then the user need to find out the Sub Settings Label of my APP, click it, and now the Accessibility Settings Page of my APP show(Pic 2).

我怀疑,如果任何方式开始我的应用程序的辅助功能设置页面(如图2)直接?

I doubt that if any way start my APP's Accessibility Settings Page(Pic 2) directly?

推荐答案

也许$ C $低于C可以帮助你:

Maybe the code below can help you :

Intent intent = new Intent();
        intent.setClassName("com.android.settings",
                "com.android.settings.Settings");
        intent.setAction(Intent.ACTION_MAIN);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                | Intent.FLAG_ACTIVITY_CLEAR_TASK
                | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
        intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT,
                "the fragment which you want show");
        intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS,
                extras);
       startActivity(intent);

或者,你可以搜索关键词片段注入更多的信息 看看这个链接,这对你来说是有用的情况:

Or you can search the Key Word "Fragment Injection" for more information; Check out this link,it is useful for you case:

的http://securityintelligence.com/new-vulnerability-android-framework-fragment-injection