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

Commit 54ae2f38 authored by Craig Mautner's avatar Craig Mautner
Browse files

Fix NPE when showing Toast from system process.

The system process has no ApplicationContext and consequently was
returning null. Use the base Context in these cases.

Bug 7673699 fixed.

Change-Id: Ie2ab856bb0baefff44775a12bef7802320f72656
parent 6c58b155
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -374,8 +374,11 @@ public class Toast {
                // remove the old view if necessary
                handleHide();
                mView = mNextView;
                mWM = (WindowManager)mView.getContext().getApplicationContext()
                        .getSystemService(Context.WINDOW_SERVICE);
                Context context = mView.getContext().getApplicationContext();
                if (context == null) {
                    context = mView.getContext();
                }
                mWM = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
                // We can resolve the Gravity here by using the Locale for getting
                // the layout direction
                final Configuration config = mView.getContext().getResources().getConfiguration();