If the preference dialog gets dismissed on a non-ab-device it still
tries to set performance mode.
Add a check to prevent that and only set performance mode on A/B devices.
Change-Id: I6290eb80550b4cfc8a012f94bdf228af7d4fc416
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
2020-04-03 16:18:18.286 28742-28742/org.lineageos.updater E/WindowManager: android.view.WindowLeaked: Activity org.lineageos.updater.UpdatesActivity has leaked window DecorView@5dd12b3[UpdatesActivity] that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:621)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:377)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:96)
at android.app.Dialog.show(Dialog.java:342)
at androidx.appcompat.app.AlertDialog$Builder.show(AlertDialog.java:1009)
at org.lineageos.updater.UpdatesListAdapter.showInfoDialog(UpdatesListAdapter.java:552)
at org.lineageos.updater.UpdatesListAdapter.lambda$setButtonAction$5$UpdatesListAdapter(UpdatesListAdapter.java:375)
at org.lineageos.updater.-$$Lambda$UpdatesListAdapter$xtQzmsol8pO3BlYZkbKcb5gVAq4.onClick(Unknown Source:2)
at org.lineageos.updater.UpdatesListAdapter.lambda$setButtonAction$9(UpdatesListAdapter.java:408)
at org.lineageos.updater.-$$Lambda$UpdatesListAdapter$M4hRQyNgJseuHrw6EfkhK_yrGK8.onClick(Unknown Source:2)
at android.view.View.performClick(View.java:7259)
at android.view.View.performClickInternal(View.java:7236)
at android.view.View.access$3600(View.java:801)
at android.view.View$PerformClick.run(View.java:27896)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7397)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
Change-Id: I7877b02b8526c7c12331a660a7ac934d02656e6f
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
BatteryManager#BATTERY_PLUGGED_ANY is hidden and actually just
a combination of all public available plugged values.
Recreate the hidden field instead of using it directly.
This unbreaks Android Studio builds.
Change-Id: I4754ce7544dab22306eeac03c3e9f26b650094d2
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
* After moving from the generic /upgrade.html url to a device specific
one, updater needs to display that instead
Change-Id: If9fc6bddfab206a97283f2080ea4df0cbb742a7d
* This replaces auto update check switch with a dropdown with 4 options:
* Never
* Once a day
* Once a week (default)
* Once a month
Change-Id: I4bcae4c013a5d44958f9c54d641e64aac3062a8b
* We are getting permission denial when sending Intent.ACTION_REBOOT
broadcast, using pm.reboot() instead works just fine.
Change-Id: I38d0ad8cc5f4c9362fd5baf7476e14bff56616dd
* After update is complete button is being handled in
handleNotActiveStatus instead of handleActiveStatus.
Change-Id: I6a4df580f93b71fd12e902801125acae668ec991
* Lower default value by 10%
* Decrease the level by another 10% if charging
* Always allow installation in case device doesn't have a battery
* Show the requirements in the alert dialog
Change-Id: Iebb10220612006fbd096eb474cf3034ef52144b3
* We cannot create dialog from service level without
hardcoding theme resource and granting SYSTEM_ALERT_WINDOW
permission therefore we got to move it here.
Change-Id: I70ee5d6c8ef4af4f5c6f29e593b1c20797781017
The recovery doesn't install the update if the remaining battery
capacity isn't at least 20% (or 15% if charging). Require at least
40%, just to be safe.
Change-Id: I5cd7c40f029141cde2b0922b25fece2b55989710
- Don't use BigTextStyle if we only need to show a single line of
text, but keep using it if the progressbar is visible.
- Change the icon to reflect the currrent state.
- Use android.R.drawable instead of com.android.internal.R.drawable
Change-Id: I0f69fe5f4fa63cdec180e89afa098d27819f33fd
This was meant to provide an upgrade path from the old app. It's
been almost a year now, this class is no longer needed.
Change-Id: I17c82e5877b275c5ceb3caefa28066abc170f095
The main activity connects to the service after setting up the local
broadcast. This allows the service to send notification before the
activity is ready, causing null pointer exceptions. This happens for
example rotating the screen while an update is being installed.
Also, replace the existing check on mUpdaterController with a check
on mDownloadsId since the latter depends on the former and both are
required.
Change-Id: I620fd7aa1e90468ab40dfedaa06c23f96f3e6807
The server may temporarily report an incorrect size that is smaller
than the actual size. Content-Length is expected to always be
accurate, but its value does not correspond to the full file size
when resuming downloads. Use Content-Length only if it's bigger
than the currently known size.
Change-Id: I2cc06bfbd2349f21528047b4840f549fbe84964e
Multiple update list downloads can happen simultaneously. Use
unique file names for the temporary jsons to avoid conflicts.
Change-Id: I751c9838394e1f5aebbe359f61532947b429f39b
This allows to delete the update only if the installation succeeded
and to notify the user in case the installation failed.
Since we now need the file in case of failure, create a copy for
uncrypt even if the user chose to delete installed updates.
Change-Id: I80b0f499663bbf50bcbca5f643c01ffdb4cd3957
Menu is not a good place to store preferences that have long strings
Change-Id: I84e782af33b2452c15998f7266c57d681dc8a377
Signed-off-by: Joey <joey@lineageos.org>
Currently the URL is only partially customizable, part of
it is hard-coded and there's no clear indication of it.
Define the entire URL as resource string and use placeholders
for runtime variables.
Also, invalidate old overrides by changing the name of the
resource.
Warning: lineage.updater.uri must be updated accordingly
Change-Id: Iecfdaf9d422d08a707c7319bafea5befc6b757d2
When the installation terminates because of an error, update_engine
sets the status to IDLE and sends a notification. Thus, we might
miss the error report and never update the status of the update.
Change-Id: Ic1536b1c157c4dab0128f039f9512f2fb734287d
This should prevent future changes from accidentally turning a
sticky service into a not sticky one.
Change-Id: I89f172626a98635149441a63536e0aa5a27f8280
The NPE shouldn't happen as we get a null intent only when the
service is sticky (i.e., isInstallingUpdate() is true), so this
is currently not a problem.
Change-Id: I8647498d9a1022f5c7207a2da3e42cf57d9ee030
UpdateEngine doesn't send an initial notification to bound client
if the last status is not known, so clear the preference when we
detect that the device has been rebooted.
Change-Id: Ib15dff5fa8ac9ec07a68018a83683cc561fd3e85
Otherwise the service won't run in foreground after restarting
the app while an update is being installed.
Change-Id: I8a75d206ead2945e7326c144b0b4354fbb2accb4
We are loosely tied to UpdateEngine and have no way to know whether
we are bound or not without keeping track of the connection manually.
Since UpdaterService is for both A/B and legacy updates, turn
ABUpdateInstaller into a singleton to keep the code simple while
ensuring that a single callback is registered.
Change-Id: Ib4e9ad1413ba96bf5ed59cc3383741b5c9bac427
We are referencing the wrong key for deciding whether to delete the
update on reboot.
Change-Id: If83d278259291b61c26302bdd59c2774901b18ca
Signed-off-by: Roman Birg <romanbirg@gmail.com>