Merge branch 'fix-fdroid-update-prompt' into 'master'
Fix incorrect persistent + annoying notification to update F-Droid. Closes #1027 and #776 See merge request !530
This commit is contained in:
commit
72d7d902e0
@ -13,6 +13,7 @@ import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
||||
import org.acra.ACRA;
|
||||
import org.fdroid.fdroid.AppUpdateStatusManager;
|
||||
import org.fdroid.fdroid.Hasher;
|
||||
import org.fdroid.fdroid.Utils;
|
||||
import org.fdroid.fdroid.data.Schema.InstalledAppTable;
|
||||
@ -72,7 +73,7 @@ public class InstalledAppProviderService extends IntentService {
|
||||
// the list of installed apps and insert them to the database...
|
||||
packageChangeNotifier
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.debounce(1, TimeUnit.SECONDS)
|
||||
.debounce(3, TimeUnit.SECONDS)
|
||||
.subscribe(new Action1<String>() {
|
||||
@Override
|
||||
public void call(String packageName) {
|
||||
@ -163,6 +164,7 @@ public class InstalledAppProviderService extends IntentService {
|
||||
* @see <a href="https://gitlab.com/fdroid/fdroidclient/issues/819>issue #819</a>
|
||||
*/
|
||||
public static void compareToPackageManager(Context context) {
|
||||
Utils.debugLog(TAG, "Comparing package manager to our installed app cache.");
|
||||
Map<String, Long> cachedInfo = InstalledAppProvider.Helper.all(context);
|
||||
|
||||
List<PackageInfo> packageInfoList = context.getPackageManager()
|
||||
@ -219,6 +221,22 @@ public class InstalledAppProviderService extends IntentService {
|
||||
try {
|
||||
String hashType = "sha256";
|
||||
String hash = Utils.getBinaryHash(apk, hashType);
|
||||
|
||||
// Ensure that we no longer notify the user that this apk successfully
|
||||
// downloaded and is now ready to be installed. Used to be handled only
|
||||
// by InstallManagerService after receiving ACTION_INSTALL_COMPLETE, but
|
||||
// that doesn't work for F-Droid itself, which never receives that action.
|
||||
for (Apk apkInRepo : ApkProvider.Helper.findApksByHash(this, hash)) {
|
||||
|
||||
Utils.debugLog(TAG, "Noticed that " + apkInRepo.apkName +
|
||||
" version " + apkInRepo.versionName + " was installed," +
|
||||
" so marking as no longer pending install");
|
||||
|
||||
AppUpdateStatusManager.getInstance(this)
|
||||
.markAsNoLongerPendingInstall(apkInRepo.getUrl());
|
||||
|
||||
}
|
||||
|
||||
insertAppIntoDb(this, packageInfo, hashType, hash);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Utils.debugLog(TAG, e.getMessage());
|
||||
|
@ -3,6 +3,7 @@ package org.fdroid.fdroid.receiver;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import org.fdroid.fdroid.Utils;
|
||||
import org.fdroid.fdroid.data.InstalledAppProviderService;
|
||||
@ -26,7 +27,11 @@ public class PackageManagerReceiver extends BroadcastReceiver {
|
||||
if (Intent.ACTION_PACKAGE_ADDED.equals(action)) {
|
||||
InstalledAppProviderService.insert(context, intent.getData());
|
||||
} else if (Intent.ACTION_PACKAGE_REMOVED.equals(action)) {
|
||||
InstalledAppProviderService.delete(context, intent.getData());
|
||||
if (TextUtils.equals(context.getPackageName(), intent.getData().getSchemeSpecificPart())) {
|
||||
Utils.debugLog(TAG, "Ignoring request to remove ourselves from cache.");
|
||||
} else {
|
||||
InstalledAppProviderService.delete(context, intent.getData());
|
||||
}
|
||||
} else {
|
||||
Utils.debugLog(TAG, "unsupported action: " + action + " " + intent);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user