From 7076bb767d69bc57fdc824df725592fa864334c9 Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Thu, 2 Jun 2016 14:54:27 +1000 Subject: [PATCH] Clarify what needs to be passed into `parseApp` and make it private. The `parseApp` method was previously accepting an `Intent`, which could have been anything. Given it was only used once, this now pushed the creation of that `Intent` into the `parseApp` method, and also reduced the visibility of the method as it is only used once at time of writing. --- .../org/fdroid/fdroid/localrepo/CacheSwapAppsService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/fdroid/fdroid/localrepo/CacheSwapAppsService.java b/app/src/main/java/org/fdroid/fdroid/localrepo/CacheSwapAppsService.java index 63a1fa1c0..31d3c880c 100644 --- a/app/src/main/java/org/fdroid/fdroid/localrepo/CacheSwapAppsService.java +++ b/app/src/main/java/org/fdroid/fdroid/localrepo/CacheSwapAppsService.java @@ -37,7 +37,9 @@ public class CacheSwapAppsService extends IntentService { * Parse the locally installed APK for {@code packageName} and save its XML * to the APK XML cache. */ - public static void parseApp(Context context, Intent intent) { + private static void parseApp(Context context, String packageName) { + Intent intent = new Intent(); + intent.setData(Utils.getPackageUri(packageName)); intent.setClass(context, CacheSwapAppsService.class); intent.setAction(ACTION_PARSE_APP); context.startService(intent); @@ -57,9 +59,7 @@ public class CacheSwapAppsService extends IntentService { } if (!indexJarFile.exists() || FileUtils.isFileNewer(new File(applicationInfo.sourceDir), indexJarFile)) { - Intent intent = new Intent(); - intent.setData(Utils.getPackageUri(applicationInfo.packageName)); - parseApp(context, intent); + parseApp(context, applicationInfo.packageName); } } }