AI 150264: DO NOT MERGE TO DONUT.
  Manual merge of https://android-git.corp.google.com/g/Gerrit#change,5804 from donut:
  Ensure that we never trigger ArrayIndexOutOfBoundsException by checking that
  the index is always < the array's length. Also ensures that the object's
  state is consistent. Should resolve a denial-of-service bug when handling
  malformed WAP pushes.
  Also add a try-catch around call to dispatchMessage(), in case there are other lurking bugs.  (This is also already in Donut.)

Automated import of CL 150264
2 files changed