digidem / mapeo-mobile

Monitor and document the world around you
GNU General Public License v3.0
95 stars 16 forks source link

[P2P Upgrades] Disallow breaking upgrades #544

Open hackergrrl opened 3 years ago

hackergrrl commented 3 years ago

There have been cases like https://github.com/digidem/mapeo-mobile/issues/543 where a new version of Mapeo Mobile is incompatible with certain versions of Android. Given the new p2p upgrades feature, it would be great if users weren't offered an upgrade that would not be able run on their device, with no means of downgrading.

I'm wondering how we can capture & codify information like this, sort of like a package.json for compatibility:

"compatibility": {
  "android": ">= 5.0.0"
}

This could feed into the upcoming p2p app upgrades feature, so that the app would be able to ignore upgrades that would result in a broken install on their phones.

gmaclennan commented 3 years ago

Mapeo currently supports Android >= v5. My understanding is that if we need to change this for some reason, we would update the minSdkVersion in AndroidManifest.xml and that would cause Android to refuse to install the APK on an older device. TL;DR it is not possible for a user to install an incompatible version of Mapeo on their device, because the information in AndroidManifest.xml already encodes this information and Android will refuse to install it.

In terms of checking this information for updates, unfortunately the ApplicationInfo minSdkVersion field is only supported on Android >=24 (v7), therefore on older devices it does not seem possible to read the minSdkVersion of an APK. A workaround would be to implement our own AndroidManifest.xml parsing code in JavaScript, that we could use to read this value before the user attempts (and fails) to install an incompatible version.

hackergrrl commented 3 years ago

The reason I'd want this feature at the p2p upgrades level is so that a user doesn't

a. waste time downloading an upgrade they find out after they can't install. b. potentially prevent them from downloading a newer compatible upgrade, because the newest available upgrade is incompatible. (e.g. they are on 5.1.0 and 5.5.9 is the last compatible version for their version of Android, however someone else on the network has 6.0.0 which is incompatible, but the p2p upgrades system will always d/l the latest version.)

gmaclennan commented 3 years ago

Agreed