Loading src/org/lineageos/updater/ExportUpdateService.java +22 −28 Original line number Diff line number Diff line Loading @@ -175,9 +175,7 @@ public class ExportUpdateService extends Service { startForeground(NOTIFICATION_ID, notificationBuilder.build()); notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build()); Runnable runnableComplete = new Runnable() { @Override public void run() { Runnable runnableComplete = () -> { notificationStyle.setSummaryText(null); notificationStyle.setBigContentTitle( getString(R.string.notification_export_success)); Loading @@ -188,12 +186,9 @@ public class ExportUpdateService extends Service { notificationBuilder.mActions.clear(); notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build()); stopForeground(STOP_FOREGROUND_DETACH); } }; Runnable runnableFailed = new Runnable() { @Override public void run() { Runnable runnableFailed = () -> { notificationStyle.setSummaryText(null); notificationStyle.setBigContentTitle( getString(R.string.notification_export_fail)); Loading @@ -204,7 +199,6 @@ public class ExportUpdateService extends Service { notificationBuilder.mActions.clear(); notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build()); stopForeground(STOP_FOREGROUND_DETACH); } }; mExportRunnable = new ExportRunnable(source, destination, progressCallBack, Loading src/org/lineageos/updater/UpdatesActivity.java +9 −22 Original line number Diff line number Diff line Loading @@ -60,8 +60,6 @@ import org.lineageos.updater.model.UpdateInfo; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; public class UpdatesActivity extends UpdatesListActivity { Loading Loading @@ -308,12 +306,7 @@ public class UpdatesActivity extends UpdatesListActivity { } else { findViewById(R.id.no_new_updates_view).setVisibility(View.GONE); findViewById(R.id.recycler_view).setVisibility(View.VISIBLE); Collections.sort(sortedUpdates, new Comparator<UpdateInfo>() { @Override public int compare(UpdateInfo u1, UpdateInfo u2) { return Long.compare(u2.getTimestamp(), u1.getTimestamp()); } }); sortedUpdates.sort((u1, u2) -> Long.compare(u2.getTimestamp(), u1.getTimestamp())); for (UpdateInfo update : sortedUpdates) { updateIds.add(update.getDownloadId()); } Loading Loading @@ -366,14 +359,11 @@ public class UpdatesActivity extends UpdatesListActivity { @Override public void onFailure(final boolean cancelled) { Log.e(TAG, "Could not download updates list"); runOnUiThread(new Runnable() { @Override public void run() { runOnUiThread(() -> { if (!cancelled) { showSnackbar(R.string.snack_updates_check_failed, Snackbar.LENGTH_LONG); } refreshAnimationStop(); } }); } Loading @@ -384,13 +374,10 @@ public class UpdatesActivity extends UpdatesListActivity { @Override public void onSuccess(File destination) { runOnUiThread(new Runnable() { @Override public void run() { runOnUiThread(() -> { Log.d(TAG, "List downloaded"); processNewJson(jsonFile, jsonFileTmp, manualRefresh); refreshAnimationStop(); } }); } }; Loading src/org/lineageos/updater/UpdatesListAdapter.java +44 −100 Original line number Diff line number Diff line Loading @@ -15,7 +15,6 @@ */ package org.lineageos.updater; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; Loading Loading @@ -292,9 +291,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. .setMessage(R.string.update_on_mobile_data_message) .setView(checkboxView) .setPositiveButton(R.string.action_description_download, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { (dialog, which) -> { if (checkbox.isChecked()) { preferences.edit() .putBoolean(Constants.PREF_MOBILE_DATA_WARNING, false) Loading @@ -302,7 +299,6 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. mActivity.supportInvalidateOptionsMenu(); } mUpdaterController.startDownload(downloadId); } }) .setNegativeButton(android.R.string.cancel, null) .show(); Loading @@ -317,24 +313,15 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. button.setContentDescription( mActivity.getString(R.string.action_description_download)); button.setEnabled(enabled); clickListener = !enabled ? null : new View.OnClickListener() { @Override public void onClick(View view) { startDownloadWithWarning(downloadId); } }; clickListener = enabled ? view -> startDownloadWithWarning(downloadId) : null; break; case PAUSE: button.setImageResource(R.drawable.ic_pause); button.setContentDescription( mActivity.getString(R.string.action_description_pause)); button.setEnabled(enabled); clickListener = !enabled ? null : new View.OnClickListener() { @Override public void onClick(View view) { mUpdaterController.pauseDownload(downloadId); } }; clickListener = enabled ? view -> mUpdaterController.pauseDownload(downloadId) : null; break; case RESUME: { button.setImageResource(R.drawable.ic_resume); Loading @@ -344,17 +331,14 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. UpdateInfo update = mUpdaterController.getUpdate(downloadId); final boolean canInstall = Utils.canInstall(update) || update.getFile().length() == update.getFileSize(); clickListener = !enabled ? null : new View.OnClickListener() { @Override public void onClick(View view) { clickListener = enabled ? view -> { if (canInstall) { mUpdaterController.resumeDownload(downloadId); } else { mActivity.showSnackbar(R.string.snack_update_not_installable, Snackbar.LENGTH_LONG); } } }; } : null; } break; case INSTALL: { Loading @@ -364,29 +348,21 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. button.setEnabled(enabled); UpdateInfo update = mUpdaterController.getUpdate(downloadId); final boolean canInstall = Utils.canInstall(update); clickListener = !enabled ? null : new View.OnClickListener() { @Override public void onClick(View view) { clickListener = enabled ? view -> { if (canInstall) { getInstallDialog(downloadId).show(); } else { mActivity.showSnackbar(R.string.snack_update_not_installable, Snackbar.LENGTH_LONG); } } }; } : null; } break; case INFO: { button.setImageResource(R.drawable.ic_info); button.setContentDescription(mActivity.getString(R.string.action_description_info)); button.setEnabled(enabled); clickListener = !enabled ? null : new View.OnClickListener() { @Override public void onClick(View view) { showInfoDialog(); } }; clickListener = enabled ? view -> showInfoDialog() : null; } break; case DELETE: { Loading @@ -394,12 +370,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. button.setContentDescription( mActivity.getString(R.string.action_description_delete)); button.setEnabled(enabled); clickListener = !enabled ? null : new View.OnClickListener() { @Override public void onClick(View view) { getDeleteDialog(downloadId).show(); } }; clickListener = enabled ? view -> getDeleteDialog(downloadId).show() : null; } break; case CANCEL_INSTALLATION: { Loading @@ -407,12 +378,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. button.setContentDescription( mActivity.getString(R.string.action_description_cancel)); button.setEnabled(enabled); clickListener = !enabled ? null : new View.OnClickListener() { @Override public void onClick(View view) { getCancelInstallationDialog().show(); } }; clickListener = enabled ? view -> getCancelInstallationDialog().show() : null; } break; default: Loading @@ -421,14 +387,11 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. button.setAlpha(enabled ? 1.f : mAlphaDisabledValue); // Disable action mode when a button is clicked button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { button.setOnClickListener(v -> { if (clickListener != null) { clickListener.onClick(v); stopActionMode(); } } }); } Loading @@ -442,26 +405,20 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. .setTitle(R.string.confirm_delete_dialog_title) .setMessage(R.string.confirm_delete_dialog_message) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { (dialog, which) -> { mUpdaterController.pauseDownload(downloadId); mUpdaterController.deleteUpdate(downloadId); } }) .setNegativeButton(android.R.string.cancel, null); } private View.OnLongClickListener getLongClickListener(final UpdateInfo update, final boolean canDelete) { return new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { return view -> { if (mActionMode == null) { startActionMode(update, canDelete); } return true; } }; } Loading @@ -488,12 +445,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. .setMessage(mActivity.getString(resId, buildInfoText, mActivity.getString(android.R.string.ok))) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Utils.triggerUpdate(mActivity, downloadId); } }) (dialog, which) -> Utils.triggerUpdate(mActivity, downloadId)) .setNegativeButton(android.R.string.cancel, null); } Loading @@ -501,13 +453,10 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. return new AlertDialog.Builder(mActivity) .setMessage(R.string.cancel_installation_dialog_message) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { (dialog, which) -> { Intent intent = new Intent(mActivity, UpdaterService.class); intent.setAction(UpdaterService.ACTION_INSTALL_STOP); mActivity.startService(intent); } }) .setNegativeButton(android.R.string.cancel, null); } Loading Loading @@ -559,12 +508,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. switch (item.getItemId()) { case R.id.menu_delete_action: getDeleteDialog(update.getDownloadId()) .setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { mode.finish(); } }) .setOnDismissListener(dialog -> mode.finish()) .show(); return true; case R.id.menu_copy_url: Loading src/org/lineageos/updater/controller/UpdaterController.java +22 −33 Original line number Diff line number Diff line Loading @@ -172,13 +172,8 @@ public class UpdaterController implements Controller { } update.setStatus(UpdateStatus.DOWNLOADING); update.setPersistentStatus(UpdateStatus.Persistent.INCOMPLETE); new Thread(new Runnable() { @Override public void run() { mUpdatesDbHelper.addUpdateWithOnConflict(update, SQLiteDatabase.CONFLICT_REPLACE); } }).start(); new Thread(() -> mUpdatesDbHelper.addUpdateWithOnConflict(update, SQLiteDatabase.CONFLICT_REPLACE)).start(); notifyUpdateChange(downloadId); } Loading Loading @@ -245,9 +240,7 @@ public class UpdaterController implements Controller { private void verifyUpdateAsync(final String downloadId) { mVerifyingUpdates.add(downloadId); new Thread(new Runnable() { @Override public void run() { new Thread(() -> { Update update = mDownloads.get(downloadId).mUpdate; File file = update.getFile(); if (file.exists() && verifyPackage(file)) { Loading @@ -263,7 +256,6 @@ public class UpdaterController implements Controller { } mVerifyingUpdates.remove(downloadId); notifyUpdateChange(downloadId); } }).start(); } Loading Loading @@ -454,15 +446,12 @@ public class UpdaterController implements Controller { } private void deleteUpdateAsync(final Update update) { new Thread(new Runnable() { @Override public void run() { new Thread(() -> { File file = update.getFile(); if (file.exists() && !file.delete()) { Log.e(TAG, "Could not delete " + file.getAbsolutePath()); } mUpdatesDbHelper.removeUpdate(update.getDownloadId()); } }).start(); } Loading src/org/lineageos/updater/download/HttpURLConnectionClient.java +1 −6 Original line number Diff line number Diff line Loading @@ -192,12 +192,7 @@ public class HttpURLConnectionClient implements DownloadClient { for (Map.Entry<String, List<String>> entry : mClient.getHeaderFields().entrySet()) { if ("Link".equalsIgnoreCase((entry.getKey()))) { duplicates = new PriorityQueue<>(entry.getValue().size(), new Comparator<DuplicateLink>() { @Override public int compare(DuplicateLink d1, DuplicateLink d2) { return Integer.compare(d1.mPriority, d2.mPriority); } }); Comparator.comparingInt(d -> d.mPriority)); // https://tools.ietf.org/html/rfc6249 // https://tools.ietf.org/html/rfc5988#section-5 Loading Loading
src/org/lineageos/updater/ExportUpdateService.java +22 −28 Original line number Diff line number Diff line Loading @@ -175,9 +175,7 @@ public class ExportUpdateService extends Service { startForeground(NOTIFICATION_ID, notificationBuilder.build()); notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build()); Runnable runnableComplete = new Runnable() { @Override public void run() { Runnable runnableComplete = () -> { notificationStyle.setSummaryText(null); notificationStyle.setBigContentTitle( getString(R.string.notification_export_success)); Loading @@ -188,12 +186,9 @@ public class ExportUpdateService extends Service { notificationBuilder.mActions.clear(); notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build()); stopForeground(STOP_FOREGROUND_DETACH); } }; Runnable runnableFailed = new Runnable() { @Override public void run() { Runnable runnableFailed = () -> { notificationStyle.setSummaryText(null); notificationStyle.setBigContentTitle( getString(R.string.notification_export_fail)); Loading @@ -204,7 +199,6 @@ public class ExportUpdateService extends Service { notificationBuilder.mActions.clear(); notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build()); stopForeground(STOP_FOREGROUND_DETACH); } }; mExportRunnable = new ExportRunnable(source, destination, progressCallBack, Loading
src/org/lineageos/updater/UpdatesActivity.java +9 −22 Original line number Diff line number Diff line Loading @@ -60,8 +60,6 @@ import org.lineageos.updater.model.UpdateInfo; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; public class UpdatesActivity extends UpdatesListActivity { Loading Loading @@ -308,12 +306,7 @@ public class UpdatesActivity extends UpdatesListActivity { } else { findViewById(R.id.no_new_updates_view).setVisibility(View.GONE); findViewById(R.id.recycler_view).setVisibility(View.VISIBLE); Collections.sort(sortedUpdates, new Comparator<UpdateInfo>() { @Override public int compare(UpdateInfo u1, UpdateInfo u2) { return Long.compare(u2.getTimestamp(), u1.getTimestamp()); } }); sortedUpdates.sort((u1, u2) -> Long.compare(u2.getTimestamp(), u1.getTimestamp())); for (UpdateInfo update : sortedUpdates) { updateIds.add(update.getDownloadId()); } Loading Loading @@ -366,14 +359,11 @@ public class UpdatesActivity extends UpdatesListActivity { @Override public void onFailure(final boolean cancelled) { Log.e(TAG, "Could not download updates list"); runOnUiThread(new Runnable() { @Override public void run() { runOnUiThread(() -> { if (!cancelled) { showSnackbar(R.string.snack_updates_check_failed, Snackbar.LENGTH_LONG); } refreshAnimationStop(); } }); } Loading @@ -384,13 +374,10 @@ public class UpdatesActivity extends UpdatesListActivity { @Override public void onSuccess(File destination) { runOnUiThread(new Runnable() { @Override public void run() { runOnUiThread(() -> { Log.d(TAG, "List downloaded"); processNewJson(jsonFile, jsonFileTmp, manualRefresh); refreshAnimationStop(); } }); } }; Loading
src/org/lineageos/updater/UpdatesListAdapter.java +44 −100 Original line number Diff line number Diff line Loading @@ -15,7 +15,6 @@ */ package org.lineageos.updater; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; Loading Loading @@ -292,9 +291,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. .setMessage(R.string.update_on_mobile_data_message) .setView(checkboxView) .setPositiveButton(R.string.action_description_download, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { (dialog, which) -> { if (checkbox.isChecked()) { preferences.edit() .putBoolean(Constants.PREF_MOBILE_DATA_WARNING, false) Loading @@ -302,7 +299,6 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. mActivity.supportInvalidateOptionsMenu(); } mUpdaterController.startDownload(downloadId); } }) .setNegativeButton(android.R.string.cancel, null) .show(); Loading @@ -317,24 +313,15 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. button.setContentDescription( mActivity.getString(R.string.action_description_download)); button.setEnabled(enabled); clickListener = !enabled ? null : new View.OnClickListener() { @Override public void onClick(View view) { startDownloadWithWarning(downloadId); } }; clickListener = enabled ? view -> startDownloadWithWarning(downloadId) : null; break; case PAUSE: button.setImageResource(R.drawable.ic_pause); button.setContentDescription( mActivity.getString(R.string.action_description_pause)); button.setEnabled(enabled); clickListener = !enabled ? null : new View.OnClickListener() { @Override public void onClick(View view) { mUpdaterController.pauseDownload(downloadId); } }; clickListener = enabled ? view -> mUpdaterController.pauseDownload(downloadId) : null; break; case RESUME: { button.setImageResource(R.drawable.ic_resume); Loading @@ -344,17 +331,14 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. UpdateInfo update = mUpdaterController.getUpdate(downloadId); final boolean canInstall = Utils.canInstall(update) || update.getFile().length() == update.getFileSize(); clickListener = !enabled ? null : new View.OnClickListener() { @Override public void onClick(View view) { clickListener = enabled ? view -> { if (canInstall) { mUpdaterController.resumeDownload(downloadId); } else { mActivity.showSnackbar(R.string.snack_update_not_installable, Snackbar.LENGTH_LONG); } } }; } : null; } break; case INSTALL: { Loading @@ -364,29 +348,21 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. button.setEnabled(enabled); UpdateInfo update = mUpdaterController.getUpdate(downloadId); final boolean canInstall = Utils.canInstall(update); clickListener = !enabled ? null : new View.OnClickListener() { @Override public void onClick(View view) { clickListener = enabled ? view -> { if (canInstall) { getInstallDialog(downloadId).show(); } else { mActivity.showSnackbar(R.string.snack_update_not_installable, Snackbar.LENGTH_LONG); } } }; } : null; } break; case INFO: { button.setImageResource(R.drawable.ic_info); button.setContentDescription(mActivity.getString(R.string.action_description_info)); button.setEnabled(enabled); clickListener = !enabled ? null : new View.OnClickListener() { @Override public void onClick(View view) { showInfoDialog(); } }; clickListener = enabled ? view -> showInfoDialog() : null; } break; case DELETE: { Loading @@ -394,12 +370,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. button.setContentDescription( mActivity.getString(R.string.action_description_delete)); button.setEnabled(enabled); clickListener = !enabled ? null : new View.OnClickListener() { @Override public void onClick(View view) { getDeleteDialog(downloadId).show(); } }; clickListener = enabled ? view -> getDeleteDialog(downloadId).show() : null; } break; case CANCEL_INSTALLATION: { Loading @@ -407,12 +378,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. button.setContentDescription( mActivity.getString(R.string.action_description_cancel)); button.setEnabled(enabled); clickListener = !enabled ? null : new View.OnClickListener() { @Override public void onClick(View view) { getCancelInstallationDialog().show(); } }; clickListener = enabled ? view -> getCancelInstallationDialog().show() : null; } break; default: Loading @@ -421,14 +387,11 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. button.setAlpha(enabled ? 1.f : mAlphaDisabledValue); // Disable action mode when a button is clicked button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { button.setOnClickListener(v -> { if (clickListener != null) { clickListener.onClick(v); stopActionMode(); } } }); } Loading @@ -442,26 +405,20 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. .setTitle(R.string.confirm_delete_dialog_title) .setMessage(R.string.confirm_delete_dialog_message) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { (dialog, which) -> { mUpdaterController.pauseDownload(downloadId); mUpdaterController.deleteUpdate(downloadId); } }) .setNegativeButton(android.R.string.cancel, null); } private View.OnLongClickListener getLongClickListener(final UpdateInfo update, final boolean canDelete) { return new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { return view -> { if (mActionMode == null) { startActionMode(update, canDelete); } return true; } }; } Loading @@ -488,12 +445,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. .setMessage(mActivity.getString(resId, buildInfoText, mActivity.getString(android.R.string.ok))) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Utils.triggerUpdate(mActivity, downloadId); } }) (dialog, which) -> Utils.triggerUpdate(mActivity, downloadId)) .setNegativeButton(android.R.string.cancel, null); } Loading @@ -501,13 +453,10 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. return new AlertDialog.Builder(mActivity) .setMessage(R.string.cancel_installation_dialog_message) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { (dialog, which) -> { Intent intent = new Intent(mActivity, UpdaterService.class); intent.setAction(UpdaterService.ACTION_INSTALL_STOP); mActivity.startService(intent); } }) .setNegativeButton(android.R.string.cancel, null); } Loading Loading @@ -559,12 +508,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. switch (item.getItemId()) { case R.id.menu_delete_action: getDeleteDialog(update.getDownloadId()) .setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { mode.finish(); } }) .setOnDismissListener(dialog -> mode.finish()) .show(); return true; case R.id.menu_copy_url: Loading
src/org/lineageos/updater/controller/UpdaterController.java +22 −33 Original line number Diff line number Diff line Loading @@ -172,13 +172,8 @@ public class UpdaterController implements Controller { } update.setStatus(UpdateStatus.DOWNLOADING); update.setPersistentStatus(UpdateStatus.Persistent.INCOMPLETE); new Thread(new Runnable() { @Override public void run() { mUpdatesDbHelper.addUpdateWithOnConflict(update, SQLiteDatabase.CONFLICT_REPLACE); } }).start(); new Thread(() -> mUpdatesDbHelper.addUpdateWithOnConflict(update, SQLiteDatabase.CONFLICT_REPLACE)).start(); notifyUpdateChange(downloadId); } Loading Loading @@ -245,9 +240,7 @@ public class UpdaterController implements Controller { private void verifyUpdateAsync(final String downloadId) { mVerifyingUpdates.add(downloadId); new Thread(new Runnable() { @Override public void run() { new Thread(() -> { Update update = mDownloads.get(downloadId).mUpdate; File file = update.getFile(); if (file.exists() && verifyPackage(file)) { Loading @@ -263,7 +256,6 @@ public class UpdaterController implements Controller { } mVerifyingUpdates.remove(downloadId); notifyUpdateChange(downloadId); } }).start(); } Loading Loading @@ -454,15 +446,12 @@ public class UpdaterController implements Controller { } private void deleteUpdateAsync(final Update update) { new Thread(new Runnable() { @Override public void run() { new Thread(() -> { File file = update.getFile(); if (file.exists() && !file.delete()) { Log.e(TAG, "Could not delete " + file.getAbsolutePath()); } mUpdatesDbHelper.removeUpdate(update.getDownloadId()); } }).start(); } Loading
src/org/lineageos/updater/download/HttpURLConnectionClient.java +1 −6 Original line number Diff line number Diff line Loading @@ -192,12 +192,7 @@ public class HttpURLConnectionClient implements DownloadClient { for (Map.Entry<String, List<String>> entry : mClient.getHeaderFields().entrySet()) { if ("Link".equalsIgnoreCase((entry.getKey()))) { duplicates = new PriorityQueue<>(entry.getValue().size(), new Comparator<DuplicateLink>() { @Override public int compare(DuplicateLink d1, DuplicateLink d2) { return Integer.compare(d1.mPriority, d2.mPriority); } }); Comparator.comparingInt(d -> d.mPriority)); // https://tools.ietf.org/html/rfc6249 // https://tools.ietf.org/html/rfc5988#section-5 Loading