Java Code Examples for android.provider.Settings#ACTION_ACCESSIBILITY_SETTINGS

The following examples show how to use android.provider.Settings#ACTION_ACCESSIBILITY_SETTINGS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EventService.java    From SoloPi with Apache License 2.0 6 votes vote down vote up
public void startTrackAccessibilityEvent() {
    Context context = contextRef.get();
    if (context == null) {
        return;
    }

    // 检查Accessibility
    if (!PermissionUtil.isAccessibilitySettingsOn(context)) {
        showEnableAccessibilityServiceHint();
        Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK
                | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
        context.startActivity(intent);
        // 当AccessibilityService已启动,修改运行模式
    } else {
        if (accessibilityTracker == null) {
            accessibilityTracker = new AccessibilityEventTracker();
        }

        accessibilityTracker.setAccessibilityListener(proxy);
        accessibilityTracker.startTrackEvent();
    }
}
 
Example 2
Source File: RemoteReceiver.java    From KeyBlocker with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    SharedPreferences mSp = PreferenceManager.getDefaultSharedPreferences(context);
    if (intent.getAction().equals(Config.REMOTE_CONTROL_ACTION)) {
        boolean displayToast = intent.getBooleanExtra("RESPOND", true);
        if (BaseMethod.isAccessibilitySettingsOn(context)) {
            BaseMethod.KeyLockBroadcast(context, true, true);
        } else if (mSp.getBoolean(Config.ROOT_OPEN_SERVICE, false) && mSp.getBoolean(Config.ROOT_FUNCTION, false)) {
            BaseMethod.controlAccessibilityServiceWithRoot(true, false);
        } else {
            if (displayToast) {
                Toast.makeText(context, R.string.start_service_first, Toast.LENGTH_SHORT).show();
                Intent access_intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
                context.startActivity(access_intent);
            }
        }
    }
}
 
Example 3
Source File: MainActivity.java    From android-silent-installer with Apache License 2.0 6 votes vote down vote up
@Override
public void onClick(View v) {
    if (v == btnRoot) {
        rootInstall();
    }
    if (v == btnAccess) {
        accessInstall();
    }
    if (v == btnSelectApk) {
        selectApk();
    }
    if (v == btnOpenAccess) {
        Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
        startActivity(intent);
    }
}
 
Example 4
Source File: MainActivity.java    From MiHomePlus with MIT License 6 votes vote down vote up
public void onClick(View v) {
    Intent intent = new Intent();
    switch (v.getId()) {
        case R.id.Accessibility:
            Context context = getApplicationContext();
            CharSequence text = "請激活 MiHomePlus 無障礙設定";
            int duration = Toast.LENGTH_SHORT;
            Toast.makeText(context, text, duration).show();

            //打开系统无障碍设置界面
            Intent accessibleIntent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
            startActivity(accessibleIntent);
            break;
        case R.id.AppSetting:
            intent.setClass(MainActivity.this, AppSetting.class);
            startActivity(intent);
            break;
        case R.id.Help:
            intent.setClass(MainActivity.this, Help.class);
            startActivity(intent);
            break;
        default:
            break;
    }
}
 
Example 5
Source File: HelpFragment.java    From oversec with GNU General Public License v3.0 6 votes vote down vote up
public void openAcsSettings(final Context ctx, boolean forceShowOnboarding) {
    mPrevAccessibilitySettingsOn = AndroidIntegration
            .isAccessibilitySettingsOnAndServiceRunning(ctx);

    Intent intent = new Intent(
            Settings.ACTION_ACCESSIBILITY_SETTINGS);

    PackageManager packageManager = getActivity().getPackageManager();
    if (intent.resolveActivity(packageManager) != null) {
        startActivityForResult(
                intent,
                0);
        if (!GotItPreferences.Companion.getPreferences(ctx).isTooltipConfirmed(getString(R.string.tooltipid_onboarding))
                || forceShowOnboarding) {
            vgBoss.postDelayed(new Runnable() {
                @Override
                public void run() {
                    OnboardingActivity.show(ctx);
                }
            }, 500);
        }
    } else {
        Ln.w("No Intent available to handle ACTION_ACCESSIBILITY_SETTINGS");
        ActionAccessibilitySettingsNotResolvableActivity.show(ctx);
    }
}
 
