Commit Graph

470 Commits

Author SHA1 Message Date
Aayush Gupta
859d32d878 AppInstaller: Always use intent based uninstallation of apps
This requests user's confirmation before uninstallation every time which
is what we want to happen as well.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-01-20 15:12:57 +05:30
Aayush Gupta
580717931d DownloadMenuSheet: Add install action
This would be useful for self-updates when they get downloaded but user
isn't automatically installed.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-01-16 18:41:19 +05:30
Aayush Gupta
a3591406b2 Download: change status parameter to downloadStatus
We want an installStatus parameter as well to enqueue installations as well

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-01-16 18:22:46 +05:30
Aayush Gupta
262ee94d84 DownloadFragment: Avoid capturing download object in listener
This results in their state never being updated when passed to menu fragment.
Store the ongoing downloads in a list and find it when required using the
package name instead.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-01-09 19:42:16 +05:30
Aayush Gupta
8c7377efd6 AppDetailsFragment: Link exodus analysis submission page
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-01-08 21:01:25 +05:30
Aayush Gupta
e23d17e4ac Context: Switch to Intent for share extension
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-01-02 11:32:03 +05:30
Aayush Gupta
25f2b111c2 fixup! UpdatesPreference: Setup auto-updates
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-31 19:37:33 +05:30
Aayush Gupta
f851a5ad3e Improvements to download progress UI
Switch to LinearProgressIndicator where possible and show an indeterminate
progress bar while download progress is below 1%

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-31 15:54:05 +05:30
Aayush Gupta
fe88345734 DownloadWorker: Use appropriate reason for failure on API 31+
Don't show failure notification if download was cancelled by the user
on Android 12+ devices. Sadly the method is not backwards compt nor I
want to spend time on it.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-31 13:18:40 +05:30
Aayush Gupta
7005409010 AuroraApplication: Limit hidden API exemptions to required ones
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-31 12:56:23 +05:30
Aayush Gupta
f84ab072e5 OnboardingFragment: Create required notification channels
No need to keep them in application class anymore now that we have moved
away from services

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-31 12:42:06 +05:30
Aayush Gupta
e66c558f82 Updates: Use appropriate certificate to verify and purchase apps
* Only show updates for devices that has atleast one matching certificate
* On Android 9.0+ devices, purchase apps with latest certificate's hash while updating
  to support key rotations

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-30 12:39:17 +05:30
Aayush Gupta
8f788dc01f UpdatesFragment: Set Update All button's status based on downloads
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-29 19:36:55 +05:30
Aayush Gupta
2b8b1af8d1 view: Drop unused custom views
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-29 19:19:53 +05:30
Aayush Gupta
bc252fae1f DownloadWorker: Create and use scaled bitmap for notification icon
Old android versions get binder transaction errors otherwise. Also move out the
logic to fetch icon into the Worker to avoid fetching it 100 times. Keep the install
logic in place as that method is only called once after installation.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-29 19:13:04 +05:30
Aayush Gupta
4d4429fd7a DownloadWorker: Verify downloaded files using SHA256 or SHA1
This lets us avoid downloading same files again

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-29 00:41:13 +05:30
Aayush Gupta
48b61f1bad InstallActivity: Use SessionInstaller with callback to install apps
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-29 00:41:13 +05:30
Aayush Gupta
96c10df255 DownloadWorkerUtil: Properly collect flow to cancel downloads
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-27 21:15:00 +05:30
Aayush Gupta
87dc309d35 PackageManagerReceiver: Rework package install actions
Notify on package installation and delete the downloaded directory

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-27 21:15:00 +05:30
Aayush Gupta
e0cda7eadf UpdatesFragment: Listen to install & uninstall events
Similar logic as AppDetailsFragment to update list of updates

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-27 21:15:00 +05:30
Aayush Gupta
14c8da2db5 DownloadWorker: Move app installation logic to new onSuccess method
Move app installation logic to onSuccess method in worker under a NonCancellable
context and convert the receiver class to be a generic status handler for anything
except success which should be handled in PackageManagerReceiver.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-27 21:15:00 +05:30
Aayush Gupta
e9080614af Drop dependency upon Fetch2 library
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-27 21:15:00 +05:30
Aayush Gupta
a796c4c381 SelfUpdateWorker: Move self-updates logic into dedicated worker
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-27 21:15:00 +05:30
Aayush Gupta
59309783b1 UpdatesPreference: Setup auto-updates
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-27 21:15:00 +05:30
Aayush Gupta
97b145e2e5 DownloadWorker: Download required shared libs for apps
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-27 21:15:00 +05:30
Aayush Gupta
e915c5060b DownloadWorker: Address race condition on download complete
Sometimes when download gets completed, the progress hasn't been updated which
results in no notification data and downloads showing status as completed with
a progress less than 100%.

