diff --git a/osu.Android/OsuGameAndroid.cs b/osu.Android/OsuGameAndroid.cs
index 02f4fa1ad6..050bf2b787 100644
--- a/osu.Android/OsuGameAndroid.cs
+++ b/osu.Android/OsuGameAndroid.cs
@@ -75,12 +75,10 @@ namespace osu.Android
protected override UpdateManager CreateUpdateManager() => new SimpleUpdateManager();
- protected override PowerStatus CreatePowerStatus() => new AndroidPowerStatus();
+ protected override BatteryInfo CreateBatteryInfo() => new AndroidBatteryInfo();
- private class AndroidPowerStatus : PowerStatus
+ private class AndroidBatteryInfo : BatteryInfo
{
- public override double BatteryCutoff => 0.20;
-
public override double ChargeLevel => Battery.ChargeLevel;
public override bool IsCharging => Battery.PowerSource != BatteryPowerSource.Battery;
diff --git a/osu.Android/osu.Android.csproj b/osu.Android/osu.Android.csproj
index 64d5e5b1c8..582c856a47 100644
--- a/osu.Android/osu.Android.csproj
+++ b/osu.Android/osu.Android.csproj
@@ -64,7 +64,6 @@
-
diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs
index 657c1dd47e..311448a284 100644
--- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs
+++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs
@@ -49,8 +49,8 @@ namespace osu.Game.Tests.Visual.Gameplay
[Cached]
private readonly VolumeOverlay volumeOverlay;
- [Cached(typeof(PowerStatus))]
- private readonly LocalPowerStatus powerStatus = new LocalPowerStatus();
+ [Cached(typeof(BatteryInfo))]
+ private readonly LocalBatteryInfo batteryInfo = new LocalBatteryInfo();
private readonly ChangelogOverlay changelogOverlay;
@@ -302,8 +302,8 @@ namespace osu.Game.Tests.Visual.Gameplay
// set charge status and level
AddStep("load player", () => resetPlayer(false, () =>
{
- powerStatus.SetCharging(isCharging);
- powerStatus.SetChargeLevel(chargeLevel);
+ batteryInfo.SetCharging(isCharging);
+ batteryInfo.SetChargeLevel(chargeLevel);
}));
AddUntilStep("wait for player", () => player?.LoadState == LoadState.Ready);
AddAssert($"notification {(shouldWarn ? "triggered" : "not triggered")}", () => notificationOverlay.UnreadCount.Value == (shouldWarn ? 1 : 0));
@@ -381,16 +381,14 @@ namespace osu.Game.Tests.Visual.Gameplay
}
///
- /// Mutable dummy PowerStatus class for
+ /// Mutable dummy BatteryInfo class for
///
///
- private class LocalPowerStatus : PowerStatus
+ private class LocalBatteryInfo : BatteryInfo
{
private bool isCharging = true;
private double chargeLevel = 1;
- public override double BatteryCutoff => 0.2;
-
public override bool IsCharging => isCharging;
public override double ChargeLevel => chargeLevel;
diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs
index 96aabf0024..de8ba93106 100644
--- a/osu.Game/OsuGameBase.cs
+++ b/osu.Game/OsuGameBase.cs
@@ -157,7 +157,7 @@ namespace osu.Game
protected override UserInputManager CreateUserInputManager() => new OsuUserInputManager();
- protected virtual PowerStatus CreatePowerStatus() => null;
+ protected virtual BatteryInfo CreateBatteryInfo() => null;
///
/// The maximum volume at which audio tracks should playback. This can be set lower than 1 to create some head-room for sound effects.
@@ -285,7 +285,7 @@ namespace osu.Game
dependencies.Cache(SettingsStore = new SettingsStore(contextFactory));
dependencies.Cache(RulesetConfigCache = new RulesetConfigCache(SettingsStore));
- var powerStatus = CreatePowerStatus();
+ var powerStatus = CreateBatteryInfo();
if (powerStatus != null)
dependencies.CacheAs(powerStatus);
diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs
index d342bf8273..964410f838 100644
--- a/osu.Game/Screens/Play/PlayerLoader.cs
+++ b/osu.Game/Screens/Play/PlayerLoader.cs
@@ -114,7 +114,7 @@ namespace osu.Game.Screens.Play
private AudioManager audioManager { get; set; }
[Resolved(CanBeNull = true)]
- private PowerStatus powerStatus { get; set; }
+ private BatteryInfo batteryInfo { get; set; }
public PlayerLoader(Func createPlayer)
{
@@ -483,11 +483,11 @@ namespace osu.Game.Screens.Play
private void showBatteryWarningIfNeeded()
{
- if (powerStatus == null) return;
+ if (batteryInfo == null) return;
if (!batteryWarningShownOnce.Value)
{
- if (powerStatus.IsLowBattery)
+ if (batteryInfo.IsLowBattery)
{
notificationOverlay?.Post(new BatteryWarningNotification());
batteryWarningShownOnce.Value = true;
diff --git a/osu.Game/Utils/PowerStatus.cs b/osu.Game/Utils/BatteryInfo.cs
similarity index 68%
rename from osu.Game/Utils/PowerStatus.cs
rename to osu.Game/Utils/BatteryInfo.cs
index 46f7e32b9e..1a64213d8e 100644
--- a/osu.Game/Utils/PowerStatus.cs
+++ b/osu.Game/Utils/BatteryInfo.cs
@@ -5,15 +5,9 @@ namespace osu.Game.Utils
{
///
/// Provides access to the system's power status.
- /// Currently implemented on iOS and Android only.
///
- public abstract class PowerStatus
+ public abstract class BatteryInfo
{
- ///
- /// The maximum battery level considered as low, from 0 to 1.
- ///
- public abstract double BatteryCutoff { get; }
-
///
/// The charge level of the battery, from 0 to 1.
///
@@ -23,8 +17,8 @@ namespace osu.Game.Utils
///
/// Whether the battery is currently low in charge.
- /// Returns true if not charging and current charge level is lower than or equal to .
+ /// Returns true if not charging and current charge level is lower than or equal to 25%.
///
- public bool IsLowBattery => !IsCharging && ChargeLevel <= BatteryCutoff;
+ public bool IsLowBattery => !IsCharging && ChargeLevel <= 0.25;
}
}
diff --git a/osu.iOS/OsuGameIOS.cs b/osu.iOS/OsuGameIOS.cs
index b53b594eae..702aef45f5 100644
--- a/osu.iOS/OsuGameIOS.cs
+++ b/osu.iOS/OsuGameIOS.cs
@@ -16,12 +16,10 @@ namespace osu.iOS
protected override UpdateManager CreateUpdateManager() => new SimpleUpdateManager();
- protected override PowerStatus CreatePowerStatus() => new IOSPowerStatus();
+ protected override BatteryInfo CreateBatteryInfo() => new IOSBatteryInfo();
- private class IOSPowerStatus : PowerStatus
+ private class IOSBatteryInfo : BatteryInfo
{
- public override double BatteryCutoff => 0.25;
-
public override double ChargeLevel => Battery.ChargeLevel;
public override bool IsCharging => Battery.PowerSource != BatteryPowerSource.Battery;
diff --git a/osu.iOS/osu.iOS.csproj b/osu.iOS/osu.iOS.csproj
index ed6f52c60e..1cbe4422cc 100644
--- a/osu.iOS/osu.iOS.csproj
+++ b/osu.iOS/osu.iOS.csproj
@@ -117,7 +117,6 @@
-