Don't remove ourselves from the installed app cache.
If F-Droid was actually removed, then we wouldn't even have an installed app cache (we aren't even on the device any more). As such, ignore all requests to remove F-Droid because it complicates the installed apk cache. Specifically, there is a race condition between the "compare apk cache to package manager" and the "package removed receiver", where the later was overriding the former.
This commit is contained in:
parent
116cb88b81
commit
1dbf5704b6
@ -164,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()
|
||||
|
@ -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