summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.mk1
-rw-r--r--docs/html/guide/appendix/media-formats.jd27
-rw-r--r--docs/html/sdk/terms.jd4
-rw-r--r--docs/html/sdk/terms_body.html6
-rw-r--r--location/java/android/location/IGeocodeProvider.aidl35
-rw-r--r--location/java/android/location/ILocationManager.aidl4
-rw-r--r--location/java/android/location/ILocationProvider.aidl7
-rw-r--r--location/java/com/android/internal/location/LocationProviderProxy.java25
-rwxr-xr-xopengl/tools/glgen/gen11
-rw-r--r--opengl/tools/glgen/src/GenerateGL.java3
-rw-r--r--opengl/tools/glgen/src/JniCodeEmitter.java479
-rw-r--r--opengl/tools/glgen/src/Jsr239CodeEmitter.java74
-rw-r--r--services/java/com/android/server/LocationManagerService.java49
13 files changed, 378 insertions, 347 deletions
diff --git a/Android.mk b/Android.mk
index b7f8977d3f23..e2c3def5a312 100644
--- a/Android.mk
+++ b/Android.mk
@@ -109,6 +109,7 @@ LOCAL_SRC_FILES += \
core/java/com/android/internal/view/IInputMethodManager.aidl \
core/java/com/android/internal/view/IInputMethodSession.aidl \
im/java/android/im/IImPlugin.aidl \
+ location/java/android/location/IGeocodeProvider.aidl \
location/java/android/location/IGpsStatusListener.aidl \
location/java/android/location/ILocationCollector.aidl \
location/java/android/location/ILocationListener.aidl \
diff --git a/docs/html/guide/appendix/media-formats.jd b/docs/html/guide/appendix/media-formats.jd
index 5419ad679297..323192d09339 100644
--- a/docs/html/guide/appendix/media-formats.jd
+++ b/docs/html/guide/appendix/media-formats.jd
@@ -95,7 +95,7 @@ page.title=Android Supported Media Formats
<td>JPEG</td>
<td style="text-align: center;">X</td>
<td style="text-align: center;">X</td>
-<td>base+progressive</td>
+<td>Base+progressive</td>
<td>JPEG (.jpg)</td>
</tr>
@@ -127,24 +127,24 @@ page.title=Android Supported Media Formats
<tr>
<td rowspan="3">Video</td>
<td>H.263</td>
-<td style="text-align: center;">X</td>
+<td style="text-align: center;"></td>
<td style="text-align: center;">X</td>
<td>&nbsp;</td>
<td>3GPP (.3gp)</td>
</tr>
<tr>
-<td>H.264</td>
-<td style="text-align: center;">X</td>
+<td>H.264 AVC</td>
+<td style="text-align: center;"></td>
<td style="text-align: center;">X</td>
<td>&nbsp;</td>
<td>3GPP (.3gp) and MPEG-4 (.mp4)</td>
</tr>
<tr>
-<td>MPEG4 SP</td>
-<td>&nbsp;</td>
+<td>MPEG-4 SP</td>
<td>&nbsp;</td>
+<td style="text-align: center;">X</td>
<td>&nbsp;</td>
<td>3GPP (.3gp)</td>
</tr>
@@ -171,7 +171,7 @@ page.title=Android Supported Media Formats
<td>Audio</td>
<td>WMA</td>
<td>&nbsp;</td>
-<td>X</td>
+<td style="text-align: center;">X</td>
<td>Supports WMA standard L1-L3:
<ul>
<li>L1: 64 kbps - 161 kbps @ 44.1kHz</li>
@@ -184,13 +184,22 @@ Mono and stereo profiles with 16-bits per sample. Decoder does not support WMA P
</tr>
<tr>
-<td>Video</td>
+<td rowspan="2">Video</td>
<td>WMV</td>
<td>&nbsp;</td>
-<td>X</td>
+<td style="text-align: center;">X</td>
<td>Versions 7, 8 and 9. Simple profile only</td>
<td>Windows Media Video (.wmv)</td>
</tr>
+
+<tr>
+<td>H.264 AVC</td>
+<td>&nbsp;</td>
+<td style="text-align: center;">X</td>
+<td>Limited to baseline profile up to 480x320, and 600 kbps average bitrate for the video stream.</td>
+<td>3GPP (.3gp) and MPEG-4 (.mp4)</td>
+</tr>
+
</tbody></table>
diff --git a/docs/html/sdk/terms.jd b/docs/html/sdk/terms.jd
index b3c5ea253cc4..614a438ef17c 100644
--- a/docs/html/sdk/terms.jd
+++ b/docs/html/sdk/terms.jd
@@ -8,7 +8,7 @@ hide_license_footer=true
1. Introduction
</h2>
<p>
- 1.1 The Android Software Development Kit (referred to in this License Agreement as the "SDK" and specifically including the Android system files, packaged APIs, and Google Services add-ons) is licensed to you subject to the terms of this License Agreement. This License Agreement forms a legally binding contract between you and Google in relation to your use of the SDK.
+ 1.1 The Android Software Development Kit (referred to in this License Agreement as the "SDK" and specifically including the Android system files, packaged APIs, and Google APIs add-ons) is licensed to you subject to the terms of this License Agreement. This License Agreement forms a legally binding contract between you and Google in relation to your use of the SDK.
</p>
<p>
@@ -46,7 +46,7 @@ hide_license_footer=true
</p>
<p>
- 3.3. Except to the extent required by applicable third party licenses, you may not copy (except for backup purposes), modify, adapt, redistribute, decompile, reverse engineer, disassemble, or create derivative works of the SDK or any part of the SDK. Except to the extent required by applicable third party licenses, you may not load any part of the SDK onto a mobile handset or any other hardware device except a personal computer, combine any part of the SDK with other software, or distribute any software or device incorporating a part of the SDK.
+ 3.3 Except to the extent required by applicable third party licenses, you may not copy (except for backup purposes), modify, adapt, redistribute, decompile, reverse engineer, disassemble, or create derivative works of the SDK or any part of the SDK. Except to the extent required by applicable third party licenses, you may not load any part of the SDK onto a mobile handset or any other hardware device except a personal computer, combine any part of the SDK with other software, or distribute any software or device incorporating a part of the SDK.
</p>
<p>
3.4 Use, reproduction and distribution of components of the SDK licensed under an open source software license are governed solely by the terms of that open source software license and not this License Agreement.
diff --git a/docs/html/sdk/terms_body.html b/docs/html/sdk/terms_body.html
index a73801f06f86..03e09066d98c 100644
--- a/docs/html/sdk/terms_body.html
+++ b/docs/html/sdk/terms_body.html
@@ -5,7 +5,7 @@
1. Introduction
</h2>
<p>
- 1.1 The Android Software Development Kit (referred to in this License Agreement as the "SDK" and specifically including the Android system files, packaged APIs, and Google Services add-ons) is licensed to you subject to the terms of this License Agreement. This License Agreement forms a legally binding contract between you and Google in relation to your use of the SDK.
+ 1.1 The Android Software Development Kit (referred to in this License Agreement as the "SDK" and specifically including the Android system files, packaged APIs, and Google APIs add-ons) is licensed to you subject to the terms of this License Agreement. This License Agreement forms a legally binding contract between you and Google in relation to your use of the SDK.
</p>
<p>
@@ -43,7 +43,7 @@
</p>
<p>
- 3.3. Except to the extent required by applicable third party licenses, you may not copy (except for backup purposes), modify, adapt, redistribute, decompile, reverse engineer, disassemble, or create derivative works of the SDK or any part of the SDK. Except to the extent required by applicable third party licenses, you may not load any part of the SDK onto a mobile handset or any other hardware device except a personal computer, combine any part of the SDK with other software, or distribute any software or device incorporating a part of the SDK.
+ 3.3 Except to the extent required by applicable third party licenses, you may not copy (except for backup purposes), modify, adapt, redistribute, decompile, reverse engineer, disassemble, or create derivative works of the SDK or any part of the SDK. Except to the extent required by applicable third party licenses, you may not load any part of the SDK onto a mobile handset or any other hardware device except a personal computer, combine any part of the SDK with other software, or distribute any software or device incorporating a part of the SDK.
</p>
<p>
3.4 Use, reproduction and distribution of components of the SDK licensed under an open source software license are governed solely by the terms of that open source software license and not this License Agreement.
@@ -201,4 +201,4 @@
</p>
<p>
<em>April 10, 2009</em>
-</p> \ No newline at end of file
+</p>
diff --git a/location/java/android/location/IGeocodeProvider.aidl b/location/java/android/location/IGeocodeProvider.aidl
new file mode 100644
index 000000000000..e79e8d2db623
--- /dev/null
+++ b/location/java/android/location/IGeocodeProvider.aidl
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+package android.location;
+
+import android.location.Address;
+
+/**
+ * An interface for location providers implementing the Geocoder services.
+ *
+ * {@hide}
+ */
+interface IGeocodeProvider {
+
+ String getFromLocation(double latitude, double longitude, int maxResults,
+ String language, String country, String variant, String appName, out List<Address> addrs);
+
+ String getFromLocationName(String locationName,
+ double lowerLeftLatitude, double lowerLeftLongitude,
+ double upperRightLatitude, double upperRightLongitude, int maxResults,
+ String language, String country, String variant, String appName, out List<Address> addrs);
+}
diff --git a/location/java/android/location/ILocationManager.aidl b/location/java/android/location/ILocationManager.aidl
index 86bd8b6e6f27..7d35814e513f 100644
--- a/location/java/android/location/ILocationManager.aidl
+++ b/location/java/android/location/ILocationManager.aidl
@@ -18,6 +18,7 @@ package android.location;
import android.app.PendingIntent;
import android.location.Address;
+import android.location.IGeocodeProvider;
import android.location.IGpsStatusListener;
import android.location.ILocationCollector;
import android.location.ILocationListener;
@@ -77,7 +78,8 @@ interface ILocationManager
void setTestProviderStatus(String provider, int status, in Bundle extras, long updateTime);
void clearTestProviderStatus(String provider);
- /* for installing Network Location Provider */
+ /* for installing external Location Providers */
void setNetworkLocationProvider(ILocationProvider provider);
void setLocationCollector(ILocationCollector collector);
+ void setGeocodeProvider(IGeocodeProvider provider);
}
diff --git a/location/java/android/location/ILocationProvider.aidl b/location/java/android/location/ILocationProvider.aidl
index 6f9daff31064..08b924668954 100644
--- a/location/java/android/location/ILocationProvider.aidl
+++ b/location/java/android/location/ILocationProvider.aidl
@@ -16,7 +16,6 @@
package android.location;
-import android.location.Address;
import android.os.Bundle;
/**
@@ -52,10 +51,4 @@ interface ILocationProvider {
void updateCellLockStatus(boolean acquired);
void addListener(in String[] applications);
void removeListener(in String[] applications);
- String getFromLocation(double latitude, double longitude, int maxResults,
- String language, String country, String variant, String appName, out List<Address> addrs);
- String getFromLocationName(String locationName,
- double lowerLeftLatitude, double lowerLeftLongitude,
- double upperRightLatitude, double upperRightLongitude, int maxResults,
- String language, String country, String variant, String appName, out List<Address> addrs);
}
diff --git a/location/java/com/android/internal/location/LocationProviderProxy.java b/location/java/com/android/internal/location/LocationProviderProxy.java
index 1f4940fed085..5b5b27a6d107 100644
--- a/location/java/com/android/internal/location/LocationProviderProxy.java
+++ b/location/java/com/android/internal/location/LocationProviderProxy.java
@@ -245,29 +245,4 @@ public class LocationProviderProxy extends LocationProviderImpl {
Log.e(TAG, "removeListener failed", e);
}
}
-
- public String getFromLocation(double latitude, double longitude, int maxResults,
- String language, String country, String variant, String appName, List<Address> addrs) {
- try {
- return mProvider.getFromLocation(latitude, longitude, maxResults, language, country,
- variant, appName, addrs);
- } catch (RemoteException e) {
- Log.e(TAG, "getFromLocation failed", e);
- return null;
- }
- }
-
- public String getFromLocationName(String locationName,
- double lowerLeftLatitude, double lowerLeftLongitude,
- double upperRightLatitude, double upperRightLongitude, int maxResults,
- String language, String country, String variant, String appName, List<Address> addrs) {
- try {
- return mProvider.getFromLocationName(locationName, lowerLeftLatitude,
- lowerLeftLongitude, upperRightLatitude, upperRightLongitude,
- maxResults, language, country, variant, appName, addrs);
- } catch (RemoteException e) {
- Log.e(TAG, "getFromLocationName failed", e);
- return null;
- }
- }
}
diff --git a/opengl/tools/glgen/gen b/opengl/tools/glgen/gen
index c060040cec44..25e9a09f2768 100755
--- a/opengl/tools/glgen/gen
+++ b/opengl/tools/glgen/gen
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+set -u
rm -rf out generated
mkdir out
@@ -12,12 +13,18 @@ echo "public interface Canvas {}" >> out/android/graphics/Canvas.java
GLFILE=out/javax/microedition/khronos/opengles/GL.java
cp stubs/GLHeader.java-if $GLFILE
-GLGEN_FILES="CFunc.java CType.java CodeEmitter.java GenerateGL.java JFunc.java JType.java JniCodeEmitter.java ParameterChecker.java"
+GLGEN_FILES="CFunc.java CType.java CodeEmitter.java GenerateGL.java JFunc.java JniCodeEmitter.java JType.java Jsr239CodeEmitter.java ParameterChecker.java"
pushd src > /dev/null
javac ${GLGEN_FILES}
+JAVAC_RESULT=$?
+if [ $JAVAC_RESULT -ne 0 ]; then
+ echo "Could not compile glgen."
+ exit $JAVAC_RESULT
+fi
popd > /dev/null
java -classpath src GenerateGL -c glspec-1.0 glspec-1.0ext glspec-1.1 glspec-1.1ext glspec-1.1extpack glspec-checks
+rm src/*.class
pushd out > /dev/null
mkdir classes
diff --git a/opengl/tools/glgen/src/GenerateGL.java b/opengl/tools/glgen/src/GenerateGL.java
index afe1bb6ba8a1..accb16e965d7 100644
--- a/opengl/tools/glgen/src/GenerateGL.java
+++ b/opengl/tools/glgen/src/GenerateGL.java
@@ -23,7 +23,6 @@ public class GenerateGL {
PrintStream glImplStream,
PrintStream cStream) throws Exception {
String s = null;
- int counter = 0;
while ((s = specReader.readLine()) != null) {
if (s.trim().startsWith("//")) {
continue;
@@ -120,7 +119,7 @@ public class GenerateGL {
ParameterChecker checker = new ParameterChecker(checksReader);
CodeEmitter emitter =
- new JniCodeEmitter(classPathName,
+ new Jsr239CodeEmitter(classPathName,
checker,
gl10Stream, gl10ExtStream,
gl11Stream, gl11ExtStream, gl11ExtPackStream,
diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java
index 2a8bcbb8ba48..9d37607c851e 100644
--- a/opengl/tools/glgen/src/JniCodeEmitter.java
+++ b/opengl/tools/glgen/src/JniCodeEmitter.java
@@ -4,90 +4,47 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-/**
- * Emits a Java interface and Java & C implementation for a C function.
- *
- * <p> The Java interface will have Buffer and array variants for functions that
- * have a typed pointer argument. The array variant will convert a single "<type> *data"
- * argument to a pair of arguments "<type>[] data, int offset".
- */
-public class JniCodeEmitter implements CodeEmitter {
-
- // If true, use C++ style for calling through a JNIEnv *:
- // env->Func(...)
- // If false, use C style:
- // (*env)->Func(env, ...)
- static final boolean mUseCPlusPlus = true;
-
- boolean mUseContextPointer = true;
-
- String mClassPathName;
-
- ParameterChecker mChecker;
- PrintStream mJava10InterfaceStream;
- PrintStream mJava10ExtInterfaceStream;
- PrintStream mJava11InterfaceStream;
- PrintStream mJava11ExtInterfaceStream;
- PrintStream mJava11ExtPackInterfaceStream;
- PrintStream mJavaImplStream;
- PrintStream mCStream;
-
- PrintStream mJavaInterfaceStream;
-
- List<String> nativeRegistrations = new ArrayList<String>();
+public class JniCodeEmitter {
+ static final boolean mUseCPlusPlus = true;
+ protected boolean mUseContextPointer = true;
+ protected String mClassPathName;
+ protected ParameterChecker mChecker;
+ protected List<String> nativeRegistrations = new ArrayList<String>();
boolean needsExit;
-
- static String indent = " ";
-
+ protected static String indent = " ";
HashSet<String> mFunctionsEmitted = new HashSet<String>();
- /**
- * @param java10InterfaceStream the PrintStream to which to emit the Java interface for GL 1.0 functions
- * @param java10ExtInterfaceStream the PrintStream to which to emit the Java interface for GL 1.0 extension functions
- * @param java11InterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 functions
- * @param java11ExtInterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 Extension functions
- * @param java11ExtPackInterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 Extension Pack functions
- * @param javaImplStream the PrintStream to which to emit the Java implementation
- * @param cStream the PrintStream to which to emit the C implementation
- */
- public JniCodeEmitter(String classPathName,
- ParameterChecker checker,
- PrintStream java10InterfaceStream,
- PrintStream java10ExtInterfaceStream,
- PrintStream java11InterfaceStream,
- PrintStream java11ExtInterfaceStream,
- PrintStream java11ExtPackInterfaceStream,
- PrintStream javaImplStream,
- PrintStream cStream,
- boolean useContextPointer) {
- mClassPathName = classPathName;
- mChecker = checker;
- mJava10InterfaceStream = java10InterfaceStream;
- mJava10ExtInterfaceStream = java10ExtInterfaceStream;
- mJava11InterfaceStream = java11InterfaceStream;
- mJava11ExtInterfaceStream = java11ExtInterfaceStream;
- mJava11ExtPackInterfaceStream = java11ExtPackInterfaceStream;
- mJavaImplStream = javaImplStream;
- mCStream = cStream;
- mUseContextPointer = useContextPointer;
- }
+ public static String getJniName(JType jType) {
+ String jniName = "";
+ if (jType.isClass()) {
+ return "L" + jType.getBaseType() + ";";
+ } else if (jType.isArray()) {
+ jniName = "[";
+ }
- public void setVersion(int version, boolean ext, boolean pack) {
- if (version == 0) {
- mJavaInterfaceStream = ext ? mJava10ExtInterfaceStream :
- mJava10InterfaceStream;
- } else if (version == 1) {
- mJavaInterfaceStream = ext ?
- (pack ? mJava11ExtPackInterfaceStream :
- mJava11ExtInterfaceStream) :
- mJava11InterfaceStream;
- } else {
- throw new RuntimeException("Bad version: " + version);
+ String baseType = jType.getBaseType();
+ if (baseType.equals("int")) {
+ jniName += "I";
+ } else if (baseType.equals("float")) {
+ jniName += "F";
+ } else if (baseType.equals("boolean")) {
+ jniName += "Z";
+ } else if (baseType.equals("short")) {
+ jniName += "S";
+ } else if (baseType.equals("long")) {
+ jniName += "L";
+ } else if (baseType.equals("byte")) {
+ jniName += "B";
}
+ return jniName;
}
- public void emitCode(CFunc cfunc, String original) {
+
+ public void emitCode(CFunc cfunc, String original,
+ PrintStream javaInterfaceStream,
+ PrintStream javaImplStream,
+ PrintStream cStream) {
JFunc jfunc;
String signature;
boolean duplicate;
@@ -107,12 +64,12 @@ public class JniCodeEmitter implements CodeEmitter {
}
if (!duplicate) {
- emitNativeDeclaration(jfunc, mJavaImplStream);
- emitJavaCode(jfunc, mJavaImplStream);
+ emitNativeDeclaration(jfunc, javaImplStream);
+ emitJavaCode(jfunc, javaImplStream);
}
- emitJavaInterfaceCode(jfunc, mJavaInterfaceStream);
+ emitJavaInterfaceCode(jfunc, javaInterfaceStream);
if (!duplicate) {
- emitJniCode(jfunc, mCStream);
+ emitJniCode(jfunc, cStream);
}
}
@@ -127,12 +84,12 @@ public class JniCodeEmitter implements CodeEmitter {
}
if (!duplicate) {
- emitNativeDeclaration(jfunc, mJavaImplStream);
+ emitNativeDeclaration(jfunc, javaImplStream);
}
- emitJavaInterfaceCode(jfunc, mJavaInterfaceStream);
+ emitJavaInterfaceCode(jfunc, javaInterfaceStream);
if (!duplicate) {
- emitJavaCode(jfunc, mJavaImplStream);
- emitJniCode(jfunc, mCStream);
+ emitJavaCode(jfunc, javaImplStream);
+ emitJniCode(jfunc, cStream);
}
}
@@ -151,7 +108,7 @@ public class JniCodeEmitter implements CodeEmitter {
emitFunction(jfunc, out, false, false);
}
- void emitFunctionCall(JFunc jfunc, PrintStream out, String iii, boolean grabArray ) {
+ void emitFunctionCall(JFunc jfunc, PrintStream out, String iii, boolean grabArray) {
boolean isVoid = jfunc.getType().isVoid();
boolean isPointerFunc = jfunc.getName().endsWith("Pointer") &&
jfunc.getCFunc().hasPointerArg();
@@ -194,37 +151,36 @@ public class JniCodeEmitter implements CodeEmitter {
out.println(iii + ");");
}
- void printIfcheckPostamble(PrintStream out, boolean isBuffer,
- boolean emitExceptionCheck, String iii) {
- printIfcheckPostamble(out, isBuffer, emitExceptionCheck,
- "offset", "_remaining", iii);
- }
+ void printIfcheckPostamble(PrintStream out, boolean isBuffer, boolean emitExceptionCheck,
+ String iii) {
+ printIfcheckPostamble(out, isBuffer, emitExceptionCheck,
+ "offset", "_remaining", iii);
+ }
- void printIfcheckPostamble(PrintStream out, boolean isBuffer,
- boolean emitExceptionCheck,
- String offset, String remaining, String iii) {
- out.println(iii + " default:");
- out.println(iii + " _needed = 0;");
- out.println(iii + " break;");
- out.println(iii + "}");
+ void printIfcheckPostamble(PrintStream out, boolean isBuffer, boolean emitExceptionCheck,
+ String offset, String remaining, String iii) {
+ out.println(iii + " default:");
+ out.println(iii + " _needed = 0;");
+ out.println(iii + " break;");
+ out.println(iii + "}");
- out.println(iii + "if (" + remaining + " < _needed) {");
- if (emitExceptionCheck) {
- out.println(iii + indent + "_exception = 1;");
- }
- out.println(iii + indent +
- (mUseCPlusPlus ? "_env" : "(*_env)") +
- "->ThrowNew(" +
- (mUseCPlusPlus ? "" : "_env, ") +
- "IAEClass, " +
- "\"" +
- (isBuffer ?
- "remaining()" : "length - " + offset) +
- " < needed\");");
- out.println(iii + indent + "goto exit;");
- needsExit = true;
- out.println(iii + "}");
- }
+ out.println(iii + "if (" + remaining + " < _needed) {");
+ if (emitExceptionCheck) {
+ out.println(iii + indent + "_exception = 1;");
+ }
+ out.println(iii + indent +
+ (mUseCPlusPlus ? "_env" : "(*_env)") +
+ "->ThrowNew(" +
+ (mUseCPlusPlus ? "" : "_env, ") +
+ "IAEClass, " +
+ "\"" +
+ (isBuffer ?
+ "remaining()" : "length - " + offset) +
+ " < needed\");");
+ out.println(iii + indent + "goto exit;");
+ needsExit = true;
+ out.println(iii + "}");
+ }
boolean isNullAllowed(CFunc cfunc) {
String[] checks = mChecker.getChecks(cfunc.getName());
@@ -310,115 +266,106 @@ public class JniCodeEmitter implements CodeEmitter {
}
void emitNativeBoundsChecks(CFunc cfunc, String cname, PrintStream out,
- boolean isBuffer, boolean emitExceptionCheck,
- String offset, String remaining, String iii) {
- CType returnType = cfunc.getType();
- boolean isVoid = returnType.isVoid();
-
- String[] checks = mChecker.getChecks(cfunc.getName());
- String checkVar;
- String retval = getErrorReturnValue(cfunc);
-
- boolean lastWasIfcheck = false;
-
- int index = 1;
- if (checks != null) {
- boolean remainingDeclared = false;
- boolean nullCheckDeclared = false;
- boolean offsetChecked = false;
- while (index < checks.length) {
- if (checks[index].startsWith("check")) {
- if (lastWasIfcheck) {
- printIfcheckPostamble(out, isBuffer, emitExceptionCheck,
- offset, remaining, iii);
- }
- lastWasIfcheck = false;
- if (cname != null && !cname.equals(checks[index + 1])) {
- index += 3;
- continue;
- }
- out.println(iii + "if (" + remaining + " < " +
- checks[index + 2] +
- ") {");
- if (emitExceptionCheck) {
- out.println(iii + indent + "_exception = 1;");
+ boolean isBuffer, boolean emitExceptionCheck, String offset, String remaining, String iii) {
+
+ String[] checks = mChecker.getChecks(cfunc.getName());
+
+ boolean lastWasIfcheck = false;
+
+ int index = 1;
+ if (checks != null) {
+ while (index < checks.length) {
+ if (checks[index].startsWith("check")) {
+ if (lastWasIfcheck) {
+ printIfcheckPostamble(out, isBuffer, emitExceptionCheck,
+ offset, remaining, iii);
+ }
+ lastWasIfcheck = false;
+ if (cname != null && !cname.equals(checks[index + 1])) {
+ index += 3;
+ continue;
+ }
+ out.println(iii + "if (" + remaining + " < " +
+ checks[index + 2] +
+ ") {");
+ if (emitExceptionCheck) {
+ out.println(iii + indent + "_exception = 1;");
+ }
+ String exceptionClassName = "IAEClass";
+ // If the "check" keyword was of the form
+ // "check_<class name>", use the class name in the
+ // exception to be thrown
+ int underscore = checks[index].indexOf('_');
+ if (underscore >= 0) {
+ exceptionClassName = checks[index].substring(underscore + 1) + "Class";
}
- String exceptionClassName = "IAEClass";
- // If the "check" keyword was of the form
- // "check_<class name>", use the class name in the
- // exception to be thrown
- int underscore = checks[index].indexOf('_');
- if (underscore >= 0) {
- exceptionClassName = checks[index].substring(underscore + 1) + "Class";
- }
- out.println(iii + indent +
- (mUseCPlusPlus ? "_env" : "(*_env)") +
- "->ThrowNew(" +
- (mUseCPlusPlus ? "" : "_env, ") +
- exceptionClassName + ", " +
- "\"" +
- (isBuffer ?
- "remaining()" : "length - " + offset) +
- " < " + checks[index + 2] +
- "\");");
-
- out.println(iii + indent + "goto exit;");
- needsExit = true;
- out.println(iii + "}");
-
- index += 3;
- } else if (checks[index].equals("ifcheck")) {
- String[] matches = checks[index + 4].split(",");
-
- if (!lastWasIfcheck) {
- out.println(iii + "int _needed;");
- out.println(iii +
- "switch (" +
- checks[index + 3] +
- ") {");
+ out.println(iii + indent +
+ (mUseCPlusPlus ? "_env" : "(*_env)") +
+ "->ThrowNew(" +
+ (mUseCPlusPlus ? "" : "_env, ") +
+ exceptionClassName + ", " +
+ "\"" +
+ (isBuffer ?
+ "remaining()" : "length - " + offset) +
+ " < " + checks[index + 2] +
+ "\");");
+
+ out.println(iii + indent + "goto exit;");
+ needsExit = true;
+ out.println(iii + "}");
+
+ index += 3;
+ } else if (checks[index].equals("ifcheck")) {
+ String[] matches = checks[index + 4].split(",");
+
+ if (!lastWasIfcheck) {
+ out.println(iii + "int _needed;");
+ out.println(iii +
+ "switch (" +
+ checks[index + 3] +
+ ") {");
+ }
+
+ for (int i = 0; i < matches.length; i++) {
+ out.println("#if defined(" + matches[i] + ")");
+ out.println(iii +
+ " case " +
+ matches[i] +
+ ":");
+ out.println("#endif // defined(" + matches[i] + ")");
+ }
+ out.println(iii +
+ " _needed = " +
+ checks[index + 2] +
+ ";");
+ out.println(iii +
+ " break;");
+
+ lastWasIfcheck = true;
+ index += 5;
+ } else if (checks[index].equals("return")) {
+ // ignore
+ index += 2;
+ } else if (checks[index].equals("unsupported")) {
+ // ignore
+ index += 1;
+ } else if (checks[index].equals("nullAllowed")) {
+ // ignore
+ index += 1;
+ } else {
+ System.out.println("Error: unknown keyword \"" +
+ checks[index] + "\"");
+ System.exit(0);
+ }
}
+ }
- for (int i = 0; i < matches.length; i++) {
- out.println("#if defined(" + matches[i] + ")");
- out.println(iii +
- " case " +
- matches[i] +
- ":");
- out.println("#endif // defined(" + matches[i] + ")");
- }
- out.println(iii +
- " _needed = " +
- checks[index + 2] +
- ";");
- out.println(iii +
- " break;");
-
- lastWasIfcheck = true;
- index += 5;
- } else if (checks[index].equals("return")) {
- // ignore
- index += 2;
- } else if (checks[index].equals("unsupported")) {
- // ignore
- index += 1;
- } else if (checks[index].equals("nullAllowed")) {
- // ignore
- index += 1;
- } else {
- System.out.println("Error: unknown keyword \"" +
- checks[index] + "\"");
- System.exit(0);
+ if (lastWasIfcheck) {
+ printIfcheckPostamble(out, isBuffer, emitExceptionCheck, iii);
}
}
- }
-
- if (lastWasIfcheck) {
- printIfcheckPostamble(out, isBuffer, emitExceptionCheck, iii);
- }
- }
- boolean hasNonConstArg(JFunc jfunc, CFunc cfunc,
- List<Integer> nonPrimitiveArgs) {
+ boolean hasNonConstArg(JFunc jfunc, CFunc cfunc, List<Integer> nonPrimitiveArgs) {
if (nonPrimitiveArgs.size() > 0) {
for (int i = nonPrimitiveArgs.size() - 1; i >= 0; i--) {
int idx = nonPrimitiveArgs.get(i).intValue();
@@ -447,9 +394,7 @@ public class JniCodeEmitter implements CodeEmitter {
* if interfaceDecl: public <returntype> func(args);
* if !interfaceDecl: public <returntype> func(args) { body }
*/
- void emitFunction(JFunc jfunc,
- PrintStream out,
- boolean nativeDecl, boolean interfaceDecl) {
+ void emitFunction(JFunc jfunc, PrintStream out, boolean nativeDecl, boolean interfaceDecl) {
boolean isPointerFunc =
jfunc.getName().endsWith("Pointer") &&
jfunc.getCFunc().hasPointerArg();
@@ -559,29 +504,43 @@ public class JniCodeEmitter implements CodeEmitter {
out.println();
}
- public static String getJniName(JType jType) {
- String jniName = "";
- if (jType.isClass()) {
- return "L" + jType.getBaseType() + ";";
- } else if (jType.isArray()) {
- jniName = "[";
- }
+ public void addNativeRegistration(String s) {
+ nativeRegistrations.add(s);
+ }
- String baseType = jType.getBaseType();
- if (baseType.equals("int")) {
- jniName += "I";
- } else if (baseType.equals("float")) {
- jniName += "F";
- } else if (baseType.equals("boolean")) {
- jniName += "Z";
- } else if (baseType.equals("short")) {
- jniName += "S";
- } else if (baseType.equals("long")) {
- jniName += "L";
- } else if (baseType.equals("byte")) {
- jniName += "B";
+ public void emitNativeRegistration(PrintStream cStream) {
+ cStream.println("static const char *classPathName = \"" +
+ mClassPathName +
+ "\";");
+ cStream.println();
+
+ cStream.println("static JNINativeMethod methods[] = {");
+
+ cStream.println("{\"_nativeClassInit\", \"()V\", (void*)nativeClassInit },");
+
+ Iterator<String> i = nativeRegistrations.iterator();
+ while (i.hasNext()) {
+ cStream.println(i.next());
}
- return jniName;
+
+ cStream.println("};");
+ cStream.println();
+
+
+ cStream.println("int register_com_google_android_gles_jni_GLImpl(JNIEnv *_env)");
+ cStream.println("{");
+ cStream.println(indent +
+ "int err;");
+
+ cStream.println(indent +
+ "err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));");
+
+ cStream.println(indent + "return err;");
+ cStream.println("}");
+ }
+
+ public JniCodeEmitter() {
+ super();
}
String getJniType(JType jType) {
@@ -721,8 +680,6 @@ public class JniCodeEmitter implements CodeEmitter {
int numBuffers = 0;
for (int i = 0; i < nonPrimitiveArgs.size(); i++) {
int idx = nonPrimitiveArgs.get(i).intValue();
- int cIndex = jfunc.getArgCIndex(idx);
- String cname = cfunc.getArgName(cIndex);
if (jfunc.getArgType(idx).isArray()) {
++numArrays;
}
@@ -832,8 +789,6 @@ public class JniCodeEmitter implements CodeEmitter {
out.println();
}
- String retval = isVoid ? "" : " _returnValue";
-
// Emit 'GetPrimitiveArrayCritical' for arrays
// Emit 'GetPointer' calls for Buffer pointers
int bufArgIdx = 0;
@@ -1047,38 +1002,4 @@ public class JniCodeEmitter implements CodeEmitter {
out.println();
}
- public void addNativeRegistration(String s) {
- nativeRegistrations.add(s);
- }
-
- public void emitNativeRegistration() {
- mCStream.println("static const char *classPathName = \"" +
- mClassPathName +
- "\";");
- mCStream.println();
-
- mCStream.println("static JNINativeMethod methods[] = {");
-
- mCStream.println("{\"_nativeClassInit\", \"()V\", (void*)nativeClassInit },");
-
- Iterator<String> i = nativeRegistrations.iterator();
- while (i.hasNext()) {
- mCStream.println(i.next());
- }
-
- mCStream.println("};");
- mCStream.println();
-
-
- mCStream.println("int register_com_google_android_gles_jni_GLImpl(JNIEnv *_env)");
- mCStream.println("{");
- mCStream.println(indent +
- "int err;");
-
- mCStream.println(indent +
- "err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));");
-
- mCStream.println(indent + "return err;");
- mCStream.println("}");
- }
}
diff --git a/opengl/tools/glgen/src/Jsr239CodeEmitter.java b/opengl/tools/glgen/src/Jsr239CodeEmitter.java
new file mode 100644
index 000000000000..eff044755c34
--- /dev/null
+++ b/opengl/tools/glgen/src/Jsr239CodeEmitter.java
@@ -0,0 +1,74 @@
+import java.io.PrintStream;
+
+/**
+ * Emits a Java interface and Java & C implementation for a C function.
+ *
+ * <p> The Java interface will have Buffer and array variants for functions that
+ * have a typed pointer argument. The array variant will convert a single "<type> *data"
+ * argument to a pair of arguments "<type>[] data, int offset".
+ */
+public class Jsr239CodeEmitter extends JniCodeEmitter implements CodeEmitter {
+
+ PrintStream mJava10InterfaceStream;
+ PrintStream mJava10ExtInterfaceStream;
+ PrintStream mJava11InterfaceStream;
+ PrintStream mJava11ExtInterfaceStream;
+ PrintStream mJava11ExtPackInterfaceStream;
+ PrintStream mJavaImplStream;
+ PrintStream mCStream;
+
+ PrintStream mJavaInterfaceStream;
+
+ /**
+ * @param java10InterfaceStream the PrintStream to which to emit the Java interface for GL 1.0 functions
+ * @param java10ExtInterfaceStream the PrintStream to which to emit the Java interface for GL 1.0 extension functions
+ * @param java11InterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 functions
+ * @param java11ExtInterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 Extension functions
+ * @param java11ExtPackInterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 Extension Pack functions
+ * @param javaImplStream the PrintStream to which to emit the Java implementation
+ * @param cStream the PrintStream to which to emit the C implementation
+ */
+ public Jsr239CodeEmitter(String classPathName,
+ ParameterChecker checker,
+ PrintStream java10InterfaceStream,
+ PrintStream java10ExtInterfaceStream,
+ PrintStream java11InterfaceStream,
+ PrintStream java11ExtInterfaceStream,
+ PrintStream java11ExtPackInterfaceStream,
+ PrintStream javaImplStream,
+ PrintStream cStream,
+ boolean useContextPointer) {
+ mClassPathName = classPathName;
+ mChecker = checker;
+ mJava10InterfaceStream = java10InterfaceStream;
+ mJava10ExtInterfaceStream = java10ExtInterfaceStream;
+ mJava11InterfaceStream = java11InterfaceStream;
+ mJava11ExtInterfaceStream = java11ExtInterfaceStream;
+ mJava11ExtPackInterfaceStream = java11ExtPackInterfaceStream;
+ mJavaImplStream = javaImplStream;
+ mCStream = cStream;
+ mUseContextPointer = useContextPointer;
+ }
+
+ public void setVersion(int version, boolean ext, boolean pack) {
+ if (version == 0) {
+ mJavaInterfaceStream = ext ? mJava10ExtInterfaceStream :
+ mJava10InterfaceStream;
+ } else if (version == 1) {
+ mJavaInterfaceStream = ext ?
+ (pack ? mJava11ExtPackInterfaceStream :
+ mJava11ExtInterfaceStream) :
+ mJava11InterfaceStream;
+ } else {
+ throw new RuntimeException("Bad version: " + version);
+ }
+ }
+
+ public void emitCode(CFunc cfunc, String original) {
+ emitCode(cfunc, original, mJavaInterfaceStream, mJavaImplStream, mCStream);
+ }
+
+ public void emitNativeRegistration() {
+ emitNativeRegistration(mCStream);
+ }
+}
diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java
index 938a43d1f83a..75b59eef8005 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -44,6 +44,7 @@ import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.location.Address;
+import android.location.IGeocodeProvider;
import android.location.IGpsStatusListener;
import android.location.ILocationCollector;
import android.location.ILocationListener;
@@ -128,6 +129,7 @@ public class LocationManagerService extends ILocationManager.Stub {
private GpsLocationProvider mGpsLocationProvider;
private boolean mGpsNavigating;
private LocationProviderProxy mNetworkLocationProvider;
+ private IGeocodeProvider mGeocodeProvider;
private LocationWorkerHandler mLocationHandler;
// Handler messages
@@ -632,6 +634,15 @@ public class LocationManagerService extends ILocationManager.Stub {
}
}
+ public void setGeocodeProvider(IGeocodeProvider provider) {
+ if (Binder.getCallingUid() != Process.SYSTEM_UID) {
+ throw new SecurityException(
+ "Installing location providers outside of the system is not supported");
+ }
+
+ mGeocodeProvider = provider;
+ }
+
private WifiManager.WifiLock getWifiWakelockLocked() {
if (mWifiLock == null && mWifiManager != null) {
mWifiLock = mWifiManager.createWifiLock(WifiManager.WIFI_MODE_SCAN_ONLY, WIFILOCK_KEY);
@@ -2074,30 +2085,34 @@ public class LocationManagerService extends ILocationManager.Stub {
// Geocoder
public String getFromLocation(double latitude, double longitude, int maxResults,
- String language, String country, String variant, String appName, List<Address> addrs) {
- synchronized (mLocationListeners) {
- if (mNetworkLocationProvider != null) {
- return mNetworkLocationProvider.getFromLocation(latitude, longitude, maxResults,
- language, country, variant, appName, addrs);
- } else {
- return null;
+ String language, String country, String variant, String appName, List<Address> addrs) {
+ if (mGeocodeProvider != null) {
+ try {
+ return mGeocodeProvider.getFromLocation(latitude, longitude, maxResults, language, country,
+ variant, appName, addrs);
+ } catch (RemoteException e) {
+ Log.e(TAG, "getFromLocation failed", e);
}
}
+ return null;
}
+
public String getFromLocationName(String locationName,
- double lowerLeftLatitude, double lowerLeftLongitude,
- double upperRightLatitude, double upperRightLongitude, int maxResults,
- String language, String country, String variant, String appName, List<Address> addrs) {
- synchronized (mLocationListeners) {
- if (mNetworkLocationProvider != null) {
- return mNetworkLocationProvider.getFromLocationName(locationName, lowerLeftLatitude,
- lowerLeftLongitude, upperRightLatitude, upperRightLongitude, maxResults,
- language, country, variant, appName, addrs);
- } else {
- return null;
+ double lowerLeftLatitude, double lowerLeftLongitude,
+ double upperRightLatitude, double upperRightLongitude, int maxResults,
+ String language, String country, String variant, String appName, List<Address> addrs) {
+
+ if (mGeocodeProvider != null) {
+ try {
+ return mGeocodeProvider.getFromLocationName(locationName, lowerLeftLatitude,
+ lowerLeftLongitude, upperRightLatitude, upperRightLongitude,
+ maxResults, language, country, variant, appName, addrs);
+ } catch (RemoteException e) {
+ Log.e(TAG, "getFromLocationName failed", e);
}
}
+ return null;
}
// Mock Providers