| | |
| | | * 点击弹出 edit弹框 |
| | | */ |
| | | private void clickEdit(){ |
| | | List<AccessibilityNodeInfo> list = getRootInActiveWindow().findAccessibilityNodeInfosByText("说点什么..."); |
| | | Log.e(TAG,"获取到控件 "+list.size()); |
| | | if (list != null && list.size() > 0 && flag) { |
| | | //模拟第三方点击事件 |
| | | //找到你的节点以后 就直接点击他就行了 |
| | | //AccessibilityNodeInfo node = list.get(0); |
| | | list.get(0).performAction(AccessibilityNodeInfo.ACTION_CLICK); |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { |
| | | Log.e(TAG,"执行点击 "+list.get(0).getPaneTitle()); |
| | | try{ |
| | | List<AccessibilityNodeInfo> list = getRootInActiveWindow().findAccessibilityNodeInfosByText("说点什么..."); |
| | | Log.e(TAG,"获取到控件 "+list.size()); |
| | | if (list != null && list.size() > 0 && flag) { |
| | | //模拟第三方点击事件 |
| | | //找到你的节点以后 就直接点击他就行了 |
| | | //AccessibilityNodeInfo node = list.get(0); |
| | | list.get(0).performAction(AccessibilityNodeInfo.ACTION_CLICK); |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { |
| | | Log.e(TAG,"执行点击 "+list.get(0).getPaneTitle()); |
| | | } |
| | | }else if(flag){ |
| | | //Toast.makeText(getBaseContext(),"未找到控件",Toast.LENGTH_SHORT).show(); |
| | | } |
| | | }else if(flag){ |
| | | //Toast.makeText(getBaseContext(),"未找到控件",Toast.LENGTH_SHORT).show(); |
| | | } |
| | | }catch ( Exception e){} |
| | | } |
| | | |
| | | @SuppressLint("NewApi") |
| | |
| | | @SuppressLint("NewApi") |
| | | private AccessibilityNodeInfo getViewByDesc(AccessibilityNodeInfo node, String desc){ |
| | | try{ |
| | | Log.e(TAG,desc +" getViewByDesc id:"+node.getViewIdResourceName() +" class:"+node.getClassName()+" text:"+node.getText()+" "+node.getContentDescription()); |
| | | Log.e(TAG,"getViewByDesc node:"+node); |
| | | //Log.e(TAG,desc +" getViewByDesc id:"+node.getViewIdResourceName() +" class:"+node.getClassName()+" text:"+node.getText()+" "+node.getContentDescription()); |
| | | //Log.e(TAG,"getViewByDesc node:"+node); |
| | | if(node.getChildCount() > 0){ |
| | | for(int i = 0 ; i < node.getChildCount() ; i ++){ |
| | | if(node.getChild(i) != null) { |
| | |
| | | |
| | | @Override |
| | | public void onInterrupt() { |
| | | Log.e(TAG,"onInterrupt 服务停止"); |
| | | unregisterReceiver(receiver); |
| | | Toast.makeText(getBaseContext(),"服务停止",Toast.LENGTH_SHORT).show(); |
| | | } |
| | | @Override |
| | | protected void onServiceConnected() { |