com.crashlytics.tools.android_2.1.0

or
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.android.sdklib.internal.repository;

import com.android.util.Pair;
import java.util.Properties;
import org.w3c.dom.Node;

public class LayoutlibVersionMixin
  implements ILayoutlibVersion
{
  private final Pair<Integer, Integer> mLayoutlibVersion;
  
  public LayoutlibVersionMixin(Node paramNode)
  {
    int i = 0;
    int j = 0;
    
    Node localNode = XmlParserUtils.getFirstChild(paramNode, "layoutlib");
    if (localNode != null)
    {
      i = XmlParserUtils.getXmlInt(localNode, "api", 0);
      j = XmlParserUtils.getXmlInt(localNode, "revision", 0);
    }
    mLayoutlibVersion = Pair.of(Integer.valueOf(i), Integer.valueOf(j));
  }
  
  public LayoutlibVersionMixin(Properties paramProperties)
  {
    int i = Integer.parseInt(Package.getProperty(paramProperties, "Layoutlib.Api", Integer.toString(0)));
    
    int j = Integer.parseInt(Package.getProperty(paramProperties, "Layoutlib.Revision", Integer.toString(0)));
    
    mLayoutlibVersion = Pair.of(Integer.valueOf(i), Integer.valueOf(j));
  }
  
  void saveProperties(Properties paramProperties)
  {
    if (((Integer)mLayoutlibVersion.getFirst()).intValue() != 0)
    {
      paramProperties.setProperty("Layoutlib.Api", ((Integer)mLayoutlibVersion.getFirst()).toString());
      paramProperties.setProperty("Layoutlib.Revision", ((Integer)mLayoutlibVersion.getSecond()).toString());
    }
  }
  
  public Pair<Integer, Integer> getLayoutlibVersion()
  {
    return mLayoutlibVersion;
  }
  
  public int hashCode()
  {
    int i = 1;
    i = 31 * i + (mLayoutlibVersion == null ? 0 : mLayoutlibVersion.hashCode());
    return i;
  }
  
  public boolean equals(Object paramObject)
  {
    if (this == paramObject) {
      return true;
    }
    if (paramObject == null) {
      return false;
    }
    if (!(paramObject instanceof LayoutlibVersionMixin)) {
      return false;
    }
    LayoutlibVersionMixin localLayoutlibVersionMixin = (LayoutlibVersionMixin)paramObject;
    if (mLayoutlibVersion == null)
    {
      if (mLayoutlibVersion != null) {
        return false;
      }
    }
    else if (!mLayoutlibVersion.equals(mLayoutlibVersion)) {
      return false;
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     com.android.sdklib.internal.repository.LayoutlibVersionMixin
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.android.sdklib.internal.repository;

import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.ISdkLog;
import com.android.sdklib.ISystemImage;
import com.android.sdklib.ISystemImage.LocationType;
import com.android.sdklib.SdkConstants;
import com.android.sdklib.SdkManager;
import com.android.util.Pair;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.Properties;

public class LocalSdkParser
{
  private Package[] mPackages;
  public static final int PARSE_ALL = 65535;
  public static final int PARSE_TOOLS = 1;
  public static final int PARSE_PLATFORM_TOOLS = 2;
  public static final int PARSE_DOCS = 4;
  public static final int PARSE_PLATFORMS = 16;
  public static final int PARSE_ADDONS = 32;
  public static final int PARSE_SAMPLES = 256;
  public static final int PARSE_SOURCES = 512;
  public static final int PARSE_EXTRAS = 1024;
  
  public Package[] getPackages()
  {
    return mPackages;
  }
  
  public void clearPackages()
  {
    mPackages = null;
  }
  
  public Package[] parseSdk(String paramString, SdkManager paramSdkManager, ITaskMonitor paramITaskMonitor)
  {
    return parseSdk(paramString, paramSdkManager, 65535, paramITaskMonitor);
  }
  
  public Package[] parseSdk(String paramString, SdkManager paramSdkManager, int paramInt, ITaskMonitor paramITaskMonitor)
  {
    ArrayList localArrayList = new ArrayList();
    HashSet localHashSet = new HashSet();
    
    paramITaskMonitor.setProgressMax(10);
    
    File localFile1 = null;
    Package localPackage1 = null;
    if ((paramInt & 0x4) != 0)
    {
      localFile1 = new File(paramString, "docs");
      localPackage1 = scanDoc(localFile1, paramITaskMonitor);
      if (localPackage1 != null)
      {
        localArrayList.add(localPackage1);
        localHashSet.add(localFile1);
      }
    }
    paramITaskMonitor.incProgress(1);
    if ((paramInt & 0x1) != 0)
    {
      localFile1 = new File(paramString, "tools");
      localPackage1 = scanTools(localFile1, paramITaskMonitor);
      if (localPackage1 != null)
      {
        localArrayList.add(localPackage1);
        localHashSet.add(localFile1);
      }
    }
    paramITaskMonitor.incProgress(1);
    if ((paramInt & 0x2) != 0)
    {
      localFile1 = new File(paramString, "platform-tools");
      localPackage1 = scanPlatformTools(localFile1, paramITaskMonitor);
      if (localPackage1 != null)
      {
        localArrayList.add(localPackage1);
        localHashSet.add(localFile1);
      }
    }
    paramITaskMonitor.incProgress(1);
    if ((paramInt & 0x30) != 0)
    {
      File localFile2 = new File(paramString, "samples");
      for (IAndroidTarget localIAndroidTarget : paramSdkManager.getTargets())
      {
        Properties localProperties1 = parseProperties(new File(localIAndroidTarget.getLocation(), "source.properties"));
        try
        {
          localPackage1 = null;
          Object localObject1;
          if ((localIAndroidTarget.isPlatform()) && ((paramInt & 0x10) != 0))
          {
            localPackage1 = PlatformPackage.create(localIAndroidTarget, localProperties1);
            if (localFile2.isDirectory())
            {
              localObject1 = new File(localIAndroidTarget.getPath(4));
              if ((((File)localObject1).exists()) && (((File)localObject1).getParentFile().equals(localFile2)))
              {
                Properties localProperties2 = parseProperties(new File((File)localObject1, "source.properties"));
                if (localProperties2 != null)
                {
                  Package localPackage2 = SamplePackage.create(localIAndroidTarget, localProperties2);
                  localArrayList.add(localPackage2);
                }
                localHashSet.add(localObject1);
              }
            }
          }
          else if ((paramInt & 0x20) != 0)
          {
            localPackage1 = AddonPackage.create(localIAndroidTarget, localProperties1);
          }
          if (localPackage1 != null) {
            for (Object localObject2 : localIAndroidTarget.getSystemImages()) {
              if (((ISystemImage)localObject2).getLocationType() == ISystemImage.LocationType.IN_SYSTEM_IMAGE)
              {
                File localFile3 = ((ISystemImage)localObject2).getLocation();
                if (localFile3.isDirectory())
                {
                  Properties localProperties3 = parseProperties(new File(localFile3, "source.properties"));
                  
                  SystemImagePackage localSystemImagePackage = new SystemImagePackage(localIAndroidTarget.getVersion(), 0, ((ISystemImage)localObject2).getAbiType(), localProperties3, localFile3.getAbsolutePath());
                  
                  localArrayList.add(localSystemImagePackage);
                  localHashSet.add(localFile3);
                }
              }
            }
          }
        }
        catch (Exception localException)
        {
          paramITaskMonitor.error(localException, null, new Object[0]);
        }
        if (localPackage1 != null)
        {
          localArrayList.add(localPackage1);
          localHashSet.add(new File(localIAndroidTarget.getLocation()));
        }
      }
    }
    paramITaskMonitor.incProgress(1);
    if ((paramInt & 0x10) != 0) {
      scanMissingSystemImages(paramSdkManager, localHashSet, localArrayList, paramITaskMonitor);
    }
    paramITaskMonitor.incProgress(1);
    if ((paramInt & 0x20) != 0) {
      scanMissingAddons(paramSdkManager, localHashSet, localArrayList, paramITaskMonitor);
    }
    paramITaskMonitor.incProgress(1);
    if ((paramInt & 0x100) != 0) {
      scanMissingSamples(paramSdkManager, localHashSet, localArrayList, paramITaskMonitor);
    }
    paramITaskMonitor.incProgress(1);
    if ((paramInt & 0x400) != 0) {
      scanExtras(paramSdkManager, localHashSet, localArrayList, paramITaskMonitor);
    }
    paramITaskMonitor.incProgress(1);
    if ((paramInt & 0x400) != 0) {
      scanExtrasDirectory(paramString, localHashSet, localArrayList, paramITaskMonitor);
    }
    paramITaskMonitor.incProgress(1);
    if ((paramInt & 0x200) != 0) {
      scanSources(paramSdkManager, localHashSet, localArrayList, paramITaskMonitor);
    }
    paramITaskMonitor.incProgress(1);
    
    Collections.sort(localArrayList);
    
    mPackages = ((Package[])localArrayList.toArray(new Package[localArrayList.size()]));
    return mPackages;
  }
  
  private void scanExtras(SdkManager paramSdkManager, HashSet<File> paramHashSet, ArrayList<Package> paramArrayList, ISdkLog paramISdkLog)
  {
    File localFile1 = new File(paramSdkManager.getLocation(), "extras");
    if (!localFile1.isDirectory()) {
      return;
    }
    for (File localFile2 : localFile1.listFiles()) {
      if (localFile2.isDirectory()) {
        scanExtrasDirectory(localFile2.getAbsolutePath(), paramHashSet, paramArrayList, paramISdkLog);
      }
    }
  }
  
  private void scanExtrasDirectory(String paramString, HashSet<File> paramHashSet, ArrayList<Package> paramArrayList, ISdkLog paramISdkLog)
  {
    File localFile1 = new File(paramString);
    if (!localFile1.isDirectory()) {
      return;
    }
    for (File localFile2 : localFile1.listFiles()) {
      if ((localFile2.isDirectory()) && (!paramHashSet.contains(localFile2)))
      {
        Properties localProperties = parseProperties(new File(localFile2, "source.properties"));
        if (localProperties != null) {
          try
          {
            Package localPackage = ExtraPackage.create(null, localProperties, null, localFile2.getName(), 0, null, null, null, Archive.Os.getCurrentOs(), Archive.Arch.getCurrentArch(), localFile2.getPath());
            
            paramArrayList.add(localPackage);
            paramHashSet.add(localFile2);
          }
          catch (Exception localException)
          {
            paramISdkLog.error(localException, null, new Object[0]);
          }
        }
      }
    }
  }
  
  private void scanMissingSamples(SdkManager paramSdkManager, HashSet<File> paramHashSet, ArrayList<Package> paramArrayList, ISdkLog paramISdkLog)
  {
    File localFile1 = new File(paramSdkManager.getLocation());
    localFile1 = new File(localFile1, "samples");
    if (!localFile1.isDirectory()) {
      return;
    }
    for (File localFile2 : localFile1.listFiles()) {
      if ((localFile2.isDirectory()) && (!paramHashSet.contains(localFile2)))
      {
        Properties localProperties = parseProperties(new File(localFile2, "source.properties"));
        if (localProperties != null) {
          try
          {
            Package localPackage = SamplePackage.create(localFile2.getAbsolutePath(), localProperties);
            paramArrayList.add(localPackage);
            paramHashSet.add(localFile2);
          }
          catch (Exception localException)
          {
            paramISdkLog.error(localException, null, new Object[0]);
          }
        }
      }
    }
  }
  
  private void scanMissingAddons(SdkManager paramSdkManager, HashSet<File> paramHashSet, ArrayList<Package> paramArrayList, ISdkLog paramISdkLog)
  {
    File localFile1 = new File(new File(paramSdkManager.getLocation()), "add-ons");
    
    File[] arrayOfFile1 = localFile1.listFiles();
    if (arrayOfFile1 == null) {
      return;
    }
    for (File localFile2 : arrayOfFile1) {
      if ((localFile2.isDirectory()) && (!paramHashSet.contains(localFile2)))
      {
        Pair localPair = SdkManager.parseAddonProperties(localFile2, paramSdkManager.getTargets(), paramISdkLog);
        
        Properties localProperties = parseProperties(new File(localFile2, "source.properties"));
        
        Map localMap = (Map)localPair.getFirst();
        String str = (String)localPair.getSecond();
        try
        {
          Package localPackage = AddonPackage.createBroken(localFile2.getAbsolutePath(), localProperties, localMap, str);
          
          paramArrayList.add(localPackage);
          paramHashSet.add(localFile2);
        }
        catch (Exception localException)
        {
          paramISdkLog.error(localException, null, new Object[0]);
        }
      }
    }
  }
  
  private void scanMissingSystemImages(SdkManager paramSdkManager, HashSet<File> paramHashSet, ArrayList<Package> paramArrayList, ISdkLog paramISdkLog)
  {
    File localFile1 = new File(paramSdkManager.getLocation(), "system-images");
    
    File[] arrayOfFile1 = localFile1.listFiles();
    if (arrayOfFile1 == null) {
      return;
    }
    for (File localFile2 : arrayOfFile1) {
      if ((localFile2.isDirectory()) && (!paramHashSet.contains(localFile2)))
      {
        paramHashSet.add(localFile2);
        
        File[] arrayOfFile3 = localFile2.listFiles();
        if (arrayOfFile3 != null) {
          for (File localFile3 : arrayOfFile3) {
            if ((localFile3.isDirectory()) && (!paramHashSet.contains(localFile3)))
            {
              paramHashSet.add(localFile3);
              
              File[] arrayOfFile5 = localFile3.listFiles();
              if ((arrayOfFile5 != null) && (arrayOfFile5.length > 0))
              {
                Properties localProperties = parseProperties(new File(localFile3, "source.properties"));
                try
                {
                  Package localPackage = SystemImagePackage.createBroken(localFile3, localProperties);
                  paramArrayList.add(localPackage);
                }
                catch (Exception localException)
                {
                  paramISdkLog.error(localException, null, new Object[0]);
                }
              }
            }
          }
        }
      }
    }
  }
  
  private void scanSources(SdkManager paramSdkManager, HashSet<File> paramHashSet, ArrayList<Package> paramArrayList, ISdkLog paramISdkLog)
  {
    File localFile1 = new File(paramSdkManager.getLocation(), "sources");
    
    File[] arrayOfFile1 = localFile1.listFiles();
    if (arrayOfFile1 == null) {
      return;
    }
    for (File localFile2 : arrayOfFile1) {
      if ((localFile2.isDirectory()) && (!paramHashSet.contains(localFile2)))
      {
        paramHashSet.add(localFile2);
        
        File[] arrayOfFile3 = localFile2.listFiles();
        if ((arrayOfFile3 != null) && (arrayOfFile3.length > 0))
        {
          Properties localProperties = parseProperties(new File(localFile2, "source.properties"));
          try
          {
            Package localPackage = SourcePackage.create(localFile2, localProperties);
            paramArrayList.add(localPackage);
          }
          catch (Exception localException)
          {
            paramISdkLog.error(localException, null, new Object[0]);
          }
        }
      }
    }
  }
  
  private Package scanTools(File paramFile, ISdkLog paramISdkLog)
  {
    Properties localProperties = parseProperties(new File(paramFile, "source.properties"));
    
    int i = 0;
    int j = 0;
    String str1 = SdkConstants.androidCmdName().replace(".bat", ".exe");
    String str2 = str1.indexOf('.') == -1 ? null : str1.replace(".exe", ".bat");
    File[] arrayOfFile = paramFile.listFiles();
    if (arrayOfFile != null) {
      for (Object localObject2 : arrayOfFile)
      {
        String str3 = ((File)localObject2).getName();
        if (SdkConstants.FN_EMULATOR.equals(str3)) {
          i = 1;
        }
        if ((str1.equals(str3)) || ((str2 != null) && (str2.equals(str3)))) {
          j = 1;
        }
      }
    }
    if ((j == 0) || (i == 0)) {
      return null;
    }
    try
    {
      return ToolPackage.create(null, localProperties, 0, null, "Tools", null, Archive.Os.getCurrentOs(), Archive.Arch.getCurrentArch(), paramFile.getPath());
    }
    catch (Exception localException)
    {
      paramISdkLog.error(localException, null, new Object[0]);
    }
    return null;
  }
  
  private Package scanPlatformTools(File paramFile, ISdkLog paramISdkLog)
  {
    Properties localProperties = parseProperties(new File(paramFile, "source.properties"));
    if (paramFile.listFiles() == null) {
      return null;
    }
    try
    {
      return PlatformToolPackage.create(null, localProperties, 0, null, "Platform Tools", null, Archive.Os.getCurrentOs(), Archive.Arch.getCurrentArch(), paramFile.getPath());
    }
    catch (Exception localException)
    {
      paramISdkLog.error(localException, null, new Object[0]);
    }
    return null;
  }
  
  private Package scanDoc(File paramFile, ISdkLog paramISdkLog)
  {
    Properties localProperties = parseProperties(new File(paramFile, "source.properties"));
    if (new File(paramFile, "index.html").isFile()) {
      try
      {
        return DocPackage.create(null, localProperties, 0, null, 0, null, null, null, Archive.Os.getCurrentOs(), Archive.Arch.getCurrentArch(), paramFile.getPath());
      }
      catch (Exception localException)
      {
        paramISdkLog.error(localException, null, new Object[0]);
      }
    }
    return null;
  }
  
  private Properties parseProperties(File paramFile)
  {
    FileInputStream localFileInputStream = null;
    try
    {
      if (paramFile.exists())
      {
        localFileInputStream = new FileInputStream(paramFile);
        
        Properties localProperties1 = new Properties();
        localProperties1.load(localFileInputStream);
        if (localProperties1.size() > 0) {
          return localProperties1;
        }
      }
      return null;
    }
    catch (IOException localIOException2)
    {
      localIOException2.printStackTrace();
    }
    finally
    {
      if (localFileInputStream != null) {
        try
        {
          localFileInputStream.close();
        }
        catch (IOException localIOException5) {}
      }
    }
  }
}

/* Location:
 * Qualified Name:     com.android.sdklib.internal.repository.LocalSdkParser
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.android.sdklib.internal.repository;

import java.util.Map;
import java.util.Properties;
import org.w3c.dom.Node;

public abstract class MinToolsPackage
  extends Package
  implements IMinToolsDependency
{
  private final int mMinToolsRevision;
  
  MinToolsPackage(SdkSource paramSdkSource, Node paramNode, String paramString, Map<String, String> paramMap)
  {
    super(paramSdkSource, paramNode, paramString, paramMap);
    
    mMinToolsRevision = XmlParserUtils.getXmlInt(paramNode, "min-tools-rev", 0);
  }
  
  public MinToolsPackage(SdkSource paramSdkSource, Properties paramProperties, int paramInt, String paramString1, String paramString2, String paramString3, Archive.Os paramOs, Archive.Arch paramArch, String paramString4)
  {
    super(paramSdkSource, paramProperties, paramInt, paramString1, paramString2, paramString3, paramOs, paramArch, paramString4);
    
    mMinToolsRevision = Integer.parseInt(getProperty(paramProperties, "Platform.MinToolsRev", Integer.toString(0)));
  }
  
  public int getMinToolsRevision()
  {
    return mMinToolsRevision;
  }
  
  void saveProperties(Properties paramProperties)
  {
    super.saveProperties(paramProperties);
    if (getMinToolsRevision() != 0) {
      paramProperties.setProperty("Platform.MinToolsRev", Integer.toString(getMinToolsRevision()));
    }
  }
  
  public int hashCode()
  {
    int i = super.hashCode();
    i = 31 * i + mMinToolsRevision;
    return i;
  }
  
  public boolean equals(Object paramObject)
  {
    if (this == paramObject) {
      return true;
    }
    if (!super.equals(paramObject)) {
      return false;
    }
    if (!(paramObject instanceof MinToolsPackage)) {
      return false;
    }
    MinToolsPackage localMinToolsPackage = (MinToolsPackage)paramObject;
    if (mMinToolsRevision != mMinToolsRevision) {
      return false;
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     com.android.sdklib.internal.repository.MinToolsPackage
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.android.sdklib.internal.repository;

import com.android.sdklib.ISdkLog;

public class NullTaskMonitor
  implements ITaskMonitor
{
  private final ISdkLog mLog;
  
  public NullTaskMonitor(ISdkLog paramISdkLog)
  {
    mLog = paramISdkLog;
  }
  
  public void setDescription(String paramString, Object... paramVarArgs) {}
  
  public void log(String paramString, Object... paramVarArgs)
  {
    mLog.printf(paramString, paramVarArgs);
  }
  
  public void logError(String paramString, Object... paramVarArgs)
  {
    mLog.error(null, paramString, paramVarArgs);
  }
  
  public void logVerbose(String paramString, Object... paramVarArgs)
  {
    mLog.printf(paramString, paramVarArgs);
  }
  
  public void setProgressMax(int paramInt) {}
  
  public int getProgressMax()
  {
    return 0;
  }
  
  public void incProgress(int paramInt) {}
  
  public int getProgress()
  {
    return 1;
  }
  
  public boolean isCancelRequested()
  {
    return false;
  }
  
  public ITaskMonitor createSubMonitor(int paramInt)
  {
    return this;
  }
  
  public boolean displayPrompt(String paramString1, String paramString2)
  {
    return false;
  }
  
  public UserCredentials displayLoginCredentialsPrompt(String paramString1, String paramString2)
  {
    return null;
  }
  
  public void error(Throwable paramThrowable, String paramString, Object... paramVarArgs)
  {
    mLog.error(paramThrowable, paramString, paramVarArgs);
  }
  
  public void warning(String paramString, Object... paramVarArgs)
  {
    mLog.warning(paramString, paramVarArgs);
  }
  
  public void printf(String paramString, Object... paramVarArgs)
  {
    mLog.printf(paramString, paramVarArgs);
  }
}

/* Location:
 * Qualified Name:     com.android.sdklib.internal.repository.NullTaskMonitor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.android.sdklib.internal.repository;

public enum Package$UpdateInfo
{
  INCOMPATIBLE,  NOT_UPDATE,  UPDATE;
  
  private Package$UpdateInfo() {}
}

/* Location:
 * Qualified Name:     com.android.sdklib.internal.repository.Package.UpdateInfo
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.android.sdklib.internal.repository;

import com.android.sdklib.AndroidVersion;
import com.android.sdklib.SdkConstants;
import com.android.sdklib.SdkManager;
import com.android.sdklib.io.IFileOp;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.util.Properties;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

public abstract class Package
  implements IDescription, Comparable<Package>
{
  private final int mRevision;
  private final String mObsolete;
  private final String mLicense;
  private final String mDescription;
  private final String mDescUrl;
  private final String mReleaseNote;
  private final String mReleaseUrl;
  private final Archive[] mArchives;
  private final SdkSource mSource;
  private static final boolean sUsingUnixPerm = (SdkConstants.CURRENT_PLATFORM == 3) || (SdkConstants.CURRENT_PLATFORM == 1);
  
  public static enum UpdateInfo
  {
    INCOMPATIBLE,  NOT_UPDATE,  UPDATE;
    
    private UpdateInfo() {}
  }
  
  Package(SdkSource paramSdkSource, Node paramNode, String paramString, Map<String, String> paramMap)
  {
    mSource = paramSdkSource;
    mRevision = XmlParserUtils.getXmlInt(paramNode, "revision", 0);
    mDescription = XmlParserUtils.getXmlString(paramNode, "description");
    mDescUrl = XmlParserUtils.getXmlString(paramNode, "desc-url");
    mReleaseNote = XmlParserUtils.getXmlString(paramNode, "release-note");
    mReleaseUrl = XmlParserUtils.getXmlString(paramNode, "release-url");
    mObsolete = XmlParserUtils.getOptionalXmlString(paramNode, "obsolete");
    
    mLicense = parseLicense(paramNode, paramMap);
    mArchives = parseArchives(XmlParserUtils.getFirstChild(paramNode, "archives"));
  }
  
  public Package(SdkSource paramSdkSource, Properties paramProperties, int paramInt, String paramString1, String paramString2, String paramString3, Archive.Os paramOs, Archive.Arch paramArch, String paramString4)
  {
    if (paramString2 == null) {
      paramString2 = "";
    }
    if (paramString3 == null) {
      paramString3 = "";
    }
    mRevision = Integer.parseInt(getProperty(paramProperties, "Pkg.Revision", Integer.toString(paramInt)));
    
    mLicense = getProperty(paramProperties, "Pkg.License", paramString1);
    mDescription = getProperty(paramProperties, "Pkg.Desc", paramString2);
    mDescUrl = getProperty(paramProperties, "Pkg.DescUrl", paramString3);
    mReleaseNote = getProperty(paramProperties, "Pkg.RelNote", "");
    mReleaseUrl = getProperty(paramProperties, "Pkg.RelNoteUrl", "");
    mObsolete = getProperty(paramProperties, "Pkg.Obsolete", null);
    
    String str = getProperty(paramProperties, "Pkg.SourceUrl", null);
    if ((paramProperties != null) && (paramSdkSource == null) && (str != null)) {
      if (((this instanceof AddonPackage)) || (((this instanceof ExtraPackage)) && (str.endsWith("addon.xml")))) {
        paramSdkSource = new SdkAddonSource(str, null);
      } else {
        paramSdkSource = new SdkRepoSource(str, null);
      }
    }
    mSource = paramSdkSource;
    
    assert (paramString4 != null);
    mArchives = initializeArchives(paramProperties, paramOs, paramArch, paramString4);
  }
  
  protected Archive[] initializeArchives(Properties paramProperties, Archive.Os paramOs, Archive.Arch paramArch, String paramString)
  {
    return new Archive[] { new Archive(this, paramProperties, paramOs, paramArch, paramString) };
  }
  
  static String getProperty(Properties paramProperties, String paramString1, String paramString2)
  {
    if (paramProperties == null) {
      return paramString2;
    }
    return paramProperties.getProperty(paramString1, paramString2);
  }
  
  void saveProperties(Properties paramProperties)
  {
    paramProperties.setProperty("Pkg.Revision", Integer.toString(mRevision));
    if ((mLicense != null) && (mLicense.length() > 0)) {
      paramProperties.setProperty("Pkg.License", mLicense);
    }
    if ((mDescription != null) && (mDescription.length() > 0)) {
      paramProperties.setProperty("Pkg.Desc", mDescription);
    }
    if ((mDescUrl != null) && (mDescUrl.length() > 0)) {
      paramProperties.setProperty("Pkg.DescUrl", mDescUrl);
    }
    if ((mReleaseNote != null) && (mReleaseNote.length() > 0)) {
      paramProperties.setProperty("Pkg.RelNote", mReleaseNote);
    }
    if ((mReleaseUrl != null) && (mReleaseUrl.length() > 0)) {
      paramProperties.setProperty("Pkg.RelNoteUrl", mReleaseUrl);
    }
    if (mObsolete != null) {
      paramProperties.setProperty("Pkg.Obsolete", mObsolete);
    }
    if (mSource != null) {
      paramProperties.setProperty("Pkg.SourceUrl", mSource.getUrl());
    }
  }
  
  private String parseLicense(Node paramNode, Map<String, String> paramMap)
  {
    Node localNode1 = XmlParserUtils.getFirstChild(paramNode, "uses-license");
    if (localNode1 != null)
    {
      Node localNode2 = localNode1.getAttributes().getNamedItem("ref");
      if (localNode2 != null)
      {
        String str = localNode2.getNodeValue();
        return (String)paramMap.get(str);
      }
    }
    return null;
  }
  
  private Archive[] parseArchives(Node paramNode)
  {
    ArrayList localArrayList = new ArrayList();
    if (paramNode != null)
    {
      String str = paramNode.getNamespaceURI();
      for (Node localNode = paramNode.getFirstChild(); localNode != null; localNode = localNode.getNextSibling()) {
        if ((localNode.getNodeType() == 1) && (str.equals(localNode.getNamespaceURI())) && ("archive".equals(localNode.getLocalName()))) {
          localArrayList.add(parseArchive(localNode));
        }
      }
    }
    return (Archive[])localArrayList.toArray(new Archive[localArrayList.size()]);
  }
  
  private Archive parseArchive(Node paramNode)
  {
    Archive localArchive = new Archive(this, (Archive.Os)XmlParserUtils.getEnumAttribute(paramNode, "os", Archive.Os.values(), null), (Archive.Arch)XmlParserUtils.getEnumAttribute(paramNode, "arch", Archive.Arch.values(), Archive.Arch.ANY), XmlParserUtils.getXmlString(paramNode, "url"), XmlParserUtils.getXmlLong(paramNode, "size", 0L), XmlParserUtils.getXmlString(paramNode, "checksum"));
    
    return localArchive;
  }
  
  public SdkSource getParentSource()
  {
    return mSource;
  }
  
  public boolean isObsolete()
  {
    return mObsolete != null;
  }
  
  public int getRevision()
  {
    return mRevision;
  }
  
  public String getLicense()
  {
    return mLicense;
  }
  
  public String getDescription()
  {
    return mDescription;
  }
  
  public String getDescUrl()
  {
    return mDescUrl;
  }
  
  public String getReleaseNote()
  {
    return mReleaseNote;
  }
  
  public String getReleaseNoteUrl()
  {
    return mReleaseUrl;
  }
  
  public Archive[] getArchives()
  {
    return mArchives;
  }
  
  public boolean hasArchive(Archive paramArchive)
  {
    for (Archive localArchive : mArchives) {
      if (localArchive == paramArchive) {
        return true;
      }
    }
    return false;
  }
  
  public boolean hasCompatibleArchive()
  {
    for (Archive localArchive : mArchives) {
      if (localArchive.isCompatible()) {
        return true;
      }
    }
    return false;
  }
  
  public abstract String installId();
  
  public String toString()
  {
    String str = getShortDescription();
    if (str != null) {
      return str;
    }
    return super.toString();
  }
  
  public abstract String getListDescription();
  
  public abstract String getShortDescription();
  
  public String getLongDescription()
  {
    StringBuilder localStringBuilder = new StringBuilder();
    
    String str = getDescription();
    if (str != null) {
      localStringBuilder.append(str);
    }
    if (localStringBuilder.length() > 0) {
      localStringBuilder.append("\n");
    }
    localStringBuilder.append(String.format("Revision %1$d%2$s", new Object[] { Integer.valueOf(getRevision()), isObsolete() ? " (Obsolete)" : "" }));
    
    str = getDescUrl();
    if ((str != null) && (str.length() > 0)) {
      localStringBuilder.append(String.format("\n\nMore information at %1$s", new Object[] { str }));
    }
    str = getReleaseNote();
    if ((str != null) && (str.length() > 0)) {
      localStringBuilder.append("\n\nRelease note:\n").append(str);
    }
    str = getReleaseNoteUrl();
    if ((str != null) && (str.length() > 0)) {
      localStringBuilder.append("\nRelease note URL: ").append(str);
    }
    return localStringBuilder.toString();
  }
  
  public boolean isLocal()
  {
    return (mArchives.length == 1) && (mArchives[0].isLocal());
  }
  
  public abstract File getInstallFolder(String paramString, SdkManager paramSdkManager);
  
  public boolean preInstallHook(Archive paramArchive, ITaskMonitor paramITaskMonitor, String paramString, File paramFile)
  {
    return true;
  }
  
  public void postUnzipFileHook(Archive paramArchive, ITaskMonitor paramITaskMonitor, IFileOp paramIFileOp, File paramFile, ZipArchiveEntry paramZipArchiveEntry)
  {
    if ((sUsingUnixPerm) && (paramIFileOp.isFile(paramFile)))
    {
      int i = paramZipArchiveEntry.getUnixMode();
      if ((i & 0x49) != 0) {
        try
        {
          paramIFileOp.setExecutablePermission(paramFile);
        }
        catch (IOException localIOException) {}
      }
    }
  }
  
  public void postInstallHook(Archive paramArchive, ITaskMonitor paramITaskMonitor, File paramFile) {}
  
  public abstract boolean sameItemAs(Package paramPackage);
  
  public UpdateInfo canBeUpdatedBy(Package paramPackage)
  {
    if (paramPackage == null) {
      return UpdateInfo.INCOMPATIBLE;
    }
    if (!sameItemAs(paramPackage)) {
      return UpdateInfo.INCOMPATIBLE;
    }
    if (paramPackage.getRevision() > getRevision()) {
      return UpdateInfo.UPDATE;
    }
    return UpdateInfo.NOT_UPDATE;
  }
  
  public int compareTo(Package paramPackage)
  {
    String str1 = comparisonKey();
    String str2 = paramPackage.comparisonKey();
    
    return str1.compareTo(str2);
  }
  
  protected String comparisonKey()
  {
    StringBuilder localStringBuilder = new StringBuilder();
    
    localStringBuilder.append("t:");
    if ((this instanceof ToolPackage)) {
      localStringBuilder.append(0);
    } else if ((this instanceof PlatformToolPackage)) {
      localStringBuilder.append(1);
    } else if ((this instanceof DocPackage)) {
      localStringBuilder.append(2);
    } else if ((this instanceof PlatformPackage)) {
      localStringBuilder.append(3);
    } else if ((this instanceof SamplePackage)) {
      localStringBuilder.append(4);
    } else if ((this instanceof SystemImagePackage)) {
      localStringBuilder.append(5);
    } else if ((this instanceof AddonPackage)) {
      localStringBuilder.append(6);
    } else {
      localStringBuilder.append(9);
    }
    localStringBuilder.append("|v:");
    if ((this instanceof IPackageVersion))
    {
      AndroidVersion localAndroidVersion = ((IPackageVersion)this).getVersion();
      
      localStringBuilder.append(String.format("%1$04d.%2$d", new Object[] { Integer.valueOf(10000 - localAndroidVersion.getApiLevel()), Integer.valueOf(localAndroidVersion.isPreview() ? 1 : 0) }));
    }
    localStringBuilder.append("|r:");
    localStringBuilder.append(String.format("%1$04d", new Object[] { Integer.valueOf(getRevision()) }));
    
    localStringBuilder.append('|');
    return localStringBuilder.toString();
  }
  
  public int hashCode()
  {
    int i = 1;
    i = 31 * i + Arrays.hashCode(mArchives);
    i = 31 * i + (mObsolete == null ? 0 : mObsolete.hashCode());
    i = 31 * i + mRevision;
    i = 31 * i + (mSource == null ? 0 : mSource.hashCode());
    return i;
  }
  
  public boolean equals(Object paramObject)
  {
    if (this == paramObject) {
      return true;
    }
    if (paramObject == null) {
      return false;
    }
    if (!(paramObject instanceof Package)) {
      return false;
    }
    Package localPackage = (Package)paramObject;
    if (!Arrays.equals(mArchives, mArchives)) {
      return false;
    }
    if (mObsolete == null)
    {
      if (mObsolete != null) {
        return false;
      }
    }
    else if (!mObsolete.equals(mObsolete)) {
      return false;
    }
    if (mRevision != mRevision) {
      return false;
    }
    if (mSource == null)
    {
      if (mSource != null) {
        return false;
      }
    }
    else if (!mSource.equals(mSource)) {
      return false;
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     com.android.sdklib.internal.repository.Package
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.android.sdklib.internal.repository;

import com.android.sdklib.AndroidVersion;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.SdkManager;
import com.android.util.Pair;
import java.io.File;
import java.util.Map;
import java.util.Properties;
import org.w3c.dom.Node;

public class PlatformPackage
  extends MinToolsPackage
  implements IPackageVersion, ILayoutlibVersion
{
  private final AndroidVersion mVersion;
  private final String mVersionName;
  private final String mIncludedAbi;
  private final LayoutlibVersionMixin mLayoutlibVersion;
  
  PlatformPackage(SdkSource paramSdkSource, Node paramNode, String paramString, Map<String, String> paramMap)
  {
    super(paramSdkSource, paramNode, paramString, paramMap);
    
    mVersionName = XmlParserUtils.getXmlString(paramNode, "version");
    
    int i = XmlParserUtils.getXmlInt(paramNode, "api-level", 0);
    String str = XmlParserUtils.getXmlString(paramNode, "codename");
    if (str.length() == 0) {
      str = null;
    }
    mVersion = new AndroidVersion(i, str);
    
    mIncludedAbi = XmlParserUtils.getOptionalXmlString(paramNode, "included-abi");
    
    mLayoutlibVersion = new LayoutlibVersionMixin(paramNode);
  }
  
  static Package create(IAndroidTarget paramIAndroidTarget, Properties paramProperties)
  {
    return new PlatformPackage(paramIAndroidTarget, paramProperties);
  }
  
  protected PlatformPackage(IAndroidTarget paramIAndroidTarget, Properties paramProperties)
  {
    this(null, paramIAndroidTarget, paramProperties);
  }
  
  protected PlatformPackage(SdkSource paramSdkSource, IAndroidTarget paramIAndroidTarget, Properties paramProperties)
  {
    super(paramSdkSource, paramProperties, paramIAndroidTarget.getRevision(), null, paramIAndroidTarget.getDescription(), null, Archive.Os.getCurrentOs(), Archive.Arch.getCurrentArch(), paramIAndroidTarget.getLocation());
    
    mVersion = paramIAndroidTarget.getVersion();
    mVersionName = paramIAndroidTarget.getVersionName();
    mLayoutlibVersion = new LayoutlibVersionMixin(paramProperties);
    mIncludedAbi = (paramProperties == null ? null : paramProperties.getProperty("Platform.Included.Abi"));
  }
  
  void saveProperties(Properties paramProperties)
  {
    super.saveProperties(paramProperties);
    
    mVersion.saveProperties(paramProperties);
    mLayoutlibVersion.saveProperties(paramProperties);
    if (mVersionName != null) {
      paramProperties.setProperty("Platform.Version", mVersionName);
    }
    if (mIncludedAbi != null) {
      paramProperties.setProperty("Platform.Included.Abi", mIncludedAbi);
    }
  }
  
  public String getVersionName()
  {
    return mVersionName;
  }
  
  public AndroidVersion getVersion()
  {
    return mVersion;
  }
  
  public String getIncludedAbi()
  {
    return mIncludedAbi;
  }
  
  public Pair<Integer, Integer> getLayoutlibVersion()
  {
    return mLayoutlibVersion.getLayoutlibVersion();
  }
  
  public String installId()
  {
    return "android-" + mVersion.getApiString();
  }
  
  public String getListDescription()
  {
    String str;
    if (mVersion.isPreview()) {
      str = String.format("SDK Platform Android %1$s Preview%2$s", new Object[] { getVersionName(), isObsolete() ? " (Obsolete)" : "" });
    } else {
      str = String.format("SDK Platform Android %1$s%2$s", new Object[] { getVersionName(), isObsolete() ? " (Obsolete)" : "" });
    }
    return str;
  }
  
  public String getShortDescription()
  {
    String str;
    if (mVersion.isPreview()) {
      str = String.format("SDK Platform Android %1$s Preview, revision %2$s%3$s", new Object[] { getVersionName(), Integer.valueOf(getRevision()), isObsolete() ? " (Obsolete)" : "" });
    } else {
      str = String.format("SDK Platform Android %1$s, API %2$d, revision %3$s%4$s", new Object[] { getVersionName(), Integer.valueOf(mVersion.getApiLevel()), Integer.valueOf(getRevision()), isObsolete() ? " (Obsolete)" : "" });
    }
    return str;
  }
  
  public String getLongDescription()
  {
    String str = getDescription();
    if ((str == null) || (str.length() == 0)) {
      str = getShortDescription();
    }
    if (str.indexOf("revision") == -1) {
      str = str + String.format("\nRevision %1$d%2$s", new Object[] { Integer.valueOf(getRevision()), isObsolete() ? " (Obsolete)" : "" });
    }
    return str;
  }
  
  public File getInstallFolder(String paramString, SdkManager paramSdkManager)
  {
    for (Object localObject2 : paramSdkManager.getTargets()) {
      if ((((IAndroidTarget)localObject2).isPlatform()) && (((IAndroidTarget)localObject2).getVersion().equals(mVersion))) {
        return new File(((IAndroidTarget)localObject2).getLocation());
      }
    }
    ??? = new File(paramStrin
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd