Skip to content

Commit 7ad05d3

Browse files
committed
add remote-adb-control.
1 parent c7135ca commit 7ad05d3

File tree

25 files changed

+307
-61
lines changed

25 files changed

+307
-61
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# PyAndroidControl
2-
Control your Android device via python scripts.
2+
Your Remote ADB controller. Control your Android device via python scripts.
33

44
## Architecture
55
![](architecture.png)
@@ -28,5 +28,14 @@ def get_commands(token, img_file):
2828
```
2929
### 3. Control your Device
3030
![](demo.gif)
31+
32+
33+
## Remote ADB Control
34+
Mock adb with PyAndroidControl, check [remote-adb-control](remote-adb-control).
35+
36+
- 1. First Start [remote-adb-control/center-server/control_server.py](remote-adb-control/center-server/control_server.py)
37+
- 2. Then use the [remote-adb-control/control-client/remote_adb_api.py](remote-adb-control/control-client/remote_adb_api.py) to control your device like using ADB.
38+
39+
3140
## License
3241
MIT

py-android-control-app/.idea/codeStyles/Project.xml

Lines changed: 0 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

py-android-control-app/.idea/compiler.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

py-android-control-app/.idea/encodings.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

py-android-control-app/.idea/gradle.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

py-android-control-app/.idea/jarRepositories.xml

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

py-android-control-app/.idea/misc.xml

Lines changed: 9 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

py-android-control-app/.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

py-android-control-app/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
applicationId "kalen.app.pyandroidcontrol"
1111
minSdkVersion 15
1212
targetSdkVersion 27
13-
versionCode 1
14-
versionName "1.0"
13+
versionCode 2
14+
versionName "2.0"
1515
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1616
}
1717
buildTypes {

py-android-control-app/app/src/main/java/kalen/app/pyandroidcontrol/BackgroundService.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class BackgroundService : Service() {
4444
layoutParams!!.gravity = Gravity.START or Gravity.TOP
4545
layoutParams!!.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or
4646
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
47-
layoutParams!!.width = 250
48-
layoutParams!!.height = 140
47+
layoutParams!!.width = 100
48+
layoutParams!!.height = 70
4949
layoutParams!!.x = 300
5050
layoutParams!!.y = 300
5151
}
@@ -73,6 +73,7 @@ class BackgroundService : Service() {
7373
}
7474
button = Button(applicationContext)
7575
button!!.setText(R.string.startTxt)
76+
button!!.setTextSize(8F)
7677
windowManager!!.addView(button, layoutParams)
7778

7879
button!!.setOnTouchListener(FloatingOnTouchListener())
@@ -94,8 +95,8 @@ class BackgroundService : Service() {
9495

9596
for (cmd in cmds) {
9697
Shell.SU.run(cmd)
97-
// random sleep 50-150ms
98-
val rndTime:Long = (50 + rnd.nextInt(100)).toLong()
98+
// random sleep 20-50ms
99+
val rndTime:Long = (20 + rnd.nextInt(30)).toLong()
99100
Thread.sleep(rndTime)
100101
}
101102
} catch (e: Exception) {
@@ -117,7 +118,6 @@ class BackgroundService : Service() {
117118
private var x: Int = 0
118119
private var y: Int = 0
119120

120-
121121
override fun onTouch(view: View, event: MotionEvent): Boolean {
122122
when (event.action) {
123123

0 commit comments

Comments
 (0)