Add checks to detect wrong conditions when creating Applications Bug: 185177290 Test: Boot + monitor logcat Change-Id: Icd9f5e891c7b7fe32ee4144d95dd26139b87d9cf (cherry picked from commit 9b9ee9dc4b8465b351e58f6804f52379e26cb737) Merged-In:Icd9f5e891c7b7fe32ee4144d95dd26139b87d9cf