Loading res/layout/activity_updates.xml +1 −0 Original line number Diff line number Diff line Loading @@ -132,6 +132,7 @@ android:paddingStart="16dp" android:textSize="16sp" android:background="@color/toolbar_collapsed" android:visibility="gone" android:text="@string/e_available_updates" android:textColor="?android:textColorPrimary" /> Loading src/org/lineageos/updater/UpdatesActivity.java +8 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,10 @@ public class UpdatesActivity extends UpdatesListActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_updates); if (UpdaterService.isDeviceRebooted()) { Utils.removeInstalledUpdate(this); } UiModeManager uiModeManager = getSystemService(UiModeManager.class); mIsTV = uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION; Loading Loading @@ -299,9 +303,11 @@ public class UpdatesActivity extends UpdatesListActivity { if (sortedUpdates.isEmpty()) { findViewById(R.id.no_new_updates_view).setVisibility(View.VISIBLE); findViewById(R.id.content).setVisibility(View.GONE); findViewById(R.id.available_update_header).setVisibility(View.GONE); } else { findViewById(R.id.no_new_updates_view).setVisibility(View.GONE); findViewById(R.id.content).setVisibility(View.VISIBLE); findViewById(R.id.available_update_header).setVisibility(View.VISIBLE); sortedUpdates.sort((u1, u2) -> Long.compare(u2.getTimestamp(), u1.getTimestamp())); for (UpdateInfo update : sortedUpdates) { updateIds.add(update.getDownloadId()); Loading Loading @@ -458,6 +464,7 @@ public class UpdatesActivity extends UpdatesListActivity { } } else { findViewById(R.id.content).setVisibility(View.GONE); findViewById(R.id.available_update_header).setVisibility(View.GONE); findViewById(R.id.no_new_updates_view).setVisibility(View.GONE); findViewById(R.id.refresh_progress).setVisibility(View.VISIBLE); } Loading @@ -473,6 +480,7 @@ public class UpdatesActivity extends UpdatesListActivity { findViewById(R.id.refresh_progress).setVisibility(View.GONE); if (mAdapter.getItemCount() > 0) { findViewById(R.id.content).setVisibility(View.VISIBLE); findViewById(R.id.available_update_header).setVisibility(View.VISIBLE); } else { findViewById(R.id.no_new_updates_view).setVisibility(View.VISIBLE); } Loading src/org/lineageos/updater/controller/UpdaterService.java +9 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,8 @@ public class UpdaterService extends Service { private static ConnectivityManager.NetworkCallback mConnectionStateMonitor; private static ConnectivityManager mConnectivityManager; private static boolean mDeviceRebooted = true; @Override public void onCreate() { super.onCreate(); Loading Loading @@ -263,6 +265,10 @@ public class UpdaterService extends Service { return mUpdaterController; } public static boolean isDeviceRebooted() { return mDeviceRebooted; } private void tryStopSelf() { if (isNetworkCallBackActive || areNotificationsActive()) return; if (!mHasClients && !mUpdaterController.hasActiveDownloads() && Loading @@ -282,6 +288,8 @@ public class UpdaterService extends Service { private void handleUpdateStatusChange(UpdateInfo update) { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences.Editor editor = pref.edit(); mNotificationBuilder.setPriority(NotificationCompat.PRIORITY_DEFAULT); mDeviceRebooted = false; switch (update.getStatus()) { case DELETED: { notifySystemUpdaterService(STATUS_WAITING_DOWNLOAD, update); Loading Loading @@ -489,6 +497,7 @@ public class UpdaterService extends Service { mNotificationBuilder.setTicker(text); mNotificationBuilder.setOngoing(true); mNotificationBuilder.setAutoCancel(false); mNotificationBuilder.setPriority(NotificationCompat.PRIORITY_MAX); mNotificationManager.notify(NOTIFICATION_ID, mNotificationBuilder.build()); boolean deleteUpdate = pref.getBoolean(Constants.PREF_AUTO_DELETE_UPDATES, true); Loading src/org/lineageos/updater/misc/Utils.java +5 −3 Original line number Diff line number Diff line Loading @@ -494,9 +494,11 @@ public class Utils { public static void removeInstalledUpdate(Context context) { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); String downloadId = pref.getString(Constants.PREF_NEEDS_DELETE_ID, null); if (downloadId != null) { UpdaterController controller = UpdaterController.getInstance(context); if (controller != null && downloadId != null) { if (controller != null) { controller.deleteUpdate(downloadId); } pref.edit().remove(Constants.PREF_NEEDS_DELETE_ID).apply(); } } Loading Loading
res/layout/activity_updates.xml +1 −0 Original line number Diff line number Diff line Loading @@ -132,6 +132,7 @@ android:paddingStart="16dp" android:textSize="16sp" android:background="@color/toolbar_collapsed" android:visibility="gone" android:text="@string/e_available_updates" android:textColor="?android:textColorPrimary" /> Loading
src/org/lineageos/updater/UpdatesActivity.java +8 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,10 @@ public class UpdatesActivity extends UpdatesListActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_updates); if (UpdaterService.isDeviceRebooted()) { Utils.removeInstalledUpdate(this); } UiModeManager uiModeManager = getSystemService(UiModeManager.class); mIsTV = uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION; Loading Loading @@ -299,9 +303,11 @@ public class UpdatesActivity extends UpdatesListActivity { if (sortedUpdates.isEmpty()) { findViewById(R.id.no_new_updates_view).setVisibility(View.VISIBLE); findViewById(R.id.content).setVisibility(View.GONE); findViewById(R.id.available_update_header).setVisibility(View.GONE); } else { findViewById(R.id.no_new_updates_view).setVisibility(View.GONE); findViewById(R.id.content).setVisibility(View.VISIBLE); findViewById(R.id.available_update_header).setVisibility(View.VISIBLE); sortedUpdates.sort((u1, u2) -> Long.compare(u2.getTimestamp(), u1.getTimestamp())); for (UpdateInfo update : sortedUpdates) { updateIds.add(update.getDownloadId()); Loading Loading @@ -458,6 +464,7 @@ public class UpdatesActivity extends UpdatesListActivity { } } else { findViewById(R.id.content).setVisibility(View.GONE); findViewById(R.id.available_update_header).setVisibility(View.GONE); findViewById(R.id.no_new_updates_view).setVisibility(View.GONE); findViewById(R.id.refresh_progress).setVisibility(View.VISIBLE); } Loading @@ -473,6 +480,7 @@ public class UpdatesActivity extends UpdatesListActivity { findViewById(R.id.refresh_progress).setVisibility(View.GONE); if (mAdapter.getItemCount() > 0) { findViewById(R.id.content).setVisibility(View.VISIBLE); findViewById(R.id.available_update_header).setVisibility(View.VISIBLE); } else { findViewById(R.id.no_new_updates_view).setVisibility(View.VISIBLE); } Loading
src/org/lineageos/updater/controller/UpdaterService.java +9 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,8 @@ public class UpdaterService extends Service { private static ConnectivityManager.NetworkCallback mConnectionStateMonitor; private static ConnectivityManager mConnectivityManager; private static boolean mDeviceRebooted = true; @Override public void onCreate() { super.onCreate(); Loading Loading @@ -263,6 +265,10 @@ public class UpdaterService extends Service { return mUpdaterController; } public static boolean isDeviceRebooted() { return mDeviceRebooted; } private void tryStopSelf() { if (isNetworkCallBackActive || areNotificationsActive()) return; if (!mHasClients && !mUpdaterController.hasActiveDownloads() && Loading @@ -282,6 +288,8 @@ public class UpdaterService extends Service { private void handleUpdateStatusChange(UpdateInfo update) { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences.Editor editor = pref.edit(); mNotificationBuilder.setPriority(NotificationCompat.PRIORITY_DEFAULT); mDeviceRebooted = false; switch (update.getStatus()) { case DELETED: { notifySystemUpdaterService(STATUS_WAITING_DOWNLOAD, update); Loading Loading @@ -489,6 +497,7 @@ public class UpdaterService extends Service { mNotificationBuilder.setTicker(text); mNotificationBuilder.setOngoing(true); mNotificationBuilder.setAutoCancel(false); mNotificationBuilder.setPriority(NotificationCompat.PRIORITY_MAX); mNotificationManager.notify(NOTIFICATION_ID, mNotificationBuilder.build()); boolean deleteUpdate = pref.getBoolean(Constants.PREF_AUTO_DELETE_UPDATES, true); Loading
src/org/lineageos/updater/misc/Utils.java +5 −3 Original line number Diff line number Diff line Loading @@ -494,9 +494,11 @@ public class Utils { public static void removeInstalledUpdate(Context context) { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); String downloadId = pref.getString(Constants.PREF_NEEDS_DELETE_ID, null); if (downloadId != null) { UpdaterController controller = UpdaterController.getInstance(context); if (controller != null && downloadId != null) { if (controller != null) { controller.deleteUpdate(downloadId); } pref.edit().remove(Constants.PREF_NEEDS_DELETE_ID).apply(); } } Loading