title: Why in this code PermissionInfo.name is returning null
body: <p>I was trying to get all the package names of apps requesting permission SYSTEM_ALERT_WINDOW and add them to an ArrayList but it's returning null, I am new here. Here is my code.</p>
  
  <pre><code>//Initialize array list
      aList = new ArrayList&lt;String&gt;();
      //get packagemanager from activity
      PackageManager pm = getPackageManager();
      //get list of installed packages from package manager
      List&lt;PackageInfo&gt; info = pm.getInstalledPackages(PackageManager.GET_PERMISSIONS);
      //itirate for each package
      for(PackageInfo packageInfo : info) {
          //get array of PermissionInfo of each package once
          PermissionInfo[] permissionInfo = packageInfo.permissions;
              //check if array is not null
              if(permissionInfo!=null){
                  //itirate for each permission
                  for(PermissionInfo aPermission : permissionInfo) {
                      //check if a permission contains this string
                      if(aPermission.name.contains("SYSTEM_ALERT_WINDOW")) {
                          //if yes then add package name to drawers
                          aList.add(packageInfo.packageName);
                      }
                  }
              }
      }
  </code></pre>
  
  <p>Can someone plz tell me what's going wrong?</p>