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

Commit d156c876 authored by Pierre Barbier de Reuille's avatar Pierre Barbier de Reuille
Browse files

Restore the creation of the remote context in sync inflation.

This was mistakenly removed in Android S (in ag/13732454) and could
cause issues if the top-level layout parameters are defined using
resources defined in the AppWidget's package.

Also add some safeguard to avoid crashing if the AppWidgetProviderInfo
doesn't contain a ProviderInfo (which can happen if it's not created by
the system).

Fix: 201744899
Test: Existing CTS tests
Change-Id: Ibb4f2c26a6258ec2c68a7fd1fafe3e5fe3551109
parent b739e834
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -552,6 +552,10 @@ public class AppWidgetHostView extends FrameLayout {
                inflateAsync(rvToApply);
                return;
            }
            // Prepare a local reference to the remote Context so we're ready to
            // inflate any requested LayoutParams.
            mRemoteContext = getRemoteContext();

            int layoutId = rvToApply.getLayoutId();
            if (rvToApply.canRecycleView(mView)) {
                try {
@@ -727,6 +731,9 @@ public class AppWidgetHostView extends FrameLayout {
        } catch (NameNotFoundException e) {
            Log.e(TAG, "Package name " +  mInfo.providerInfo.packageName + " not found");
            return mContext;
        } catch (NullPointerException e) {
            Log.e(TAG, "Error trying to create the remote context.", e);
            return mContext;
        }
    }