Exemplo n.º 1
0
 Set<PackageInfo> getSubPackages(PackageInfo parent) {
   final Set<PackageInfo> subPackages = new HashSet<PackageInfo>();
   for (PackageInfo pkgInfo : packages.values()) {
     if (pkgInfo.getName().startsWith(parent.getName())) {
       subPackages.add(pkgInfo);
     }
   }
   return subPackages;
 }
Exemplo n.º 2
0
 Set<PackageInfo> getRootPackages() {
   final Set<PackageInfo> roots = new HashSet<PackageInfo>();
   for (PackageInfo pkgInfo : packages.values()) {
     if (pkgInfo.isRoot()) {
       roots.add(pkgInfo);
     }
   }
   return roots;
 }
Exemplo n.º 3
0
 // getPackageInfo()
 public PackageInfo getPackageInfo(String packageName, int flags) {
   PackageParser.Package p = mPackages.get(packageName);
   generatePackageInfo(p, flags);
   // PackageInfo generatePackageInfo(PackageParser.Package p, int flags)
   {
     // Everything is already preinstalled in PackageParser.Package
     PackageParser.generatePackageInfo(p, null, flags, 0, 0);
     // frameworks/base/core/java/android/content/pm/PackageParser.java
     // public static PackageInfo generatePackageInfo(PackageParser.Package p,
     //      int gids[], int flags, long firstInstallTime, long lastUpdateTime)
     {
       PackageInfo pi = new PackageInfo();
       pi.signatures = new Signature[N];
       System.arraycopy(p.mSignatures, 0, pi.signatures, 0, N);
     } // PackageParser.generatePackageInfo()
   } // getPackageInfo()
 } // PackageManagerService.getPackageInfo()
Exemplo n.º 4
0
  /** Looks to the default plug-in directory location to initialize this store */
  public void initializeOrUpdateStore() {

    try {
      List<PackageInfo> list = PackageInfoPeerClassFinder.findPackageInfo();
      for (PackageInfo pi : list) {
        for (String className : pi.getClassList()) {

          try {
            // If we don't have the class
            Class<?> o = Class.forName(className);
            if (o == null) {
              throw new Exception("Class not available");
            }
          } catch (NoClassDefFoundError ncdfe) {
            // By Design: gobbling up this error to reduce the
            // non-needed noise upon startup. If there is a real
            // issue, then it will bubble up somewhere else.
          } catch (Exception e) {
            // Explicitly load classes from packages that have
            // package-info
            try {
              ClassLoader.getSystemClassLoader().loadClass(className);
            } catch (java.lang.NoClassDefFoundError ncdfe) {
              // By Design: gobbling up this error to reduce the
              // non-needed noise upon startup. If there is a real
              // issue, then it will bubble up somewhere else.
            }
          }

          Package packageItem = Package.getPackage(pi.getName());
          if (null != packageItem.getAnnotation(MockeyRequestInspector.class)) {
            Class<?> x = doesThisImplementIRequestInspector(className);
            if (x != null && !this.reqInspectorClassNameList.contains(x)) {
              this.reqInspectorClassNameList.add(x);
              logger.debug("Plugin added: " + className);
            }
          }
        }
      }

    } catch (Exception e) {
      logger.error("Found a Mockey.jar, but unable read mockey jar", e);
    }
  }
Exemplo n.º 5
0
  /**
   * Update the layouts tree.
   *
   * @param current The name of the current layout or <CODE>null</CODE> if none.
   */
  public void updateLayouts(Path current) throws PipelineException {
    DefaultMutableTreeNode root = null;
    {
      root = new DefaultMutableTreeNode(new TreeData(), true);

      {
        Path path = new Path(PackageInfo.getSettingsPath(), "layouts");
        rebuildTreeModel(path, new Path("/"), root);
      }

      DefaultTreeModel model = (DefaultTreeModel) pTree.getModel();
      model.setRoot(root);

      {
        Enumeration e = root.depthFirstEnumeration();
        if (e != null) {
          while (e.hasMoreElements()) {
            DefaultMutableTreeNode tnode = (DefaultMutableTreeNode) e.nextElement();
            pTree.expandPath(new TreePath(tnode.getPath()));
          }
        }
      }
    }

    pTree.clearSelection();
    if (current != null) {
      TreePath tpath = null;
      DefaultMutableTreeNode tnode = root;
      for (String comp : current.getComponents()) {
        DefaultMutableTreeNode next = null;
        Enumeration e = tnode.children();
        if (e != null) {
          while (e.hasMoreElements()) {
            DefaultMutableTreeNode child = (DefaultMutableTreeNode) e.nextElement();
            TreeData data = (TreeData) child.getUserObject();
            if (data.toString().equals(comp)) {
              tpath = new TreePath(child.getPath());
              next = child;
              break;
            }
          }
        }

        if (next == null) break;

        tnode = next;
      }

      if (tpath != null) {
        pTree.setSelectionPath(tpath);
        pTree.makeVisible(tpath);
      }
    }
  }
 public void install(String id, int version, String versionName) {
   PackageInfo existing = getPackageInfo(id);
   if (existing != null) {
     existing.versionCode = version;
     existing.versionName = versionName;
   } else {
     PackageInfo p = new PackageInfo();
     p.packageName = id;
     p.versionCode = version;
     p.versionName = versionName;
     info.add(p);
   }
 }