OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.offlinepages; | 5 package org.chromium.chrome.browser.offlinepages; |
6 | 6 |
7 /** Device network and power conditions. */ | 7 /** Device network and power conditions. */ |
8 public class DeviceConditions { | 8 public class DeviceConditions { |
9 private final boolean mPowerConnected; | 9 private final boolean mPowerConnected; |
10 private final int mBatteryPercentage; | 10 private final int mBatteryPercentage; |
11 private final int mNetConnectionType; | 11 private final int mNetConnectionType; |
12 | 12 |
13 /** | 13 /** |
14 * Creates set of device network and power conditions. | 14 * Creates set of device network and power conditions. |
15 * @param powerConnected whether device is connected to power | 15 * @param powerConnected whether device is connected to power |
16 * @param batteryPercentage percentage (0-100) of remaining battery power | 16 * @param batteryPercentage percentage (0-100) of remaining battery power |
17 * @param connectionType the org.chromium.net.ConnectionType value for the n etwork connection | 17 * @param connectionType the org.chromium.net.ConnectionType value for the n etwork connection |
18 */ | 18 */ |
19 public DeviceConditions(boolean powerConnected, int batteryPercentage, int n etConnectionType) { | 19 public DeviceConditions(boolean powerConnected, int batteryPercentage, int n etConnectionType) { |
20 mPowerConnected = powerConnected; | 20 mPowerConnected = powerConnected; |
21 mBatteryPercentage = batteryPercentage; | 21 mBatteryPercentage = batteryPercentage; |
22 mNetConnectionType = netConnectionType; | 22 mNetConnectionType = netConnectionType; |
23 } | 23 } |
24 | 24 |
25 /** @return Whether power is connected. */ | |
25 public boolean isPowerConnected() { | 26 public boolean isPowerConnected() { |
26 return mPowerConnected; | 27 return mPowerConnected; |
27 } | 28 } |
28 | 29 |
30 /** @return Battery percentage. */ | |
29 public int getBatteryPercentage() { | 31 public int getBatteryPercentage() { |
30 return mBatteryPercentage; | 32 return mBatteryPercentage; |
31 } | 33 } |
32 | 34 |
33 /** | 35 /** @return Network connection type as defined by org.chroium.net.Connection Type. */ |
Pete Williamson
2017/02/10 02:10:43
Comment might be slightly misleading. We actually
fgorski
2017/02/10 19:26:00
Updated.
| |
34 * Returns the Chromium enum value for the network connection type. Connecti on type values are | |
35 * defined in org.chromium.net.ConnectionType. | |
36 */ | |
37 public int getNetConnectionType() { | 36 public int getNetConnectionType() { |
38 return mNetConnectionType; | 37 return mNetConnectionType; |
39 } | 38 } |
40 } | 39 } |
OLD | NEW |