Set progress manually to 100% and avoid checking progress in notificationUtil if
download has succeded. Also avoid calling onProgress again if download has finished.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-20 21:07:54 +05:30
Aayush Gupta
691a3c61a4 PathUtil: Switch to File instead of Path class
Path is only available since Android 8.0+ and it makes no sense to
add a dependency upon desugaring lib for it.

Switch to File class instead which is available on all Android versions

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-18 23:28:30 +05:30
Aayush Gupta
cd8c4c1364 DownloadWorker: Use a generic download notification if required
On old android versions, work manager runs expedited jobs using FGS which
seem to require a work notification as soon as the service starts by automatically
calling getForegroundInfo method.

This causes an exception as we haven't parsed the data yet. Use a generic
download notification for such cases.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-18 23:28:30 +05:30
Aayush Gupta
70cfdbafd8 DownloadWorker: Inject Gson's instance using Hilt
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-18 23:28:30 +05:30
Aayush Gupta
8f518d026a fixup! Fix AuroraOSS/AuroraStore#981 allow Sui without Shizuku app
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-18 23:28:30 +05:30
Aayush Gupta
ea0bce8c79 fixup! Import and setup Hilt for dependency injection
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-14 18:26:19 +05:30
Aayush Gupta
c7c35da492 DownloadWorkerUtil: Only trigger downloads if app is in foreground
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-14 18:26:19 +05:30
Aayush Gupta
cc0302cbe9 NotificationUtil: Load app's icon into big icon
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-14 18:26:19 +05:30
Aayush Gupta
c9bf37302e AppUpdateView: Use semi-transparent gray color for showing progress
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-14 18:26:19 +05:30
Aayush Gupta
63c55b8858 UpdatesFragment: Refactor to work with new downloads logic
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-14 18:26:19 +05:30
Aayush Gupta
bd55b157e6 DownloadFragment: Refactor to work with new downloads logic
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-14 18:26:19 +05:30
Aayush Gupta
4c932bd048 DownloadWorkerUtil: Use room database to store downloads
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-14 18:26:18 +05:30
Aayush Gupta
acd2e7a586 MainActivity: Warn users if battery optimizations are enabled
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-14 18:26:18 +05:30
Aayush Gupta
f4226ac9ef AppDetailsFragment: Download apps using DownloadWorker
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-14 18:26:18 +05:30
Aayush Gupta
52686adaba BaseFragment: Inject Gson using Hilt
* Make BaseFragment an abstract class, no reason to keep this open
* This also fixes memory leak that happens after onboarding is finished

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-13 12:23:18 +05:30
Aayush Gupta
7420c96b86 Import and setup Hilt for dependency injection
Considering we will be having a room database instance soon for downloads
and already have tons of other instances everywhere, feels right time to
use Hilt to manage them to avoid more memory leaks.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-13 12:23:18 +05:30
Alexander Georgievskiy
ac595c8232 Fix AuroraOSS/AuroraStore#981 allow Sui without Shizuku app 2023-12-07 12:11:35 +00:00
Aayush Gupta
b2cbc8dc16 DownloadWorker: Move downloads observing logic into worker as well
This allows us to keep all the modifications related to DownloadWorker in a
single place.

Also, drop the 3seconds delay and do the cleanup instead of delegating it to
worker if last job was failed. This is better and more error-proof.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-12-01 20:23:06 +05:30
Aayush Gupta
acecf6b89b DownloadWorker: Ensure ell app downloads are unique works
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-11-29 19:35:30 +05:30
Aayush Gupta
1e75bcbf85 DownloadWorker: Handle cancelling downloads
* Keep results for 7 days atleast
* Cancel download using tag & remove app from download queue
* Tag downloads and updates. This will allow a user to query & cancel all updates or downloads in one click
* Default to cancel all downloads & updates

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-11-29 19:35:16 +05:30
Aayush Gupta
67bd65be94 DownloadWorker: Support downloading OBB and patch files
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-11-29 18:59:17 +05:30
Aayush Gupta
0f4021117f DownloadWorker: Progress improvements
* Handle split apk download progress
* Also share download speed and time remaining

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-11-29 18:59:17 +05:30
Aayush Gupta
5b60758347 InstallReceiver: Notify package installation status as well
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-11-29 18:59:17 +05:30
Aayush Gupta
26c4749047 DownloadWorker: Restrict concurrent downloads to one
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-11-29 18:59:17 +05:30
Aayush Gupta
dcaf4f024a PermissionsFragment: Request users to disable doze during onboarding
* Required for background downloads using WorkManager expedited works

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2023-11-29 18:59:17 +05:30