microsoft / appcenter-sdk-android

Development repository for the App Center SDK for Android
Other
274 stars 135 forks source link

In-app updates fail on MIUI devices with optimizations enabled (AppCenter SDK 4.3.1+) #1714

Closed LennonReid closed 3 months ago

LennonReid commented 8 months ago

Description

The in-app update feature is non-functional when MIUI optimization is enabled in appCenter version 5.0.2, the latest release. However, earlier appCenter version 4.3.1 does allow in-app updates to work properly even with MIUI optimization turned on.

This suggests a regression bug was introduced in appCenter version 5.0.2, causing in-app updates to fail on devices with MIUI optimizations enabled. Asking users to disable MIUI optimizations is not an acceptable workaround, as this would inconvenience users and potentially annoy them. Instead, developers should consider downgrading to the previous stable release, appCenter 4.3.1, as a temporary workaround.

Repro Steps

Please list the steps used to reproduce your issue.

  1. Refer to the Microsoft documentation to configure the AppCenter SDK in an Android app properly: https://learn.microsoft.com/en-us/appcenter/sdk/getting-started/android
  2. Release an app built through AppCenter and install it on a Xiaomi device with MIUI optimization enabled.
  3. Upload a new version increment of the app to AppCenter.
  4. Launch the app on the Xiaomi device and initiate the in-app update flow when prompted.
  5. Check LogCat in Android Studio after in-app update failure. An "INSTALL_FAILED_ABORTED" error related to permissions will be logged, indicating the update was blocked by MIUI optimizations.

Details

  1. Which SDK version are you using?
    • 5.0.2
  2. Which OS version did you experience the issue on?
    • Android 11
  3. What device version did you see this error on? Were you using an emulator or a physical device?
    • Xiaomi11 physical device
  4. What third party libraries are you using?
    • none
  5. Please enable verbose logging for your app using AppCenter.setLogLevel(Log.VERBOSE) before your call to AppCenter.start(...) and include the logs here:

