监控安装界面,并根据逻辑处理点击:
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
super.onAccessibilityEvent(event);
if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED &&
event.getPackageName().equals("com.android.packageinstaller")) {
AccessibilityNodeInfo nodeInfo = findViewByText("安装", true);
if (nodeInfo != null) {
performViewClick(nodeInfo);
}
}
}