Skip to content

Commit a437149

Browse files
committed
Split Install: Catch exceptions from callback
1 parent 8bee737 commit a437149

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

vending-app/src/main/kotlin/com/google/android/finsky/splitinstallservice/SplitInstallService.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ class SplitInstallServiceImpl(private val installManager: SplitInstallManager, p
5151
lifecycleScope.launch {
5252
val installStatus = installManager.splitInstallFlow(pkg, splits)
5353
Log.d(TAG, "startInstall: installStatus -> $installStatus")
54-
callback.onStartInstall(CommonStatusCodes.SUCCESS, Bundle())
54+
runCatching { callback.onStartInstall(CommonStatusCodes.SUCCESS, Bundle()) }
5555
}
5656
} else {
5757
Log.w(TAG, "refusing to perform split installation for $pkg as the service is disabled")
58-
callback.onStartInstall(CommonStatusCodes.ERROR, Bundle())
58+
runCatching { callback.onStartInstall(CommonStatusCodes.ERROR, Bundle()) }
5959
}
6060
}
6161

@@ -73,7 +73,7 @@ class SplitInstallServiceImpl(private val installManager: SplitInstallManager, p
7373

7474
override fun getSessionStates(pkg: String, callback: ISplitInstallServiceCallback) {
7575
Log.d(TAG, "Method (getSessionStates) called but not implement by package -> $pkg")
76-
callback.onGetSessionStates(ArrayList<Bundle>(1))
76+
runCatching { callback.onGetSessionStates(ArrayList<Bundle>(1)) }
7777
}
7878

7979
override fun splitRemoval(pkg: String, splits: List<Bundle>, callback: ISplitInstallServiceCallback) {
@@ -82,7 +82,7 @@ class SplitInstallServiceImpl(private val installManager: SplitInstallManager, p
8282

8383
override fun splitDeferred(pkg: String, splits: List<Bundle>, bundle0: Bundle, callback: ISplitInstallServiceCallback) {
8484
Log.d(TAG, "Method (splitDeferred) called but not implement by package -> $pkg")
85-
callback.onDeferredInstall(Bundle())
85+
runCatching { callback.onDeferredInstall(Bundle()) }
8686
}
8787

8888
override fun getSessionState2(pkg: String, sessionId: Int, callback: ISplitInstallServiceCallback) {

0 commit comments

Comments
 (0)