Check permissions before creating dynamic shortcuts.

Dynamic shortcuts is initialized before permissions may have been granted so
it needs to check permissions before running queries.

Test
Ran the following:
$ adb shell pm revoke com.android.contacts android.permission.READ_CONTACTS
$ adb shell pm revoke com.android.contacts android.permission.WRITE_CONTACTS
$ adb shell pm revoke com.android.contacts android.permission.GET_ACCOUNTS
$ adb shell pm revoke com.android.contacts android.permission.READ_PHONE_STATE
$ adb shell pm revoke com.android.contacts android.permission.READ_CALL_LOG
$ adb shell pm revoke com.android.contacts android.permission.CALL_PHONE
$ adb shell am instrument -w \
    com.google.android.contacts.tests/android.support.test.runner.AndroidJUnitRunner \
    -e class com.android.contacts.NoPermissionsLaunchSmokeTest

Bug 30189449

Change-Id: I3e7f865559d142c12f3b026a9d6aa2d7e1a1e5f9
5 files changed