Skip to content

Commit d2ec1c6

Browse files
committed
pid获取优化
1 parent 0eb4f50 commit d2ec1c6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/src/main/java/com/wrbug/developerhelper/shell/ShellManager.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import java.util.regex.Pattern
1111

1212
object ShellManager {
1313
private const val SHELL_TOP_ACTIVITY = "dumpsys activity top"
14-
private const val SHELL_PROCESS_PID_1 = "ps -ef | grep \"%s\" | grep -v grep | awk '{print \$2}'"
15-
private const val SHELL_PROCESS_PID_2 = "top -b -n 1 |grep %s |grep -v grep"
16-
private const val SHELL_PROCESS_PID_3 = "top -n 1 |grep %s |grep -v grep"
14+
private const val SHELL_PROCESS_PID_1 = "ps -ef | grep \"%1\$s&\" | grep -v grep | awk '{print \$2}'"
15+
private const val SHELL_PROCESS_PID_2 = "top -b -n 1 |grep %1\$s |grep -v grep|grep -v %1\$s:"
16+
private const val SHELL_PROCESS_PID_3 = "top -n 1 |grep %1\$s |grep -v grep|grep -v %1\$s:"
1717
private var SHELL_OPEN_ACCESSiBILITY_SERVICE = arrayOf(
1818
"settings put secure enabled_accessibility_services com.wrbug.developerhelper/com.wrbug.developerhelper.service.DeveloperHelperAccessibilityService",
1919
"settings put secure accessibility_enabled 1"

0 commit comments

Comments
 (0)