Example 6
Source File: OversecIntentService.java    From oversec with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onHandleIntent(Intent intent) {
    String action = intent.getAction();
    if (ACTION_TEMP_HIDE.equals(action)) {
        Core.getInstance(this).doTemporaryHide(intent.getStringExtra(EXTRA_PACKAGE_NAME), Boolean.TRUE);
        Core.getInstance(this).closeNotificationDrawer();

    } else if (ACTION_TEMP_SHOW.equals(action)) {
        Core.getInstance(this).doTemporaryHide(intent.getStringExtra(EXTRA_PACKAGE_NAME), Boolean.FALSE);
        Core.getInstance(this).closeNotificationDrawer();

    } else if (ACTION_SHOW_CONFIG.equals(action)) {
        AppConfigActivity.show(this, intent.getStringExtra(EXTRA_PACKAGE_NAME), null);
    } else if (ACTION_STOPBOSS.equals(action)) {
        Core.getInstance(this).panic();

    } else if (ACTION_SHOW_ACCESSIBILITY_SETTINGS.equals(action)) {

        Intent i = new Intent(
                Settings.ACTION_ACCESSIBILITY_SETTINGS);
        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

        PackageManager packageManager = getPackageManager();
        if (intent.resolveActivity(packageManager) != null) {
            startActivity(i);
        } else {
            Ln.w("No Intent available to handle ACTION_ACCESSIBILITY_SETTINGS");
            ActionAccessibilitySettingsNotResolvableActivity.showFromService(this);
            ;
        }


    } else if (ACTION_INFO_ON.equals(action)) {
        Core.getInstance(this).toggleInfoMode(true);
        Core.getInstance(this).closeNotificationDrawer();
    } else if (ACTION_INFO_OFF.equals(action)) {
        Core.getInstance(this).toggleInfoMode(false);
        Core.getInstance(this).closeNotificationDrawer();
    }
}
 
Example 7
Source File: EventsPrefsFragment.java    From PhoneProfilesPlus with Apache License 2.0 5 votes vote down vote up
private void enableExtender() {
        if (getActivity() == null)
            return;

        boolean ok = false;
        if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_ACCESSIBILITY_SETTINGS, getActivity())) {
            try {
                Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
                startActivityForResult(intent, RESULT_ACCESSIBILITY_SETTINGS);
                ok = true;
            } catch (Exception e) {
                PPApplication.recordException(e);
            }
        }
        if (!ok) {
            if (getActivity() != null) {
                AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity());
                dialogBuilder.setMessage(R.string.setting_screen_not_found_alert);
                //dialogBuilder.setIcon(android.R.drawable.ic_dialog_alert);
                dialogBuilder.setPositiveButton(android.R.string.ok, null);
                AlertDialog dialog = dialogBuilder.create();

//                dialog.setOnShowListener(new DialogInterface.OnShowListener() {
//                    @Override
//                    public void onShow(DialogInterface dialog) {
//                        Button positive = ((AlertDialog)dialog).getButton(DialogInterface.BUTTON_POSITIVE);
//                        if (positive != null) positive.setAllCaps(false);
//                        Button negative = ((AlertDialog)dialog).getButton(DialogInterface.BUTTON_NEGATIVE);
//                        if (negative != null) negative.setAllCaps(false);
//                    }
//                });

                if (!getActivity().isFinishing())
                    dialog.show();
            }
        }
    }
 
