-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Xamarin.Android.Build.Tests] Add support for testing on system appli…
…cations. (#5708) Context: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1288717 Context: xamarin/monodroid@83de4b4 Changes: xamarin/monodroid@b2a750a...4163ee9 * xamarin/monodroid@4163ee947: [Xamarin.Android.Build.Tasks] Support FastDev for System Apps (#1177) (#1186) * xamarin/monodroid@947c6ef72: Bump to xamarin/xamarin-android/d16-9@877f5727 (#1183) The new fast deployment system (xamarin/monodroid@767f6471) broke fast deployment for system-installed applications. This is fixed in xamarin/monodroid@4163ee94. Adds unit tests to stop this kind of regression in the future. In order to install a `system` application we need a few things: 1. The emulator MUST be started with the `-system-writable` argument 2. The `.apk` needs to be signed with a platform keystore, found at: https://github.com/aosp-mirror/platform_build/tree/master/target/product/security 3. `AndroidManifest.xml` must set [`/manifest/@android:sharedUserId`][0] to `android.uid.system`: <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:sharedUserId="android.uid.system" …> </manifest> See also: * https://medium.com/xrpractices/android-system-apps-development-d73bedfb8def [0]: https://developer.android.com/guide/topics/manifest/manifest-element#uid
- Loading branch information
1 parent
466ec79
commit 7f4fc3e
Showing
30 changed files
with
264 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
xamarin/monodroid:d16-9@b2a750a2bd9f25e4f16592168dd919bf36930de4 | ||
xamarin/monodroid:d16-9@4163ee94735f4176d2e212041d15c9158316371e | ||
mono/mono:2020-02@5e9cb6d1c1de430965312927d5aed7fcb27bfa73 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#### Application build and deployment | ||
|
||
* [Developer Community 1288717][0]: | ||
*Support Fast Deployment for System Applications.* | ||
Added support for fast deployment while building system based | ||
applications. Applications developed in this mode need to be | ||
signed with a platform key and have a special attribute | ||
|
||
`android:sharedUserId="android.uid.system"` | ||
|
||
in the `AndroidManifest.xml`. | ||
|
||
[0]: https://developercommunity.visualstudio.com/t/VS-2019-1690-Error-XA0130-XamarinAndr/1359238 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
build-tools/automation/yaml-templates/run-systemapp-tests.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Runs TimeZoneInfo tests against an emulator running on macOS | ||
|
||
jobs: | ||
- job: mac_systemapp_tests | ||
displayName: System App Emulator Tests | ||
pool: | ||
vmImage: $(HostedMacImage) | ||
timeoutInMinutes: 120 | ||
cancelTimeoutInMinutes: 5 | ||
workspace: | ||
clean: all | ||
steps: | ||
- template: setup-test-environment.yaml | ||
|
||
- script: mono $(System.DefaultWorkingDirectory)/build-tools/xaprepare/xaprepare/bin/$(XA.Build.Configuration)/xaprepare.exe --s=EmulatorTestDependencies --no-emoji --run-mode=CI | ||
displayName: install emulator | ||
|
||
- task: DownloadPipelineArtifact@2 | ||
inputs: | ||
artifactName: $(TestAssembliesArtifactName) | ||
downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration) | ||
|
||
- task: MSBuild@1 | ||
displayName: start emulator | ||
inputs: | ||
solution: tests/Mono.Android-Tests/Mono.Android-Tests.csproj | ||
configuration: $(XA.Build.Configuration) | ||
msbuildArguments: >- | ||
/t:AcquireAndroidTarget /p:TestEmulatorArguments=-writable-system /bl:$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/start-emulator.binlog | ||
- template: run-nunit-tests.yaml | ||
parameters: | ||
testRunTitle: System App On Device - macOS | ||
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/MSBuildDeviceIntegration/net472/MSBuildDeviceIntegration.dll | ||
nunitConsoleExtraArgs: --where "cat == SystemApplication" | ||
testResultsFile: TestResult-SystemApp--$(XA.Build.Configuration).xml | ||
|
||
- task: MSBuild@1 | ||
displayName: shut down emulator | ||
inputs: | ||
solution: tests/Mono.Android-Tests/Mono.Android-Tests.csproj | ||
configuration: $(XA.Build.Configuration) | ||
msbuildArguments: >- | ||
/t:AcquireAndroidTarget,ReleaseAndroidTarget | ||
/bl:$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/shutdown-emulator.binlog | ||
condition: always() | ||
|
||
- template: upload-results.yaml | ||
parameters: | ||
artifactName: Test Results - System App With Emulator - macOS | ||
|
||
- template: fail-on-issue.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.