With .NET 6, the way Xamarin package versioning works has changed.
- The `ApplicationVersion` MSBuild property aims to replace
`android:versionCode` in the manifest.
- The `ApplicationDisplayVersion` MSBuild property aims to replace
`android:versionName` in the manifest.
More about this can be read in Xamarin docs:
ec712da8c1/Documentation/guides/OneDotNetSingleProject.md
To this end:
- Manual `version{Code,Name}` specs are removed from
`AndroidManifest.xml`, as they were preventing MSBuild properties
from functioning properly.
- `Version` now defaults to 0.0.0, so that local builds don't appear
like they were deployed (see `OsuGameBase.IsDeployedBuild`).
- `ApplicationDisplayVersion` now defaults to `Version`.
This addresses the Android portion of #21498.
- `ApplicationVersion` can now be specified by command line,
but still needs to be supplied manually for version detection to
work correctly. See `OsuGameAndroid.AssemblyVersion` for more info.
Putting the pieces together, the complete publish command to deploy
a new build should look something like so:
dotnet publish -f net6.0-android \
-r android-arm64 \
-c Release \
-p:Version=2022.1228.0 \
-p:ApplicationVersion=202212280
- Removed the Xamarin.Essentials package from osu.Game and added it to osu.iOS and osu.Android only.
- iOS and Android implementations use Xamarin.Essentials.Battery, while the Desktop implementation
only returns 100% battery for now.
- Added a BatteryCutoff property to PowerStatus so it can be different for each platform (default 20%, 25% on iOS)
- Uses Xamarin.Essentials in osu.Game.PlayerLoader to check battery level
- Encapsulated battery checking in the public BatteryManager class so battery level and plugged in status can be accessed and edited in TestPlayerLoader
- When checking battery level, catch NotImplementedException thrown by Xamarin.Essentials.Battery on non-mobile platforms
- Added visual unit tests for battery notification
To mock battery status and level, we had to define a batteryManager object in TestPlayerLoader and add a new function ResetPlayerWithBattery()
Co-Authored-By: Marlina José <marlina@umich.edu>
Aimed to improve build time (especially for CI builds).
The additional lines come from visual studio. I'm intentionally
committing its output so it doesn't cause a diff on further csproj
changes.