summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/apicheck/src/com/android/apicheck/ApiCheck.java1
-rw-r--r--tools/apicheck/src/com/android/apicheck/ApiInfo.java3
-rw-r--r--tools/apicheck/src/com/android/apicheck/ClassInfo.java62
-rw-r--r--tools/droiddoc/templates-pdk/customization.cs20
-rw-r--r--tools/droiddoc/templates-pdk/head_tag.cs6
-rw-r--r--tools/releasetools/amend_generator.py222
-rw-r--r--tools/releasetools/both_generator.py62
-rwxr-xr-xtools/releasetools/ota_from_target_files46
8 files changed, 50 insertions, 372 deletions
diff --git a/tools/apicheck/src/com/android/apicheck/ApiCheck.java b/tools/apicheck/src/com/android/apicheck/ApiCheck.java
index c8272ddd74..b2f22650dc 100644
--- a/tools/apicheck/src/com/android/apicheck/ApiCheck.java
+++ b/tools/apicheck/src/com/android/apicheck/ApiCheck.java
@@ -107,6 +107,7 @@ public class ApiCheck {
xmlreader.parse(new InputSource(fileReader));
ApiInfo apiInfo = handler.getApi();
apiInfo.resolveSuperclasses();
+ apiInfo.resolveInterfaces();
return apiInfo;
} catch (SAXParseException e) {
Errors.error(Errors.PARSE_ERROR,
diff --git a/tools/apicheck/src/com/android/apicheck/ApiInfo.java b/tools/apicheck/src/com/android/apicheck/ApiInfo.java
index c237814552..47b9a15feb 100644
--- a/tools/apicheck/src/com/android/apicheck/ApiInfo.java
+++ b/tools/apicheck/src/com/android/apicheck/ApiInfo.java
@@ -31,14 +31,13 @@ public class ApiInfo {
return mAllClasses.get(name);
}
- private void resolveInterfaces() {
+ public void resolveInterfaces() {
for (ClassInfo c : mAllClasses.values()) {
c.resolveInterfaces(this);
}
}
public boolean isConsistent(ApiInfo otherApi) {
- resolveInterfaces();
boolean consistent = true;
for (PackageInfo pInfo : mPackages.values()) {
if (otherApi.getPackages().containsKey(pInfo.name())) {
diff --git a/tools/apicheck/src/com/android/apicheck/ClassInfo.java b/tools/apicheck/src/com/android/apicheck/ClassInfo.java
index e62a3d0d64..962a316e8f 100644
--- a/tools/apicheck/src/com/android/apicheck/ClassInfo.java
+++ b/tools/apicheck/src/com/android/apicheck/ClassInfo.java
@@ -86,41 +86,35 @@ public class ClassInfo {
return mIsFinal;
}
- // Find a superclass implementation of the given method. Looking at our superclass
- // instead of at 'this' is unusual, but it fits the point-of-call demands well.
- public MethodInfo overriddenMethod(MethodInfo candidate) {
- if (mSuperClass == null) {
+ // Find a superclass implementation of the given method.
+ public static MethodInfo overriddenMethod(MethodInfo candidate, ClassInfo newClassObj) {
+ if (newClassObj == null) {
return null;
}
-
- // does our immediate superclass have it?
- ClassInfo sup = mSuperClass;
- for (MethodInfo mi : sup.mMethods.values()) {
+ for (MethodInfo mi : newClassObj.mMethods.values()) {
if (mi.matches(candidate)) {
// found it
return mi;
}
}
- // no, so recurse
- if (sup.mSuperClass != null) {
- return mSuperClass.overriddenMethod(candidate);
- }
-
- // no parent, so we just don't have it
- return null;
+ // not found here. recursively search ancestors
+ return ClassInfo.overriddenMethod(candidate, newClassObj.mSuperClass);
}
// Find a superinterface declaration of the given method.
- public MethodInfo interfaceMethod(MethodInfo candidate) {
- for (ClassInfo interfaceInfo : mInterfaces) {
+ public static MethodInfo interfaceMethod(MethodInfo candidate, ClassInfo newClassObj) {
+ if (newClassObj == null) {
+ return null;
+ }
+ for (ClassInfo interfaceInfo : newClassObj.mInterfaces) {
for (MethodInfo mi : interfaceInfo.mMethods.values()) {
if (mi.matches(candidate)) {
return mi;
}
}
}
- return (mSuperClass != null) ? mSuperClass.interfaceMethod(candidate) : null;
+ return ClassInfo.interfaceMethod(candidate, newClassObj.mSuperClass);
}
public boolean isConsistent(ClassInfo cl) {
@@ -135,11 +129,7 @@ public class ClassInfo {
consistent = false;
}
for (String iface : mInterfaceNames) {
- boolean found = false;
- for (ClassInfo c = cl; c != null && !found; c = c.mSuperClass) {
- found = c.mInterfaceNames.contains(iface);
- }
- if (!found) {
+ if (!implementsInterface(cl, iface)) {
Errors.error(Errors.REMOVED_INTERFACE, cl.position(),
"Class " + qualifiedName() + " no longer implements " + iface);
}
@@ -163,9 +153,9 @@ public class ClassInfo {
* Check our ancestry to see if there's an inherited version that still
* fulfills the API requirement.
*/
- MethodInfo mi = mInfo.containingClass().overriddenMethod(mInfo);
+ MethodInfo mi = ClassInfo.overriddenMethod(mInfo, cl);
if (mi == null) {
- mi = mInfo.containingClass().interfaceMethod(mInfo);
+ mi = ClassInfo.interfaceMethod(mInfo, cl);
}
if (mi == null) {
Errors.error(Errors.REMOVED_METHOD, mInfo.position(),
@@ -179,7 +169,7 @@ public class ClassInfo {
/* Similarly to the above, do not fail if this "new" method is
* really an override of an existing superclass method.
*/
- MethodInfo mi = mInfo.containingClass().overriddenMethod(mInfo);
+ MethodInfo mi = ClassInfo.overriddenMethod(mInfo, cl);
if (mi == null) {
Errors.error(Errors.ADDED_METHOD, mInfo.position(),
"Added public method " + mInfo.qualifiedName());
@@ -274,6 +264,26 @@ public class ClassInfo {
return consistent;
}
+ /**
+ * Returns true if {@code cl} implements the interface {@code iface} either
+ * by either being that interface, implementing that interface or extending
+ * a type that implements the interface.
+ */
+ private boolean implementsInterface(ClassInfo cl, String iface) {
+ if (cl.qualifiedName().equals(iface)) {
+ return true;
+ }
+ for (ClassInfo clImplements : cl.mInterfaces) {
+ if (implementsInterface(clImplements, iface)) {
+ return true;
+ }
+ }
+ if (cl.mSuperClass != null && implementsInterface(cl.mSuperClass, iface)) {
+ return true;
+ }
+ return false;
+ }
+
public void resolveInterfaces(ApiInfo apiInfo) {
for (String interfaceName : mInterfaceNames) {
mInterfaces.add(apiInfo.findClass(interfaceName));
diff --git a/tools/droiddoc/templates-pdk/customization.cs b/tools/droiddoc/templates-pdk/customization.cs
index 3e9be06f7f..3d80cc8e99 100644
--- a/tools/droiddoc/templates-pdk/customization.cs
+++ b/tools/droiddoc/templates-pdk/customization.cs
@@ -11,7 +11,6 @@ def:custom_masthead() ?>
elif:doc.type == "source" ?>source<?cs
elif:doc.type == "porting" ?>porting<?cs
elif:doc.type == "compatibility" ?>compatibility<?cs
- elif:doc.type == "downloads" ?>downloads<?cs
elif:doc.type == "community" ?>community<?cs
elif:doc.type == "about" ?>about<?cs /if ?>">
<li id="home-link"><a href="<?cs var:toroot ?>index.html"><span>Home</span></a></li>
@@ -23,8 +22,6 @@ def:custom_masthead() ?>
onClick="return loadLast('compatibility')"><span>Compatibility</span></a></li>
<li id="community-link"><a href="<?cs var:toroot ?>community/index.html"
onClick="return loadLast('community')"><span>Community</span></a></li>
- <li id="downloads-link"><a href="<?cs var:toroot ?>downloads/index.html"
- onClick="return loadLast('downloads')"><span>Downloads</span></a></li>
<li id="about-link"><a href="<?cs var:toroot ?>about/index.html"
onClick="return loadLast('about')"><span>About</span></a></li>
</ul>
@@ -102,21 +99,6 @@ def:custom_masthead() ?>
</div>
<?cs /def ?>
-<?cs def:downloads_nav() ?>
- <div class="g-section g-tpl-240" id="body-content">
- <div class="g-unit g-first side-nav-resizable" id="side-nav">
- <div id="devdoc-nav"><?cs
- include:"../../../../development/pdk/docs/downloads/downloads_toc.cs" ?>
- </div>
- </div> <!-- end side-nav -->
- <script>
- addLoadEvent(function() {
- scrollIntoView("devdoc-nav");
- });
- </script>
- </div>
-<?cs /def ?>
-
<?cs def:compatibility_nav() ?>
<div class="g-section g-tpl-240" id="body-content">
<div class="g-unit g-first side-nav-resizable" id="side-nav">
@@ -140,8 +122,6 @@ def:custom_masthead() ?>
<?cs call:porting_nav() ?>
<?cs elif:doc.type == "compatibility" ?>
<?cs call:compatibility_nav() ?>
- <?cs elif:doc.type == "downloads" ?>
- <?cs call:downloads_nav() ?>
<?cs elif:doc.type == "community" ?>
<?cs call:community_nav() ?>
<?cs elif:doc.type == "about" ?>
diff --git a/tools/droiddoc/templates-pdk/head_tag.cs b/tools/droiddoc/templates-pdk/head_tag.cs
index 915dc0e496..cccbb1466d 100644
--- a/tools/droiddoc/templates-pdk/head_tag.cs
+++ b/tools/droiddoc/templates-pdk/head_tag.cs
@@ -1,6 +1,6 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<link rel="shortcut icon" type="image/x-icon" href="<?cs var:toroot ?>assets-pdk/favicon.ico" />
+<link rel="shortcut icon" type="image/x-icon" href="<?cs var:toroot ?>assets/favicon.ico" />
<title><?cs
if:page.title ?><?cs
var:page.title ?><?cs
@@ -9,7 +9,7 @@
/if ?> | <?cs
/if ?>Android Open Source</title>
<link href="<?cs var:toroot ?>assets/android-developer-docs-devguide.css" rel="stylesheet" type="text/css" />
-<link href="<?cs var:toroot ?>assets-pdk/pdk-local.css" rel="stylesheet" type="text/css" />
+<!-- <link href="<?cs var:toroot ?>assets-pdk/pdk-local.css" rel="stylesheet" type="text/css" /> -->
<script src="<?cs var:toroot ?>assets/search_autocomplete.js" type="text/javascript"></script>
<script src="<?cs var:toroot ?>assets/jquery-resizable.min.js" type="text/javascript"></script>
<script src="<?cs var:toroot ?>assets/android-developer-docs.js" type="text/javascript"></script>
@@ -28,7 +28,7 @@
}
}
</script>
-<script type="text/javascript>
+<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("pre").addClass("prettyprint");
});
diff --git a/tools/releasetools/amend_generator.py b/tools/releasetools/amend_generator.py
deleted file mode 100644
index b543bf7864..0000000000
--- a/tools/releasetools/amend_generator.py
+++ /dev/null
@@ -1,222 +0,0 @@
-# Copyright (C) 2009 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-
-import common
-
-class AmendGenerator(object):
- """Class to generate scripts in the 'amend' recovery script language
- used up through cupcake."""
-
- def __init__(self):
- self.script = ['assert compatible_with("0.2") == "true"']
- self.included_files = set()
-
- def MakeTemporary(self):
- """Make a temporary script object whose commands can latter be
- appended to the parent script with AppendScript(). Used when the
- caller wants to generate script commands out-of-order."""
- x = AmendGenerator()
- x.script = []
- x.included_files = self.included_files
- return x
-
- @staticmethod
- def _FileRoot(fn):
- """Convert a file path to the 'root' notation used by amend."""
- if fn.startswith("/system/"):
- return "SYSTEM:" + fn[8:]
- elif fn == "/system":
- return "SYSTEM:"
- elif fn.startswith("/tmp/"):
- return "CACHE:.." + fn
- else:
- raise ValueError("don't know root for \"%s\"" % (fn,))
-
- @staticmethod
- def _PartitionRoot(partition):
- """Convert a partition name to the 'root' notation used by amend."""
- if partition == "userdata":
- return "DATA:"
- else:
- return partition.upper() + ":"
-
- def AppendScript(self, other):
- """Append the contents of another script (which should be created
- with temporary=True) to this one."""
- self.script.extend(other.script)
- self.included_files.update(other.included_files)
-
- def AssertSomeFingerprint(self, *fp):
- """Assert that the current fingerprint is one of *fp."""
- x = [('file_contains("SYSTEM:build.prop", '
- '"ro.build.fingerprint=%s") == "true"') % i for i in fp]
- self.script.append("assert %s" % (" || ".join(x),))
-
- def AssertOlderBuild(self, timestamp):
- """Assert that the build on the device is older (or the same as)
- the given timestamp."""
- self.script.append("run_program PACKAGE:check_prereq %s" % (timestamp,))
- self.included_files.add("check_prereq")
-
- def AssertDevice(self, device):
- """Assert that the device identifier is the given string."""
- self.script.append('assert getprop("ro.product.device") == "%s" || '
- 'getprop("ro.build.product") == "%s"' % (device, device))
-
- def AssertSomeBootloader(self, *bootloaders):
- """Asert that the bootloader version is one of *bootloaders."""
- self.script.append("assert " +
- " || ".join(['getprop("ro.bootloader") == "%s"' % (b,)
- for b in bootloaders]))
-
- def ShowProgress(self, frac, dur):
- """Update the progress bar, advancing it over 'frac' over the next
- 'dur' seconds."""
- self.script.append("show_progress %f %d" % (frac, int(dur)))
-
- def SetProgress(self, frac):
- """Not implemented in amend."""
- pass
-
- def PatchCheck(self, filename, *sha1):
- """Check that the given file (or MTD reference) has one of the
- given *sha1 hashes."""
- out = ["run_program PACKAGE:applypatch -c %s" % (filename,)]
- for i in sha1:
- out.append(" " + i)
- self.script.append("".join(out))
- self.included_files.add(("applypatch_static", "applypatch"))
-
- # Not quite right since we don't need to check /cache/saved.file on
- # failure, but shouldn't hurt.
- FileCheck = PatchCheck
-
- def CacheFreeSpaceCheck(self, amount):
- """Check that there's at least 'amount' space that can be made
- available on /cache."""
- self.script.append("run_program PACKAGE:applypatch -s %d" % (amount,))
- self.included_files.add(("applypatch_static", "applypatch"))
-
- def Mount(self, kind, what, path):
- # no-op; amend uses it's 'roots' system to automatically mount
- # things when they're referred to
- pass
-
- def UnpackPackageDir(self, src, dst):
- """Unpack a given directory from the OTA package into the given
- destination directory."""
- dst = self._FileRoot(dst)
- self.script.append("copy_dir PACKAGE:%s %s" % (src, dst))
-
- def Comment(self, comment):
- """Write a comment into the update script."""
- self.script.append("")
- for i in comment.split("\n"):
- self.script.append("# " + i)
- self.script.append("")
-
- def Print(self, message):
- """Log a message to the screen (if the logs are visible)."""
- # no way to do this from amend; substitute a script comment instead
- self.Comment(message)
-
- def FormatPartition(self, partition):
- """Format the given MTD partition."""
- self.script.append("format %s" % (self._PartitionRoot(partition),))
-
- def DeleteFiles(self, file_list):
- """Delete all files in file_list."""
- line = []
- t = 0
- for i in file_list:
- i = self._FileRoot(i)
- line.append(i)
- t += len(i) + 1
- if t > 80:
- self.script.append("delete " + " ".join(line))
- line = []
- t = 0
- if line:
- self.script.append("delete " + " ".join(line))
-
- def ApplyPatch(self, srcfile, tgtfile, tgtsize, tgtsha1, *patchpairs):
- """Apply binary patches (in *patchpairs) to the given srcfile to
- produce tgtfile (which may be "-" to indicate overwriting the
- source file."""
- if len(patchpairs) % 2 != 0:
- raise ValueError("bad patches given to ApplyPatch")
- self.script.append(
- ("run_program PACKAGE:applypatch %s %s %s %d " %
- (srcfile, tgtfile, tgtsha1, tgtsize)) +
- " ".join(["%s:%s" % patchpairs[i:i+2]
- for i in range(0, len(patchpairs), 2)]))
- self.included_files.add(("applypatch_static", "applypatch"))
-
- def WriteFirmwareImage(self, kind, fn):
- """Arrange to update the given firmware image (kind must be
- "hboot" or "radio") when recovery finishes."""
- self.script.append("write_%s_image PACKAGE:%s" % (kind, fn))
-
- def WriteRawImage(self, partition, fn):
- """Write the given file into the given MTD partition."""
- self.script.append("write_raw_image PACKAGE:%s %s" %
- (fn, self._PartitionRoot(partition)))
-
- def SetPermissions(self, fn, uid, gid, mode):
- """Set file ownership and permissions."""
- fn = self._FileRoot(fn)
- self.script.append("set_perm %d %d 0%o %s" % (uid, gid, mode, fn))
-
- def SetPermissionsRecursive(self, fn, uid, gid, dmode, fmode):
- """Recursively set path ownership and permissions."""
- fn = self._FileRoot(fn)
- self.script.append("set_perm_recursive %d %d 0%o 0%o %s" %
- (uid, gid, dmode, fmode, fn))
-
- def MakeSymlinks(self, symlink_list):
- """Create symlinks, given a list of (dest, link) pairs."""
- self.DeleteFiles([i[1] for i in symlink_list])
- self.script.extend(["symlink %s %s" % (i[0], self._FileRoot(i[1]))
- for i in sorted(symlink_list)])
-
- def AppendExtra(self, extra):
- """Append text verbatim to the output script."""
- self.script.append(extra)
-
- def UnmountAll(self):
- pass
-
- def AddToZip(self, input_zip, output_zip, input_path=None):
- """Write the accumulated script to the output_zip file. input_zip
- is used as the source for any ancillary binaries needed by the
- script. If input_path is not None, it will be used as a local
- path for binaries instead of input_zip."""
- common.ZipWriteStr(output_zip, "META-INF/com/google/android/update-script",
- "\n".join(self.script) + "\n")
- for i in self.included_files:
- if isinstance(i, tuple):
- sourcefn, targetfn = i
- else:
- sourcefn = i
- targetfn = i
- try:
- if input_path is None:
- data = input_zip.read(os.path.join("OTA/bin", sourcefn))
- else:
- data = open(os.path.join(input_path, sourcefn)).read()
- common.ZipWriteStr(output_zip, targetfn, data, perms=0755)
- except (IOError, KeyError), e:
- raise ExternalError("unable to include binary %s: %s" % (i, e))
diff --git a/tools/releasetools/both_generator.py b/tools/releasetools/both_generator.py
deleted file mode 100644
index 4ae8d505cd..0000000000
--- a/tools/releasetools/both_generator.py
+++ /dev/null
@@ -1,62 +0,0 @@
-# Copyright (C) 2009 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import edify_generator
-import amend_generator
-
-class BothGenerator(object):
- def __init__(self, version):
- self.version = version
- self.edify = edify_generator.EdifyGenerator(version)
- self.amend = amend_generator.AmendGenerator()
-
- def MakeTemporary(self):
- x = BothGenerator(self.version)
- x.edify = self.edify.MakeTemporary()
- x.amend = self.amend.MakeTemporary()
- return x
-
- def AppendScript(self, other):
- self.edify.AppendScript(other.edify)
- self.amend.AppendScript(other.amend)
-
- def _DoBoth(self, name, *args):
- getattr(self.edify, name)(*args)
- getattr(self.amend, name)(*args)
-
- def AssertSomeFingerprint(self, *a): self._DoBoth("AssertSomeFingerprint", *a)
- def AssertOlderBuild(self, *a): self._DoBoth("AssertOlderBuild", *a)
- def AssertDevice(self, *a): self._DoBoth("AssertDevice", *a)
- def AssertSomeBootloader(self, *a): self._DoBoth("AssertSomeBootloader", *a)
- def ShowProgress(self, *a): self._DoBoth("ShowProgress", *a)
- def PatchCheck(self, *a): self._DoBoth("PatchCheck", *a)
- def FileCheck(self, filename, *sha1): self._DoBoth("FileCheck", *a)
- def CacheFreeSpaceCheck(self, *a): self._DoBoth("CacheFreeSpaceCheck", *a)
- def Mount(self, *a): self._DoBoth("Mount", *a)
- def UnpackPackageDir(self, *a): self._DoBoth("UnpackPackageDir", *a)
- def Comment(self, *a): self._DoBoth("Comment", *a)
- def Print(self, *a): self._DoBoth("Print", *a)
- def FormatPartition(self, *a): self._DoBoth("FormatPartition", *a)
- def DeleteFiles(self, *a): self._DoBoth("DeleteFiles", *a)
- def ApplyPatch(self, *a): self._DoBoth("ApplyPatch", *a)
- def WriteFirmwareImage(self, *a): self._DoBoth("WriteFirmwareImage", *a)
- def WriteRawImage(self, *a): self._DoBoth("WriteRawImage", *a)
- def SetPermissions(self, *a): self._DoBoth("SetPermissions", *a)
- def SetPermissionsRecursive(self, *a): self._DoBoth("SetPermissionsRecursive", *a)
- def MakeSymlinks(self, *a): self._DoBoth("MakeSymlinks", *a)
- def AppendExtra(self, *a): self._DoBoth("AppendExtra", *a)
- def UnmountAll(self, *a): self._DoBoth("UnmountAll", *a)
-
- def AddToZip(self, input_zip, output_zip, input_path=None):
- self._DoBoth("AddToZip", input_zip, output_zip, input_path)
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
index cf5fb34834..8c3b2c2397 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -44,10 +44,6 @@ Usage: ota_from_target_files [flags] input_target_files output_ota_package
-e (--extra_script) <file>
Insert the contents of file at the end of the update script.
- -m (--script_mode) <mode>
- Specify 'amend' or 'edify' scripts, or 'auto' to pick
- automatically (this is the default).
-
"""
import sys
@@ -68,9 +64,7 @@ import time
import zipfile
import common
-import amend_generator
import edify_generator
-import both_generator
OPTIONS = common.OPTIONS
OPTIONS.package_key = "build/target/product/security/testkey"
@@ -81,7 +75,6 @@ OPTIONS.patch_threshold = 0.95
OPTIONS.wipe_user_data = False
OPTIONS.omit_prereq = False
OPTIONS.extra_script = None
-OPTIONS.script_mode = 'auto'
OPTIONS.worker_threads = 3
def MostPopularKey(d, default):
@@ -343,15 +336,10 @@ fi
def WriteFullOTAPackage(input_zip, output_zip):
- if OPTIONS.script_mode == "auto":
- script = both_generator.BothGenerator(2)
- elif OPTIONS.script_mode == "amend":
- script = amend_generator.AmendGenerator()
- else:
- # TODO: how to determine this? We don't know what version it will
- # be installed on top of. For now, we expect the API just won't
- # change very often.
- script = edify_generator.EdifyGenerator(2)
+ # TODO: how to determine this? We don't know what version it will
+ # be installed on top of. For now, we expect the API just won't
+ # change very often.
+ script = edify_generator.EdifyGenerator(3)
metadata = {"post-build": GetBuildProp("ro.build.fingerprint", input_zip),
"pre-device": GetBuildProp("ro.product.device", input_zip),
@@ -586,20 +574,10 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
source_version = GetRecoveryAPIVersion(source_zip)
target_version = GetRecoveryAPIVersion(target_zip)
- if OPTIONS.script_mode == 'amend':
- script = amend_generator.AmendGenerator()
- elif OPTIONS.script_mode == 'edify':
- if source_version == 0:
- print ("WARNING: generating edify script for a source that "
- "can't install it.")
- script = edify_generator.EdifyGenerator(source_version)
- elif OPTIONS.script_mode == 'auto':
- if source_version > 0:
- script = edify_generator.EdifyGenerator(source_version)
- else:
- script = amend_generator.AmendGenerator()
- else:
- raise ValueError('unknown script mode "%s"' % (OPTIONS.script_mode,))
+ if source_version == 0:
+ print ("WARNING: generating edify script for a source that "
+ "can't install it.")
+ script = edify_generator.EdifyGenerator(source_version)
metadata = {"pre-device": GetBuildProp("ro.product.device", source_zip),
}
@@ -854,8 +832,6 @@ def main(argv):
OPTIONS.omit_prereq = True
elif o in ("-e", "--extra_script"):
OPTIONS.extra_script = a
- elif o in ("-m", "--script_mode"):
- OPTIONS.script_mode = a
elif o in ("--worker_threads"):
OPTIONS.worker_threads = int(a)
else:
@@ -863,14 +839,13 @@ def main(argv):
return True
args = common.ParseOptions(argv, __doc__,
- extra_opts="b:k:i:d:wne:m:",
+ extra_opts="b:k:i:d:wne:",
extra_long_opts=["board_config=",
"package_key=",
"incremental_from=",
"wipe_user_data",
"no_prereq",
"extra_script=",
- "script_mode=",
"worker_threads="],
extra_option_handler=option_handler)
@@ -878,9 +853,6 @@ def main(argv):
common.Usage(__doc__)
sys.exit(1)
- if OPTIONS.script_mode not in ("amend", "edify", "auto"):
- raise ValueError('unknown script mode "%s"' % (OPTIONS.script_mode,))
-
if OPTIONS.extra_script is not None:
OPTIONS.extra_script = open(OPTIONS.extra_script).read()