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

Commit 3dcc4ea9 authored by Sunny Goyal's avatar Sunny Goyal Committed by Evelyn Torres
Browse files

Handle exceptions from querying appinfo in RemoteViews#addAppWidget.

Host process may not have access to the ApplicationInfo directly in some cases

Bug: 395168279
Test: Manual
Flag: EXEMPT bugfix
(cherry picked from commit 37bf5823)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:74decaab6437094783853b531a5c6538cce8f58f)
Merged-In: Ic26d63acea5f227b56d44bc2e417f7b189f0d2f2
Change-Id: Ic26d63acea5f227b56d44bc2e417f7b189f0d2f2
parent 5d597c81
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -6005,13 +6005,17 @@ public class RemoteViews implements Parcelable, Filter {
                    && context.getPackageName().equals(mApplication.packageName)) {
                return context;
            }
            try {
                ApplicationInfo sanitizedApplication = mApplication;
                try {
                    // Use PackageManager as the source of truth for application information, rather
                    // than the parceled ApplicationInfo provided by the app.
                ApplicationInfo sanitizedApplication =
                        context.getPackageManager().getApplicationInfoAsUser(
                                mApplication.packageName, 0,
                                UserHandle.getUserId(mApplication.uid));
                    sanitizedApplication = context.getPackageManager().getApplicationInfoAsUser(
                        mApplication.packageName, 0, UserHandle.getUserId(mApplication.uid));
                } catch(SecurityException se) {
                    Log.d(LOG_TAG, "Unable to fetch appInfo for " + mApplication.packageName);
                }

                Context applicationContext = context.createApplicationContext(
                        sanitizedApplication,
                        Context.CONTEXT_RESTRICTED);