Add isBatteryCharging to NetworkProviderInfo extras

Bug: 278155694
Test: none
Change-Id: I0d9d288e65ac2410ab3c2d96b5c8fa5143d5ba40
This commit is contained in:
Matt Walliser
2023-04-14 02:51:59 +00:00
parent 9af3f4558e
commit b25b3b1ddf

View File

@@ -84,6 +84,12 @@ public final class NetworkProviderInfo implements Parcelable {
public @interface DeviceType {
}
/**
* Key in extras bundle indicating that the device battery is charging.
* @hide
*/
public static final String EXTRA_KEY_IS_BATTERY_CHARGING = "is_battery_charging";
@DeviceType
private final int mDeviceType;
private final String mDeviceName;
@@ -163,11 +169,11 @@ public final class NetworkProviderInfo implements Parcelable {
/**
* Sets the displayed connection strength of the remote device to the internet.
*
* @param connectionStrength Connection strength in range 0 to 3.
* @param connectionStrength Connection strength in range 0 to 4.
* @return Returns the Builder object.
*/
@NonNull
public Builder setConnectionStrength(@IntRange(from = 0, to = 3) int connectionStrength) {
public Builder setConnectionStrength(@IntRange(from = 0, to = 4) int connectionStrength) {
mConnectionStrength = connectionStrength;
return this;
}
@@ -205,8 +211,8 @@ public final class NetworkProviderInfo implements Parcelable {
if (batteryPercentage < 0 || batteryPercentage > 100) {
throw new IllegalArgumentException("BatteryPercentage must be in range 0-100");
}
if (connectionStrength < 0 || connectionStrength > 3) {
throw new IllegalArgumentException("ConnectionStrength must be in range 0-3");
if (connectionStrength < 0 || connectionStrength > 4) {
throw new IllegalArgumentException("ConnectionStrength must be in range 0-4");
}
}
@@ -265,9 +271,9 @@ public final class NetworkProviderInfo implements Parcelable {
/**
* Gets the displayed connection strength of the remote device to the internet.
*
* @return Returns the connection strength in range 0 to 3.
* @return Returns the connection strength in range 0 to 4.
*/
@IntRange(from = 0, to = 3)
@IntRange(from = 0, to = 4)
public int getConnectionStrength() {
return mConnectionStrength;
}