device_api-android 1.2.15 → 1.2.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 212e7370956150bfc7b757c63aef3e3438d5727b
4
- data.tar.gz: 2fac6552d5f192b7642b3a1d5f33f9c2fca4e712
3
+ metadata.gz: a60d874192e707106199039e8d1163d7ef5a9ca0
4
+ data.tar.gz: 66017f7dbf4e46e8ea407c6a7c0b7d0f2dc2eed7
5
5
  SHA512:
6
- metadata.gz: 628adbda037fd374334e589e73411b2bf1624fdf2762a3d02cac191b66d16b8328b9ef8dabbf5e6494456cf87225b96dc33b98fbcd2e9c25fc590db211c0d564
7
- data.tar.gz: c4559aa1717b8be083fa8fd8c9734d8c3cf9a51b4e7438030e982af07c09ce61fddbb4e54850278c015d97d42ec418770a39c098f575ab14f575ae9e9c3489b2
6
+ metadata.gz: d990e5a3d73eb9e27e77302ca8a98e172b4f04f2ee352f93fd78abd17ace2ee6818eab4768014a635c7919b3ac0a0ff70a9aca24dac3f2d0310e3586634ebca8
7
+ data.tar.gz: e205e6b2789fd07565e0bb0765d207afbce0a76a8d473c28c0a45ef31a42bfd1dce3dbc5f7f5f9a2d2d4457cb2c900d397d077c06499a1ab53afdc6859434734
@@ -237,9 +237,13 @@ module DeviceAPI
237
237
 
238
238
  filename = args[:filename] or raise "filename not provided (:filename => '/tmp/myfile.png')"
239
239
 
240
- convert_carriage_returns = %q{perl -pe 's/\x0D\x0A/\x0A/g'}
241
- cmd = "screencap -p | #{convert_carriage_returns} > #{filename}"
242
-
240
+ if getprop(qualifier)['ro.build.version.release'].to_i < 7
241
+ convert_carriage_returns = %q{perl -pe 's/\x0D\x0A/\x0A/g'}
242
+ cmd = "screencap -p | #{convert_carriage_returns} > #{filename}"
243
+ else
244
+ cmd = "screencap -p > #{filename}"
245
+ end
246
+
243
247
  shell(qualifier, cmd)
244
248
  end
245
249
 
@@ -124,13 +124,13 @@ module DeviceAPI
124
124
  # Return the battery level
125
125
  # @return (String) device battery level
126
126
  def battery_level
127
- get_battery_info['level']
127
+ get_battery_info.level
128
128
  end
129
129
 
130
130
  # Is the device currently being powered?
131
131
  # @return (Boolean) true if it is being powered in some way, false if it is unpowered
132
132
  def powered?
133
- !get_battery_info.select { |keys| keys.include?('powered')}.select { |_,v| v == 'true' }.empty?
133
+ get_battery_info.powered
134
134
  end
135
135
 
136
136
  def block_package(package)
@@ -2,7 +2,7 @@ module DeviceAPI
2
2
  module Android
3
3
  module Plugin
4
4
  class Battery
5
- attr_reader :current_temp, :max_temp, :max_current, :voltage, :level, :health, :status
5
+ attr_reader :current_temp, :max_temp, :max_current, :voltage, :level, :health, :status, :powered
6
6
 
7
7
  def initialize(options = {})
8
8
  qualifier = options[:qualifier]
@@ -14,6 +14,7 @@ module DeviceAPI
14
14
  @level = props["level"]
15
15
  @health = props["health"]
16
16
  @status = props["status"]
17
+ @powered = props["USB powered"]
17
18
  end
18
19
  end
19
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: device_api-android
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.15
4
+ version: 1.2.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Buckhurst
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-11-10 00:00:00.000000000 Z
14
+ date: 2016-11-29 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: device_api