Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set installer? #47

Open
whitis opened this issue Jul 15, 2020 · 3 comments
Open

set installer? #47

whitis opened this issue Jul 15, 2020 · 3 comments

Comments

@whitis
Copy link

whitis commented Jul 15, 2020

Installer is currently set to null. Seems like you can do better than that although fdroid doesn't do very well either since it uses an external app to actually install unlike google play and amazon app store.

fdroid was installed using fdroidcl

adb shell pm list packages -i -f -U | fgrep -i fdroid
package:/data/app/org.fdroid.fdroid-iuAasAj9JZFxU3XWeoSptQ==/base.apk=org.fdroid.fdroid installer=null uid:10473

antenna pod was manually installed using f-droid app

adb shell pm list packages -i -f -U | fgrep -i antenna
package:/data/app/de.danoeh.antennapod-ipm6qV5SdjpZAUEcvlRjog==/base.apk=de.danoeh.antennapod installer=com.google.android.packageinstaller uid:10474

This was an example I found of how to set the installer when installing via adb
adb shell pm install -i "com.android.vending" -r /data/local/tmp/app.apk
but with that you need to push the file across first, unlike adb install. The -r will reinstall

the following options looked interesting

--originating-uri: set URI where app was downloaded from
--referrer: set URI that instigated the install of the app

@mvdan
Copy link
Owner

mvdan commented Jul 15, 2020

Sure, patches are welcome. There are already some tests, which use a device connected over ADB.

ypid added a commit to ypid/fdroidcl that referenced this issue May 7, 2023
@ypid
Copy link

ypid commented May 7, 2023

Starting with Android 12, setting the installer has a practical use case, see NeoApplications/Neo-Store#20

I propose allowing the user to configure which installer they want to set, maybe even default to Neo-Store because setting it to fdroidcl is not an Android app thus cannot make use of Android 12+ auto update and F-Droid currently cannot auto update apps.

I tested this all with adb and I even patched fdroidcl to set Neo-Store as installer. This works great and allows to bulk install apps with fdroidcl and then letting Neo-Store auto update the apps in the background (for apps that target a recent enough API level, ref: NeoApplications/Neo-Store#20). I am amazed how far we have gotten with Open Source, de-googled Android! Unfortunately my patch is quick and dirty (https://github.com/ypid/fdroidcl/tree/feature/set-installer-quick-and-dirty) and my golang knowledge is very limited.

Optionally, it would be cool if fdroidcl could retroactively change the installer for already installed apps. Note that fdroidcl install -u already updates the installer when updating an app, but you might want to switch all installed apps once. The logic for this can look like the following:

  1. Get a list of all F-Droid installed apps that currently have no installer set. I tested with adb shell pm list packages -3 -i --user 0 | grep 'installer=null' | sed --regexp-extended 's/package:([^ ]+).*/\1/;' but that is not a good default.
  2. Reinstall the latest version with the installer set. I tested this with adb install --user 0 -i com.machiav3lli.fdroid -r ./${myapp}.apk, works great even if that version is already installed. adb shell pm set-installer fails with "java.lang.SecurityException: Caller does not have same cert as new installer package com.machiav3lli.fdroid" on my phone but it probably does not hurt to try that first.

@Mannshoch
Copy link

fdroid meanwhile also have auto update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants