Fix crash of PictureInPictureDetailPreferenceController

PackageManager.getPackageInfoAsUser() will throw DeadObjectException
when the package is too large which is a known issue to PackageManager
but very low priority given resourcing constraints. As per the
PackageManager team suggestion, catch the exception on the app side to
alleviate the impact to the App info page.

Bug: 198861478
Test: manual
Change-Id: I3115cf1b99a305efef192a0dcf3e809eb7903d0a
This commit is contained in:
Yanting Yang
2021-09-23 16:44:42 +08:00
parent 6bd4441314
commit 31d9ec3356

View File

@@ -67,7 +67,9 @@ public class PictureInPictureDetailPreferenceController extends AppInfoPreferenc
try { try {
packageInfoWithActivities = mPackageManager.getPackageInfoAsUser(mPackageName, packageInfoWithActivities = mPackageManager.getPackageInfoAsUser(mPackageName,
PackageManager.GET_ACTIVITIES, UserHandle.myUserId()); PackageManager.GET_ACTIVITIES, UserHandle.myUserId());
} catch (PackageManager.NameNotFoundException e) { } catch (Exception e) {
// Catch Exception to avoid DeadObjectException thrown with binder transaction
// failures, since the explicit request of DeadObjectException has compiler errors.
Log.e(TAG, "Exception while retrieving the package info of " + mPackageName, e); Log.e(TAG, "Exception while retrieving the package info of " + mPackageName, e);
} }