Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Xamarin.Android.Build.Tests] Add support for testing on system applications. #5708

Merged
merged 3 commits into from
Mar 24, 2021

Conversation

dellis1972
Copy link
Contributor

@dellis1972 dellis1972 commented Mar 8, 2021

Context https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1288717

The new fast deployment system broke fast deployment for system installed
applications. This commit adds unit tests to stop this kind of regression
in the future.

In order to install a system application we need a few things to happen

  1. The emulator MUST be started with the -writable-system argument
  2. The apk needs to be signed with a platform keystore.
  3. The AndroidManifest must include android:sharedUserId="android.uid.system"
    in its manifest element.

@dellis1972 dellis1972 force-pushed the fastdevsystemapp branch 2 times, most recently from 1087d13 to 28062ae Compare March 10, 2021 11:21
@dellis1972 dellis1972 marked this pull request as ready for review March 10, 2021 15:58
@dellis1972
Copy link
Contributor Author

The nightly build has the new test and it passed https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=4543632&view=results

@dellis1972 dellis1972 force-pushed the fastdevsystemapp branch 3 times, most recently from b81ea3e to 41edce4 Compare March 17, 2021 10:24
@dellis1972
Copy link
Contributor Author

Some tests are failing because the emulator is disappearing half way through the test run... weird.
Trying to run the tests again.

@dellis1972 dellis1972 force-pushed the fastdevsystemapp branch 2 times, most recently from 39c1c42 to 164d4e6 Compare March 19, 2021 14:44
…cations.

Context https://work.azdo.io/1288717

The new fast deployment system broke fast deployment for system installed
applications. This commit adds unit tests to stop this kind of regression
in the future.

In order to install a `system` application we need a few things to happen

1. The emulator MUST be started with the `-system-writable` argument
2. The apk needs to be signed with a platform keystore.
3. The AndroidManifest must include `android:sharedUserId="android.uid.system"`
   in its `manifest` element.
@jonpryor jonpryor merged commit 2a04748 into dotnet:main Mar 24, 2021
@dellis1972 dellis1972 deleted the fastdevsystemapp branch March 24, 2021 10:37
jonpryor pushed a commit to jonpryor/xamarin-android that referenced this pull request Mar 29, 2021
…cations. (dotnet#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 (dotnet#1177) (dotnet#1186)
  * xamarin/monodroid@947c6ef72: Bump to xamarin/xamarin-android/d16-9@877f5727 (dotnet#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
jonpryor pushed a commit that referenced this pull request Mar 30, 2021
…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
@github-actions github-actions bot locked and limited conversation to collaborators Jan 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants