microsoft / appcenter-sdk-android

Development repository for the App Center SDK for Android
Other
276 stars 134 forks source link

"App installed" alert no longer present when update installation is done #1644

Closed fabiendem closed 2 years ago

fabiendem commented 2 years ago

Description

Previously, before appcenter-sdk-android 4.4.3+, once the update was installed, a screen or an alert (depends on the OS) would be rendered once the app is installed. The user would then be able to tap on "Open" and the updated app would start. This behaviour is still present in other side loading apps (Files, Google Chrome, etc.):

You won't see an installation confirmation with appcenter-sdk-android 4.4.5, the app will close after the update, almost as if it crashed.

I am wondering if we can't bring back this behaviour. The Files app and the Google Chrome apps don't have extra permission and could render this "Open" alert.

I know that you adjusted this on purpose in your recent updates but I am wondering if something didn't get lost on the way.

Cheers!

Repro Steps

Please list the steps used to reproduce your issue.

  1. Install an app with the appcenter-sdk-android 4.4.5
  2. Download an optional update which has the appcenter-sdk-android 4.4.5
  3. Install the update

You won't see an installation confirmation, the app will close, almost as if it crashed. Then a notification is created, and you can tap on the app icon to start the app.

Details

  1. Which SDK version are you using?
    • 4.4.5
  2. Which OS version did you experience the issue on?
    • e.g. Android 12
  3. What device version did you see this error on? Were you using an emulator or a physical device?
    • e.g. Google Pixel 6, Lenovo M8
  4. What third party libraries are you using?
    • N/A
  5. Please enable verbose logging for your app using AppCenter.setLogLevel(Log.VERBOSE) before your call to AppCenter.start(...) and include the logs here: N/A
fabiendem commented 2 years ago

I am wondering if it's not because you immediately close the installation session when you start it: https://github.com/microsoft/appcenter-sdk-android/blob/bad11c3410b2379bb25a30f9523cf24f30c58fb0/sdk/appcenter-distribute/src/main/java/com/microsoft/appcenter/distribute/install/session/SessionReleaseInstaller.java#L207-L208

Taking inspiration from https://android.googlesource.com/platform/development/+/master/samples/ApiDemos/src/com/example/android/apis/content/InstallApkSessionApi.java

MatkovIvan commented 2 years ago

Hi @fabiendem, Thanks for getting in touch again 😄

Please, let me some time to check and investigate this. I'll let you know when I have results. Regarding session close: there is no diff since prev versions (4.4.1-4.4.3): https://github.com/microsoft/appcenter-sdk-android/blob/cef970c6ab77af7d4d7a8997a586051729275a0f/sdk/appcenter-distribute/src/main/java/com/microsoft/appcenter/distribute/InstallerUtils.java#L176-L177

My first thought here - it's the behaviour of deprecated ACTION_INSTALL_PACKAGE that was used in pre 4.4.x

fabiendem commented 2 years ago

👍 thank you. No worries, the InstallPackage API is pretty obscure and the doc difficult to grasp.

Sorry, I realized that we've been using 3.3.0 before, so 3.3.0 is my point of reference, which was using the old ACTION_INSTALL_PACKAGE. So I don't know if the .close is the culprit or not.

If it can help: Google provides one example with the old ACTION_INSTALL_PACKAGE: https://android.googlesource.com/platform/development/+/master/samples/ApiDemos/src/com/example/android/apis/content/InstallApk.java

and one example with the new Session API: https://android.googlesource.com/platform/development/+/master/samples/ApiDemos/src/com/example/android/apis/content/InstallApkSessionApi.java

I noticed this comment: https://android.googlesource.com/platform/development/+/master/samples/ApiDemos/src/com/example/android/apis/content/InstallApkSessionApi.java#105

I don't know if the Google Chrome or Files (which can behave as installer or delegate to some app) use one or the other API.

I have found this thread as well: https://stackoverflow.com/questions/19005213/android-package-installer-how-to-get-open-and-done-and-activity-result-bot

fabiendem commented 2 years ago

Trying to see if it's worth waiting for the next update: would you have a rough timeline around this issue to be investigated and eventually fixed? Thanks!

MatkovIvan commented 2 years ago

~ETA for next release is end of Q3, but in this case it's 90% "by design". I'll do my best to investigate the root cause of it during a week.

MatkovIvan commented 2 years ago

Okay, this dialog is implemented as part of ACTION_INSTALL_PACKAGE workflow. More of that it's might differ on different device manufacturers. In the mentioned implementation they show this dialog only if EXTRA_RETURN_RESULT flag is not set. But even on current ACTION_INSTALL_PACKAGE implementation this flag is used to correctly handle #1619 case.

So, it's expected and it wasn't required part before. The current version shows notification about "app installed" event (behaviour changed to mitigate #1624). Closing this thread.

fabiendem commented 2 years ago

OK thanks @MatkovIvan 👍