AccessibilityManager 를 얻어와 사용중인 서비스 Id중에 com.google.android.marvin.talkback 가 있는지 확인 하여 체크
public Boolean isTalkbackRunning(Context context){
String TALKBACK_PACKAGE_NAME = "com.google.android.marvin.talkback";
AccessibilityManager manager = (AccessibilityManager)context.getSystemService(Context.ACCESSIBILITY_SERVICE);
if (manager == null){
return false;
}
boolean isTalkbackRunning = false;
try {
List<AccessibilityServiceInfo> services = manager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_SPOKEN);
for (AccessibilityServiceInfo service : services) {
if (service.getId().contains(TALKBACK_PACKAGE_NAME)){
isTalkbackRunning = true;
}
}
} catch (NullPointerException npe) {
npe.printStackTrace();
return isTalkbackRunning;
// getEnabledAccessibilityServiceList() can throw an NPE due to a bad
// AccessibilityService.
}
return isTalkbackRunning;
}
참고 : https://chromium.googlesource.com/chromium/src.git/+/76ef458065798bc70114854cf4b51827005448a1/chrome/android/java/src/org/chromium/chrome/browser/AccessibilityUtil.java
'프로그램 > Java - Android' 카테고리의 다른 글
Fragment 데이터 전달 (0) | 2017.04.13 |
---|---|
Android O 기능 및 API (0) | 2017.04.03 |
android source download (1) | 2014.05.09 |
android emma 사용하기 (0) | 2014.03.18 |
uiautomator 사용법(ant 사용) (0) | 2014.03.17 |