Merge "Ignore ActivityNotFoundException from app launch" into udc-dev am: 35f9d486a5

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/22347563

Change-Id: I812e4a865730a1d45bde9ae9f500b990e0d0c6d3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-04-10 07:37:18 +00:00
committed by Automerger Merge Worker

View File

@@ -16,6 +16,7 @@
package com.android.settings.spa.app.appinfo
import android.content.ActivityNotFoundException
import android.content.Intent
import android.content.pm.ApplicationInfo
import androidx.compose.material.icons.Icons
@@ -37,6 +38,11 @@ class AppLaunchButton(packageInfoPresenter: PackageInfoPresenter) {
text = context.getString(R.string.launch_instant_app),
imageVector = Icons.Outlined.Launch,
) {
try {
context.startActivityAsUser(intent, app.userHandle)
} catch (_: ActivityNotFoundException) {
// Only happens after package changes like uninstall, and before page auto refresh or
// close, so ignore this exception is safe.
}
}
}