From 2c394e4a9944b186dc995679eeebfc72778faf2e Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Mon, 25 Mar 2024 10:03:05 -0300 Subject: [PATCH] [app] request update ownership for newly installed apps This way, when trying to update the app with another "store", the user will need to confirm a scary warning. --- app/src/main/AndroidManifest.xml | 1 + .../fdroid/fdroid/installer/SessionInstallManager.java | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 8355c4a22..f44e5c3d1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -60,6 +60,7 @@ android:name="android.permission.QUERY_ALL_PACKAGES" tools:ignore="QueryAllPackagesPermission" /> + = 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; }