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.
Este commit está contenido en:
Peter Serwylo 2017-06-07 22:07:01 +10:00
padre 116cb88b81
commit 1dbf5704b6
Se han modificado 2 ficheros con 7 adiciones y 1 borrados

Ver fichero

@ -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()

Ver fichero

@ -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);
}