Commit Graph

341 Commits

Author SHA1 Message Date
Bartłomiej Rudecki
7d9b6c0c64 Updater: Define foregroundServiceType
Required since Android 14 [1].

11-16 14:05:45.363 20623 20623 E AndroidRuntime: FATAL EXCEPTION: main
11-16 14:05:45.363 20623 20623 E AndroidRuntime: Process: org.lineageos.updater, PID: 20623
11-16 14:05:45.363 20623 20623 E AndroidRuntime: android.app.MissingForegroundServiceTypeException: Starting FGS without a type  callerApp=ProcessRecord{6d14558 20623:org.lineageos.updater/u0a149} targetSDK=34

[1] https://developer.android.com/about/versions/14/changes/fgs-types-required

Change-Id: Id6217424177b94d37621062fb1a55778f1dabbab
2023-11-16 22:11:39 +01:00
LineageOS Infra
0b1821c9dc Automatic translation import
Change-Id: I8615afa7afd004f98d18b482f4fa2e946476bf99
2023-11-15 18:52:18 +00:00
LineageOS Infra
a804504378 Automatic translation import
Change-Id: I02c7f9741ab977fb62b0f652fa84e6011feb7dee
2023-11-01 17:29:18 +00:00
LineageOS Infra
7f43b5b628 Automatic translation import
Change-Id: I9f3ad5b2c365df52d808116fe30ee94ab19686f9
2023-10-15 20:43:22 +00:00
LineageOS Infra
3f365d5feb Automatic translation import
Change-Id: I881449a5def2e3e649cda736c10bd6bf119b84d9
2023-10-01 16:33:00 +00:00
LuK1337
64261f1321 Updater: Use generateBp plugin
Change-Id: Ic5431575b684ee2d416d5707e499f0cf538ce4c4
2023-09-18 13:12:06 +02:00
LineageOS Infra
5c17826dcd Automatic translation import
Change-Id: Icff4f920131242cf530f31231cd3ed9916159d11
2023-09-15 17:53:31 +00:00
LineageOS Infra
919a15e270 Automatic translation import
Change-Id: Idd77531a68e9f28c96dd08bf7beceefbb94d7b0a
2023-09-01 14:42:24 +00:00
Joey
5a212ca159 Updater: add support for local updates
Allow importing and installation of OTA files already
downloaded instead of requiring to reboot to recovery
to install them.

Squash of:
- Add support for importing local updates
  Signed-off-by: Joey <jbevilacqua@shiftphones.com>
  Change-Id: I64ca3a6af29bdf8b2c6023a502f23080a27fd79e
- OTA: read timestamp from imported zip metadata
  Signed-off-by: Joey <jbevilacqua@shiftphones.com>
  Change-Id: I93a5c0be81adab9ba8e50afde0e09839f059c9e0
- OTA: fix UI issues with local update
  Signed-off-by: Joey <jbevilacqua@shiftphones.com>
  Change-Id: I07c8f5507bc52c254c3dc1468fea495a073ae96c
- OTA: fix local updates not being shown in UI (pt.2)
  Signed-off-by: Joey <jbevilacqua@shiftphones.com>
  Change-Id: Ife40eea05099eca9e1ee84c6f87d2715e5981cab
- OTA: ignore download status changes for local updates
  Signed-off-by: Joey <jbevilacqua@shiftphones.com>
  Change-Id: I198f9b5462718f8a6e5687c891f3bfc6b1c645bd
- UpdaterService: fix crash with local install
  Change-Id: I27b187cf4adec986d516e3017d1b3877691029b2
  Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
- Local updates: do not remove local update from ui after installation
  Change-Id: I869e090f26273006f933ad99c42b7c6a2e963797
  Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
- Local updates: modify display version
  Change-Id: I8a39e0936040bb9546499754ab4a9ef60c56aca0
  Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
- Local updates: show build date in import dialog
  Change-Id: I9014358ea1cf941e76fdd80a5147e9d924fc1a8f
  Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>

Change-Id: I64ca3a6af29bdf8b2c6023a502f23080a27fd79e
Signed-off-by: Joey <joey@lineageos.org>
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
2023-08-24 17:57:21 +02:00
LineageOS Infra
5ff552fa43 Automatic translation import
Change-Id: Id05d7c44e5cb5d560ff621ba9a91482925b568e2
2023-07-15 18:08:10 +00:00
Michael W
185b5de51d Updater: Don't show delete twice
* If an update exists and can be deleted, the action button AND the
  popup menu both show the delete action
* By checking wether the action already shows "Delete" we can hide
  that action from the submenu
* Additionally check for online availability to only hide it when it's
  not the last item - otherwise a click on the menu icon wouldn't do
  anything

