android-adb-extension 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/android-adb-extension/adb.rb +29 -13
- data/lib/android-adb-extension/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 132e495adcd4e5ba874c6e033d7df8f65e7be31b
|
4
|
+
data.tar.gz: a868a9b814ac86e7d75416c037de78a8c6c2022b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a151a6cdb29ce70b339c9acba22dc7a46a029f549a932c322df3a720d0f6296bb956f09c7b7164215e19e50ccf674a248e70b9a8b9c729ba0492b1bc52e4da16
|
7
|
+
data.tar.gz: 10af7aea987d2db31f3f0ca241fabfde6602a9dc4210fa5ad9855b5ac0695536281907edcf833cf6e0a6f4e5f732723498e33ad827ebc8f178c232a8ecc685e2
|
@@ -3,11 +3,11 @@
|
|
3
3
|
class ADB
|
4
4
|
class << self
|
5
5
|
def sdk
|
6
|
-
|
6
|
+
`#{adb_shell_command} getprop ro.build.version.sdk`.strip.to_i
|
7
7
|
end
|
8
8
|
|
9
9
|
def release
|
10
|
-
|
10
|
+
`#{adb_shell_command} getprop ro.build.version.release`.strip
|
11
11
|
end
|
12
12
|
|
13
13
|
def major
|
@@ -15,7 +15,7 @@ class ADB
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def orientation
|
18
|
-
|
18
|
+
`#{adb_shell_command} dumpsys input |
|
19
19
|
grep 'SurfaceOrientation' |
|
20
20
|
awk '{ print $2 }'`.strip.to_i
|
21
21
|
end
|
@@ -43,7 +43,7 @@ class ADB
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def airplane_mode
|
46
|
-
|
46
|
+
`#{adb_shell_command} settings get global airplane_mode_on`.strip.to_i
|
47
47
|
end
|
48
48
|
|
49
49
|
def airplane_mode?
|
@@ -59,28 +59,28 @@ class ADB
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def monkey(aPackageName, aEventCount = 500)
|
62
|
-
|
62
|
+
`#{adb_shell_command} monkey -p #{aPackageName} #{aEventCount}`
|
63
63
|
end
|
64
64
|
|
65
65
|
def lock
|
66
|
-
cmd =
|
66
|
+
cmd = "#{adb_shell_command} input keyevent 26"
|
67
67
|
`#{cmd}`
|
68
68
|
res = `#{cmd}`
|
69
69
|
res.empty? ? nil : res
|
70
70
|
end
|
71
71
|
|
72
72
|
def unlock
|
73
|
-
res =
|
73
|
+
res = `#{adb_shell_command} input keyevent 82`
|
74
74
|
res.empty? ? nil : res
|
75
75
|
end
|
76
76
|
|
77
77
|
def send_to_background
|
78
|
-
res =
|
78
|
+
res = `#{adb_shell_command} input keyevent 3`
|
79
79
|
res.empty? ? nil : res
|
80
80
|
end
|
81
81
|
|
82
82
|
def bring_to_foreground(aPackage, aActivity)
|
83
|
-
res =
|
83
|
+
res = `#{adb_shell_command} am start -n #{aPackage}/#{aActivity}`
|
84
84
|
res.empty? ? nil : res
|
85
85
|
end
|
86
86
|
|
@@ -93,7 +93,7 @@ class ADB
|
|
93
93
|
private
|
94
94
|
|
95
95
|
def change_accelerometer_control(aMode)
|
96
|
-
command =
|
96
|
+
command = "#{adb_shell_command} content insert"
|
97
97
|
param1 = '--uri content://settings/system'
|
98
98
|
param2 = '--bind name:s:accelerometer_rotation'
|
99
99
|
param3 = "--bind value:i:#{aMode}"
|
@@ -102,7 +102,7 @@ class ADB
|
|
102
102
|
end
|
103
103
|
|
104
104
|
def change_device_orientation(aOrientation)
|
105
|
-
command =
|
105
|
+
command = "#{adb_shell_command} content insert"
|
106
106
|
param1 = '--uri content://settings/system'
|
107
107
|
param2 = '--bind name:s:user_rotation'
|
108
108
|
param3 = "--bind value:i:#{aOrientation}"
|
@@ -111,12 +111,28 @@ class ADB
|
|
111
111
|
end
|
112
112
|
|
113
113
|
def change_airplane_mode(aMode)
|
114
|
-
command1 = "
|
115
|
-
command2 =
|
114
|
+
command1 = "#{adb_shell_command} settings put global airplane_mode_on #{aMode}"
|
115
|
+
command2 = "#{adb_shell_command} am broadcast"
|
116
116
|
param1 = '-a android.intent.action.AIRPLANE_MODE'
|
117
117
|
param2 = "--ez state #{aMode.to_boolean}"
|
118
118
|
|
119
119
|
`#{command1} & #{command2} #{param1} #{param2}`
|
120
120
|
end
|
121
|
+
|
122
|
+
def multiple_devices?
|
123
|
+
!adb_device_arg.nil?
|
124
|
+
end
|
125
|
+
|
126
|
+
def device_id
|
127
|
+
adb_device_arg
|
128
|
+
end
|
129
|
+
|
130
|
+
def adb_device_arg
|
131
|
+
ENV['ADB_DEVICE_ARG']
|
132
|
+
end
|
133
|
+
|
134
|
+
def adb_shell_command
|
135
|
+
multiple_devices? ? "adb -s #{device_id} shell" : 'adb shell'
|
136
|
+
end
|
121
137
|
end
|
122
138
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: android-adb-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jani Jegoroff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: to_boolean
|
@@ -116,4 +116,3 @@ signing_key:
|
|
116
116
|
specification_version: 4
|
117
117
|
summary: Android debug bridge extension.
|
118
118
|
test_files: []
|
119
|
-
has_rdoc:
|