Merge branch 'update-ownership' into 'master'

Request update ownership for newly installed apps

See merge request fdroid/fdroidclient!1370
This commit is contained in:
Hans-Christoph Steiner
2024-04-02 15:20:45 +00:00
2 changed files with 9 additions and 0 deletions

View File

@@ -60,6 +60,7 @@
android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.ENFORCE_UPDATE_OWNERSHIP" />
<application
android:name=".FDroidApp"

View File

@@ -107,6 +107,14 @@ public class SessionInstallManager extends BroadcastReceiver {
if (Build.VERSION.SDK_INT >= 33) {
params.setPackageSource(PackageInstaller.PACKAGE_SOURCE_STORE);
}
if (Build.VERSION.SDK_INT >= 34) {
// Once the update ownership enforcement is enabled,
// the other installers will need the user action to update the package
// even if the installers have been granted the INSTALL_PACKAGES permission.
// The update ownership enforcement can only be enabled on initial installation.
// Set this to true on package update is a no-op.
params.setRequestUpdateOwnership(true);
}
return params;
}