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.
This commit is contained in:
Peter Serwylo 2016-06-02 14:54:27 +10:00
parent a74e951cdf
commit 7076bb767d

View File

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