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

[enumification][Mono.Android] fix ChoiceMode enum generation. #1183

Merged
merged 1 commit into from
Jan 17, 2018

Conversation

atsushieno
Copy link
Contributor

After the last API XML generation sanitization, ChoiceMode was removed
because they were generated from AbsListView fields which DOES NOT EXIST
in API Level 10.

And getChoiceMode() and setChoiceMode are removed because they expect
that nonexistent enum.

Fortunately they are in ListView in API Level 10, so they can be generated
from there.

@atsushieno
Copy link
Contributor Author

This should fix #1170 (comment)

@atsushieno
Copy link
Contributor Author

We will regret this fix because this will be broken once we remove API Level 10.

@jonpryor
Copy link
Member

macOS+xbuild fails because of an ABI break:

ABI BREAK IN: Mono.Android.dll
<!-- start namespace Android.Widget --> <div> 
<h2>Namespace Android.Widget</h2>
<!-- start type ListView --> <div>
<h3>Type Changed: Android.Widget.ListView</h3>
<p>Modified fields:</p>
<pre>
<div data-is-breaking>	public const <span class='removed removed-inline removed-breaking-inline'>int</span> <span class='added '>ChoiceMode</span> ChoiceModeMultiple = 2;
</div><div data-is-breaking>	public const <span class='removed removed-inline removed-breaking-inline'>int</span> <span class='added '>ChoiceMode</span> ChoiceModeNone = 0;
</div><div data-is-breaking>	public const <span class='removed removed-inline removed-breaking-inline'>int</span> <span class='added '>ChoiceMode</span> ChoiceModeSingle = 1;
</div></pre>

</div> <!-- end type ListView -->
</div> <!-- end namespace Android.Widget -->

@atsushieno
Copy link
Contributor Author

They are false ABI breakage report. There is no run-time breakage unless you reference them by reflection.

atsushieno added a commit to atsushieno/xamarin-android-api-compatibility that referenced this pull request Jan 17, 2018
(The corresponding Java constants do not exist in android.widget.ListView
anymore. They exist here only because of API merging.)

It is to make dotnet/android#1183 pass.
jonpryor pushed a commit to xamarin/xamarin-android-api-compatibility that referenced this pull request Jan 17, 2018
Context: dotnet/android#1170
Context: dotnet/android#1183
Context: dotnet/android@a301764

Xamarin.Android 8.1 (d15-5) provides an `Android.Widget.ChoiceMode`
enum type in API-10+. `ChoiceMode` contains the
`android.widget.ListView.CHOICE_MODE_*` constants from API-10, which
were moved to `android.widget.AbsListView` in API-15.

Xamarin.Android 8.2 (d15-6) inadvertently *removed* the
`Android.Widget.ChoiceMode` enum, because
[xamarin-android/a301764a][xa-a301764a] altered the mapping of the
`CHOICE_MODE` constants so that they were only bound into the
`Android.Widget.ChoiceMode` enum for API-15+.

[xa-a301764a]: dotnet/android@a301764

[xamarin-android PR #1183][xa-1183] fixes `ChoiceMode` generation so
that it applies to API-10+, and in the process alters the API tracked
within xamarin-android-api-compatibility.

[xa-1183]: dotnet/android#1183

Add the `ChoiceMode` API changes so that [PR #1183][xa-1183] passes
the API compatibility tests.
jonpryor pushed a commit to xamarin/xamarin-android-api-compatibility that referenced this pull request Jan 17, 2018
Context: dotnet/android#1170
Context: dotnet/android#1183
Context: dotnet/android@a301764

Xamarin.Android 8.1 (d15-5) provides an `Android.Widget.ChoiceMode`
enum type in API-10+. `ChoiceMode` contains the
`android.widget.ListView.CHOICE_MODE_*` constants from API-10, which
were moved to `android.widget.AbsListView` in API-15.

Xamarin.Android 8.2 (d15-6) inadvertently *removed* the
`Android.Widget.ChoiceMode` enum, because
[xamarin-android/a301764a][xa-a301764a] altered the mapping of the
`CHOICE_MODE` constants so that they were only bound into the
`Android.Widget.ChoiceMode` enum for API-15+.

[xa-a301764a]: dotnet/android@a301764

[xamarin-android PR #1183][xa-1183] fixes `ChoiceMode` generation so
that it applies to API-10+, and in the process alters the API tracked
within xamarin-android-api-compatibility.

[xa-1183]: dotnet/android#1183

Add the `ChoiceMode` API changes so that [PR #1183][xa-1183] passes
the API compatibility tests.
@jonpryor
Copy link
Member

xamarin/xamarin-android-api-compatibility#12 has been merged and cherry-picked to the d15-6 branch.

Please update this PR to include a bump to xamarin-android-api-compatibility/d15-6.

After the last API XML generation sanitization, ChoiceMode was removed
because they were generated from AbsListView fields which DOES NOT EXIST
in API Level 10.

And getChoiceMode() and setChoiceMode are removed because they expect
that nonexistent enum.

Fortunately they are in ListView in API Level 10, so they can be generated
from there.
@jonpryor jonpryor merged commit 8ff139f into dotnet:master Jan 17, 2018
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 Feb 4, 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.

2 participants