2023-11-13 23:03:49.146 22248-22248 AppCenter io.ionic.starter W App Center may only be configured once. 2023-11-13 23:03:49.146 22248-22324 AppCenterDistribute io.ionic.starter D Distribute workflow will be resumed on activity resume event. 2023-11-13 23:03:49.149 22248-22248 AppCenterDistribute io.ionic.starter D Resetting workflow on entering foreground. 2023-11-13 23:03:49.150 22248-22248 AppCenterDistribute io.ionic.starter D Resume distribute workflow... 2023-11-13 23:03:49.150 22248-22248 AppCenterDistribute io.ionic.starter I Get latest release details... 2023-11-13 23:03:49.150 22248-22324 AppCenterAnalytics io.ionic.starter D onActivityResumed 2023-11-13 23:03:49.150 22248-22324 AppCenterAnalytics io.ionic.starter D noLogSentForLong=true wasBackgroundForLong=true 2023-11-13 23:03:49.150 22248-22248 AppCenterDistribute io.ionic.starter D Check if we need to report release installation.. 2023-11-13 23:03:49.150 22248-22248 AppCenterDistribute io.ionic.starter D New release was downloaded but not installed yet, skip reporting. 2023-11-13 23:03:49.151 22248-22324 AppCenter io.ionic.starter D Storing a log to the Persistence database for log type startSession with flags=1 2023-11-13 23:03:49.153 22248-27400 AppCenterDistribute io.ionic.starter V Calling https://api.appcenter.ms/v0.1/public/sdk/apps/****************************2e76e499/releases/latest?is_install_page=true&release_hash=9329cae68bca7204a213bea1bb05d59a12fd4d6ebeb2333c5d658fc8cfc9d6e8... 2023-11-13 23:03:49.153 22248-27400 AppCenterDistribute io.ionic.starter V Headers: {} 2023-11-13 23:03:49.154 22248-27400 CapacitorCookies io.ionic.starter I Getting cookies at: 'https://api.appcenter.ms/v0.1/public/sdk/apps/8140dfc4-2b47-4990-94f5-ebe12e76e499/releases/latest?is_install_page=true&release_hash=9329cae68bca7204a213bea1bb05d59a12fd4d6ebeb2333c5d658fc8cfc9d6e8' 2023-11-13 23:03:49.156 22248-22324 AppCenter io.ionic.starter D Stored a log to the Persistence database for log type startSession with databaseId=27 2023-11-13 23:03:49.156 22248-22324 AppCenter io.ionic.starter D enqueue(group_analytics) pendingLogCount=4 2023-11-13 23:03:49.156 22248-22324 AppCenter io.ionic.starter D Channel is temporarily disabled, log was saved to disk. 2023-11-13 23:03:50.245 22248-27400 AppCenter io.ionic.starter V HTTP response status=200 payload={"app_name":"ionic-test","app_display_name":"ionic-test","app_os":"Android","app_icon_url":"https://appcenter-filemanagement-distrib1ede6f06e.azureedge.net/11bbb2e8-5e46-413c-a552-f749667ac274/u3.png?sv=2019-02-02&sr=c&sig=WelcIz1%2FCWDw8JFQ6YO4QdhId2DqecMsNapejvLV8eI%3D&se=2023-11-20T14%3A25%3A02Z&sp=r","release_notes_url":"https://install.appcenter.ms/users/lennonReid/apps/ionic-test/distribution_groups/Public","owner":{"name":"lennonReid","display_name":"Lennon Reid"},"is_external_build":false,"origin":"appcenter","id":8,"version":"6","short_version":"0.0.6","size":4222252,"min_os":"5.1","android_min_api_level":"22","device_family":null,"bundle_identifier":"io.ionic.starter","fingerprint":"e761f77b46ed81853ed56683789d9bf0","uploaded_at":"2023-11-13T14:25:00.455Z","download_url":"https://appcenter-filemanagement-distrib5ede6f06e.azureedge.net/e04a14e6-0e35-456b-b00f-bb29a2efcd31/app-release.apk?sv=2019-02-02&sr=c&sig=z4L1EZmqI%2BKoQ3U1nKaVzbhlC1kkNrEbGJ5JB0X2ToI%3D&se=2023-11-14T14%3A52%3A56Z&sp=r","install_url":"https://appcenter-filemanagement-distrib5ede6f06e.azureedge.net/e04a14e6-0e35-456b-b00f-bb29a2efcd31/app-release.apk?sv=2019-02-02&sr=c&sig=z4L1EZmqI%2BKoQ3U1nKaVzbhlC1kkNrEbGJ5JB0X2ToI%3D&se=2023-11-14T14%3A52%3A56Z&sp=r","mandatory_update":false,"enabled":true,"fileExtension":"apk","is_latest":true,"release_notes":"v0.0.6","can_resign":null,"package_hashes":["138725618e179e2efde5e5fdca8eac481860be2a85a27aadc444f33a23135170"],"destination_type":"group","status":"available","distribution_group_id":"fa643005-9860-4fd4-bee7-18583e42291a","distribution_groups":[{"id":"fa643005-9860-4fd4-bee7-18583e42291a","name":"Public","origin":"appcenter","display_name":"Public","is_public":true}]} 2023-11-13 23:03:50.246 22248-22248 AppCenterDistribute io.ionic.starter D Stored release hash doesn't match current installation, probably downloaded but not installed yet, keep in store 2023-11-13 23:03:50.246 22248-22248 AppCenterDistribute io.ionic.starter D Check if latest release is more recent. 2023-11-13 23:03:50.246 22248-22248 AppCenterDistribute io.ionic.starter D Latest release more recent=true 2023-11-13 23:03:50.246 22248-22248 AppCenterDistribute io.ionic.starter D Removing download and notification id=2812 2023-11-13 23:03:50.246 22248-22248 AppCenterDistribute io.ionic.starter D Latest release is more recent. 2023-11-13 23:03:50.246 22248-22248 AppCenterDistribute io.ionic.starter D Show default update dialog. 2023-11-13 23:03:53.618 22248-22248 AppCenterDistribute io.ionic.starter D There is no need to request permissions in runtime on Android earlier than 6.0. 2023-11-13 23:03:53.618 22248-22248 AppCenterDistribute io.ionic.starter D Schedule download... 2023-11-13 23:03:53.619 22248-30103 AppCenterDistribute io.ionic.starter D Start downloading new release from https://appcenter-filemanagement-distrib5ede6f06e.azureedge.net/e04a14e6-0e35-456b-b00f-bb29a2efcd31/app-release.apk?sv=2019-02-02&sr=c&sig=z4L1EZmqI%2BKoQ3U1nKaVzbhlC1kkNrEbGJ5JB0X2ToI%3D&se=2023-11-14T14%3A52%3A56Z&sp=r 2023-11-13 23:03:53.654 22248-30103 AppCenterDistribute io.ionic.starter D Start download 0.0.6 (6) update. 2023-11-13 23:03:53.712 24847-30104 DownloadThread android.process.media D in runInternal, Download mId=2813 uri=https://appcenter-filemanagement-distrib5ede6f06e.azureedge.net/e04a14e6-0e35-456b-b00f-bb29a2efcd31/app-release.apk?sv=2019-02-02&sr=c&sig=z4L1EZmqI%2BKoQ3U1nKaVzbhlC1kkNrEbGJ5JB0X2ToI%3D&se=2023-11-14T14%3A52%3A56Z&sp=r 2023-11-13 23:03:59.839 22248-22248 AppCenterDistribute io.ionic.starter V Receive broadcast action: android.intent.action.DOWNLOAD_COMPLETE 2023-11-13 23:03:59.839 22248-30103 AppCenterDistribute io.ionic.starter D Check download id=2813 2023-11-13 23:03:59.860 22248-30114 AppCenterDistribute io.ionic.starter D Download was successful for id=2813 2023-11-13 23:03:59.865 22248-22248 AppCenterDistribute io.ionic.starter I Start installing new release... 2023-11-13 23:03:59.865 22248-22248 AppCenterDistribute io.ionic.starter D Stored release details: group id=fa643005-9860-4fd4-bee7-18583e42291a release hash=138725618e179e2efde5e5fdca8eac481860be2a85a27aadc444f33a23135170 release id=8 2023-11-13 23:03:59.865 22248-22248 AppCenterDistribute io.ionic.starter D Trying to install update via PackageInstaller. 2023-11-13 23:03:59.865 22248-22248 AppCenterDistribute io.ionic.starter D Register receiver for installing a new release. 2023-11-13 23:03:59.877 22248-22248 AppCenterDistribute io.ionic.starter V The install session was created. sessionId=1380486471 2023-11-13 23:03:59.921 22248-22248 AppCenterDistribute io.ionic.starter V Installation progress: 80%. sessionId=1380486471 2023-11-13 23:03:59.921 22248-22248 AppCenterDistribute io.ionic.starter V Receive broadcast action: com.microsoft.appcenter.action.INSTALL_STATUS 2023-11-13 23:03:59.921 22248-22248 AppCenterDistribute io.ionic.starter V android.content.pm.extra.STATUS: -1 2023-11-13 23:03:59.921 22248-22248 AppCenterDistribute io.ionic.starter V android.content.pm.extra.SESSION_ID: 1380486471 2023-11-13 23:03:59.921 22248-22248 AppCenterDistribute io.ionic.starter V android.intent.extra.INTENT: Intent { act=android.content.pm.action.CONFIRM_INSTALL pkg=com.miui.packageinstaller (has extras) } 2023-11-13 23:03:59.921 22248-22248 AppCenterDistribute io.ionic.starter I Ask confirmation to install a new release. 2023-11-13 23:03:59.922 1638-2637 ActivityTaskManager system_server I START u0 {flg=0x30010000 cmp=io.ionic.starter/com.microsoft.appcenter.distribute.install.ReleaseInstallerActivity (has extras)} from uid 10507 2023-11-13 23:03:59.932 22248-22324 AppCenterAnalytics io.ionic.starter D onActivityPaused 2023-11-13 23:03:59.954 22248-22324 AppCenterAnalytics io.ionic.starter D onActivityResumed 2023-11-13 23:03:59.954 22248-22324 AppCenterAnalytics io.ionic.starter D noLogSentForLong=false wasBackgroundForLong=false 2023-11-13 23:03:59.962 32690-32715 AppUpdateXmsfLauncher com.xiaomi.xmsf D activityResumed intent : Intent { cmp=io.ionic.starter/com.microsoft.appcenter.distribute.install.ReleaseInstallerActivity (has extras) } 2023-11-13 23:03:59.962 2927-2927 RecentsImpl com.miui.home D mActivityStateObserver com.microsoft.appcenter.distribute.install.ReleaseInstallerActivity 2023-11-13 23:03:59.962 2927-2927 RecentsImpl com.miui.home W onResumed className=com.microsoft.appcenter.distribute.install.ReleaseInstallerActivity mIsInAnotherPro=false isKeyguardLocked=false 2023-11-13 23:03:59.962 24680-30085 VA_ActivityStateHelper com.miui.voiceassist I activityResumed componentName ComponentInfo{io.ionic.starter/com.microsoft.appcenter.distribute.install.ReleaseInstallerActivity} 2023-11-13 23:03:59.962 22248-22324 AppCenterAnalytics io.ionic.starter D onActivityPaused 2023-11-13 23:04:00.031 1638-9159 Timeline system_server I Timeline: Activity_windows_visible id: ActivityRecord{fc6f6a u0 io.ionic.starter/com.microsoft.appcenter.distribute.install.ReleaseInstallerActivity t2865} time:434372906 2023-11-13 23:04:00.035 22248-22248 AppCenterDistribute io.ionic.starter V The installation has been finished. sessionId=1380486471, success=false 2023-11-13 23:04:00.035 22248-22248 AppCenterDistribute io.ionic.starter V Receive broadcast action: com.microsoft.appcenter.action.INSTALL_STATUS 2023-11-13 23:04:00.035 22248-22248 AppCenterDistribute io.ionic.starter V android.content.pm.extra.STATUS: 3 2023-11-13 23:04:00.035 22248-22248 AppCenterDistribute io.ionic.starter V android.content.pm.extra.PACKAGE_NAME: io.ionic.starter 2023-11-13 23:04:00.035 22248-22248 AppCenterDistribute io.ionic.starter V android.content.pm.extra.SESSION_ID: 1380486471 2023-11-13 23:04:00.035 22248-22248 AppCenterDistribute io.ionic.starter V android.content.pm.extra.LEGACY_STATUS: -115 2023-11-13 23:04:00.035 22248-22248 AppCenterDistribute io.ionic.starter V android.content.pm.extra.STATUS_MESSAGE: INSTALL_FAILED_ABORTED: User rejected permissions 2023-11-13 23:04:00.035 22248-22248 AppCenterDistribute io.ionic.starter D Installation cancelled. 2023-11-13 23:04:00.035 22248-22248 AppCenterDistribute io.ionic.starter D Complete current updating process. 2023-11-13 23:04:00.035 22248-22248 AppCenterDistribute io.ionic.starter D Unregister receiver for installing a new release. 2023-11-13 23:04:00.036 22248-22248 AppCenterDistribute io.ionic.starter V Release installer activity result=0 2023-11-13 23:04:00.036 1638-1800 ActivityTaskManager system_server I Displayed io.ionic.starter/com.microsoft.appcenter.distribute.install.ReleaseInstallerActivity: +70ms 2023-11-13 23:04:00.045 1638-3110 MIUIInput system_server D [FoucsChange]: Display 0 FocusedWindow From null(0,0) to Window{e9c80a4 mode=1 rootTaskId=2865 u0 io.ionic.starter/com.microsoft.appcenter.distribute.install.ReleaseInstallerActivity}(1,1) 2023-11-13 23:04:00.059 32690-32715 AppUpdateXmsfLauncher com.xiaomi.xmsf D activityResumed intent : Intent { cmp=io.ionic.starter/com.microsoft.appcenter.distribute.install.ReleaseInstallerActivity (has extras) } 2023-11-13 23:04:00.059 24680-30085 VA_ActivityStateHelper com.miui.voiceassist I activityResumed componentName ComponentInfo{io.ionic.starter/com.microsoft.appcenter.distribute.install.ReleaseInstallerActivity} 2023-11-13 23:04:00.060 2927-2927 RecentsImpl com.miui.home D mActivityStateObserver com.microsoft.appcenter.distribute.install.ReleaseInstallerActivity 2023-11-13 23:04:00.061 2927-2927 RecentsImpl com.miui.home W onResumed className=com.microsoft.appcenter.distribute.install.ReleaseInstallerActivity mIsInAnotherPro=false isKeyguardLocked=false 2023-11-13 23:04:00.074 1638-9159 MIUIInput system_server D [FoucsChange]: Display 0 FocusedWindow From Window{e9c80a4 mode=1 rootTaskId=2865 u0 io.ionic.starter/com.microsoft.appcenter.distribute.install.ReleaseInstallerActivity}(1,1) to null(0,0) 2023-11-13 23:04:00.084 22248-22324 AppCenterAnalytics io.ionic.starter D onActivityResumed 2023-11-13 23:04:00.084 22248-22324 AppCenterAnalytics io.ionic.starter D noLogSentForLong=false wasBackgroundForLong=false 2023-11-13 23:04:01.036 22248-30115 AppCenterDistribute io.ionic.starter E Canceling installation due to lack of progress. 2023-11-13 23:04:01.036 22248-30115 AppCenterDistribute io.ionic.starter D Installation cancelled.



8. Related issues:
https://github.com/microsoft/appcenter-sdk-dotnet/issues/1633
https://github.com/microsoft/appcenter-sdk-android/pull/1631
DmitriyKirakosyan commented 7 months ago

Thank you for submitting a new issue, @LennonReid.

For anyone else experiencing a similar problem, the context can be found here: https://github.com/microsoft/appcenter-sdk-android/issues/1680#issuecomment-1812615112.

Please feel free to upvote the issue or leave a comment if you are also affected.

DmitriyKirakosyan commented 3 months ago

As we do not have plans to fix this bug in the next year, I'm closing the issue. However, contributions are still welcome.