|
|
@@ -15,6 +15,9 @@ import com.example.modifier.constants.CMD_BACK
|
|
|
import com.example.modifier.constants.CMD_RCS_SETTINGS_ACTIVITY
|
|
|
import com.example.modifier.utils.currentActivity
|
|
|
import com.example.modifier.utils.findAllScrollable
|
|
|
+import com.example.modifier.utils.findById
|
|
|
+import com.example.modifier.utils.findByText
|
|
|
+import com.example.modifier.utils.findFirstByDesc
|
|
|
import com.example.modifier.utils.findFirstByIdAndText
|
|
|
import com.example.modifier.utils.shellRun
|
|
|
import kotlinx.coroutines.Dispatchers
|
|
|
@@ -214,4 +217,38 @@ class ScreenController(val context: AccessibilityService, private val inspector:
|
|
|
Log.i(TAG, "found $appName")
|
|
|
node.parent.performAction(AccessibilityNodeInfo.ACTION_CLICK)
|
|
|
}
|
|
|
+
|
|
|
+ suspend fun groupDetails(): Boolean {
|
|
|
+ val more = context.rootInActiveWindow.findFirstByDesc("More")
|
|
|
+ if (more == null) {
|
|
|
+ Log.e(TAG, "not found More")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ more.parent.performAction(AccessibilityNodeInfo.ACTION_CLICK)
|
|
|
+ delay(500)
|
|
|
+ val groupDetails = context.rootInActiveWindow.findByText("Group details")
|
|
|
+ if (groupDetails == null) {
|
|
|
+ inspector.traverseNode(TraverseResult(), true)
|
|
|
+ Log.e(TAG, "not found Group details")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ groupDetails.performAction(AccessibilityNodeInfo.ACTION_CLICK)
|
|
|
+ groupDetails.parent.performAction(AccessibilityNodeInfo.ACTION_CLICK)
|
|
|
+ delay(500)
|
|
|
+ val leave = context.rootInActiveWindow.findById("Leave group")
|
|
|
+ if (leave == null) {
|
|
|
+ Log.e(TAG, "not found Leave group")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ leave.performAction(AccessibilityNodeInfo.ACTION_CLICK)
|
|
|
+ delay(500)
|
|
|
+ val ok = context.rootInActiveWindow.findByText("OK")
|
|
|
+ if (ok == null) {
|
|
|
+ Log.e(TAG, "not found OK")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ Log.i(TAG, "groupDetails: click OK")
|
|
|
+ ok.parent.performAction(AccessibilityNodeInfo.ACTION_CLICK)
|
|
|
+ return true
|
|
|
+ }
|
|
|
}
|