Change-Id: Idc5da3962be4e0a69847f47b3c5f014b251bd438
2023-07-08 15:23:17 -04:00
Michael W
613fbacdbf Updater: Fix header margin
* Instead of hardcoding it to 86dp (which was probably fine
  when we didn't have cutouts, calculate the required top margin
  by adding top inset and status bar height and applying it dynamically
* Increase compile and min sdk versions to avoid warnings - we compile
  using the build sdk (33) when building inline anyway

Change-Id: I80444e5a2247730f06af461a1cce7ac36c6c9631
2023-07-08 15:23:11 -04:00
Michael W
c3093cb4cc Updater: Align with Settings / Materialize
* Better integrate with Settings by changing the background
  so it matches the Toolbar - one solid background
* Make updates distinct cards with rounded border and
  add spacing between them

Change-Id: If9c649f63e9bb3762f2ae272c96f5e62e0821e46
2023-07-08 15:23:03 -04:00
Michael W
bf1646fa93 Updater: Handle NumberFormatException
* For cases like local Updates (not yet merged) and probably
  others, the parsing might fail and take down the Updater
* Handle NFE properly

Change-Id: If9609c59d1048c9d37aa6de90855e02f28d96ce2
2023-07-08 15:22:56 -04:00
Sebastiano Barezzi
755560bbcd Updater: Redo project structure
* Let's be more Android Studio friendly
* While at it match AOSP deps with Gradle ones and update them

Change-Id: Ib8829e3d954ce43fbf19280d1db2bc43c6fc89e0
2023-07-08 15:22:49 -04:00
LineageOS Infra
ae11300ff0 Automatic translation import
Change-Id: I3609a2dc8eb68bb479f2f101231de03e2b0de9e0
2023-07-01 16:12:33 +00:00
LineageOS Infra
3852db1751 Automatic translation import
Change-Id: Ide309b43c89b7efc78579ccc303b539a90662749
2023-06-20 16:28:32 +00:00
Michael W
1ec0b8d1de Updater: 20 and up are integers!
Not 20.0 but 20!

Change-Id: Iccbcd765ce2be60cef413a73461563569bc7cdc6
2023-06-05 19:19:52 +02:00
LineageOS Infra
0b5e925013 Automatic translation import
Change-Id: Ia202063d4d134323f36a5b494b0019d9f97cffff
2023-06-01 12:49:42 +00:00
althafvly
cdcb51197b Updater: Drop usage of NetworkInfo
- NetworkInfo is deprecated

Change-Id: I433bd5e89080931e9a2fdf1253d8e5f493ea2cbe
2023-05-22 15:05:02 +02:00
Bruno Martins
e32b81fb3a Updater: Check if network is really metered
Instead of assuming so, based on whether user is connected over
a WiFi or Ethernet connection, simply use the proper API.

Use default value of PREF_MOBILE_DATA_WARNING, if it had been
already set.

Change-Id: Ie4fa0301df7f2cebf94c967fc188acc54b2ce71e
Signed-off-by: althafvly <althafvly@gmail.com>
2023-05-22 15:04:54 +02:00
LineageOS Infra
9ddb4f10e0 Automatic translation import
Change-Id: I929cbcac278eca6c2aefc04f3d6e08b75d797f72
2023-05-15 09:16:34 +00:00
LineageOS Infra
85347e77d1 Automatic translation import
Change-Id: Ieaa98bc4483ecafe190dc992667132a2b309ba6d
2023-04-24 08:41:49 +00:00
Tommaso Fonda
bfbc440118 Updater: Show the correct percentage during package installation
Fixes the mismatch between the progress bar's status and the percentage
displayed next to it.

Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/4830
Change-Id: I5c243acda4f06561cbd5b3a73060205b32d8d41d
2023-04-13 17:31:46 +02:00
Michael Bestas
e83f74ace7 Automatic translation import
Change-Id: Id98f9cc0e305b0425364dbb62639b483ad221bf7
2023-03-23 16:39:02 +02:00
Michael Bestas
304b45b3eb Automatic translation import
Change-Id: Ie2fa01b2491be5bed23c1280ed24725fd4f4b4b5
2023-02-13 16:05:54 +02:00
Michael Bestas
468ff36885 Automatic translation import
Change-Id: I08d6cc588245610a901d55d38488b542722ea20a
2023-01-10 04:42:11 +02:00
Michael Bestas
dfe9efc180 Automatic translation import
Change-Id: I56665d5c1bb65b94ef79be87b891b218dffcbbdf
2022-12-16 20:58:10 +02:00
althafvly
79845a7f0b Updater: Move PreferenceManager to AndroidX
Change-Id: I18c1c64652036359adcb47a34a2e565223f59e53
2022-11-28 20:35:23 +05:30
Michael Bestas
baf2238f5b Automatic translation import
Change-Id: Icb46946c7cec9f77b372627a7e2e6d5ca1e1dfad
2022-11-25 15:04:01 +02:00
Dil3mm4
59c5c5ff21 Updater: Add POST_NOTIFICATIONS permission & pre-grant it
Without the permission, Updater can't spawn notifications on
downloads/install

Reference: https://developer.android.com/develop/ui/views/notifications/notification-permission
Test: boot, download an update via updater, check notification drawer
Co-authored-by: Michael Bestas <mkbestas@lineageos.org>
Change-Id: I131c62ae5033f56f8915426f68f7aea76dba78dd
2022-11-15 00:07:09 +01:00
Michael Bestas
cb6281e7f0 Automatic translation import
Change-Id: I9d30d9157184ddde3f1145cac0e4108cebd42008
2022-11-03 20:11:06 +01:00
Michael Bestas
9ff0a26243 Automatic translation import
Change-Id: Icb95ebb843b9f212877e277463ed6ed02e02b2b8
2022-10-05 20:08:46 +03:00
Michael Bestas
8c2d4337b8 Automatic translation import
Change-Id: I88933a49fd3bbfffc6c9c1c45ccaca2779bb75e2
2022-09-22 15:30:24 +03:00
Aaron Kling
257a80e351 Use -television instead of -large-notouch for atv resources
Mobile builds on devices with no touch panel are also getting these
settings applied, which is not intended.

Change-Id: I02fac65dc7042c04259d6f65a957185aac32a252
2022-09-14 05:45:15 +02:00
Michael W
c25d43a9ca Automatic translation import
Change-Id: Ia33b8622d3f16e6d139e6ca63e9f4cc305e427cc
2022-08-15 15:50:00 +02:00
Michael Bestas
580c7ec218 Automatic translation import
Change-Id: I317e8fbd026393a3808915ee5e8beaf81afaee4c
2022-08-04 20:42:39 +03:00
Michael Bestas
b5dca5271f Automatic translation import
Change-Id: I359623d2a73f6f310f277551dfd7716ddd464291
2022-06-20 23:59:13 +03:00
LuK1337
c6d2a1694a Updater: Unbreak "Export update" feature
Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/4736
Change-Id: I186a27d2e99098cf8ebb3dd5c7348cdb528baa78
2022-05-26 00:12:28 +02:00
Aayush Gupta
418d464d14 Updater: Show update's version on AlertDialog and Notification
Currently at most of the places, build version is obtained from BuildInfoUtils.getBuildVersion()
method. This method obtains build version from the current running system's property.

However, in case there is a version bump on OTA, this logic results in wrong version
being shown to the user while updating/upgrading the system.

Get the version from the update itself to show the proper version in update notification
and pre-install warning.

Signed-off-by: Aayush Gupta <theimpulson@e.email>
Change-Id: Ia74085d8d7c067c408e7cfce1de90d49dcc68307
2022-05-23 11:20:45 +05:30
Michael Bestas
55a4e6eb97 Automatic translation import
Change-Id: I44333045e0168a795a1a1a0440c3df71f44c7c7c
2022-05-10 21:58:51 +03:00
Arian
16cb5c2f25 UpdateInstaller: Set file permissions on uncrypt ota package
-----

E RecoverySystemService: Failed to reserve space for compressed apex:
E RecoverySystemService: java.io.FileNotFoundException: /data/lineageos_updates/lineage-19.1-20220422-UNOFFICIAL-GMS-sagit.zip.uncrypt (Permission denied)
E RecoverySystemService: 	at java.util.zip.ZipFile.open(Native Method)
E RecoverySystemService: 	at java.util.zip.ZipFile.<init>(ZipFile.java:265)
E RecoverySystemService: 	at java.util.zip.ZipFile.<init>(ZipFile.java:187)
E RecoverySystemService: 	at java.util.zip.ZipFile.<init>(ZipFile.java:158)
E RecoverySystemService: 	at com.android.server.recoverysystem.RecoverySystemService.getCompressedApexInfoList(RecoverySystemService.java:921)
E RecoverySystemService: 	at com.android.server.recoverysystem.RecoverySystemService.allocateSpaceForUpdate(RecoverySystemService.java:972)
E RecoverySystemService: 	at android.os.IRecoverySystem$Stub.onTransact(IRecoverySystem.java:156)
E RecoverySystemService: 	at android.os.Binder.execTransactInternal(Binder.java:1179)
E RecoverySystemService: 	at android.os.Binder.execTransact(Binder.java:1143)
E UpdateInstaller: Could not install update
E UpdateInstaller: java.io.IOException: Failed to allocate space for update /data/lineageos_updates/lineage-19.1-20220422-UNOFFICIAL-GMS-sagit.zip.uncrypt
E UpdateInstaller: 	at android.os.RecoverySystem.installPackage(RecoverySystem.java:678)
E UpdateInstaller: 	at android.os.RecoverySystem.installPackage(RecoverySystem.java:596)
E UpdateInstaller: 	at org.lineageos.updater.controller.UpdateInstaller.installPackage(UpdateInstaller.java:100)
E UpdateInstaller: 	at org.lineageos.updater.controller.UpdateInstaller.access$400(UpdateInstaller.java:35)
E UpdateInstaller: 	at org.lineageos.updater.controller.UpdateInstaller$1.run(UpdateInstaller.java:144)
E UpdateInstaller: 	at java.lang.Thread.run(Thread.java:920)

Change-Id: I8250bf58709b92572cdffc8e5faca4bf243935aa
2022-04-23 14:46:28 +02:00
Asher Simonds
bbf2442ad4 Updater: Bring in the new icon
* Part of the new iconset made by Asher Simonds

Co-authored-by: Michael W <baddaemon87@gmail.com>
Change-Id: Iead4aaf8fce32418ad86ca58c03c7e86f1067d78
2022-04-06 23:14:45 +02:00
Michael Bestas
6fe0ac8682 Automatic translation import
Change-Id: I4c859e7e41fcbe1cc51fbb3b541e2f092a3d808b
2022-04-03 20:09:01 +03:00
Michael W
1ffe1a80ae Updater: Don't show thousands of days
* When pausing and resuming, the ETA calculation is off by a lot
  due to the time diff since the last calculation resulting in a
  big delta and therefore a very low speed
* By fixing this, we also need to set the last byte count to the total
  byte count there, otherwise the downloaded bytes since last calculation
  will be larger than in reality, resulting in too fast speeds calculated

Change-Id: Ica1053cc297ff59221ea2bc0014f20973a080c88
2022-03-07 14:08:16 +00:00
Michael W
9ad96eca85 Updater: Move progress next to progressbar
Author: Michael W <baddaemon87@gmail.com>
Date:   Fri Feb 11 18:16:02 2022 +0100

    Updater: Move progress next to progressbar

    * The progress text can get very long, resulting in jumping marquee text
    * In order to reduce the length, move the percentage out of the text
      and next to the progressbar
    * The behavior can be observed e.g. on pro1 in german, where the button
      is also wider due to the german text

    Change-Id: I0276182efed757c0929b31434edad9be548b841c

Author: Timi Rautamäki <timi.rautamaki@gmail.com>
Date:   Thu Mar 3 16:12:16 2022 +0000

    fixup! Updater: Move progress next to progressbar

    Fix crash on ATV devices by applying same layout changes to
    layout-large-notouch.

    Change-Id: Id6eabcf8b1960106eb63bd15bcf97f9b4cf0bbc8

Change-Id: I8aed4c35c6ac4261c0536a6b263d63f5b1fd11ba
2022-03-07 14:08:01 +00:00
Alexander Martinz
27f04e5b78 Updater: layout: activity_updates: add spacing between build info and last checked entry
Change-Id: Ie85fecb30ba12b056569049aac674dc1b8653942
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
2022-02-10 20:53:39 +00:00
Alexander Martinz
75497ee48b Updater: Allow starting activities from background
-----

05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: FATAL EXCEPTION: main
05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: Process: com.shiftos.updater, PID: 19707
05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.shiftos.updater/org.lineageos.updater.controller.UpdaterService }: app is in background uid UidRecord{1463ce2 u0a63 TPSL bg:+47m50s26ms idle change:idle procs:1 seq(0,0,0)}
05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: 	at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1616)
05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: 	at android.app.ContextImpl.startService(ContextImpl.java:1571)
05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: 	at android.content.ContextWrapper.startService(ContextWrapper.java:669)
05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: 	at org.lineageos.updater.UpdatesActivity.onStart(UpdatesActivity.java:181)
05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: 	at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1433)
05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: 	at android.app.Activity.performStart(Activity.java:7847)
05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: 	at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3295)
05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: 	at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: 	at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: 	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2017)
05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:107)
05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:214)
05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:7397)
05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
05-06 17:21:58.988 10063 19707 19707 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)

-----

Change-Id: Ibc2d471b028c1d4e824b3ede4bbc336d76801f88
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
2022-02-10 20:53:39 +00:00
Joey
9edea6468c Updater: use consistent format for file sizes
Change-Id: I9a17cf2df69e2e39e90de169ca108511c71d4e31
Signed-off-by: Joey <joey@lineageos.org>
2022-02-10 20:53:39 +00:00
Michael W
d54176ccf7 Updater: Show toast when starting export
* It's not immediately clear that an export is started since the
  notification isn't intrusive
* Show a toast - that will be clear enough

Change-Id: I78d78b23884df3ddb37bc486c1d6012f899c888d
2022-02-10 20:53:39 +00:00