From 0d1cdf84f9278e5b94cc300c2702f2b757763ebd Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 28 Jun 2018 23:42:10 +0200 Subject: [PATCH 1/3] stop all F-Droid services when hiding by querying for list No need to list them out manually, it is easy to get the list of what is actually registered for this app. !629 --- .../fdroid/views/hiding/HidingManager.java | 39 +++++++------------ 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/app/src/full/java/org/fdroid/fdroid/views/hiding/HidingManager.java b/app/src/full/java/org/fdroid/fdroid/views/hiding/HidingManager.java index 2d8f90184..c0afc2217 100644 --- a/app/src/full/java/org/fdroid/fdroid/views/hiding/HidingManager.java +++ b/app/src/full/java/org/fdroid/fdroid/views/hiding/HidingManager.java @@ -4,29 +4,19 @@ import android.content.ComponentName; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.content.pm.PackageInfo; import android.content.pm.PackageManager; +import android.content.pm.ServiceInfo; import android.support.v4.app.NotificationManagerCompat; import android.support.v7.app.AlertDialog; - -import org.fdroid.fdroid.AppUpdateStatusService; import org.fdroid.fdroid.BuildConfig; -import org.fdroid.fdroid.CleanCacheService; import org.fdroid.fdroid.R; -import org.fdroid.fdroid.UpdateService; -import org.fdroid.fdroid.data.InstalledAppProviderService; -import org.fdroid.fdroid.installer.InstallHistoryService; -import org.fdroid.fdroid.installer.InstallManagerService; -import org.fdroid.fdroid.installer.InstallerService; -import org.fdroid.fdroid.localrepo.CacheSwapAppsService; -import org.fdroid.fdroid.localrepo.SwapService; -import org.fdroid.fdroid.net.DownloaderService; -import org.fdroid.fdroid.net.WifiStateChangeService; import org.fdroid.fdroid.views.main.MainActivity; /** * This class is encapsulating all methods related to hiding the app from the launcher * and restoring it. - * + *

* It can tell you whether the app is hidden, what the PIN to restore is * and show confirmation dialogs before hiding. */ @@ -107,17 +97,16 @@ public class HidingManager { * Stops all running services, so nothing can pop up and reveal F-Droid's existence on the system */ private static void stopServices(Context context) { - context.stopService(new Intent(context, UpdateService.class)); - context.stopService(new Intent(context, DownloaderService.class)); - context.stopService(new Intent(context, InstallerService.class)); - context.stopService(new Intent(context, CleanCacheService.class)); - context.stopService(new Intent(context, WifiStateChangeService.class)); - context.stopService(new Intent(context, SwapService.class)); - context.stopService(new Intent(context, InstallManagerService.class)); - context.stopService(new Intent(context, InstallHistoryService.class)); - context.stopService(new Intent(context, CacheSwapAppsService.class)); - context.stopService(new Intent(context, InstalledAppProviderService.class)); - context.stopService(new Intent(context, AppUpdateStatusService.class)); + try { + PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), + PackageManager.GET_SERVICES); + for (ServiceInfo serviceInfo : packageInfo.services) { + Intent intent = new Intent(); + intent.setComponent(new ComponentName(context, serviceInfo.name)); + context.stopService(intent); + } + } catch (PackageManager.NameNotFoundException e) { + e.printStackTrace(); + } } - } From 61a452e7cd011e76b448d4ce8bc827c4dbb83086 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 10 Jul 2018 14:42:45 +0200 Subject: [PATCH 2/3] add new Anti-Feature: NoSourceSince * https://f-droid.org/wiki/page/Antifeature:NoSourceSince * fdroidserver!529 * fdroidserver#508 --- .../org/fdroid/fdroid/views/AppDetailsRecyclerViewAdapter.java | 2 ++ app/src/main/res/values/strings.xml | 1 + 2 files changed, 3 insertions(+) diff --git a/app/src/main/java/org/fdroid/fdroid/views/AppDetailsRecyclerViewAdapter.java b/app/src/main/java/org/fdroid/fdroid/views/AppDetailsRecyclerViewAdapter.java index ea6722ea9..a07982285 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/AppDetailsRecyclerViewAdapter.java +++ b/app/src/main/java/org/fdroid/fdroid/views/AppDetailsRecyclerViewAdapter.java @@ -550,6 +550,8 @@ public class AppDetailsRecyclerViewAdapter return itemView.getContext().getString(R.string.antidisabledalgorithmlist); case "KnownVuln": return itemView.getContext().getString(R.string.antiknownvulnlist); + case "NoSourceSince": + return itemView.getContext().getString(R.string.antinosourcesince); default: return af; } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 54029b0fb..f2fa3367d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -218,6 +218,7 @@ This often occurs with apps installed via Google Play or other sources, if they This app contains non-free assets This app has a weak security signature This app contains a known security vulnerability + The source code is no longer available, no updates possible. Display From 5b11898ba39ae276cd746e330805920e011e1e12 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 11 Jul 2018 14:58:18 +0200 Subject: [PATCH 3/3] improve debug message when Apk is missing NAME and/or REPO_ADDRESS --- app/src/main/java/org/fdroid/fdroid/data/Apk.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/org/fdroid/fdroid/data/Apk.java b/app/src/main/java/org/fdroid/fdroid/data/Apk.java index 2618edd94..de6a6cbcf 100644 --- a/app/src/main/java/org/fdroid/fdroid/data/Apk.java +++ b/app/src/main/java/org/fdroid/fdroid/data/Apk.java @@ -257,6 +257,8 @@ public class Apk extends ValueObject implements Comparable, Parcelable { + "Schema.ApkTable.Cols.NAME set in order to calculate URL " + "[package: " + packageName + ", versionCode: " + versionCode + + ", apkName: " + apkName + + ", repoAddress: " + repoAddress + ", repoId: " + repoId + "]"); } }