remove pointless method: DownloaderService.getPackageNameFromIntent()

This method provides the exact same results as the underlying method it
uses, intent.getStringExtra()

This was added in 0163d6efa6013181c2e6554760e5fa6e67a6daf9
This commit is contained in:
Hans-Christoph Steiner 2016-05-04 21:01:37 +02:00
parent 44b703a7d2
commit 0214e9e447

View File

@ -154,11 +154,6 @@ public class DownloaderService extends Service {
} }
} }
@Nullable
private static String getPackageNameFromIntent(@NonNull Intent intent) {
return intent.hasExtra(EXTRA_PACKAGE_NAME) ? intent.getStringExtra(EXTRA_PACKAGE_NAME) : null;
}
private NotificationCompat.Builder createNotification(String urlString, @Nullable String packageName) { private NotificationCompat.Builder createNotification(String urlString, @Nullable String packageName) {
return new NotificationCompat.Builder(this) return new NotificationCompat.Builder(this)
.setAutoCancel(true) .setAutoCancel(true)
@ -262,11 +257,11 @@ public class DownloaderService extends Service {
File downloadDir = new File(Utils.getApkCacheDir(this), uri.getHost() + "-" + uri.getPort()); File downloadDir = new File(Utils.getApkCacheDir(this), uri.getHost() + "-" + uri.getPort());
downloadDir.mkdirs(); downloadDir.mkdirs();
final SanitizedFile localFile = new SanitizedFile(downloadDir, uri.getLastPathSegment()); final SanitizedFile localFile = new SanitizedFile(downloadDir, uri.getLastPathSegment());
final String packageName = getPackageNameFromIntent(intent); final String packageName = intent.getStringExtra(EXTRA_PACKAGE_NAME);
sendBroadcast(uri, Downloader.ACTION_STARTED, localFile); sendBroadcast(uri, Downloader.ACTION_STARTED, localFile);
if (Preferences.get().isUpdateNotificationEnabled()) { if (Preferences.get().isUpdateNotificationEnabled()) {
Notification notification = createNotification(intent.getDataString(), getPackageNameFromIntent(intent)).build(); Notification notification = createNotification(intent.getDataString(), intent.getStringExtra(EXTRA_PACKAGE_NAME)).build();
startForeground(NOTIFY_DOWNLOADING, notification); startForeground(NOTIFY_DOWNLOADING, notification);
} }