Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 901faef9 authored by Hasib Prince's avatar Hasib Prince
Browse files

Merge branch '5713-technical_debt' into 'main'

Removed uncessary delays of install process

See merge request !171
parents 9fae5d2a a085f7a2
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -381,7 +381,7 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) {
                        appSize
                    )
                    Status.UNAVAILABLE -> handleUnavaiable(installButton, fusedApp, downloadPB, appSize)
                    Status.QUEUED, Status.AWAITING -> handleQueued(
                    Status.QUEUED, Status.AWAITING, Status.DOWNLOADED -> handleQueued(
                        installButton,
                        fusedApp,
                        downloadPB,
+1 −1
Original line number Diff line number Diff line
@@ -219,7 +219,7 @@ class ApplicationListRVAdapter(
            Status.UNAVAILABLE -> {
                handleUnavailable(view, searchApp, holder)
            }
            Status.QUEUED, Status.AWAITING, Status.DOWNLOADING -> {
            Status.QUEUED, Status.AWAITING, Status.DOWNLOADING, Status.DOWNLOADED -> {
                handleDownloading(view, searchApp)
            }
            Status.INSTALLING, Status.UNINSTALLING -> {
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ class HomeChildRVAdapter(
                Status.UNAVAILABLE -> {
                    handleUnavailable(homeApp, holder, view)
                }
                Status.QUEUED, Status.AWAITING, Status.DOWNLOADING -> {
                Status.QUEUED, Status.AWAITING, Status.DOWNLOADING, Status.DOWNLOADED -> {
                    handleQueued(view, homeApp)
                }
                Status.INSTALLING, Status.UNINSTALLING -> {
+0 −8
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ import foundation.e.apps.utils.enums.Status
import foundation.e.apps.utils.enums.Type
import foundation.e.apps.utils.modules.PWAManagerModule
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.delay
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import timber.log.Timber
@@ -92,18 +91,14 @@ class FusedManagerImpl @Inject constructor(
    suspend fun updateDownloadStatus(fusedDownload: FusedDownload, status: Status) {
        if (status == Status.INSTALLED) {
            fusedDownload.status = status
            databaseRepository.updateDownload(fusedDownload)
            DownloadManagerBR.downloadedList.clear()
            delay(100)
            flushOldDownload(fusedDownload.packageName)
            databaseRepository.deleteDownload(fusedDownload)
        } else if (status == Status.INSTALLING) {
            fusedDownload.downloadIdMap.all { true }
            fusedDownload.status = status
            databaseRepository.updateDownload(fusedDownload)
            delay(100)
            installApp(fusedDownload)
            delay(100)
        }
    }

@@ -141,7 +136,6 @@ class FusedManagerImpl @Inject constructor(
                Timber.d("Unsupported application type!")
                fusedDownload.status = Status.INSTALLATION_ISSUE
                databaseRepository.updateDownload(fusedDownload)
                delay(100)
            }
        }
    }
@@ -157,7 +151,6 @@ class FusedManagerImpl @Inject constructor(

            // Reset the status before deleting download
            updateDownloadStatus(fusedDownload, fusedDownload.orgStatus)
            delay(100)

            databaseRepository.deleteDownload(fusedDownload)
            flushOldDownload(fusedDownload.packageName)
@@ -199,7 +192,6 @@ class FusedManagerImpl @Inject constructor(
        fusedDownload.status = Status.DOWNLOADING
        databaseRepository.updateDownload(fusedDownload)
        DownloadProgressLD.setDownloadId(-1)
        delay(100)
        fusedDownload.downloadURLList.forEach {
            count += 1
            val packagePath: File = if (fusedDownload.files.isNotEmpty()) {
+10 −1
Original line number Diff line number Diff line
@@ -56,8 +56,17 @@ class InstallerService : Service() {
    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
        val status = intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -69)
        val packageName = intent.getStringExtra(PackageInstaller.EXTRA_PACKAGE_NAME)
        var packageName = intent.getStringExtra(PackageInstaller.EXTRA_PACKAGE_NAME)
        val extra = intent.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE)

        /**
         There is some error case where package name from PackageInstaller remains
         empty (example: INSTALL_PARSE_FAILED_NOT_APK).
         the packageName from PkgManagerModule will be used in this error case.
         */
        val packageNamePackageManagerModule = intent.getStringExtra(PkgManagerModule.PACKAGE_NAME)

        packageName = packageName ?: packageNamePackageManagerModule
        postStatus(status, packageName, extra)
        stopSelf()
        return START_NOT_STICKY
Loading