android.accessibilityservice.AccessibilityServiceInfo Java Examples
The following examples show how to use
android.accessibilityservice.AccessibilityServiceInfo.
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: QQFragment.java From WeChatHongBao with Apache License 2.0 | 6 votes |
private void updateServiceStatus() { boolean serviceEnabled = false; AccessibilityManager accessibilityManager = (AccessibilityManager) baseContext.getSystemService(Context.ACCESSIBILITY_SERVICE); List<AccessibilityServiceInfo> accessibilityServices = accessibilityManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_GENERIC); for (AccessibilityServiceInfo info : accessibilityServices) { if (info.getId().equals(baseContext.getPackageName() + "/.services.QQService")) { serviceEnabled = true; break; } } if (!serviceEnabled) { btn.setText(R.string.service_open); } else { btn.setText(R.string.service_off); } }
Example #2
Source File: UiAutomation.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** * Sets the {@link AccessibilityServiceInfo} that describes how this * UiAutomation will be handled by the platform accessibility layer. * * @param info The info. * * @see AccessibilityServiceInfo */ public final void setServiceInfo(AccessibilityServiceInfo info) { final IAccessibilityServiceConnection connection; synchronized (mLock) { throwIfNotConnectedLocked(); AccessibilityInteractionClient.getInstance().clearCache(); connection = AccessibilityInteractionClient.getInstance() .getConnection(mConnectionId); } // Calling out without a lock held. if (connection != null) { try { connection.setServiceInfo(info); } catch (RemoteException re) { Log.w(LOG_TAG, "Error while setting AccessibilityServiceInfo", re); } } }
Example #3
Source File: MainActivity.java From Float-Bar with Eclipse Public License 1.0 | 6 votes |
@Override protected void onResume() { super.onResume(); AccessibilityManager manager = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE); List<AccessibilityServiceInfo> list = AccessibilityManagerCompat.getEnabledAccessibilityServiceList(manager, AccessibilityServiceInfo.FEEDBACK_ALL_MASK); System.out.println("list.size = " + list.size()); for (int i = 0; i < list.size(); i++) { System.out.println("已经可用的服务列表 = " + list.get(i).getId()); if ("com.kale.floatbar/.service.FloatService".equals(list.get(i).getId())) { System.out.println("已启用"); isEnabled = true; break; } } if (!isEnabled) { showDialog(this, "激活悬浮窗", "您还没有激活悬浮窗。" + "在设置中:系统 → 辅助功能 → 服务 中激活" + getResources().getString(R.string.app_name) + "后,便可安全稳定的使用悬浮窗啦~", "去激活", "取消"); } }
Example #4
Source File: AccessibilityInjector.java From android-chromium with BSD 2-Clause "Simplified" License | 6 votes |
/** * Checks whether or not touch to explore is enabled on the system. */ public boolean accessibilityIsAvailable() { if (!getAccessibilityManager().isEnabled() || mContentViewCore.getContentSettings() == null || !mContentViewCore.getContentSettings().getJavaScriptEnabled()) { return false; } try { // Check that there is actually a service running that requires injecting this script. List<AccessibilityServiceInfo> services = getAccessibilityManager().getEnabledAccessibilityServiceList( FEEDBACK_BRAILLE | AccessibilityServiceInfo.FEEDBACK_SPOKEN); return services.size() > 0; } catch (NullPointerException e) { // getEnabledAccessibilityServiceList() can throw an NPE due to a bad // AccessibilityService. return false; } }
Example #5
Source File: SwitchAccessService.java From talkback with Apache License 2.0 | 5 votes |
private void updateServiceInfoIfFeedbackTypeChanged() { boolean spokenFeedbackEnabled = SwitchAccessPreferenceUtils.isSpokenFeedbackEnabled(this); boolean hapticFeedbackEnabled = SwitchAccessPreferenceUtils.shouldPlayVibrationFeedback(this); boolean auditoryFeedbackEnabled = SwitchAccessPreferenceUtils.shouldPlaySoundFeedback(this); if ((spokenFeedbackEnabled == spokenFeedbackEnabledInServiceInfo) && (hapticFeedbackEnabled == hapticFeedbackEnabledInServiceInfo) && (auditoryFeedbackEnabled == auditoryFeedbackEnabledInServiceInfo)) { return; } AccessibilityServiceInfo serviceInfo = getServiceInfo(); if (serviceInfo == null) { LogUtils.e(TAG, "Failed to update feedback type, service info was null"); return; } if (spokenFeedbackEnabled) { serviceInfo.feedbackType |= AccessibilityServiceInfo.FEEDBACK_SPOKEN; } else { serviceInfo.feedbackType &= ~AccessibilityServiceInfo.FEEDBACK_SPOKEN; } if (hapticFeedbackEnabled) { serviceInfo.feedbackType |= AccessibilityServiceInfo.FEEDBACK_HAPTIC; } else { serviceInfo.feedbackType &= ~AccessibilityServiceInfo.FEEDBACK_HAPTIC; } if (auditoryFeedbackEnabled) { serviceInfo.feedbackType |= AccessibilityServiceInfo.FEEDBACK_AUDIBLE; } else { serviceInfo.feedbackType &= ~AccessibilityServiceInfo.FEEDBACK_AUDIBLE; } setServiceInfo(serviceInfo); spokenFeedbackEnabledInServiceInfo = spokenFeedbackEnabled; hapticFeedbackEnabledInServiceInfo = hapticFeedbackEnabled; auditoryFeedbackEnabledInServiceInfo = auditoryFeedbackEnabled; }
Example #6
Source File: VolumeAccessibilityService.java From Noyze with Apache License 2.0 | 5 votes |
protected void initServiceInfo() { mInfo.eventTypes = AccessibilityEvent.TYPES_ALL_MASK; mInfo.notificationTimeout = 100; // This is the KEY (to KeyEvents)! Sweet deal. mInfo.flags = AccessibilityServiceInfo.FLAG_REQUEST_FILTER_KEY_EVENTS; // We'll respond with a popup (visual), and possibly a noise (audible) // and/ or a vibration (haptic). No spoken feedback here! mInfo.feedbackType = (AccessibilityServiceInfo.FEEDBACK_VISUAL | AccessibilityServiceInfo.FEEDBACK_AUDIBLE | AccessibilityServiceInfo.FEEDBACK_HAPTIC ); setServiceInfo(mInfo); }
Example #7
Source File: AccessibilityServiceInfoCompat.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
@Override public int getCapabilities(AccessibilityServiceInfo info) { if (getCanRetrieveWindowContent(info)) { return CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT; } return 0; }
Example #8
Source File: AccessibilityServiceInfoCompat.java From V.FlyoutTest with MIT License | 5 votes |
@Override public int getCapabilities(AccessibilityServiceInfo info) { if (getCanRetrieveWindowContent(info)) { return CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT; } return 0; }
Example #9
Source File: MainActivity.java From NewsPushMonitor with Apache License 2.0 | 5 votes |
private boolean isServiceEnabled() { List<AccessibilityServiceInfo> accessibilityServices = accessibilityManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_GENERIC); for (AccessibilityServiceInfo info : accessibilityServices) { if (info.getId().equals(getPackageName() + "/.PushMonitorAccessibilityService")) { return true; } } return false; }
Example #10
Source File: AccessibilityService.java From HeadsUp with GNU General Public License v2.0 | 5 votes |
@Override public void onServiceConnected() { AccessibilityServiceInfo info = new AccessibilityServiceInfo(); info.eventTypes = AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED; info.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC; info.notificationTimeout = 100; setServiceInfo(info); }
Example #11
Source File: Per_App.java From kernel_adiutor with Apache License 2.0 | 5 votes |
public static boolean isAccessibilityEnabled(Context context, String id) { AccessibilityManager am = (AccessibilityManager) context .getSystemService(Context.ACCESSIBILITY_SERVICE); List<AccessibilityServiceInfo> runningServices = am .getEnabledAccessibilityServiceList(AccessibilityEvent.TYPES_ALL_MASK); for (AccessibilityServiceInfo service : runningServices) { if (id != null && id.equals(service.getId())) { return true; } } return false; }
Example #12
Source File: ButlerService.java From test-butler with Apache License 2.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); Log.d(TAG, "ButlerService starting up..."); AppSettingsAccessor settings = new AppSettingsAccessor(getContentResolver()); gsmDataDisabler = new GsmDataDisabler(); permissionGranter = new PermissionGranter(); InstalledAccessibilityServiceProvider serviceProvider = new InstalledAccessibilityServiceProvider() { @NonNull @Override public List<AccessibilityServiceInfo> getInstalledAccessibilityServiceList() { AccessibilityManager manager = (AccessibilityManager) getApplicationContext() .getSystemService(ACCESSIBILITY_SERVICE); if (manager == null) { return Collections.emptyList(); } return manager.getInstalledAccessibilityServiceList(); } }; accessibilityServiceEnabler = new AccessibilityServiceEnabler(serviceProvider, settings); accessibilityServiceWaiter = new AccessibilityServiceWaiter(); locks = new CommonDeviceLocks(); locks.acquire(this); butlerApi.onCreate(settings); // Install custom IActivityController to prevent system dialogs from appearing if apps crash or ANR NoDialogActivityController.install(); }
Example #13
Source File: AccessibilityServiceEnabler.java From test-butler with Apache License 2.0 | 5 votes |
@Nullable private String findButlerAccessibilityServiceId() throws RemoteException { List<AccessibilityServiceInfo> accessibilityServices = serviceProvider.getInstalledAccessibilityServiceList(); for (AccessibilityServiceInfo service : accessibilityServices) { String serviceId = service.getId(); if (serviceId.endsWith(ButlerAccessibilityService.SERVICE_NAME)) { return serviceId; } } return null; }
Example #14
Source File: USSDController.java From VoIpUSSD with Apache License 2.0 | 5 votes |
protected static boolean isAccessiblityServicesEnable(Context context) { AccessibilityManager am = (AccessibilityManager) context .getSystemService(Context.ACCESSIBILITY_SERVICE); if (am != null) { for (AccessibilityServiceInfo service : am.getInstalledAccessibilityServiceList()) { if (service.getId().contains(context.getPackageName())) { return USSDController.isAccessibilitySettingsOn(context, service.getId()); } } } return false; }
Example #15
Source File: AccessibilityManager.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Find an installed service with the specified {@link ComponentName}. * * @param componentName The name to match to the service. * * @return The info corresponding to the installed service, or {@code null} if no such service * is installed. * @hide */ public AccessibilityServiceInfo getInstalledServiceInfoWithComponentName( ComponentName componentName) { final List<AccessibilityServiceInfo> installedServiceInfos = getInstalledAccessibilityServiceList(); if ((installedServiceInfos == null) || (componentName == null)) { return null; } for (int i = 0; i < installedServiceInfos.size(); i++) { if (componentName.equals(installedServiceInfos.get(i).getComponentName())) { return installedServiceInfos.get(i); } } return null; }
Example #16
Source File: AccessibilityManager.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Check if the accessibility volume stream is active. * * @return True if accessibility volume is active (i.e. some service has requested it). False * otherwise. * @hide */ public boolean isAccessibilityVolumeStreamActive() { List<AccessibilityServiceInfo> serviceInfos = getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_ALL_MASK); for (int i = 0; i < serviceInfos.size(); i++) { if ((serviceInfos.get(i).flags & FLAG_ENABLE_ACCESSIBILITY_VOLUME) != 0) { return true; } } return false; }
Example #17
Source File: AccessibilityManager.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Returns the {@link AccessibilityServiceInfo}s of the installed accessibility services. * * @return An unmodifiable list with {@link AccessibilityServiceInfo}s. */ public List<AccessibilityServiceInfo> getInstalledAccessibilityServiceList() { final IAccessibilityManager service; final int userId; synchronized (mLock) { service = getServiceLocked(); if (service == null) { return Collections.emptyList(); } userId = mUserId; } List<AccessibilityServiceInfo> services = null; try { services = service.getInstalledAccessibilityServiceList(userId); if (DEBUG) { Log.i(LOG_TAG, "Installed AccessibilityServices " + services); } } catch (RemoteException re) { Log.e(LOG_TAG, "Error while obtaining the installed AccessibilityServices. ", re); } if (mAccessibilityPolicy != null) { services = mAccessibilityPolicy.getInstalledAccessibilityServiceList(services); } if (services != null) { return Collections.unmodifiableList(services); } else { return Collections.emptyList(); } }
Example #18
Source File: ClockBackService.java From codeexamples-android with Eclipse Public License 1.0 | 5 votes |
/** * Sets the {@link AccessibilityServiceInfo} which informs the system how to * handle this {@link AccessibilityService}. * * @param feedbackType The type of feedback this service will provide. * <p> * Note: The feedbackType parameter is an bitwise or of all * feedback types this service would like to provide. * </p> */ private void setServiceInfo(int feedbackType) { AccessibilityServiceInfo info = new AccessibilityServiceInfo(); // We are interested in all types of accessibility events. info.eventTypes = AccessibilityEvent.TYPES_ALL_MASK; // We want to provide specific type of feedback. info.feedbackType = feedbackType; // We want to receive events in a certain interval. info.notificationTimeout = EVENT_NOTIFICATION_TIMEOUT_MILLIS; // We want to receive accessibility events only from certain packages. info.packageNames = PACKAGE_NAMES; setServiceInfo(info); }
Example #19
Source File: UiDevice.java From za-Farmer with MIT License | 5 votes |
/** Private constructor. Clients should use {@link UiDevice#getInstance(Instrumentation)}. */ private UiDevice(Instrumentation instrumentation) { mInstrumentation = instrumentation; UiAutomation uiAutomation = instrumentation.getUiAutomation(); mUiAutomationBridge = new InstrumentationUiAutomatorBridge( instrumentation.getContext(), uiAutomation); // Enable multi-window support for API level 21 and up if (UiDevice.API_LEVEL_ACTUAL >= Build.VERSION_CODES.LOLLIPOP) { // Subscribe to window information AccessibilityServiceInfo info = uiAutomation.getServiceInfo(); info.flags |= AccessibilityServiceInfo.FLAG_RETRIEVE_INTERACTIVE_WINDOWS; uiAutomation.setServiceInfo(info); } }
Example #20
Source File: AccessibilityServiceInfoCompatJellyBeanMr2.java From V.FlyoutTest with MIT License | 4 votes |
public static int getCapabilities(AccessibilityServiceInfo info) { return info.getCapabilities(); }
Example #21
Source File: AccessibilityServiceInfoCompat.java From android-recipes-app with Apache License 2.0 | 4 votes |
public String getSettingsActivityName(AccessibilityServiceInfo info) { return null; }
Example #22
Source File: AccessibilityServiceInfoCompatIcs.java From CodenameOne with GNU General Public License v2.0 | 4 votes |
public static String getDescription(AccessibilityServiceInfo info) { return info.getDescription(); }
Example #23
Source File: AccessibilityServiceInfoCompat.java From android-recipes-app with Apache License 2.0 | 4 votes |
@Override public String getId(AccessibilityServiceInfo info) { return AccessibilityServiceInfoCompatIcs.getId(info); }
Example #24
Source File: AccessibilityServiceInfoCompat.java From letv with Apache License 2.0 | 4 votes |
public boolean getCanRetrieveWindowContent(AccessibilityServiceInfo info) { return false; }
Example #25
Source File: AccessibilityServiceInfoCompatIcs.java From adt-leanback-support with Apache License 2.0 | 4 votes |
public static String getDescription(AccessibilityServiceInfo info) { return info.getDescription(); }
Example #26
Source File: AccessibilityServiceInfoAssert.java From assertj-android with Apache License 2.0 | 4 votes |
public AccessibilityServiceInfoAssert(AccessibilityServiceInfo actual) { super(actual, AccessibilityServiceInfoAssert.class); }
Example #27
Source File: AccessibilityServiceInfoCompat.java From letv with Apache License 2.0 | 4 votes |
public int getCapabilities(AccessibilityServiceInfo info) { return AccessibilityServiceInfoCompatJellyBeanMr2.getCapabilities(info); }
Example #28
Source File: AccessibilityManagerCompat.java From V.FlyoutTest with MIT License | 4 votes |
public List<AccessibilityServiceInfo> getInstalledAccessibilityServiceList( AccessibilityManager manager) { return Collections.emptyList(); }
Example #29
Source File: AccessibilityServiceInfoCompat.java From CodenameOne with GNU General Public License v2.0 | 4 votes |
public int getCapabilities(AccessibilityServiceInfo info) { return 0; }
Example #30
Source File: AccessibilityServiceInfoCompat.java From adt-leanback-support with Apache License 2.0 | 4 votes |
@Override public boolean getCanRetrieveWindowContent(AccessibilityServiceInfo info) { return AccessibilityServiceInfoCompatIcs.getCanRetrieveWindowContent(info); }