Bug #1111 CTS-Verifier Crash when rotate the DUT.

[root cause  ] Check the wrong permission.
[changes     ] Judge the permission whether it is a runtime permission.
[side effects] No
[self test   ] <board, Test cases summary>:
[reviewers   ] renkang
[change_type ] AOB --> google_original
[tag_product ] common

Change-Id: I17278c0cbf373ba2d193cab902275a15857e0117
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/TestListActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/TestListActivity.java
index 6a96961..807e02a 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/TestListActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/TestListActivity.java
@@ -22,6 +22,7 @@
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.pm.PermissionInfo;
 import android.os.Bundle;
 import android.util.Log;
 import android.view.Menu;
@@ -49,12 +50,22 @@
         super.onCreate(savedInstanceState);
 
         try {
-            PackageInfo packageInfo = getPackageManager().getPackageInfo(
-                  getApplicationInfo().packageName, PackageManager.GET_PERMISSIONS);
+            PackageManager pm = getPackageManager();
+            PackageInfo packageInfo = pm.getPackageInfo(
+                    getApplicationInfo().packageName, PackageManager.GET_PERMISSIONS);
 
             if (packageInfo.requestedPermissions != null) {
                 for (String permission : packageInfo.requestedPermissions) {
                     Log.v(TAG, "Checking permissions for: " + permission);
+                    try {
+                        PermissionInfo info = pm.getPermissionInfo(permission, 0);
+                        if ((info.protectionLevel & PermissionInfo.PROTECTION_DANGEROUS) == 0) {
+                            continue;
+                        }
+                    } catch (NameNotFoundException e) {
+                        Log.v(TAG, "Checking permissions for: " + permission + "not found");
+                        continue;
+                    }
                     if (checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) {
                         requestPermissions(packageInfo.requestedPermissions,
                                 CTS_VERIFIER_PERMISSION_REQUEST);