Skip to content

Commit

Permalink
修复当订阅号中出现标题为“[微信红包]拜年红包”(其实并非红包)的信息时误判
Browse files Browse the repository at this point in the history
  • Loading branch information
larryxiao625 committed Feb 12, 2016
1 parent 0a856f4 commit 9dcd925
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
package xyz.monkeytong.hongbao.services;

import android.accessibilityservice.AccessibilityService;
import android.app.Instrumentation;
import android.app.Notification;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcelable;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.KeyEvent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import xyz.monkeytong.hongbao.activities.MainActivity;
import xyz.monkeytong.hongbao.utils.HongbaoSignature;
import xyz.monkeytong.hongbao.utils.PowerUtil;

import java.util.List;

import xyz.monkeytong.hongbao.utils.HongbaoSignature;
import xyz.monkeytong.hongbao.utils.PowerUtil;


public class HongbaoService extends AccessibilityService implements SharedPreferences.OnSharedPreferenceChangeListener {
private static final String WECHAT_DETAILS_EN = "Details";
Expand Down Expand Up @@ -131,7 +130,9 @@ private boolean watchList(AccessibilityEvent event) {
return false;

List<AccessibilityNodeInfo> nodes = eventSource.findAccessibilityNodeInfosByText(WECHAT_NOTIFICATION_TIP);
if (!nodes.isEmpty()) {
//增加条件判断currentActivityName.contains(WECHAT_LUCKMONEY_GENERAL_ACTIVITY)
//避免当订阅号中出现标题为“[微信红包]拜年红包”(其实并非红包)的信息时误判
if (!nodes.isEmpty() && currentActivityName.contains(WECHAT_LUCKMONEY_GENERAL_ACTIVITY)) {
AccessibilityNodeInfo nodeToClick = nodes.get(0);
CharSequence contentDescription = nodeToClick.getContentDescription();
if (contentDescription != null && !signature.getContentDescription().equals(contentDescription)) {
Expand Down

0 comments on commit 9dcd925

Please sign in to comment.