Example 8
Source File: BaseMethod.java    From KeyBlocker with GNU General Public License v3.0 5 votes vote down vote up
public static void RestartAccessibilityService(Context context) {
    if (isAccessibilitySettingsOn(context)) {
        SharedPreferences mSp = PreferenceManager.getDefaultSharedPreferences(context);
        if (mSp.getBoolean(Config.ROOT_OPEN_SERVICE, false) && mSp.getBoolean(Config.ROOT_FUNCTION, false)) {
            controlAccessibilityServiceWithRoot(false, true);
        } else {
            Toast.makeText(context, R.string.restart_service, Toast.LENGTH_SHORT).show();
            Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
            context.startActivity(intent);
        }
    }
}
 
Example 9
Source File: ConfigurationActivity.java    From Noyze with Apache License 2.0 5 votes vote down vote up
private void openAccessibility() {
    Intent accessibility = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
    try {
        startActivity(accessibility);
    } catch (ActivityNotFoundException e) {
        LOGE(TAG, "Error opening Accessibility.", e);
        Crouton.showText(getActivity(), R.string.accessibility_error, Style.ALERT);
    }
}
 
Example 10
Source File: MainService.java    From pc-android-controller-android with Apache License 2.0 5 votes vote down vote up
public void openAccessibility() {
    try {
        Intent accessibleIntent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
        accessibleIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        if (accessibleIntent == null) {
        } else {
            startActivity(accessibleIntent);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

}
 
Example 11
Source File: AccessibilityUtil.java    From FileManager with Apache License 2.0 5 votes vote down vote up
public static void gotoAccessibilityPage(Context context) {
    try {
        Intent accessibilityItent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
        context.startActivity(accessibilityItent);
    } catch (Exception e) {
        Loger.w("AccessibilityUtil", e.toString());
        e.printStackTrace();
    }
}
 
Example 12
Source File: BaseMethod.java    From KeyBlocker with GNU General Public License v3.0 5 votes vote down vote up
public static void RunAccessibilityService(Context context) {
    SharedPreferences mSp = PreferenceManager.getDefaultSharedPreferences(context);
    if (mSp.getBoolean(Config.ROOT_OPEN_SERVICE, false) && mSp.getBoolean(Config.ROOT_FUNCTION, false)) {
        controlAccessibilityServiceWithRoot(true, false);
    } else {
        Toast.makeText(context, R.string.start_service_first, Toast.LENGTH_SHORT).show();
        Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    }
}
 
Example 13
Source File: buff_ext.java    From styT with Apache License 2.0 4 votes vote down vote up
public void onForwardToAccessibility(View view) {
    Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
    startActivity(intent);
}
 
Example 14
Source File: buff_ext.java    From stynico with MIT License 4 votes vote down vote up
public void onForwardToAccessibility(View view)
{
    Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
    startActivity(intent);
}
 
Example 15
Source File: MainPreferenceFragment.java    From kcanotify_h5-master with GNU General Public License v3.0 4 votes vote down vote up
public void showObtainingPermissionAccessibility() {
    Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
    startActivity(intent);
}
 
Example 16
Source File: PackageManagerUtils.java    From FireFiles with Apache License 2.0 4 votes vote down vote up
public static void startAccessibilitySettings(Context context) {
	Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
	intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
	context.startActivity(intent);
}
 
Example 17
Source File: PackageManagerUtils.java    From FireFiles with Apache License 2.0 4 votes vote down vote up
public static void startAccessibilitySettings(Context context) {
	Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
	intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
	context.startActivity(intent);
}
 
Example 18
Source File: PermissionAccessibility.java    From AcDisplay with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@NonNull
@Override
public Intent getIntentSettings() {
    return new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
}
 
Example 19
Source File: ActivityAccessibilityImpl.java    From MiPushFramework with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void guideToEnable(Context context) {
    Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
}
 
Example 20
Source File: SettingsFragment.java    From Anti-recall with GNU Affero General Public License v3.0 4 votes vote down vote up
private void jumpToAccessSetting() {
    Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);
}