Merge "Revert "Revert "CDD: Relax Overview title count requirement.""" into nougat-mr1-dev
diff --git a/12_document-changelog/12_0_intro.md b/12_document-changelog/12_0_intro.md
index fc28dd4..4027753 100644
--- a/12_document-changelog/12_0_intro.md
+++ b/12_document-changelog/12_0_intro.md
@@ -2,24 +2,24 @@
For a summary of changes to the Compatibility Definition in this release:
-* [Document changelog](https://android.googlesource.com/platform/compatibility/cdd/+log/nougat-release/?pretty=full&no-merges)
+* [Document changelog](https://android.googlesource.com/platform/compatibility/cdd/+log/CURRENT_BRANCH/?pretty=full&no-merges)
For a summary of changes to individuals sections:
-1. [Introduction](https://android.googlesource.com/platform/compatibility/cdd/+log/nougat-release/1_introduction?pretty=full&no-merges)
-1. [Device Types](https://android.googlesource.com/platform/compatibility/cdd/+log/nougat-release/2_device_types?pretty=full&no-merges)
-1. [Software](https://android.googlesource.com/platform/compatibility/cdd/+log/nougat-release/3_software?pretty=full&no-merges)
-1. [Application Packaging](https://android.googlesource.com/platform/compatibility/cdd/+log/nougat-release/4_application-packaging?pretty=full&no-merges)
-1. [Multimedia](https://android.googlesource.com/platform/compatibility/cdd/+log/nougat-release/5_multimedia?pretty=full&no-merges)
-1. [Developer Tools and Options](https://android.googlesource.com/platform/compatibility/cdd/+log/nougat-release/6_dev-tools-and-options?pretty=full&no-merges)
-1. [Hardware Compatibility](https://android.googlesource.com/platform/compatibility/cdd/+log/nougat-release/7_hardware-compatibility?pretty=full&no-merges)
-1. [Performance and Power](https://android.googlesource.com/platform/compatibility/cdd/+log/nougat-release/8_performance-and-power?pretty=full&no-merges)
-1. [Security Model](https://android.googlesource.com/platform/compatibility/cdd/+log/nougat-release/9_security-model?pretty=full&no-merges)
-1. [Software Compatibility Testing](https://android.googlesource.com/platform/compatibility/cdd/+log/nougat-release/10_software-compatibility-testing?pretty=full&no-merges)
-1. [Updatable Software](https://android.googlesource.com/platform/compatibility/cdd/+log/nougat-release/11_updatable-software?pretty=full&no-merges)
-1. [Document Changelog](https://android.googlesource.com/platform/compatibility/cdd/+log/nougat-release/12_document-changelog?pretty=full&no-merges)
-1. [Contact Us](https://android.googlesource.com/platform/compatibility/cdd/+log/nougat-release/13_contact-us?pretty=full&no-merges)
+1. [Introduction](https://android.googlesource.com/platform/compatibility/cdd/+log/CURRENT_BRANCH/1_introduction?pretty=full&no-merges)
+1. [Device Types](https://android.googlesource.com/platform/compatibility/cdd/+log/CURRENT_BRANCH/2_device_types?pretty=full&no-merges)
+1. [Software](https://android.googlesource.com/platform/compatibility/cdd/+log/CURRENT_BRANCH/3_software?pretty=full&no-merges)
+1. [Application Packaging](https://android.googlesource.com/platform/compatibility/cdd/+log/CURRENT_BRANCH/4_application-packaging?pretty=full&no-merges)
+1. [Multimedia](https://android.googlesource.com/platform/compatibility/cdd/+log/CURRENT_BRANCH/5_multimedia?pretty=full&no-merges)
+1. [Developer Tools and Options](https://android.googlesource.com/platform/compatibility/cdd/+log/CURRENT_BRANCH/6_dev-tools-and-options?pretty=full&no-merges)
+1. [Hardware Compatibility](https://android.googlesource.com/platform/compatibility/cdd/+log/CURRENT_BRANCH/7_hardware-compatibility?pretty=full&no-merges)
+1. [Performance and Power](https://android.googlesource.com/platform/compatibility/cdd/+log/CURRENT_BRANCH/8_performance-and-power?pretty=full&no-merges)
+1. [Security Model](https://android.googlesource.com/platform/compatibility/cdd/+log/CURRENT_BRANCH/9_security-model?pretty=full&no-merges)
+1. [Software Compatibility Testing](https://android.googlesource.com/platform/compatibility/cdd/+log/CURRENT_BRANCH/10_software-compatibility-testing?pretty=full&no-merges)
+1. [Updatable Software](https://android.googlesource.com/platform/compatibility/cdd/+log/CURRENT_BRANCH/11_updatable-software?pretty=full&no-merges)
+1. [Document Changelog](https://android.googlesource.com/platform/compatibility/cdd/+log/CURRENT_BRANCH/12_document-changelog?pretty=full&no-merges)
+1. [Contact Us](https://android.googlesource.com/platform/compatibility/cdd/+log/CURRENT_BRANCH/13_contact-us?pretty=full&no-merges)
## 12.1\. Changelog Viewing Tips
diff --git a/7_hardware-compatibility/7_9_virtual-reality.md b/7_hardware-compatibility/7_9_virtual-reality.md
index 1b017b2..e19dd96 100644
--- a/7_hardware-compatibility/7_9_virtual-reality.md
+++ b/7_hardware-compatibility/7_9_virtual-reality.md
@@ -20,11 +20,13 @@
* Device implementations MUST have at least 2 physical cores.
* Device implementations MUST declare android.software.vr.mode feature.
-* Device implementations MUST provide an exclusive core to the foreground application and MUST
- support the Process.getExclusiveCores API to return the numbers of the cpu cores that are
- exclusive to the top foreground application. This core MUST not allow any other userspace
- processes to run on it (except device drivers used by the application), but MAY allow some
- kernel processes to run as necessary.
+* Device implementations MAY provide an exclusive core to the foreground
+ application and MAY support the Process.getExclusiveCores API to return
+ the numbers of the cpu cores that are exclusive to the top foreground
+ application. If exclusive core is supported then the core MUST not allow
+ any other userspace processes to run on it (except device drivers used
+ by the application), but MAY allow some kernel processes to run as
+ necessary.
* Device implementations MUST support sustained performance mode.
* Device implementations MUST support OpenGL ES 3.2.
* Device implementations MUST support Vulkan Hardware Level 0 and SHOULD support
@@ -63,4 +65,4 @@
* The display MUST support a low-persistence mode with ≤5 ms persistence,persistence being
defined as the amount of time for which a pixel is emitting light.
* Device implementations MUST support Bluetooth 4.2 and Bluetooth LE Data Length Extension
- [section 7.4.3](#7_4_3_bluetooth).
\ No newline at end of file
+ [section 7.4.3](#7_4_3_bluetooth).
diff --git a/make_cdd.py b/make_cdd.py
index 348aef7..c51821e 100755
--- a/make_cdd.py
+++ b/make_cdd.py
@@ -2,14 +2,16 @@
"""
Utility for building the CDD from component markdown files.
-From the compatibility/cdd directory, run python make-cdd.py.
+From the compatibility/cdd directory, run:
+python make-cdd.py --version <version number> --branch <AOSP branch>
+ --output <output file name>
-Each generated CDD file is marked with a hash based on the content of the input files.
TODO(gdimino): Clean up and comment this code.
"""
from bs4 import BeautifulSoup
+import argparse
import hashlib
import markdown
import os
@@ -22,7 +24,6 @@
# from jinja2 import Template
HEADERS_FOR_TOC = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'h7']
-ANDROID_VERSION = "7.0, (N)"
TOC_PER_COL = 34
def get_section_info(my_path):
@@ -62,7 +63,7 @@
def get_soup(section_info):
html_body_text = '''<!DOCTYPE html>
<head>
-<title>Android ''' + ANDROID_VERSION + ''' Compatibility Definition</title>
+<title>Android ANDROID_VERSION Compatibility Definition</title>
<link rel="stylesheet" type="text/css" href="source/android-cdd.css"/>
</head>
<body>
@@ -80,14 +81,6 @@
for tag in soup.find_all(header_tags):
tag['id'] = create_id(tag)
-def old_generate_toc(soup):
- toc_html = ''
- header_tags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'h7']
- for tag in soup.find_all(header_tags):
- tag_html = '<p class="toc_' + tag.name + '"><a href= "#' + create_id(tag) + '">' + tag.contents[0] + '</a></p>'
- toc_html = toc_html + tag_html
- return (BeautifulSoup(toc_html).body.contents, '')
-
def generate_toc(soup):
toc_html = '<div id="toc">'
header_tags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'h7']
@@ -109,19 +102,6 @@
toc_html = toc_html + '<div style="clear: both"></div>'
return (BeautifulSoup(toc_html).body.contents)
-def old_add_toc(soup):
- toc = soup.new_tag('div', id='toc')
- toc_left = soup.new_tag('div', id='toc_left')
- toc_right = soup.new_tag('div', id='toc_right')
- toc.append(toc_left)
- toc.append(toc_right)
- # toc_left.contents, toc_right.contents = generate_toc(soup)
- toc_left.contents, toc_right.contents = generate_toc(soup)
- toc_title = BeautifulSoup("<h6>Table of Contents</h6>").body.contents[0]
- soup.body.insert(0,toc)
- soup.body.insert(0, toc_title)
- return soup
-
def add_toc(soup):
toc_contents = generate_toc(soup)[0]
toc_title = BeautifulSoup("<h6>Table of Contents</h6>").body.contents[0]
@@ -148,25 +128,50 @@
header_numbers.append(re.sub(r"([\d.]*).*", r"\1"), heading.contents)
return true
-def elim_para_whitespace(html):
- new_html = re.sub(re.compile(r"(<p[^>]*>)\s*\n\s*(<a[^>]*>)\n([^<]*)\n\s*(</a>)\n\s*(</p>)", re.M),r"\1\2\3\4\5\n", html)
- return new_html
+def get_version_branch_and_output():
+
+ # Get command-line args. If there aren't any, then prompt for user input.
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--version', help='Android version')
+ parser.add_argument('--branch', help='AOSP branch')
+ parser.add_argument('--output', help='Base name of output file')
+ args = parser.parse_args()
+
+ if not args.version:
+ args.version = raw_input('Android version for CDD: ')
+ if not args.branch:
+ args.branch = raw_input('Current AOSP branch for changelog: ')
+ if not args.output:
+ args.output = raw_input('Base name of desired output file: ')
+
+ return (args.version, args.branch, args.output)
+
def main():
+ # Read version and branch info and output file name.
+ (ANDROID_VERSION, CURRENT_BRANCH, output_filename) = get_version_branch_and_output()
+
+ # Scan current directory for source files and compile info for the toc..
my_path = os.getcwd()
section_info = get_section_info(my_path)
+
+ # Generate the HTML
soup = get_soup(section_info)
add_id_to_section_headers(soup)
add_toc(soup)
html = soup.prettify(formatter='html')
- # Add a hash to the filename, so that identidal inputs produce the same output
- # file.
- output_filename = "test-generated-cdd-%s.html" % hashlib.md5(html).hexdigest()[0:5]
- output = open(output_filename, "w")
- output.write(html.encode('utf-8'))
+
+ # Add version and branch info
+ html = re.sub(re.compile(r"ANDROID_VERSION"), ANDROID_VERSION, html)
+ html = re.sub(re.compile(r"CURRENT_BRANCH"), CURRENT_BRANCH, html)
+
+ # Apply HTML Tidy to output
+ (document, errors) = tidylib.tidy_document(html, options={})
+
+ # Write output file
+ output = open('%s.html' % output_filename, "w")
+ output.write(document.encode('utf-8'))
output.close()
- # Code to generate PDF, needs work.
- # subprocess.call('wkhtmltopdf -B 1in -T 1in -L .75in -R .75in page ' + output_filename + ' --footer-html source/android-cdd-footer.html /tmp/android-cdd-body.pdf')
if __name__ == '__main__':