atom 青少年弹窗问题
This commit is contained in:
3
.idea/gradle.xml
generated
3
.idea/gradle.xml
generated
@@ -4,7 +4,7 @@
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="PLATFORM" />
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="disableWrapperSourceDistributionNotification" value="true" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -24,7 +24,6 @@
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
@@ -158,7 +158,7 @@ public class AblService extends AccessibilityService {
|
||||
if (classname.equals("android.app.AlertDialog")) {
|
||||
|
||||
} else if (classname.equals("com.android.packageinstaller.permission.ui.GrantPermissionsActivity")) {
|
||||
// //点击安装
|
||||
//点击安装
|
||||
// AblViewUtil.mySleep(2);
|
||||
// inputClickId("始终允许");
|
||||
} else if (classname.equals("com.android.packageinstaller.PackageInstallerActivity")) {
|
||||
@@ -177,7 +177,8 @@ public class AblService extends AccessibilityService {
|
||||
} else if (classname.equals("androidx.appcompat.app.AlertDialog")) {
|
||||
if (str.contains("为呵护未成")) {
|
||||
AblViewUtil.mySleep(2);
|
||||
performGlobalAction(GLOBAL_ACTION_BACK); // 返回安装页面
|
||||
performGlobalAction(GLOBAL_ACTION_BACK);
|
||||
// 返回安装页面
|
||||
Log.e("TIAOSHI###", "关闭了为呵护未成年人健康成长的弹框");
|
||||
}
|
||||
} else if (str.contains("检测到更新")) {//测试可以用
|
||||
|
||||
@@ -15,6 +15,7 @@ import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -582,4 +583,73 @@ public class AblViewUtil {
|
||||
public static void potgegin(String str){
|
||||
infoMessag.potgegin(str);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 跳过广告
|
||||
*/
|
||||
public static void Skip(){
|
||||
List<AccessibilityNodeInfo> nodeInfoList = AblService.getInstance().getRootInActiveWindow().findAccessibilityNodeInfosByText("跳过");
|
||||
for (AccessibilityNodeInfo info : nodeInfoList) {
|
||||
CharSequence charSequence = info.getText();
|
||||
if (charSequence != null) {
|
||||
String msg = charSequence.toString();
|
||||
if (msg.contains("跳过")) {
|
||||
info.performAction(AccessibilityNodeInfo.ACTION_CLICK);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭弹窗
|
||||
*/
|
||||
public static void Close(){
|
||||
if (isContainText("青少年模式")){
|
||||
findAndPerformActionTextView("我知道了");
|
||||
}
|
||||
if (isContainText("获取设备的定位信息")){
|
||||
findAndPerformActionTextView("仅在使用中允许");
|
||||
}
|
||||
if (isContainText("")){
|
||||
findAndPerformActionTextView("");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param text
|
||||
* 根据文本寻找控件节点
|
||||
*/
|
||||
public static void findAndPerformActionTextView(String text) {
|
||||
if (AblService.getInstance().getRootInActiveWindow() == null) {
|
||||
return;
|
||||
}
|
||||
List node = AblService.getInstance().getRootInActiveWindow().findAccessibilityNodeInfosByText(text);
|
||||
for ( int i = 0; i < node.size(); i++ ){
|
||||
AccessibilityNodeInfo nodeInfo = (AccessibilityNodeInfo) node.get(i);
|
||||
if (nodeInfo != null && nodeInfo.isEnabled()){
|
||||
performViewClick(nodeInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 模拟点击事件,如果该node不能点击,则点击父node,将点击事件一直向父级传递,直至到根node或者找到一个可以点击的node
|
||||
*
|
||||
* @param nodeInfo nodeInfo
|
||||
*/
|
||||
public static void performViewClick(AccessibilityNodeInfo nodeInfo) {
|
||||
if (nodeInfo == null) {
|
||||
return;
|
||||
} else {
|
||||
while (nodeInfo != null) {
|
||||
if (nodeInfo.isClickable()) {
|
||||
nodeInfo.performAction(AccessibilityNodeInfo.ACTION_CLICK);
|
||||
break;
|
||||
}
|
||||
nodeInfo = nodeInfo.getParent();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.fisherbone.fuzhu.quzan;
|
||||
|
||||
import android.os.Message;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.fisherbone.fuzhu.ChangLiang;
|
||||
import com.fisherbone.fuzhu.abllib.AblService;
|
||||
@@ -26,19 +27,20 @@ public class AblStep1 extends BaseAblStep {
|
||||
switch ( step ){
|
||||
case AblSteps.STEP_260:
|
||||
AblViewUtil.startApplication();
|
||||
AblViewUtil.Skip();
|
||||
AblViewUtil.mySleep(5);
|
||||
AblStepHandler.sendMsg(AblSteps.STEP_261);
|
||||
break;
|
||||
case AblSteps.STEP_261:
|
||||
ChangLiang.ishuodong = "T";
|
||||
AblViewUtil.mySleep(2);
|
||||
AblViewUtil.Close();
|
||||
AblViewUtil.mySleep(5);
|
||||
AblService instance = AblService.getInstance();
|
||||
AblViewUtil.mySleep(2);
|
||||
myClick();
|
||||
AblStepHandler.sendMsg(AblSteps.STEP_262);
|
||||
break;
|
||||
case AblSteps.STEP_262:
|
||||
findAndPerformActionTextView("喜欢");
|
||||
AblViewUtil.findAndPerformActionTextView("喜欢");
|
||||
AblStepHandler.sendMsg(AblSteps.STEP_263);
|
||||
break;
|
||||
case AblSteps.STEP_263:
|
||||
@@ -59,41 +61,6 @@ public class AblStep1 extends BaseAblStep {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param text
|
||||
* 根据文本寻找控件节点
|
||||
*/
|
||||
public void findAndPerformActionTextView(String text) {
|
||||
if (AblService.getInstance().getRootInActiveWindow() == null) {
|
||||
return;
|
||||
}
|
||||
List node = AblService.getInstance().getRootInActiveWindow().findAccessibilityNodeInfosByText(text);
|
||||
for ( int i = 0; i < node.size(); i++ ){
|
||||
AccessibilityNodeInfo nodeInfo = (AccessibilityNodeInfo) node.get(i);
|
||||
if (nodeInfo != null && nodeInfo.isEnabled()){
|
||||
performViewClick(nodeInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 模拟点击事件,如果该node不能点击,则点击父node,将点击事件一直向父级传递,直至到根node或者找到一个可以点击的node
|
||||
*
|
||||
* @param nodeInfo nodeInfo
|
||||
*/
|
||||
public void performViewClick(AccessibilityNodeInfo nodeInfo) {
|
||||
if (nodeInfo == null) {
|
||||
return;
|
||||
} else {
|
||||
while (nodeInfo != null) {
|
||||
if (nodeInfo.isClickable()) {
|
||||
nodeInfo.performAction(AccessibilityNodeInfo.ACTION_CLICK);
|
||||
break;
|
||||
}
|
||||
nodeInfo = nodeInfo.getParent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据控件描述文本找到“喜欢”按钮
|
||||
@@ -110,4 +77,6 @@ public class AblStep1 extends BaseAblStep {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user