You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2017/04/15 01:10:36 UTC
[15/39] cordova-lib git commit: CB-11346: added tests for support of
3rd party platforms
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/intermediates/incremental/packageReleaseResources/merger.xml
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/intermediates/incremental/packageReleaseResources/merger.xml b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/intermediates/incremental/packageReleaseResources/merger.xml
new file mode 100644
index 0000000..346037c
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/intermediates/incremental/packageReleaseResources/merger.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?>
+<merger version="3"><dataSet config="main$Generated" generated="true"><source path="/Users/steveng/repo/cordova/cordova-android/framework/res"/><source path="/Users/steveng/repo/cordova/cordova-android/framework/build/generated/res/rs/release"/><source path="/Users/steveng/repo/cordova/cordova-android/framework/build/generated/res/resValues/release"/></dataSet><dataSet config="release$Generated" generated="true"><source path="/Users/steveng/repo/cordova/cordova-android/framework/src/release/res"/></dataSet><dataSet config="main" generated-set="main$Generated"><source path="/Users/steveng/repo/cordova/cordova-android/framework/res"/><source path="/Users/steveng/repo/cordova/cordova-android/framework/build/generated/res/rs/release"/><source path="/Users/steveng/repo/cordova/cordova-android/framework/build/generated/res/resValues/release"/></dataSet><dataSet config="release" generated-set="release$Generated"><source path="/Users/steveng/repo/cordova/cordova-android/framework/src/releas
e/res"/></dataSet><mergedItems/></merger>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/intermediates/manifests/aapt/debug/AndroidManifest.xml
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/intermediates/manifests/aapt/debug/AndroidManifest.xml b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/intermediates/manifests/aapt/debug/AndroidManifest.xml
new file mode 100644
index 0000000..90863ed
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/intermediates/manifests/aapt/debug/AndroidManifest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.apache.cordova"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk android:minSdkVersion="14" />
+
+</manifest>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/intermediates/manifests/aapt/release/AndroidManifest.xml
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/intermediates/manifests/aapt/release/AndroidManifest.xml b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/intermediates/manifests/aapt/release/AndroidManifest.xml
new file mode 100644
index 0000000..90863ed
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/intermediates/manifests/aapt/release/AndroidManifest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.apache.cordova"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk android:minSdkVersion="14" />
+
+</manifest>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/outputs/aar/framework-debug.aar
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/outputs/aar/framework-debug.aar b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/outputs/aar/framework-debug.aar
new file mode 100644
index 0000000..c01e438
Binary files /dev/null and b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/outputs/aar/framework-debug.aar differ
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/outputs/aar/framework-release.aar
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/outputs/aar/framework-release.aar b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/outputs/aar/framework-release.aar
new file mode 100644
index 0000000..5c54914
Binary files /dev/null and b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/outputs/aar/framework-release.aar differ
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/poms/pom-default.xml
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/poms/pom-default.xml b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/poms/pom-default.xml
new file mode 100644
index 0000000..b668017
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/poms/pom-default.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.cordova</groupId>
+ <artifactId>framework</artifactId>
+ <version>6.1.2</version>
+ <packaging>aar</packaging>
+ <name>Cordova</name>
+ <url>https://cordova.apache.org</url>
+ <licenses>
+ <license>
+ <name>The Apache Software License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ </license>
+ </licenses>
+ <developers>
+ <developer>
+ <id>stevengill</id>
+ <name>Steve Gill</name>
+ </developer>
+ </developers>
+ <scm>
+ <connection>https://git-wip-us.apache.org/repos/asf?p=cordova-android.git</connection>
+ <developerConnection>https://git-wip-us.apache.org/repos/asf?p=cordova-android.git</developerConnection>
+ <url>https://git-wip-us.apache.org/repos/asf?p=cordova-android</url>
+ </scm>
+</project>
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/tmp/sourcesJar/MANIFEST.MF
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/tmp/sourcesJar/MANIFEST.MF b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/tmp/sourcesJar/MANIFEST.MF
new file mode 100644
index 0000000..59499bc
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/build/tmp/sourcesJar/MANIFEST.MF
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/cordova.gradle
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/cordova.gradle b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/cordova.gradle
new file mode 100644
index 0000000..21a01bb
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/cordova.gradle
@@ -0,0 +1,201 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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 java.util.regex.Pattern
+import groovy.swing.SwingBuilder
+
+String doEnsureValueExists(filePath, props, key) {
+ if (props.get(key) == null) {
+ throw new GradleException(filePath + ': Missing key required "' + key + '"')
+ }
+ return props.get(key)
+}
+
+String doGetProjectTarget() {
+ def props = new Properties()
+ file('project.properties').withReader { reader ->
+ props.load(reader)
+ }
+ return doEnsureValueExists('project.properties', props, 'target')
+}
+
+String[] getAvailableBuildTools() {
+ def buildToolsDir = new File(getAndroidSdkDir(), "build-tools")
+ buildToolsDir.list()
+ .findAll { it ==~ /[0-9.]+/ }
+ .sort { a, b -> compareVersions(b, a) }
+}
+
+String doFindLatestInstalledBuildTools(String minBuildToolsVersion) {
+ def availableBuildToolsVersions
+ try {
+ availableBuildToolsVersions = getAvailableBuildTools()
+ } catch (e) {
+ println "An exception occurred while trying to find the Android build tools."
+ throw e
+ }
+ if (availableBuildToolsVersions.length > 0) {
+ def highestBuildToolsVersion = availableBuildToolsVersions[0]
+ if (compareVersions(highestBuildToolsVersion, minBuildToolsVersion) < 0) {
+ throw new RuntimeException(
+ "No usable Android build tools found. Highest installed version is " +
+ highestBuildToolsVersion + "; minimum version required is " +
+ minBuildToolsVersion + ".")
+ }
+ highestBuildToolsVersion
+ } else {
+ throw new RuntimeException(
+ "No installed build tools found. Install the Android build tools version " +
+ minBuildToolsVersion + " or higher.")
+ }
+}
+
+// Return the first non-zero result of subtracting version list elements
+// pairwise. If they are all identical, return the difference in length of
+// the two lists.
+int compareVersionList(Collection aParts, Collection bParts) {
+ def pairs = ([aParts, bParts]).transpose()
+ pairs.findResult(aParts.size()-bParts.size()) {it[0] - it[1] != 0 ? it[0] - it[1] : null}
+}
+
+// Compare two version strings, such as "19.0.0" and "18.1.1.0". If all matched
+// elements are identical, the longer version is the largest by this method.
+// Examples:
+// "19.0.0" > "19"
+// "19.0.1" > "19.0.0"
+// "19.1.0" > "19.0.1"
+// "19" > "18.999.999"
+int compareVersions(String a, String b) {
+ def aParts = a.tokenize('.').collect {it.toInteger()}
+ def bParts = b.tokenize('.').collect {it.toInteger()}
+ compareVersionList(aParts, bParts)
+}
+
+String getAndroidSdkDir() {
+ def rootDir = project.rootDir
+ def androidSdkDir = null
+ String envVar = System.getenv("ANDROID_HOME")
+ def localProperties = new File(rootDir, 'local.properties')
+ String systemProperty = System.getProperty("android.home")
+ if (envVar != null) {
+ androidSdkDir = envVar
+ } else if (localProperties.exists()) {
+ Properties properties = new Properties()
+ localProperties.withInputStream { instr ->
+ properties.load(instr)
+ }
+ def sdkDirProp = properties.getProperty('sdk.dir')
+ if (sdkDirProp != null) {
+ androidSdkDir = sdkDirProp
+ } else {
+ sdkDirProp = properties.getProperty('android.dir')
+ if (sdkDirProp != null) {
+ androidSdkDir = (new File(rootDir, sdkDirProp)).getAbsolutePath()
+ }
+ }
+ }
+ if (androidSdkDir == null && systemProperty != null) {
+ androidSdkDir = systemProperty
+ }
+ if (androidSdkDir == null) {
+ throw new RuntimeException(
+ "Unable to determine Android SDK directory.")
+ }
+ androidSdkDir
+}
+
+def doExtractIntFromManifest(name) {
+ def manifestFile = file(android.sourceSets.main.manifest.srcFile)
+ def pattern = Pattern.compile(name + "=\"(\\d+)\"")
+ def matcher = pattern.matcher(manifestFile.getText())
+ matcher.find()
+ return new BigInteger(matcher.group(1))
+}
+
+def doExtractStringFromManifest(name) {
+ def manifestFile = file(android.sourceSets.main.manifest.srcFile)
+ def pattern = Pattern.compile(name + "=\"(\\S+)\"")
+ def matcher = pattern.matcher(manifestFile.getText())
+ matcher.find()
+ return matcher.group(1)
+}
+
+def doPromptForPassword(msg) {
+ if (System.console() == null) {
+ def ret = null
+ new SwingBuilder().edt {
+ dialog(modal: true, title: 'Enter password', alwaysOnTop: true, resizable: false, locationRelativeTo: null, pack: true, show: true) {
+ vbox {
+ label(text: msg)
+ def input = passwordField()
+ button(defaultButton: true, text: 'OK', actionPerformed: {
+ ret = input.password;
+ dispose();
+ })
+ }
+ }
+ }
+ if (!ret) {
+ throw new GradleException('User canceled build')
+ }
+ return new String(ret)
+ } else {
+ return System.console().readPassword('\n' + msg);
+ }
+}
+
+def doGetConfigXml() {
+ def xml = file("res/xml/config.xml").getText()
+ // Disable namespace awareness since Cordova doesn't use them properly
+ return new XmlParser(false, false).parseText(xml)
+}
+
+def doGetConfigPreference(name, defaultValue) {
+ name = name.toLowerCase()
+ def root = doGetConfigXml()
+
+ def ret = defaultValue
+ root.preference.each { it ->
+ def attrName = it.attribute("name")
+ if (attrName && attrName.toLowerCase() == name) {
+ ret = it.attribute("value")
+ }
+ }
+ return ret
+}
+
+// Properties exported here are visible to all plugins.
+ext {
+ // These helpers are shared, but are not guaranteed to be stable / unchanged.
+ privateHelpers = {}
+ privateHelpers.getProjectTarget = { doGetProjectTarget() }
+ privateHelpers.findLatestInstalledBuildTools = { doFindLatestInstalledBuildTools('19.1.0') }
+ privateHelpers.extractIntFromManifest = { name -> doExtractIntFromManifest(name) }
+ privateHelpers.extractStringFromManifest = { name -> doExtractStringFromManifest(name) }
+ privateHelpers.promptForPassword = { msg -> doPromptForPassword(msg) }
+ privateHelpers.ensureValueExists = { filePath, props, key -> doEnsureValueExists(filePath, props, key) }
+
+ // These helpers can be used by plugins / projects and will not change.
+ cdvHelpers = {}
+ // Returns a XmlParser for the config.xml. Added in 4.1.0.
+ cdvHelpers.getConfigXml = { doGetConfigXml() }
+ // Returns the value for the desired <preference>. Added in 4.1.0.
+ cdvHelpers.getConfigPreference = { name, defaultValue -> doGetConfigPreference(name, defaultValue) }
+}
+
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/default.properties
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/default.properties b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/default.properties
new file mode 100644
index 0000000..d4e24dc
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/default.properties
@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Indicates whether an apk should be generated for each density.
+split.density=false
+# Project target.
+target=android-14
+apk-configurations=
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/framework.iml
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/framework.iml b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/framework.iml
new file mode 100644
index 0000000..19dbd15
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/framework.iml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="false">
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/gradle/wrapper/gradle-wrapper.properties
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/gradle/wrapper/gradle-wrapper.properties b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..04e285f
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Mon Dec 28 10:00:20 PST 2015
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/gradlew
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/gradlew b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/gradlew
new file mode 100755
index 0000000..9d82f78
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/gradlew
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/gradlew.bat
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/gradlew.bat b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/gradlew.bat
new file mode 100644
index 0000000..8a0b282
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/local.properties
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/local.properties b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/local.properties
new file mode 100644
index 0000000..24bec30
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/local.properties
@@ -0,0 +1,11 @@
+## This file is automatically generated by Android Studio.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must *NOT* be checked into Version Control Systems,
+# as it contains information specific to your local configuration.
+#
+# Location of the SDK. This is only used by Gradle.
+# For customization when using a Version Control System, please read the
+# header note.
+#Thu Jul 28 16:51:16 PDT 2016
+sdk.dir=/Users/steveng/Library/Android/sdk
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/project.properties
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/project.properties b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/project.properties
new file mode 100644
index 0000000..df3c73c
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/project.properties
@@ -0,0 +1,16 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+
+# Indicates whether an apk should be generated for each density.
+split.density=false
+# Project target.
+target=android-25
+apk-configurations=
+renderscript.opt.level=O0
+android.library=true
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/AuthenticationToken.java
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/AuthenticationToken.java b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/AuthenticationToken.java
new file mode 100644
index 0000000..d3a231a
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/AuthenticationToken.java
@@ -0,0 +1,69 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+*/
+package org.apache.cordova;
+
+/**
+ * The Class AuthenticationToken defines the userName and password to be used for authenticating a web resource
+ */
+public class AuthenticationToken {
+ private String userName;
+ private String password;
+
+ /**
+ * Gets the user name.
+ *
+ * @return the user name
+ */
+ public String getUserName() {
+ return userName;
+ }
+
+ /**
+ * Sets the user name.
+ *
+ * @param userName
+ * the new user name
+ */
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ /**
+ * Gets the password.
+ *
+ * @return the password
+ */
+ public String getPassword() {
+ return password;
+ }
+
+ /**
+ * Sets the password.
+ *
+ * @param password
+ * the new password
+ */
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CallbackContext.java
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CallbackContext.java b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CallbackContext.java
new file mode 100644
index 0000000..4336386
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CallbackContext.java
@@ -0,0 +1,142 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+*/
+package org.apache.cordova;
+
+import org.json.JSONArray;
+
+import org.apache.cordova.CordovaWebView;
+import org.apache.cordova.PluginResult;
+import org.json.JSONObject;
+
+public class CallbackContext {
+ private static final String LOG_TAG = "CordovaPlugin";
+
+ private String callbackId;
+ private CordovaWebView webView;
+ protected boolean finished;
+ private int changingThreads;
+
+ public CallbackContext(String callbackId, CordovaWebView webView) {
+ this.callbackId = callbackId;
+ this.webView = webView;
+ }
+
+ public boolean isFinished() {
+ return finished;
+ }
+
+ public boolean isChangingThreads() {
+ return changingThreads > 0;
+ }
+
+ public String getCallbackId() {
+ return callbackId;
+ }
+
+ public void sendPluginResult(PluginResult pluginResult) {
+ synchronized (this) {
+ if (finished) {
+ LOG.w(LOG_TAG, "Attempted to send a second callback for ID: " + callbackId + "\nResult was: " + pluginResult.getMessage());
+ return;
+ } else {
+ finished = !pluginResult.getKeepCallback();
+ }
+ }
+ webView.sendPluginResult(pluginResult, callbackId);
+ }
+
+ /**
+ * Helper for success callbacks that just returns the Status.OK by default
+ *
+ * @param message The message to add to the success result.
+ */
+ public void success(JSONObject message) {
+ sendPluginResult(new PluginResult(PluginResult.Status.OK, message));
+ }
+
+ /**
+ * Helper for success callbacks that just returns the Status.OK by default
+ *
+ * @param message The message to add to the success result.
+ */
+ public void success(String message) {
+ sendPluginResult(new PluginResult(PluginResult.Status.OK, message));
+ }
+
+ /**
+ * Helper for success callbacks that just returns the Status.OK by default
+ *
+ * @param message The message to add to the success result.
+ */
+ public void success(JSONArray message) {
+ sendPluginResult(new PluginResult(PluginResult.Status.OK, message));
+ }
+
+ /**
+ * Helper for success callbacks that just returns the Status.OK by default
+ *
+ * @param message The message to add to the success result.
+ */
+ public void success(byte[] message) {
+ sendPluginResult(new PluginResult(PluginResult.Status.OK, message));
+ }
+
+ /**
+ * Helper for success callbacks that just returns the Status.OK by default
+ *
+ * @param message The message to add to the success result.
+ */
+ public void success(int message) {
+ sendPluginResult(new PluginResult(PluginResult.Status.OK, message));
+ }
+
+ /**
+ * Helper for success callbacks that just returns the Status.OK by default
+ */
+ public void success() {
+ sendPluginResult(new PluginResult(PluginResult.Status.OK));
+ }
+
+ /**
+ * Helper for error callbacks that just returns the Status.ERROR by default
+ *
+ * @param message The message to add to the error result.
+ */
+ public void error(JSONObject message) {
+ sendPluginResult(new PluginResult(PluginResult.Status.ERROR, message));
+ }
+
+ /**
+ * Helper for error callbacks that just returns the Status.ERROR by default
+ *
+ * @param message The message to add to the error result.
+ */
+ public void error(String message) {
+ sendPluginResult(new PluginResult(PluginResult.Status.ERROR, message));
+ }
+
+ /**
+ * Helper for error callbacks that just returns the Status.ERROR by default
+ *
+ * @param message The message to add to the error result.
+ */
+ public void error(int message) {
+ sendPluginResult(new PluginResult(PluginResult.Status.ERROR, message));
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CallbackMap.java
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CallbackMap.java b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CallbackMap.java
new file mode 100644
index 0000000..050daa0
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CallbackMap.java
@@ -0,0 +1,65 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+*/
+package org.apache.cordova;
+
+import android.util.Pair;
+import android.util.SparseArray;
+
+/**
+ * Provides a collection that maps unique request codes to CordovaPlugins and Integers.
+ * Used to ensure that when plugins make requests for runtime permissions, those requests do not
+ * collide with requests from other plugins that use the same request code value.
+ */
+public class CallbackMap {
+ private int currentCallbackId = 0;
+ private SparseArray<Pair<CordovaPlugin, Integer>> callbacks;
+
+ public CallbackMap() {
+ this.callbacks = new SparseArray<Pair<CordovaPlugin, Integer>>();
+ }
+
+ /**
+ * Stores a CordovaPlugin and request code and returns a new unique request code to use
+ * in a permission request.
+ *
+ * @param receiver The plugin that is making the request
+ * @param requestCode The original request code used by the plugin
+ * @return A unique request code that can be used to retrieve this callback
+ * with getAndRemoveCallback()
+ */
+ public synchronized int registerCallback(CordovaPlugin receiver, int requestCode) {
+ int mappedId = this.currentCallbackId++;
+ callbacks.put(mappedId, new Pair<CordovaPlugin, Integer>(receiver, requestCode));
+ return mappedId;
+ }
+
+ /**
+ * Retrieves and removes a callback stored in the map using the mapped request code
+ * obtained from registerCallback()
+ *
+ * @param mappedId The request code obtained from registerCallback()
+ * @return The CordovaPlugin and orignal request code that correspond to the
+ * given mappedCode
+ */
+ public synchronized Pair<CordovaPlugin, Integer> getAndRemoveCallback(int mappedId) {
+ Pair<CordovaPlugin, Integer> callback = callbacks.get(mappedId);
+ callbacks.remove(mappedId);
+ return callback;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/Config.java
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/Config.java b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/Config.java
new file mode 100644
index 0000000..0739795
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/Config.java
@@ -0,0 +1,71 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+*/
+
+package org.apache.cordova;
+
+import java.util.List;
+
+import android.app.Activity;
+
+@Deprecated // Use Whitelist, CordovaPrefences, etc. directly.
+public class Config {
+ private static final String TAG = "Config";
+
+ static ConfigXmlParser parser;
+
+ private Config() {
+ }
+
+ public static void init(Activity action) {
+ parser = new ConfigXmlParser();
+ parser.parse(action);
+ //TODO: Add feature to bring this back. Some preferences should be overridden by intents, but not all
+ parser.getPreferences().setPreferencesBundle(action.getIntent().getExtras());
+ }
+
+ // Intended to be used for testing only; creates an empty configuration.
+ public static void init() {
+ if (parser == null) {
+ parser = new ConfigXmlParser();
+ }
+ }
+
+ public static String getStartUrl() {
+ if (parser == null) {
+ return "file:///android_asset/www/index.html";
+ }
+ return parser.getLaunchUrl();
+ }
+
+ public static String getErrorUrl() {
+ return parser.getPreferences().getString("errorurl", null);
+ }
+
+ public static List<PluginEntry> getPluginEntries() {
+ return parser.getPluginEntries();
+ }
+
+ public static CordovaPreferences getPreferences() {
+ return parser.getPreferences();
+ }
+
+ public static boolean isInitialized() {
+ return parser != null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/ConfigXmlParser.java
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/ConfigXmlParser.java b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/ConfigXmlParser.java
new file mode 100644
index 0000000..01a97f2
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/ConfigXmlParser.java
@@ -0,0 +1,145 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+*/
+
+package org.apache.cordova;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Locale;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import android.content.Context;
+
+public class ConfigXmlParser {
+ private static String TAG = "ConfigXmlParser";
+
+ private String launchUrl = "file:///android_asset/www/index.html";
+ private CordovaPreferences prefs = new CordovaPreferences();
+ private ArrayList<PluginEntry> pluginEntries = new ArrayList<PluginEntry>(20);
+
+ public CordovaPreferences getPreferences() {
+ return prefs;
+ }
+
+ public ArrayList<PluginEntry> getPluginEntries() {
+ return pluginEntries;
+ }
+
+ public String getLaunchUrl() {
+ return launchUrl;
+ }
+
+ public void parse(Context action) {
+ // First checking the class namespace for config.xml
+ int id = action.getResources().getIdentifier("config", "xml", action.getClass().getPackage().getName());
+ if (id == 0) {
+ // If we couldn't find config.xml there, we'll look in the namespace from AndroidManifest.xml
+ id = action.getResources().getIdentifier("config", "xml", action.getPackageName());
+ if (id == 0) {
+ LOG.e(TAG, "res/xml/config.xml is missing!");
+ return;
+ }
+ }
+ parse(action.getResources().getXml(id));
+ }
+
+ boolean insideFeature = false;
+ String service = "", pluginClass = "", paramType = "";
+ boolean onload = false;
+
+ public void parse(XmlPullParser xml) {
+ int eventType = -1;
+
+ while (eventType != XmlPullParser.END_DOCUMENT) {
+ if (eventType == XmlPullParser.START_TAG) {
+ handleStartTag(xml);
+ }
+ else if (eventType == XmlPullParser.END_TAG)
+ {
+ handleEndTag(xml);
+ }
+ try {
+ eventType = xml.next();
+ } catch (XmlPullParserException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void handleStartTag(XmlPullParser xml) {
+ String strNode = xml.getName();
+ if (strNode.equals("feature")) {
+ //Check for supported feature sets aka. plugins (Accelerometer, Geolocation, etc)
+ //Set the bit for reading params
+ insideFeature = true;
+ service = xml.getAttributeValue(null, "name");
+ }
+ else if (insideFeature && strNode.equals("param")) {
+ paramType = xml.getAttributeValue(null, "name");
+ if (paramType.equals("service")) // check if it is using the older service param
+ service = xml.getAttributeValue(null, "value");
+ else if (paramType.equals("package") || paramType.equals("android-package"))
+ pluginClass = xml.getAttributeValue(null,"value");
+ else if (paramType.equals("onload"))
+ onload = "true".equals(xml.getAttributeValue(null, "value"));
+ }
+ else if (strNode.equals("preference")) {
+ String name = xml.getAttributeValue(null, "name").toLowerCase(Locale.ENGLISH);
+ String value = xml.getAttributeValue(null, "value");
+ prefs.set(name, value);
+ }
+ else if (strNode.equals("content")) {
+ String src = xml.getAttributeValue(null, "src");
+ if (src != null) {
+ setStartUrl(src);
+ }
+ }
+ }
+
+ public void handleEndTag(XmlPullParser xml) {
+ String strNode = xml.getName();
+ if (strNode.equals("feature")) {
+ pluginEntries.add(new PluginEntry(service, pluginClass, onload));
+
+ service = "";
+ pluginClass = "";
+ insideFeature = false;
+ onload = false;
+ }
+ }
+
+ private void setStartUrl(String src) {
+ Pattern schemeRegex = Pattern.compile("^[a-z-]+://");
+ Matcher matcher = schemeRegex.matcher(src);
+ if (matcher.find()) {
+ launchUrl = src;
+ } else {
+ if (src.charAt(0) == '/') {
+ src = src.substring(1);
+ }
+ launchUrl = "file:///android_asset/www/" + src;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaActivity.java
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaActivity.java b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaActivity.java
new file mode 100755
index 0000000..85eeb53
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaActivity.java
@@ -0,0 +1,518 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+*/
+package org.apache.cordova;
+
+import java.util.ArrayList;
+import java.util.Locale;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.annotation.SuppressLint;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.res.Configuration;
+import android.graphics.Color;
+import android.media.AudioManager;
+import android.os.Build;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.Window;
+import android.view.WindowManager;
+import android.webkit.WebViewClient;
+import android.widget.FrameLayout;
+
+/**
+ * This class is the main Android activity that represents the Cordova
+ * application. It should be extended by the user to load the specific
+ * html file that contains the application.
+ *
+ * As an example:
+ *
+ * <pre>
+ * package org.apache.cordova.examples;
+ *
+ * import android.os.Bundle;
+ * import org.apache.cordova.*;
+ *
+ * public class Example extends CordovaActivity {
+ * @Override
+ * public void onCreate(Bundle savedInstanceState) {
+ * super.onCreate(savedInstanceState);
+ * super.init();
+ * // Load your application
+ * loadUrl(launchUrl);
+ * }
+ * }
+ * </pre>
+ *
+ * Cordova xml configuration: Cordova uses a configuration file at
+ * res/xml/config.xml to specify its settings. See "The config.xml File"
+ * guide in cordova-docs at http://cordova.apache.org/docs for the documentation
+ * for the configuration. The use of the set*Property() methods is
+ * deprecated in favor of the config.xml file.
+ *
+ */
+public class CordovaActivity extends Activity {
+ public static String TAG = "CordovaActivity";
+
+ // The webview for our app
+ protected CordovaWebView appView;
+
+ private static int ACTIVITY_STARTING = 0;
+ private static int ACTIVITY_RUNNING = 1;
+ private static int ACTIVITY_EXITING = 2;
+
+ // Keep app running when pause is received. (default = true)
+ // If true, then the JavaScript and native code continue to run in the background
+ // when another application (activity) is started.
+ protected boolean keepRunning = true;
+
+ // Flag to keep immersive mode if set to fullscreen
+ protected boolean immersiveMode;
+
+ // Read from config.xml:
+ protected CordovaPreferences preferences;
+ protected String launchUrl;
+ protected ArrayList<PluginEntry> pluginEntries;
+ protected CordovaInterfaceImpl cordovaInterface;
+
+ /**
+ * Called when the activity is first created.
+ */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ // need to activate preferences before super.onCreate to avoid "requestFeature() must be called before adding content" exception
+ loadConfig();
+
+ String logLevel = preferences.getString("loglevel", "ERROR");
+ LOG.setLogLevel(logLevel);
+
+ LOG.i(TAG, "Apache Cordova native platform version " + CordovaWebView.CORDOVA_VERSION + " is starting");
+ LOG.d(TAG, "CordovaActivity.onCreate()");
+
+ if (!preferences.getBoolean("ShowTitle", false)) {
+ getWindow().requestFeature(Window.FEATURE_NO_TITLE);
+ }
+
+ if (preferences.getBoolean("SetFullscreen", false)) {
+ LOG.d(TAG, "The SetFullscreen configuration is deprecated in favor of Fullscreen, and will be removed in a future version.");
+ preferences.set("Fullscreen", true);
+ }
+ if (preferences.getBoolean("Fullscreen", false)) {
+ // NOTE: use the FullscreenNotImmersive configuration key to set the activity in a REAL full screen
+ // (as was the case in previous cordova versions)
+ if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) && !preferences.getBoolean("FullscreenNotImmersive", false)) {
+ immersiveMode = true;
+ } else {
+ getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+ WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ }
+ } else {
+ getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
+ WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
+ }
+
+ super.onCreate(savedInstanceState);
+
+ cordovaInterface = makeCordovaInterface();
+ if (savedInstanceState != null) {
+ cordovaInterface.restoreInstanceState(savedInstanceState);
+ }
+ }
+
+ protected void init() {
+ appView = makeWebView();
+ createViews();
+ if (!appView.isInitialized()) {
+ appView.init(cordovaInterface, pluginEntries, preferences);
+ }
+ cordovaInterface.onCordovaInit(appView.getPluginManager());
+
+ // Wire the hardware volume controls to control media if desired.
+ String volumePref = preferences.getString("DefaultVolumeStream", "");
+ if ("media".equals(volumePref.toLowerCase(Locale.ENGLISH))) {
+ setVolumeControlStream(AudioManager.STREAM_MUSIC);
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void loadConfig() {
+ ConfigXmlParser parser = new ConfigXmlParser();
+ parser.parse(this);
+ preferences = parser.getPreferences();
+ preferences.setPreferencesBundle(getIntent().getExtras());
+ launchUrl = parser.getLaunchUrl();
+ pluginEntries = parser.getPluginEntries();
+ Config.parser = parser;
+ }
+
+ //Suppressing warnings in AndroidStudio
+ @SuppressWarnings({"deprecation", "ResourceType"})
+ protected void createViews() {
+ //Why are we setting a constant as the ID? This should be investigated
+ appView.getView().setId(100);
+ appView.getView().setLayoutParams(new FrameLayout.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT));
+
+ setContentView(appView.getView());
+
+ if (preferences.contains("BackgroundColor")) {
+ try {
+ int backgroundColor = preferences.getInteger("BackgroundColor", Color.BLACK);
+ // Background of activity:
+ appView.getView().setBackgroundColor(backgroundColor);
+ }
+ catch (NumberFormatException e){
+ e.printStackTrace();
+ }
+ }
+
+ appView.getView().requestFocusFromTouch();
+ }
+
+ /**
+ * Construct the default web view object.
+ * <p/>
+ * Override this to customize the webview that is used.
+ */
+ protected CordovaWebView makeWebView() {
+ return new CordovaWebViewImpl(makeWebViewEngine());
+ }
+
+ protected CordovaWebViewEngine makeWebViewEngine() {
+ return CordovaWebViewImpl.createEngine(this, preferences);
+ }
+
+ protected CordovaInterfaceImpl makeCordovaInterface() {
+ return new CordovaInterfaceImpl(this) {
+ @Override
+ public Object onMessage(String id, Object data) {
+ // Plumb this to CordovaActivity.onMessage for backwards compatibility
+ return CordovaActivity.this.onMessage(id, data);
+ }
+ };
+ }
+
+ /**
+ * Load the url into the webview.
+ */
+ public void loadUrl(String url) {
+ if (appView == null) {
+ init();
+ }
+
+ // If keepRunning
+ this.keepRunning = preferences.getBoolean("KeepRunning", true);
+
+ appView.loadUrlIntoView(url, true);
+ }
+
+ /**
+ * Called when the system is about to start resuming a previous activity.
+ */
+ @Override
+ protected void onPause() {
+ super.onPause();
+ LOG.d(TAG, "Paused the activity.");
+
+ if (this.appView != null) {
+ // CB-9382 If there is an activity that started for result and main activity is waiting for callback
+ // result, we shoudn't stop WebView Javascript timers, as activity for result might be using them
+ boolean keepRunning = this.keepRunning || this.cordovaInterface.activityResultCallback != null;
+ this.appView.handlePause(keepRunning);
+ }
+ }
+
+ /**
+ * Called when the activity receives a new intent
+ */
+ @Override
+ protected void onNewIntent(Intent intent) {
+ super.onNewIntent(intent);
+ //Forward to plugins
+ if (this.appView != null)
+ this.appView.onNewIntent(intent);
+ }
+
+ /**
+ * Called when the activity will start interacting with the user.
+ */
+ @Override
+ protected void onResume() {
+ super.onResume();
+ LOG.d(TAG, "Resumed the activity.");
+
+ if (this.appView == null) {
+ return;
+ }
+ // Force window to have focus, so application always
+ // receive user input. Workaround for some devices (Samsung Galaxy Note 3 at least)
+ this.getWindow().getDecorView().requestFocus();
+
+ this.appView.handleResume(this.keepRunning);
+ }
+
+ /**
+ * Called when the activity is no longer visible to the user.
+ */
+ @Override
+ protected void onStop() {
+ super.onStop();
+ LOG.d(TAG, "Stopped the activity.");
+
+ if (this.appView == null) {
+ return;
+ }
+ this.appView.handleStop();
+ }
+
+ /**
+ * Called when the activity is becoming visible to the user.
+ */
+ @Override
+ protected void onStart() {
+ super.onStart();
+ LOG.d(TAG, "Started the activity.");
+
+ if (this.appView == null) {
+ return;
+ }
+ this.appView.handleStart();
+ }
+
+ /**
+ * The final call you receive before your activity is destroyed.
+ */
+ @Override
+ public void onDestroy() {
+ LOG.d(TAG, "CordovaActivity.onDestroy()");
+ super.onDestroy();
+
+ if (this.appView != null) {
+ appView.handleDestroy();
+ }
+ }
+
+ /**
+ * Called when view focus is changed
+ */
+ @Override
+ public void onWindowFocusChanged(boolean hasFocus) {
+ super.onWindowFocusChanged(hasFocus);
+ if (hasFocus && immersiveMode) {
+ final int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
+
+ getWindow().getDecorView().setSystemUiVisibility(uiOptions);
+ }
+ }
+
+ @SuppressLint("NewApi")
+ @Override
+ public void startActivityForResult(Intent intent, int requestCode, Bundle options) {
+ // Capture requestCode here so that it is captured in the setActivityResultCallback() case.
+ cordovaInterface.setActivityResultRequestCode(requestCode);
+ super.startActivityForResult(intent, requestCode, options);
+ }
+
+ /**
+ * Called when an activity you launched exits, giving you the requestCode you started it with,
+ * the resultCode it returned, and any additional data from it.
+ *
+ * @param requestCode The request code originally supplied to startActivityForResult(),
+ * allowing you to identify who this result came from.
+ * @param resultCode The integer result code returned by the child activity through its setResult().
+ * @param intent An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
+ */
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
+ LOG.d(TAG, "Incoming Result. Request code = " + requestCode);
+ super.onActivityResult(requestCode, resultCode, intent);
+ cordovaInterface.onActivityResult(requestCode, resultCode, intent);
+ }
+
+ /**
+ * Report an error to the host application. These errors are unrecoverable (i.e. the main resource is unavailable).
+ * The errorCode parameter corresponds to one of the ERROR_* constants.
+ *
+ * @param errorCode The error code corresponding to an ERROR_* value.
+ * @param description A String describing the error.
+ * @param failingUrl The url that failed to load.
+ */
+ public void onReceivedError(final int errorCode, final String description, final String failingUrl) {
+ final CordovaActivity me = this;
+
+ // If errorUrl specified, then load it
+ final String errorUrl = preferences.getString("errorUrl", null);
+ if ((errorUrl != null) && (!failingUrl.equals(errorUrl)) && (appView != null)) {
+ // Load URL on UI thread
+ me.runOnUiThread(new Runnable() {
+ public void run() {
+ me.appView.showWebPage(errorUrl, false, true, null);
+ }
+ });
+ }
+ // If not, then display error dialog
+ else {
+ final boolean exit = !(errorCode == WebViewClient.ERROR_HOST_LOOKUP);
+ me.runOnUiThread(new Runnable() {
+ public void run() {
+ if (exit) {
+ me.appView.getView().setVisibility(View.GONE);
+ me.displayError("Application Error", description + " (" + failingUrl + ")", "OK", exit);
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * Display an error dialog and optionally exit application.
+ */
+ public void displayError(final String title, final String message, final String button, final boolean exit) {
+ final CordovaActivity me = this;
+ me.runOnUiThread(new Runnable() {
+ public void run() {
+ try {
+ AlertDialog.Builder dlg = new AlertDialog.Builder(me);
+ dlg.setMessage(message);
+ dlg.setTitle(title);
+ dlg.setCancelable(false);
+ dlg.setPositiveButton(button,
+ new AlertDialog.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ if (exit) {
+ finish();
+ }
+ }
+ });
+ dlg.create();
+ dlg.show();
+ } catch (Exception e) {
+ finish();
+ }
+ }
+ });
+ }
+
+ /*
+ * Hook in Cordova for menu plugins
+ */
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ if (appView != null) {
+ appView.getPluginManager().postMessage("onCreateOptionsMenu", menu);
+ }
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ @Override
+ public boolean onPrepareOptionsMenu(Menu menu) {
+ if (appView != null) {
+ appView.getPluginManager().postMessage("onPrepareOptionsMenu", menu);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (appView != null) {
+ appView.getPluginManager().postMessage("onOptionsItemSelected", item);
+ }
+ return true;
+ }
+
+ /**
+ * Called when a message is sent to plugin.
+ *
+ * @param id The message id
+ * @param data The message data
+ * @return Object or null
+ */
+ public Object onMessage(String id, Object data) {
+ if ("onReceivedError".equals(id)) {
+ JSONObject d = (JSONObject) data;
+ try {
+ this.onReceivedError(d.getInt("errorCode"), d.getString("description"), d.getString("url"));
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ } else if ("exit".equals(id)) {
+ finish();
+ }
+ return null;
+ }
+
+ protected void onSaveInstanceState(Bundle outState) {
+ cordovaInterface.onSaveInstanceState(outState);
+ super.onSaveInstanceState(outState);
+ }
+
+ /**
+ * Called by the system when the device configuration changes while your activity is running.
+ *
+ * @param newConfig The new device configuration
+ */
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ if (this.appView == null) {
+ return;
+ }
+ PluginManager pm = this.appView.getPluginManager();
+ if (pm != null) {
+ pm.onConfigurationChanged(newConfig);
+ }
+ }
+
+ /**
+ * Called by the system when the user grants permissions
+ *
+ * @param requestCode
+ * @param permissions
+ * @param grantResults
+ */
+ @Override
+ public void onRequestPermissionsResult(int requestCode, String permissions[],
+ int[] grantResults) {
+ try
+ {
+ cordovaInterface.onRequestPermissionResult(requestCode, permissions, grantResults);
+ }
+ catch (JSONException e)
+ {
+ LOG.d(TAG, "JSONException: Parameters fed into the method are not valid");
+ e.printStackTrace();
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaArgs.java
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaArgs.java b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaArgs.java
new file mode 100644
index 0000000..d40d26e
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaArgs.java
@@ -0,0 +1,113 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+*/
+package org.apache.cordova;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import android.util.Base64;
+
+public class CordovaArgs {
+ private JSONArray baseArgs;
+
+ public CordovaArgs(JSONArray args) {
+ this.baseArgs = args;
+ }
+
+
+ // Pass through the basics to the base args.
+ public Object get(int index) throws JSONException {
+ return baseArgs.get(index);
+ }
+
+ public boolean getBoolean(int index) throws JSONException {
+ return baseArgs.getBoolean(index);
+ }
+
+ public double getDouble(int index) throws JSONException {
+ return baseArgs.getDouble(index);
+ }
+
+ public int getInt(int index) throws JSONException {
+ return baseArgs.getInt(index);
+ }
+
+ public JSONArray getJSONArray(int index) throws JSONException {
+ return baseArgs.getJSONArray(index);
+ }
+
+ public JSONObject getJSONObject(int index) throws JSONException {
+ return baseArgs.getJSONObject(index);
+ }
+
+ public long getLong(int index) throws JSONException {
+ return baseArgs.getLong(index);
+ }
+
+ public String getString(int index) throws JSONException {
+ return baseArgs.getString(index);
+ }
+
+
+ public Object opt(int index) {
+ return baseArgs.opt(index);
+ }
+
+ public boolean optBoolean(int index) {
+ return baseArgs.optBoolean(index);
+ }
+
+ public double optDouble(int index) {
+ return baseArgs.optDouble(index);
+ }
+
+ public int optInt(int index) {
+ return baseArgs.optInt(index);
+ }
+
+ public JSONArray optJSONArray(int index) {
+ return baseArgs.optJSONArray(index);
+ }
+
+ public JSONObject optJSONObject(int index) {
+ return baseArgs.optJSONObject(index);
+ }
+
+ public long optLong(int index) {
+ return baseArgs.optLong(index);
+ }
+
+ public String optString(int index) {
+ return baseArgs.optString(index);
+ }
+
+ public boolean isNull(int index) {
+ return baseArgs.isNull(index);
+ }
+
+
+ // The interesting custom helpers.
+ public byte[] getArrayBuffer(int index) throws JSONException {
+ String encoded = baseArgs.getString(index);
+ return Base64.decode(encoded, Base64.DEFAULT);
+ }
+}
+
+
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaBridge.java
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaBridge.java b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaBridge.java
new file mode 100644
index 0000000..9459a11
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaBridge.java
@@ -0,0 +1,182 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+*/
+package org.apache.cordova;
+
+import java.security.SecureRandom;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+
+/**
+ * Contains APIs that the JS can call. All functions in here should also have
+ * an equivalent entry in CordovaChromeClient.java, and be added to
+ * cordova-js/lib/android/plugin/android/promptbasednativeapi.js
+ */
+public class CordovaBridge {
+ private static final String LOG_TAG = "CordovaBridge";
+ private PluginManager pluginManager;
+ private NativeToJsMessageQueue jsMessageQueue;
+ private volatile int expectedBridgeSecret = -1; // written by UI thread, read by JS thread.
+
+ public CordovaBridge(PluginManager pluginManager, NativeToJsMessageQueue jsMessageQueue) {
+ this.pluginManager = pluginManager;
+ this.jsMessageQueue = jsMessageQueue;
+ }
+
+ public String jsExec(int bridgeSecret, String service, String action, String callbackId, String arguments) throws JSONException, IllegalAccessException {
+ if (!verifySecret("exec()", bridgeSecret)) {
+ return null;
+ }
+ // If the arguments weren't received, send a message back to JS. It will switch bridge modes and try again. See CB-2666.
+ // We send a message meant specifically for this case. It starts with "@" so no other message can be encoded into the same string.
+ if (arguments == null) {
+ return "@Null arguments.";
+ }
+
+ jsMessageQueue.setPaused(true);
+ try {
+ // Tell the resourceApi what thread the JS is running on.
+ CordovaResourceApi.jsThread = Thread.currentThread();
+
+ pluginManager.exec(service, action, callbackId, arguments);
+ String ret = null;
+ if (!NativeToJsMessageQueue.DISABLE_EXEC_CHAINING) {
+ ret = jsMessageQueue.popAndEncode(false);
+ }
+ return ret;
+ } catch (Throwable e) {
+ e.printStackTrace();
+ return "";
+ } finally {
+ jsMessageQueue.setPaused(false);
+ }
+ }
+
+ public void jsSetNativeToJsBridgeMode(int bridgeSecret, int value) throws IllegalAccessException {
+ if (!verifySecret("setNativeToJsBridgeMode()", bridgeSecret)) {
+ return;
+ }
+ jsMessageQueue.setBridgeMode(value);
+ }
+
+ public String jsRetrieveJsMessages(int bridgeSecret, boolean fromOnlineEvent) throws IllegalAccessException {
+ if (!verifySecret("retrieveJsMessages()", bridgeSecret)) {
+ return null;
+ }
+ return jsMessageQueue.popAndEncode(fromOnlineEvent);
+ }
+
+ private boolean verifySecret(String action, int bridgeSecret) throws IllegalAccessException {
+ if (!jsMessageQueue.isBridgeEnabled()) {
+ if (bridgeSecret == -1) {
+ LOG.d(LOG_TAG, action + " call made before bridge was enabled.");
+ } else {
+ LOG.d(LOG_TAG, "Ignoring " + action + " from previous page load.");
+ }
+ return false;
+ }
+ // Bridge secret wrong and bridge not due to it being from the previous page.
+ if (expectedBridgeSecret < 0 || bridgeSecret != expectedBridgeSecret) {
+ LOG.e(LOG_TAG, "Bridge access attempt with wrong secret token, possibly from malicious code. Disabling exec() bridge!");
+ clearBridgeSecret();
+ throw new IllegalAccessException();
+ }
+ return true;
+ }
+
+ /** Called on page transitions */
+ void clearBridgeSecret() {
+ expectedBridgeSecret = -1;
+ }
+
+ public boolean isSecretEstablished() {
+ return expectedBridgeSecret != -1;
+ }
+
+ /** Called by cordova.js to initialize the bridge. */
+ int generateBridgeSecret() {
+ SecureRandom randGen = new SecureRandom();
+ expectedBridgeSecret = randGen.nextInt(Integer.MAX_VALUE);
+ return expectedBridgeSecret;
+ }
+
+ public void reset() {
+ jsMessageQueue.reset();
+ clearBridgeSecret();
+ }
+
+ public String promptOnJsPrompt(String origin, String message, String defaultValue) {
+ if (defaultValue != null && defaultValue.length() > 3 && defaultValue.startsWith("gap:")) {
+ JSONArray array;
+ try {
+ array = new JSONArray(defaultValue.substring(4));
+ int bridgeSecret = array.getInt(0);
+ String service = array.getString(1);
+ String action = array.getString(2);
+ String callbackId = array.getString(3);
+ String r = jsExec(bridgeSecret, service, action, callbackId, message);
+ return r == null ? "" : r;
+ } catch (JSONException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ return "";
+ }
+ // Sets the native->JS bridge mode.
+ else if (defaultValue != null && defaultValue.startsWith("gap_bridge_mode:")) {
+ try {
+ int bridgeSecret = Integer.parseInt(defaultValue.substring(16));
+ jsSetNativeToJsBridgeMode(bridgeSecret, Integer.parseInt(message));
+ } catch (NumberFormatException e){
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ return "";
+ }
+ // Polling for JavaScript messages
+ else if (defaultValue != null && defaultValue.startsWith("gap_poll:")) {
+ int bridgeSecret = Integer.parseInt(defaultValue.substring(9));
+ try {
+ String r = jsRetrieveJsMessages(bridgeSecret, "1".equals(message));
+ return r == null ? "" : r;
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ return "";
+ }
+ else if (defaultValue != null && defaultValue.startsWith("gap_init:")) {
+ // Protect against random iframes being able to talk through the bridge.
+ // Trust only pages which the app would have been allowed to navigate to anyway.
+ if (pluginManager.shouldAllowBridgeAccess(origin)) {
+ // Enable the bridge
+ int bridgeMode = Integer.parseInt(defaultValue.substring(9));
+ jsMessageQueue.setBridgeMode(bridgeMode);
+ // Tell JS the bridge secret.
+ int secret = generateBridgeSecret();
+ return ""+secret;
+ } else {
+ LOG.e(LOG_TAG, "gap_init called from restricted origin: " + origin);
+ }
+ return "";
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaClientCertRequest.java
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaClientCertRequest.java b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaClientCertRequest.java
new file mode 100644
index 0000000..5dd0eca
--- /dev/null
+++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaClientCertRequest.java
@@ -0,0 +1,96 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+*/
+package org.apache.cordova;
+
+import java.security.Principal;
+import java.security.PrivateKey;
+import java.security.cert.X509Certificate;
+
+import android.webkit.ClientCertRequest;
+
+/**
+ * Implementation of the ICordovaClientCertRequest for Android WebView.
+ */
+public class CordovaClientCertRequest implements ICordovaClientCertRequest {
+
+ private final ClientCertRequest request;
+
+ public CordovaClientCertRequest(ClientCertRequest request) {
+ this.request = request;
+ }
+
+ /**
+ * Cancel this request
+ */
+ public void cancel()
+ {
+ request.cancel();
+ }
+
+ /*
+ * Returns the host name of the server requesting the certificate.
+ */
+ public String getHost()
+ {
+ return request.getHost();
+ }
+
+ /*
+ * Returns the acceptable types of asymmetric keys (can be null).
+ */
+ public String[] getKeyTypes()
+ {
+ return request.getKeyTypes();
+ }
+
+ /*
+ * Returns the port number of the server requesting the certificate.
+ */
+ public int getPort()
+ {
+ return request.getPort();
+ }
+
+ /*
+ * Returns the acceptable certificate issuers for the certificate matching the private key (can be null).
+ */
+ public Principal[] getPrincipals()
+ {
+ return request.getPrincipals();
+ }
+
+ /*
+ * Ignore the request for now. Do not remember user's choice.
+ */
+ public void ignore()
+ {
+ request.ignore();
+ }
+
+ /*
+ * Proceed with the specified private key and client certificate chain. Remember the user's positive choice and use it for future requests.
+ *
+ * @param privateKey The privateKey
+ * @param chain The certificate chain
+ */
+ public void proceed(PrivateKey privateKey, X509Certificate[] chain)
+ {
+ request.proceed(privateKey, chain);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org