droid_adbs 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/droid_adbs/commons/doze.rb +29 -0
- data/lib/droid_adbs/commons/grant.rb +15 -0
- data/lib/droid_adbs/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb639cb3de929a4eb89e56f232c75c5dab4b1c33
|
4
|
+
data.tar.gz: fd264b7c329ecb02be0928fe854c2c7080f683ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8525afbee2930029d8e26c7e2d05441d32a1ba3a6a3ac637376255b75e056c741f99e7ba5a8fa5b694df7c925649598dee1565a2bcd6c57a2dababfa25a3fb0
|
7
|
+
data.tar.gz: e4cf31975c5a72c906a38408da36ddcb5c4d60c4e67d08f2043609e402bbbf6f39bab48345293f5e27d7accf96962ad102117ae9520bd0a0cf13d42b9cd2a243
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module DroidAdbs
|
2
|
+
module Doze
|
3
|
+
class << self
|
4
|
+
# @return [String] message from adb command
|
5
|
+
def force_idle
|
6
|
+
`#{::DroidAdbs.shell} dumpsys battery unplug`.strip
|
7
|
+
`#{::DroidAdbs.shell} dumpsys deviceidle force-idle`.strip
|
8
|
+
|
9
|
+
result = false
|
10
|
+
|
11
|
+
30.times do
|
12
|
+
deviceidle = `#{::DroidAdbs.shell} dumpsys deviceidle`.strip
|
13
|
+
result = deviceidle.include?("mState=IDLE mLightState=OVERRIDE")
|
14
|
+
break if result
|
15
|
+
sleep 0.5
|
16
|
+
end
|
17
|
+
|
18
|
+
result
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [String] message from adb command
|
22
|
+
def reset
|
23
|
+
`#{::DroidAdbs.shell} dumpsys deviceidle disable`
|
24
|
+
`#{::DroidAdbs.shell} dumpsys deviceidle enable`
|
25
|
+
`#{::DroidAdbs.shell} dumpsys battery reset`
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -15,6 +15,21 @@ module DroidAdbs
|
|
15
15
|
|
16
16
|
result
|
17
17
|
end
|
18
|
+
|
19
|
+
# @param [String] package A name of package you would like to allow permission
|
20
|
+
# @param [Object] permission Permission you would like to revoke
|
21
|
+
# @return [String] message from adb command
|
22
|
+
def revoke(package:, permission:)
|
23
|
+
result = `#{::DroidAdbs.shell} pm revoke #{package} #{permission}`.strip
|
24
|
+
|
25
|
+
unless result.empty?
|
26
|
+
exception = "java.lang.IllegalArgumentException:"
|
27
|
+
error_message = result.each_line.find { |line| line.include? exception }.chomp
|
28
|
+
raise RuntimeError, message unless error_message.empty?
|
29
|
+
end
|
30
|
+
|
31
|
+
result
|
32
|
+
end
|
18
33
|
end
|
19
34
|
end
|
20
35
|
end
|
data/lib/droid_adbs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: droid_adbs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuaki MATSUO
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- lib/droid_adbs/aapt.rb
|
73
73
|
- lib/droid_adbs/commons/backup.rb
|
74
74
|
- lib/droid_adbs/commons/devices.rb
|
75
|
+
- lib/droid_adbs/commons/doze.rb
|
75
76
|
- lib/droid_adbs/commons/dumpsys.rb
|
76
77
|
- lib/droid_adbs/commons/grant.rb
|
77
78
|
- lib/droid_adbs/commons/ime.rb
|