From 5cfc6d134e49f0d324860dc2de3786eba98b75c1 Mon Sep 17 00:00:00 2001 From: dev-12 Date: Tue, 23 Dec 2025 13:28:42 +0530 Subject: [PATCH 1/4] fix: throw error if downloaded file doesn't exit before installing --- .../e/apps/data/install/AppManagerImpl.kt | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/data/install/AppManagerImpl.kt b/app/src/main/java/foundation/e/apps/data/install/AppManagerImpl.kt index 5bfb81e8b..8cad8e494 100644 --- a/app/src/main/java/foundation/e/apps/data/install/AppManagerImpl.kt +++ b/app/src/main/java/foundation/e/apps/data/install/AppManagerImpl.kt @@ -136,16 +136,22 @@ class AppManagerImpl @Inject constructor( parentPathFile.listFiles()?.let { list.addAll(it) } list.sort() - if (list.size != 0) { - try { - Timber.i("installApp: STARTED ${appInstall.name} ${list.size}") - appLoungePackageManager.installApplication(list, appInstall.packageName) - Timber.i("installApp: ENDED ${appInstall.name} ${list.size}") - } catch (e: Exception) { - Timber.i(">>> installApp app failed ") - installationIssue(appInstall) - throw e - } + if (list.isEmpty()) { + installationIssue(appInstall) + val errorMessage = + "installApp: error downloaded files doesn't exit for package ${appInstall.packageName} " + Timber.e(errorMessage) + throw IllegalStateException(errorMessage) + } + + try { + Timber.i("installApp: STARTED ${appInstall.name} ${list.size}") + appLoungePackageManager.installApplication(list, appInstall.packageName) + Timber.i("installApp: ENDED ${appInstall.name} ${list.size}") + } catch (e: Exception) { + Timber.i(">>> installApp app failed ") + installationIssue(appInstall) + throw e } } else -> { -- GitLab From a328a7d0521a070fdd067ab311425011c7038ab2 Mon Sep 17 00:00:00 2001 From: dev-12 Date: Thu, 25 Dec 2025 21:37:58 +0530 Subject: [PATCH 2/4] refactor: rename `installationIssue` to `reportInstallationIssue` --- .../main/java/foundation/e/apps/data/install/AppManager.kt | 2 +- .../java/foundation/e/apps/data/install/AppManagerImpl.kt | 6 +++--- .../foundation/e/apps/data/install/AppManagerWrapper.kt | 2 +- .../java/foundation/e/apps/fusedManager/FakeAppManager.kt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/data/install/AppManager.kt b/app/src/main/java/foundation/e/apps/data/install/AppManager.kt index a37de7778..d299b4227 100644 --- a/app/src/main/java/foundation/e/apps/data/install/AppManager.kt +++ b/app/src/main/java/foundation/e/apps/data/install/AppManager.kt @@ -60,7 +60,7 @@ interface AppManager { fun moveOBBFilesToOBBDirectory(appInstall: AppInstall) fun getBaseApkPath(appInstall: AppInstall): String - suspend fun installationIssue(appInstall: AppInstall) + suspend fun reportInstallationIssue(appInstall: AppInstall) suspend fun updateAwaiting(appInstall: AppInstall) diff --git a/app/src/main/java/foundation/e/apps/data/install/AppManagerImpl.kt b/app/src/main/java/foundation/e/apps/data/install/AppManagerImpl.kt index 8cad8e494..5a25c9198 100644 --- a/app/src/main/java/foundation/e/apps/data/install/AppManagerImpl.kt +++ b/app/src/main/java/foundation/e/apps/data/install/AppManagerImpl.kt @@ -137,7 +137,7 @@ class AppManagerImpl @Inject constructor( list.sort() if (list.isEmpty()) { - installationIssue(appInstall) + reportInstallationIssue(appInstall) val errorMessage = "installApp: error downloaded files doesn't exit for package ${appInstall.packageName} " Timber.e(errorMessage) @@ -150,7 +150,7 @@ class AppManagerImpl @Inject constructor( Timber.i("installApp: ENDED ${appInstall.name} ${list.size}") } catch (e: Exception) { Timber.i(">>> installApp app failed ") - installationIssue(appInstall) + reportInstallationIssue(appInstall) throw e } } @@ -279,7 +279,7 @@ class AppManagerImpl @Inject constructor( override fun getBaseApkPath(appInstall: AppInstall) = "$cacheDir/${appInstall.packageName}/${appInstall.packageName}_1.apk" - override suspend fun installationIssue(appInstall: AppInstall) { + override suspend fun reportInstallationIssue(appInstall: AppInstall) { appInstall.status = Status.INSTALLATION_ISSUE appInstallRepository.updateDownload(appInstall) flushOldDownload(appInstall.packageName) diff --git a/app/src/main/java/foundation/e/apps/data/install/AppManagerWrapper.kt b/app/src/main/java/foundation/e/apps/data/install/AppManagerWrapper.kt index fd82ddfd4..44b8f90da 100644 --- a/app/src/main/java/foundation/e/apps/data/install/AppManagerWrapper.kt +++ b/app/src/main/java/foundation/e/apps/data/install/AppManagerWrapper.kt @@ -87,7 +87,7 @@ class AppManagerWrapper @Inject constructor( } suspend fun installationIssue(appInstall: AppInstall) { - return appManager.installationIssue(appInstall) + return appManager.reportInstallationIssue(appInstall) } suspend fun updateAwaiting(appInstall: AppInstall) { diff --git a/app/src/test/java/foundation/e/apps/fusedManager/FakeAppManager.kt b/app/src/test/java/foundation/e/apps/fusedManager/FakeAppManager.kt index 20abb9f03..c2613295b 100644 --- a/app/src/test/java/foundation/e/apps/fusedManager/FakeAppManager.kt +++ b/app/src/test/java/foundation/e/apps/fusedManager/FakeAppManager.kt @@ -96,7 +96,7 @@ class FakeAppManager(private val appInstallDAO: AppInstallDAO) : AppManager { return "root/data/apps/${appInstall.packageName}/${appInstall.packageName}_1.apk" } - override suspend fun installationIssue(appInstall: AppInstall) { + override suspend fun reportInstallationIssue(appInstall: AppInstall) { TODO("Not yet implemented") } -- GitLab From 5046e9c80cdd62b233e375e956b494ab4f87f689 Mon Sep 17 00:00:00 2001 From: dev-12 Date: Thu, 25 Dec 2025 21:40:44 +0530 Subject: [PATCH 3/4] refactor: push logs in debug channel instead of info --- .../java/foundation/e/apps/data/install/AppManagerImpl.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/data/install/AppManagerImpl.kt b/app/src/main/java/foundation/e/apps/data/install/AppManagerImpl.kt index 5a25c9198..0b0015d05 100644 --- a/app/src/main/java/foundation/e/apps/data/install/AppManagerImpl.kt +++ b/app/src/main/java/foundation/e/apps/data/install/AppManagerImpl.kt @@ -145,11 +145,11 @@ class AppManagerImpl @Inject constructor( } try { - Timber.i("installApp: STARTED ${appInstall.name} ${list.size}") + Timber.d("installApp: STARTED ${appInstall.name} ${list.size}") appLoungePackageManager.installApplication(list, appInstall.packageName) - Timber.i("installApp: ENDED ${appInstall.name} ${list.size}") + Timber.d("installApp: ENDED ${appInstall.name} ${list.size}") } catch (e: Exception) { - Timber.i(">>> installApp app failed ") + Timber.e(">>> installApp app failed ${e.localizedMessage}") reportInstallationIssue(appInstall) throw e } -- GitLab From 9cc30ae439eec65264ee694ef07f0f83e10520c6 Mon Sep 17 00:00:00 2001 From: dev-12 Date: Thu, 25 Dec 2025 21:42:23 +0530 Subject: [PATCH 4/4] refactor: typo fixes --- .../main/java/foundation/e/apps/data/install/AppManagerImpl.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/apps/data/install/AppManagerImpl.kt b/app/src/main/java/foundation/e/apps/data/install/AppManagerImpl.kt index 0b0015d05..3e4475293 100644 --- a/app/src/main/java/foundation/e/apps/data/install/AppManagerImpl.kt +++ b/app/src/main/java/foundation/e/apps/data/install/AppManagerImpl.kt @@ -139,7 +139,7 @@ class AppManagerImpl @Inject constructor( if (list.isEmpty()) { reportInstallationIssue(appInstall) val errorMessage = - "installApp: error downloaded files doesn't exit for package ${appInstall.packageName} " + "installApp: Downloaded files doesn't exist for package ${appInstall.packageName} " Timber.e(errorMessage) throw IllegalStateException(errorMessage) } -- GitLab