下面列出了android.app.UiAutomation.OnAccessibilityEventListener#android.accessibilityservice.AccessibilityService 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* 执行操作的方法,根据传来的不同值执行不同的操作
*
* @param service
* @param event
*/
private void doOperation(AccessibilityService service, String event) {
if (event.equals("openBar")) {
Util.openStatusBar(mContext);
} else if (event.equals("closeBar")) {
Util.closeStatusBar(mContext);
} else if (event.equals("openDraw")) {
mContext.startService(new Intent(mContext, DrawService.class));
} else if (event.equals("recents")) {
Util.recentApps(service);
} else if (event.equals("back")) {
Util.virtualBack(service);
} else if (event.equals("home")) {
Util.virtualHome(mContext);
} else if (event.equals("camera")) {
Util.openCamera(mContext);
}
}
public ScreenFeedbackManager(
AccessibilityService service,
@Nullable AccessibilityHintsManager hintsManager,
SpeechController speechController,
FeedbackController feedbackController,
boolean screenOrientationLandscape) {
interpreter = new WindowEventInterpreter(service);
interpreter.addListener(this);
allContext = getAllContext(service, createPreferences());
feedbackComposer = createComposer();
this.service = service;
isArc = FeatureSupport.isArc();
accessibilityHintsManager = hintsManager;
this.speechController = speechController;
this.feedbackController = feedbackController;
isScreenOrientationLandscape = screenOrientationLandscape;
}
/**
* 查找符合条件的节点
* @param service {@link AccessibilityService}
* @param focus 焦点类型
* @param className 节点所属的类 ( 类名 )
* @return 拥有特定焦点类型的节点
*/
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public static AccessibilityNodeInfo findFocus(final AccessibilityService service, final int focus, final String className) {
if (service == null || className == null) return null;
// 获取根节点
AccessibilityNodeInfo nodeInfo = service.getRootInActiveWindow();
// 取得当前激活窗体的根节点
if (nodeInfo == null) return null;
// 通过指定的焦点类型找到当前的节点
AccessibilityNodeInfo node = nodeInfo.findFocus(focus);
// 防止为 null
if (node != null) {
// 判断是否符合的类型
if (node.getClassName().equals(className) && node.isEnabled()) {
return node;
}
}
return null;
}
/**
* 执行操作的方法,根据传来的不同值执行不同的操作
*
* @param service
* @param event
*/
private void doOperation(AccessibilityService service, String event) {
if (event.equals("openBar")) {
Util.openStatusBar(mContext);
} else if (event.equals("closeBar")) {
Util.closeStatusBar(mContext);
} else if (event.equals("openDraw")) {
mContext.startService(new Intent(mContext, DrawService.class));
} else if (event.equals("recents")) {
Util.recentApps(service);
} else if (event.equals("back")) {
Util.virtualBack(service);
} else if (event.equals("home")) {
Util.virtualHome(mContext);
} else if (event.equals("camera")) {
Util.openCamera(mContext);
}
}
/**
* 查找符合条件的节点
* @param service {@link AccessibilityService}
* @param text 文本内容 ( 搜索包含该文本内容的节点 )
* @param className 节点所属的类 ( 类名 )
* @return 包含该文本内容, 且属于指定类的节点集合
*/
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public static List<AccessibilityNodeInfo> findAccessibilityNodeInfosByText(final AccessibilityService service, final String text, final String className) {
if (service == null || text == null || className == null) return null;
List<AccessibilityNodeInfo> lists = new ArrayList<>();
// 获取根节点
AccessibilityNodeInfo nodeInfo = service.getRootInActiveWindow();
// 取得当前激活窗体的根节点
if (nodeInfo == null) return lists;
// 通过文字找到当前的节点
List<AccessibilityNodeInfo> nodes = nodeInfo.findAccessibilityNodeInfosByText(text);
for (int i = 0; i < nodes.size(); i++) {
AccessibilityNodeInfo node = nodes.get(i);
// 判断是否符合的类型
if (node.getClassName().equals(className) && node.isEnabled()) {
// 保存符合条件
lists.add(node);
}
}
return lists;
}
public DirectionNavigationActor(
InputModeManager inputModeManager,
GlobalVariables globalVariables,
Analytics analytics,
Compositor compositor,
AccessibilityService service,
ProcessorPhoneticLetters processorPhoneticLetters,
AccessibilityFocusMonitor accessibilityFocusMonitor,
ScreenStateMonitor screenStateMonitor) {
this.context = service;
this.inputModeManager = inputModeManager;
this.analytics = analytics;
this.accessibilityFocusMonitor = accessibilityFocusMonitor;
this.cursorGranularityManager =
new CursorGranularityManager(
globalVariables, compositor, service, processorPhoneticLetters);
focusProcessorForLogicalNavigation =
new FocusProcessorForLogicalNavigation(
service, accessibilityFocusMonitor, screenStateMonitor);
}
private void openHongBao(AccessibilityEvent event) {
String className = event.getClassName().toString();
//Log.i(TAG, className);
if (className.equals(QQ_CLASSNAME_WALLET) && isNeedBack) {
performGlobalAction(AccessibilityService.GLOBAL_ACTION_BACK);
isNeedBack = false;
} else if (className.equals(QQ_CLASSNAME_CHAT) || (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED && windowState)) {
windowState = true;
if (!runState) {
AccessibilityNodeInfo info = event.getSource();
if (info == null) return;
getAllHongBao(info);
}
} else {
windowState = false;
}
}
/**
* 返回事件
*/
public static void performBack(final AccessibilityService service, AccessibilityNodeInfo nodeInfo) {
CharSequence packageName = nodeInfo.getPackageName();
if (!(packageName+"").equals(WECHAT_PACKAGE_NAME)) {
L.d("不是微信,不能后退 " + packageName);
return;
}
if (service == null) {
L.e("performBackWithDelay service is null");
return;
}
if (service.getRootInActiveWindow() == null) {
L.e("performBackWithDelay rootNode is null");
return;
}
L.d("performBack Reboot ");
service.performGlobalAction(AccessibilityService.GLOBAL_ACTION_BACK);
}
public static void inputText(Context context, AccessibilityService service, AccessibilityNodeInfo nodeInfo,
final String hello) {
//找到当前获取焦点的view
// AccessibilityNodeInfo target = nodeInfo.findFocus(AccessibilityNodeInfo.FOCUS_INPUT);
AccessUtil.findNodeInfosByName(nodeInfo, "android.widget.EditText");
AccessibilityNodeInfo target = editText;
if (target == null) {
L.d("inputHello: null");
return;
} else {
L.d("inputHello: not null " + target.getText());
}
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("message", hello);
clipboard.setPrimaryClip(clip);
L.d("设置粘贴板");
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
// target.performAction(AccessibilityNodeInfo.ACTION_PASTE);
// }
target.performAction(AccessibilityNodeInfo.ACTION_FOCUS);
L.d("获取焦点");
target.performAction(AccessibilityNodeInfo.ACTION_PASTE);
L.d("粘贴内容");
// openNext2("发送", nodeInfo, service);//点击发送
}
public static boolean inputText2(Context context, AccessibilityService service, AccessibilityNodeInfo nodeInfo,
final String hello) {
//找到当前获取焦点的view
// AccessibilityNodeInfo target = nodeInfo.findFocus(AccessibilityNodeInfo.FOCUS_INPUT);
AccessUtil.findNodeInfosByName(nodeInfo, "android.widget.EditText");
AccessibilityNodeInfo target = editText;
if (target == null) {
L.d("inputHello: null");
return false;
} else {
L.d("inputHello: not null " + target.getText());
}
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("message", hello);
clipboard.setPrimaryClip(clip);
L.d("设置粘贴板");
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
// target.performAction(AccessibilityNodeInfo.ACTION_PASTE);
// }
target.performAction(AccessibilityNodeInfo.ACTION_FOCUS);
L.d("获取焦点");
target.performAction(AccessibilityNodeInfo.ACTION_PASTE);
L.d("粘贴内容");
return true;
}
public SearchNavigationMode(
DisplayManager displayManager,
AccessibilityService accessibilityService,
FeedbackManager feedbackManager,
TranslatorManager translatorManager,
SelfBrailleManager selfBrailleManager,
NodeBrailler nodeBrailler,
SearchStateListener searchStateListener,
CustomLabelManager labelManager) {
mDisplayManager = displayManager;
mAccessibilityService = accessibilityService;
mFeedbackManager = feedbackManager;
mTranslatorManager = translatorManager;
mSelfBrailleManager = selfBrailleManager;
mNodeBrailler = nodeBrailler;
mSearchStateListener = searchStateListener;
mLabelManager = labelManager;
mSearchOverlay = new SearchOverlay(mAccessibilityService, mQueryText);
}
/**
* Populates a list with the set of {@link CursorGranularity}s supported by the specified root
* node and its navigable children.
*
* @param service The a11y service.
* @param root The root node from which to extract granularities.
* @return A list of supported granularities.
*/
public static List<CursorGranularity> getSupportedGranularities(
AccessibilityService service, AccessibilityNodeInfoCompat root, EventId eventId) {
final List<CursorGranularity> supported = new ArrayList<>();
Set<AccessibilityNodeInfoCompat> visitedNodes = new HashSet<>();
final int supportedMask = extractNavigableNodes(root, null, visitedNodes, eventId, service);
AccessibilityNodeInfoUtils.recycleNodes(visitedNodes);
final boolean hasWebContent = WebInterfaceUtils.hasNavigableWebContent(root);
String[] supportedHtmlElements = WebInterfaceUtils.getSupportedHtmlElements(root);
CursorGranularity.extractFromMask(
supportedMask, hasWebContent, supportedHtmlElements, supported);
return supported;
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.tv_brightness:
removeOrSendMsg(true,true);
brightnessPermissionCheck();
break;
case R.id.tv_back:
removeOrSendMsg(true,true);
clearSeekBar();
mSideBarService.performGlobalAction(AccessibilityService.GLOBAL_ACTION_BACK);
break;
case R.id.tv_home:
removeOrSendMsg(true,false);
goNormal();
mSideBarService.performGlobalAction(AccessibilityService.GLOBAL_ACTION_HOME);
break;
case R.id.tv_annotation:
removeOrSendMsg(true,false);
goNormal();
annotationGo();
break;
case R.id.tv_volume:
removeOrSendMsg(true,true);
brightnessOrVolume(1);
break;
case R.id.tv_backstage:
removeOrSendMsg(true,false);
goNormal();
mSideBarService.performGlobalAction(AccessibilityService.GLOBAL_ACTION_RECENTS);
break;
}
}
/**
* @param nodeCompats A list containing a {@link SwitchAccessNodeCompat} and any of its children
* with duplicate bounds that support actions
* @param service AccessibilityService used to determine whether autoselect is enabled
* @param actionTimeline The {@link SwitchAccessActionTimeline} used to track to actions performed
* on this node
*/
public ShowActionsMenuNode(
List<SwitchAccessNodeCompat> nodeCompats,
AccessibilityService service,
SwitchAccessActionTimeline actionTimeline) {
this.nodeCompats = nodeCompats;
this.service = service;
this.actionTimeline = actionTimeline;
}
/**
* 重启辅助功能
*/
private void restartAccessibilityService() {
LauncherApplication.getInstance().showToast("重启辅助功能中,请耐心等待");
// 关uiautomator
cleanInstrumentationAndUiAutomator();
// 切换回TalkBack
CmdTools.execHighPrivilegeCmd("settings put secure enabled_accessibility_services com.android.talkback/com.google.android.marvin.talkback.TalkBackService");
// 等2秒
MiscUtil.sleep(2000);
CmdTools.execHighPrivilegeCmd("settings put secure enabled_accessibility_services com.alipay.hulu/com.alipay.hulu.shared.event.accessibility.AccessibilityServiceImpl");
final CountDownLatch latch = new CountDownLatch(1);
InjectorService.g().waitForMessage(SubscribeParamEnum.ACCESSIBILITY_SERVICE, new Callback<AccessibilityService>() {
@Override
public void onResult(AccessibilityService item) {
latch.countDown();
}
@Override
public void onFailed() {
latch.countDown();
}
});
CmdTools.execHighPrivilegeCmd("settings put secure enabled_accessibility_services com.alipay.hulu/com.alipay.hulu.shared.event.accessibility.AccessibilityServiceImpl");
// 等待辅助功能重新激活
try {
latch.await(20000, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
LogUtil.e(TAG, "Catch java.lang.InterruptedException: " + e.getMessage(), e);
}
}
private List<SwitchAccessActionBase> getActions(AccessibilityService service) {
List<SwitchAccessActionBase> actions =
ActionBuildingUtils.getActionsForNode(service, nodeCompats.get(0), actionTimeline);
// If child nodes have the same bounds, add their actions to this node's list of actions.
List<SwitchAccessActionBase> actionsFromDescendants = new ArrayList<>();
int duplicateBoundsDisambiguationNumber = 2;
for (int i = 1; i < nodeCompats.size(); i++) {
List<SwitchAccessActionBase> descendantActions =
ActionBuildingUtils.getActionsForNode(service, nodeCompats.get(i), actionTimeline);
// Append the child actions to the parent's list.
if (!descendantActions.isEmpty()) {
for (int j = 0; j < descendantActions.size(); j++) {
descendantActions
.get(j)
.setNumberToAppendToDuplicateAction(duplicateBoundsDisambiguationNumber);
}
actionsFromDescendants.addAll(descendantActions);
duplicateBoundsDisambiguationNumber++;
}
}
if (!actionsFromDescendants.isEmpty()) {
// Add a disambiguation number to this node's actions.
for (int i = 0; i < actions.size(); i++) {
actions.get(i).setNumberToAppendToDuplicateAction(1);
}
actions.addAll(actionsFromDescendants);
}
return actions;
}
public static @Nullable AccessibilityNodeInfoCompat getFocusedNode(
AccessibilityService service, boolean fallbackOnRoot) {
AccessibilityNodeInfo root = service.getRootInActiveWindow();
AccessibilityNodeInfo focused = null;
try {
AccessibilityNodeInfo ret = null;
if (root != null) {
focused = root.findFocus(AccessibilityNodeInfo.FOCUS_ACCESSIBILITY);
if (focused != null && focused.isVisibleToUser()) {
ret = focused;
focused = null;
} else if (fallbackOnRoot) {
ret = root;
root = null;
}
} else {
LogUtils.e(TAG, "No current window root");
}
if (ret != null) {
return AccessibilityNodeInfoUtils.toCompat(ret);
}
} finally {
if (root != null) {
root.recycle();
}
if (focused != null) {
focused.recycle();
}
}
return null;
}
public SwitchAccessFeedbackController(
AccessibilityService service,
Compositor compositor,
SpeechControllerImpl speechController,
FeedbackController feedbackController,
GlobalVariables globalVariables,
AccessibilityHintsManager hintsManager,
SwitchAccessHighlightFeedbackController highlightFeedbackController,
SwitchAccessActionFeedbackController actionFeedbackController,
SwitchAccessAccessibilityEventFeedbackController accessibilityEventFeedbackController,
Handler handler) {
context = service;
this.compositor = compositor;
this.globalVariables = globalVariables;
this.speechController = speechController;
this.feedbackController = feedbackController;
this.handler = handler;
this.hintsManager = hintsManager;
this.highlightFeedbackController = highlightFeedbackController;
this.actionFeedbackController = actionFeedbackController;
this.accessibilityEventFeedbackController = accessibilityEventFeedbackController;
this.hintsManager.setHintEventListener(this.highlightFeedbackController);
this.speechController.addObserver(this);
SwitchAccessPreferenceUtils.registerSwitchAccessPreferenceChangedListener(service, this);
}
/** @return root node of the Application window */
public static AccessibilityNodeInfoCompat getRootInActiveWindow(AccessibilityService service) {
if (service == null) {
return null;
}
AccessibilityNodeInfo root = service.getRootInActiveWindow();
if (root == null) {
return null;
}
return AccessibilityNodeInfoUtils.toCompat(root);
}
private String getGestureString(int gestureId) {
switch (gestureId) {
case AccessibilityService.GESTURE_SWIPE_UP:
return context.getString(R.string.title_pref_shortcut_up);
case AccessibilityService.GESTURE_SWIPE_DOWN:
return context.getString(R.string.title_pref_shortcut_down);
case AccessibilityService.GESTURE_SWIPE_LEFT:
return context.getString(R.string.title_pref_shortcut_left);
case AccessibilityService.GESTURE_SWIPE_RIGHT:
return context.getString(R.string.title_pref_shortcut_right);
case AccessibilityService.GESTURE_SWIPE_UP_AND_DOWN:
return context.getString(R.string.title_pref_shortcut_up_and_down);
case AccessibilityService.GESTURE_SWIPE_DOWN_AND_UP:
return context.getString(R.string.title_pref_shortcut_down_and_up);
case AccessibilityService.GESTURE_SWIPE_LEFT_AND_RIGHT:
return context.getString(R.string.title_pref_shortcut_left_and_right);
case AccessibilityService.GESTURE_SWIPE_RIGHT_AND_LEFT:
return context.getString(R.string.title_pref_shortcut_right_and_left);
case AccessibilityService.GESTURE_SWIPE_UP_AND_RIGHT:
return context.getString(R.string.title_pref_shortcut_up_and_right);
case AccessibilityService.GESTURE_SWIPE_UP_AND_LEFT:
return context.getString(R.string.title_pref_shortcut_up_and_left);
case AccessibilityService.GESTURE_SWIPE_DOWN_AND_RIGHT:
return context.getString(R.string.title_pref_shortcut_down_and_right);
case AccessibilityService.GESTURE_SWIPE_DOWN_AND_LEFT:
return context.getString(R.string.title_pref_shortcut_down_and_left);
case AccessibilityService.GESTURE_SWIPE_RIGHT_AND_DOWN:
return context.getString(R.string.title_pref_shortcut_right_and_down);
case AccessibilityService.GESTURE_SWIPE_RIGHT_AND_UP:
return context.getString(R.string.title_pref_shortcut_right_and_up);
case AccessibilityService.GESTURE_SWIPE_LEFT_AND_DOWN:
return context.getString(R.string.title_pref_shortcut_left_and_down);
case AccessibilityService.GESTURE_SWIPE_LEFT_AND_UP:
return context.getString(R.string.title_pref_shortcut_left_and_up);
default:
return null;
}
}
public ProcessorMagnification(AccessibilityService service) {
if (BuildVersionUtils.isAtLeastN()) {
magnificationController = service.getMagnificationController();
} else {
magnificationController = null;
}
}
/** @return root node of the window that currently has accessibility focus */
public static @Nullable AccessibilityNodeInfoCompat getRootInAccessibilityFocusedWindow(
AccessibilityService service) {
if (service == null) {
return null;
}
AccessibilityNodeInfo focusedRoot = null;
List<AccessibilityWindowInfo> windows = getWindows(service);
// Create window manager with fake value of isInRTL = false. This is okay here since
// isInRTL will not change the result of getCurrentWindow.
WindowManager manager = new WindowManager(false /* isInRTL */);
manager.setWindows(windows);
AccessibilityWindowInfo accessibilityFocusedWindow =
manager.getCurrentWindow(false /* useInputFocus */);
if (accessibilityFocusedWindow != null) {
focusedRoot = AccessibilityWindowInfoUtils.getRoot(accessibilityFocusedWindow);
}
if (focusedRoot == null) {
focusedRoot = service.getRootInActiveWindow();
}
if (focusedRoot == null) {
return null;
}
return AccessibilityNodeInfoUtils.toCompat(focusedRoot);
}
/**
* Executes a redo operation by performing the next action. May modify the state of the screen.
*
* @return {@code true} if the execution of the redo operation was successful
*/
public synchronized boolean performRedo(AccessibilityService service) {
updateTimeStamp();
if (!canPerformRedo()) {
return false;
}
// Get the next action
final TimelineAction nextAction = getNextActionToRedo();
// We don't want this action to be inadvertently clear the redo stack while executing
nextAction.setUndoingAnotherAction(true);
// Perform the next action
final ActionResult result = nextAction.execute(service);
nextAction.setUndoingAnotherAction(false);
// Change the action's stack assignment if we were successfully able to perform the action
if (result.isSuccessful()) {
redoActionPerformed();
return true;
} else {
return false;
}
}
public FocusActor(
AccessibilityService service,
ScreenStateMonitor screenStateMonitor,
AccessibilityFocusActionHistory accessibilityFocusActionHistory,
AccessibilityFocusMonitor accessibilityFocusMonitor) {
this.history = accessibilityFocusActionHistory;
this.accessibilityFocusMonitor = accessibilityFocusMonitor;
focusManagerInternal =
new FocusManagerInternal(service, screenStateMonitor, history, accessibilityFocusMonitor);
}
/** @param service A valid {@link AccessibilityService} for interacting with the framework */
public MainTreeBuilder(AccessibilityService service) {
super(service);
linearScanTreeBuilder = new LinearScanTreeBuilder(service);
rowColumnTreeBuilder = new RowColumnTreeBuilder(service);
orderNTreeBuilder = new TalkBackOrderNDegreeTreeBuilder(service);
}
/**
* 获取无障碍服务的ID
*
* @param serviceClz accessibility service class
* @return accessibility service id
*/
public static String getServiceId(Class<? extends AccessibilityService> serviceClz) {
// eg.
// service Class: com.github.tianma8023.smscode.service.accessibility.SmsCodeAutoInputService
// package name: com.github.tianma8023.smscode
// accessibility service id : com.github.tianma8023.smscode/.service.accessibility.SmsCodeAutoInputService
String packageName = BuildConfig.APPLICATION_ID;
String serviceClzName = serviceClz.getName();
int index = serviceClzName.indexOf(packageName);
if (index != -1) {
return packageName + "/" + serviceClzName.substring(index + packageName.length());
}
return serviceClzName;
}
/**
* 模拟最近任务
*
* @param service
*/
public static void recentApps(AccessibilityService service) {
if (VERSION.SDK_INT < 16) {
Toast.makeText(service, "Android 4.1及以上系统才支持此功能,请升级后重试", 1).show();
} else {
service.performGlobalAction(AccessibilityService.GLOBAL_ACTION_RECENTS);
}
}
/**
* Executes an undo operation by performing the next action. May modify the state of the screen.
*
* @return {@code true} if the execution of the undo operation was successful
*/
public synchronized boolean performUndo(AccessibilityService service) {
updateTimeStamp();
if (!canPerformUndo()) {
return false;
}
// Get the previous action
final TimelineAction prevActionObj = getLastActionExecuted();
if (!(prevActionObj instanceof Undoable)) {
return false;
}
final Undoable prevAction = (Undoable) prevActionObj;
// Get the inverse action and perform it
final TimelineAction inverseAction = prevAction.generateInverseAction();
if (inverseAction == null) {
return false;
}
final ActionResult result = inverseAction.execute(service);
// Change the action's stack assignment if we were successfully able to perform the action
if (result.isSuccessful()) {
undoActionPerformed();
return true;
} else {
return false;
}
}
/**
* Returns a new ShowActionsMenuNode if the provided {@link SwitchAccessNodeCompat} has actions we
* support and is visible to the user.
*
* @param service AccessibilityService used to determine whether autoselect is enabled
* @param nodeCompat The {@link SwitchAccessNodeCompat} based on which this node will be created
* @return A ShowActionsMenuMode if the provided {@link SwitchAccessNodeCompat} has supported
* actions. Returns {@code null} otherwise}
*/
@Nullable
public static ShowActionsMenuNode createNodeIfHasActions(
AccessibilityService service, SwitchAccessNodeCompat nodeCompat) {
List<SwitchAccessNodeCompat> nodeCompats = getNodesIfHasActions(nodeCompat);
// Create a node if valid actions exist.
if (nodeCompats != null) {
return new ShowActionsMenuNode(
nodeCompats, service, new SwitchAccessActionTimeline(nodeCompat));
} else {
return null;
}
}
private void openHongBao(AccessibilityEvent event)
{
String className=event.getClassName().toString();
//Log.i(TAG, className);
if (className.equals(QQ_CLASSNAME_WALLET) && isNeedBack)
{
performGlobalAction(AccessibilityService.GLOBAL_ACTION_BACK);
isNeedBack = false;
}
else if (className.equals(QQ_CLASSNAME_CHAT) || (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED && windowState))
{
SharedPreferences haredPreferences = getSharedPreferences("nico.styTool_preferences", MODE_PRIVATE);
boolean sFirstRun = haredPreferences.getBoolean("ok_b", true);
//Editor editor = sharedPreferences.edit();
if (sFirstRun)
{
wakeAndUnlock(true);
}
else
{
}
windowState = true;
if (!runState)
{
AccessibilityNodeInfo info = event.getSource();
if (info == null) return;
getAllHongBao(info);
}
}
else
{
windowState = false;
}
}