void checkPackageList(String packageName, String restriction,
void checkPackageList(String packageName, final String restriction,
    void checkPackageList(String packageName, String restriction,                        String permission)  {        // Use the toString() hack to do the null check.    Permission p = new RuntimePermission(permission + packageName.toString());        String list = Security.getProperty("package." + restriction);    if (list == null)      return;    while (! "".equals(packageName))      {        for (int index = list.indexOf(packageName);             index != -1; index = list.indexOf(packageName, index + 1))          {                // Exploit package visibility for speed.                int packageNameCount = packageName.length();                if (index + packageNameCount == list.length()                || list.charAt(index + packageNameCount) == ',')              {                    checkPermission(p);                    return;                }            }            int index = packageName.lastIndexOf('.');            packageName = index < 0 ? "" : packageName.substring(0, index);        }    }