Skip to content

Incorrect enum ApplicationExitInfoReason #9000

Closed

Description

@rgroenewoudt

Android framework version

net8.0-android

Affected platform version

VS2022 17.10.1

Description

The enum Android.App.ApplicationExitInfoReason contains value Other but it has the incorrect numeric value.

Defined with value 10:

[IntDefinition("Android.App.ApplicationExitInfo.ReasonOther", JniField = "android/app/ApplicationExitInfo.REASON_OTHER"), SupportedOSPlatform("android30.0")]
Other = 10, // 0x0000000A

which is duplicate with:

[IntDefinition("Android.App.ApplicationExitInfo.ReasonUserRequested", JniField = "android/app/ApplicationExitInfo.REASON_USER_REQUESTED"), SupportedOSPlatform("android30.0")] 
UserRequested = 10, // 0x0000000A

According to Android documentation it should be value 13

We noticed this we have a lot of ApplicationExitInfo records with value '13' instead of a pretty enum name.

Activity

  1. added this to the .NET 9 milestone on Jun 4, 2024
  2. jpobst commented on Jun 4, 2024

    @jpobst
    Contributor

    Wrote a quick script to compare map.csv to api-34.xml to find all instances where our enum values do not match what is actually in API-34. It would appear that api-merge does not update constant values if they change when building api.xml.

    // Changed value in API-26:
    // https://developer.android.com/sdk/api_diff/26/changes/android.app.ActivityManager.RunningAppProcessInfo#android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_PERCEPTIBLE
    // We have the correct value, api-34.xml is incorrect.
    android/app/ActivityManager$RunningAppProcessInfo.IMPORTANCE_PERCEPTIBLE 230 != 130 [API-10]
    
    // Changed value in API-28:
    // https://developer.android.com/sdk/api_diff/28/changes/android.app.ActivityManager.RunningAppProcessInfo
    // We have the correct value, api-34.xml is incorrect.
    android/app/ActivityManager$RunningAppProcessInfo.IMPORTANCE_TOP_SLEEPING 325 != 150 [API-23]
    
    // We bound this constant when API-30 was only Developer Preview 2, and it changed afterwards.
    // Nowadays we do not do enumification until Google marks the API as "stable".
    android/app/ApplicationExitInfo.REASON_OTHER 10 != 13 [API-30]
    
    // https://developer.android.com/reference/android/content/pm/PermissionInfo#PROTECTION_MASK_FLAGS
    // We have the correct value, api-34.xml is incorrect.
    android/content/pm/PermissionInfo.PROTECTION_MASK_FLAGS 65520 != 240 [API-16]
    
    // This "constant" is deprecated and documented as "can change from release to release":
    // https://developer.android.com/reference/android/net/http/SslError#SSL_MAX_ERROR
    // We have the correct value, api-34.xml is incorrect.
    android/net/http/SslError.SSL_MAX_ERROR 6 != 4 [API-10]
    
    // These values are correct, not sure why api-34.xml is missing them
    android/view/animation/Transformation.TYPE_ALPHA 1 !=  [API-10]
    android/view/animation/Transformation.TYPE_BOTH 3 !=  [API-10]
    android/view/animation/Transformation.TYPE_IDENTITY 0 !=  [API-10]
    android/view/animation/Transformation.TYPE_MATRIX 2 !=  [API-10]
    
  3. added
    bugComponent does not function as intended.
    on Jun 5, 2024
  4. locked and limited conversation to collaborators on Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Area: Mono.AndroidIssues with the Android API binding (Mono.Android.dll).bugComponent does not function as intended.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions