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

Commit 37bf5823 authored by Sunny Goyal's avatar Sunny Goyal
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
Change-Id: Ic26d63acea5f227b56d44bc2e417f7b189f0d2f2
Test: Manual
Flag: EXEMPT bugfix
parent b9d34127
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -8564,13 +8564,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);