am 29d4484d: am e771f3a6: am ddd75cb1: Merge "Fix NPE when showing Toast from system process." into jb-mr1.1-dev

* commit '29d4484dd822d7781da4170f907b8a020eb3e1d0':
  Fix NPE when showing Toast from system process.
This commit is contained in:
Craig Mautner
2012-12-06 23:22:05 -08:00
committed by Android Git Automerger

View File

@@ -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();