Merge "Don't attempt to launch disabled activities in smoke test."
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index d6db8c2..10ef535 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -816,7 +816,7 @@
}
/**
- * Return the LoaderManager for this fragment, creating it if needed.
+ * Return the LoaderManager for this activity, creating it if needed.
*/
public LoaderManager getLoaderManager() {
if (mLoaderManager != null) {
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index d3080e5..b103e71 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -68,6 +68,7 @@
import android.os.SystemProperties;
import android.os.Trace;
import android.os.UserHandle;
+import android.provider.Settings;
import android.util.AndroidRuntimeException;
import android.util.ArrayMap;
import android.util.DisplayMetrics;
@@ -106,6 +107,7 @@
import java.lang.ref.WeakReference;
import java.net.InetAddress;
import java.security.Security;
+import java.text.DateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
@@ -742,8 +744,42 @@
setCoreSettings(coreSettings);
- // Tell the VMRuntime about the application.
- VMRuntime.registerAppInfo(appInfo.dataDir, appInfo.processName);
+ /*
+ * Two possible indications that this package could be
+ * sharing its runtime with other packages:
+ *
+ * 1.) the sharedUserId attribute is set in the manifest,
+ * indicating a request to share a VM with other
+ * packages with the same sharedUserId.
+ *
+ * 2.) the application element of the manifest has an
+ * attribute specifying a non-default process name,
+ * indicating the desire to run in another packages VM.
+ *
+ * If sharing is enabled we do not have a unique application
+ * in a process and therefore cannot rely on the package
+ * name inside the runtime.
+ */
+ IPackageManager pm = getPackageManager();
+ android.content.pm.PackageInfo pi = null;
+ try {
+ pi = pm.getPackageInfo(appInfo.packageName, 0, UserHandle.myUserId());
+ } catch (RemoteException e) {
+ }
+ if (pi != null) {
+ boolean sharedUserIdSet = (pi.sharedUserId != null);
+ boolean processNameNotDefault =
+ (pi.applicationInfo != null &&
+ !appInfo.packageName.equals(pi.applicationInfo.processName));
+ boolean sharable = (sharedUserIdSet || processNameNotDefault);
+
+ // Tell the VMRuntime about the application, unless it is shared
+ // inside a process.
+ if (!sharable) {
+ VMRuntime.registerAppInfo(appInfo.packageName, appInfo.dataDir,
+ appInfo.processName);
+ }
+ }
AppBindData data = new AppBindData();
data.processName = processName;
@@ -1095,6 +1131,11 @@
public void scheduleInstallProvider(ProviderInfo provider) {
sendMessage(H.INSTALL_PROVIDER, provider);
}
+
+ @Override
+ public final void updateTimePrefs(boolean is24Hour) {
+ DateFormat.set24HourTimePref(is24Hour);
+ }
}
private class H extends Handler {
@@ -1144,6 +1185,7 @@
public static final int REQUEST_ASSIST_CONTEXT_EXTRAS = 143;
public static final int TRANSLUCENT_CONVERSION_COMPLETE = 144;
public static final int INSTALL_PROVIDER = 145;
+
String codeToString(int code) {
if (DEBUG_MESSAGES) {
switch (code) {
@@ -4189,6 +4231,11 @@
Log.e(TAG, "Unable to setupGraphicsSupport due to missing cache directory");
}
}
+
+
+ final boolean is24Hr = "24".equals(mCoreSettings.getString(Settings.System.TIME_12_24));
+ DateFormat.set24HourTimePref(is24Hr);
+
/**
* For system applications on userdebug/eng builds, log stack
* traces of disk and network access to dropbox for analysis.
diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java
index 347d43f..cb453e2 100644
--- a/core/java/android/app/ApplicationThreadNative.java
+++ b/core/java/android/app/ApplicationThreadNative.java
@@ -627,6 +627,15 @@
reply.writeNoException();
return true;
}
+
+ case UPDATE_TIME_PREFS_TRANSACTION:
+ {
+ data.enforceInterface(IApplicationThread.descriptor);
+ byte is24Hour = data.readByte();
+ updateTimePrefs(is24Hour == (byte) 1);
+ reply.writeNoException();
+ return true;
+ }
}
return super.onTransact(code, data, reply, flags);
@@ -1266,4 +1275,13 @@
mRemote.transact(SCHEDULE_INSTALL_PROVIDER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
data.recycle();
}
+
+ @Override
+ public void updateTimePrefs(boolean is24Hour) throws RemoteException {
+ Parcel data = Parcel.obtain();
+ data.writeInterfaceToken(IApplicationThread.descriptor);
+ data.writeByte(is24Hour ? (byte) 1 : (byte) 0);
+ mRemote.transact(UPDATE_TIME_PREFS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
+ data.recycle();
+ }
}
diff --git a/core/java/android/app/IAlarmManager.aidl b/core/java/android/app/IAlarmManager.aidl
index 8476609..ef9f26e 100644
--- a/core/java/android/app/IAlarmManager.aidl
+++ b/core/java/android/app/IAlarmManager.aidl
@@ -28,7 +28,7 @@
/** windowLength == 0 means exact; windowLength < 0 means the let the OS decide */
void set(int type, long triggerAtTime, long windowLength,
long interval, in PendingIntent operation, in WorkSource workSource);
- void setTime(long millis);
+ boolean setTime(long millis);
void setTimeZone(String zone);
void remove(in PendingIntent operation);
}
diff --git a/core/java/android/app/IApplicationThread.java b/core/java/android/app/IApplicationThread.java
index d0cc1bb..3aceff9 100644
--- a/core/java/android/app/IApplicationThread.java
+++ b/core/java/android/app/IApplicationThread.java
@@ -138,6 +138,7 @@
throws RemoteException;
void setProcessState(int state) throws RemoteException;
void scheduleInstallProvider(ProviderInfo provider) throws RemoteException;
+ void updateTimePrefs(boolean is24Hour) throws RemoteException;
String descriptor = "android.app.IApplicationThread";
@@ -191,4 +192,5 @@
int SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+48;
int SET_PROCESS_STATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+49;
int SCHEDULE_INSTALL_PROVIDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+50;
+ int UPDATE_TIME_PREFS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+51;
}
diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java
index ddde3fb..44831fc 100644
--- a/core/java/android/content/ContentProvider.java
+++ b/core/java/android/content/ContentProvider.java
@@ -987,7 +987,7 @@
* Implement this to handle requests to delete one or more rows.
* The implementation should apply the selection clause when performing
* deletion, allowing the operation to affect multiple rows in a directory.
- * As a courtesy, call {@link ContentResolver#notifyChange(android.net.Uri ,android.database.ContentObserver) notifyDelete()}
+ * As a courtesy, call {@link ContentResolver#notifyChange(android.net.Uri ,android.database.ContentObserver) notifyChange()}
* after deleting.
* This method can be called from multiple threads, as described in
* <a href="{@docRoot}guide/topics/fundamentals/processes-and-threads.html#Threads">Processes
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index a289649..2e2d4b8 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -3331,6 +3331,15 @@
public static final String EXTRA_SHUTDOWN_USERSPACE_ONLY
= "android.intent.extra.SHUTDOWN_USERSPACE_ONLY";
+ /**
+ * Optional boolean extra for {@link #ACTION_TIME_CHANGED} that indicates the
+ * user has set their time format preferences to the 24 hour format.
+ *
+ * @hide for internal use only.
+ */
+ public static final String EXTRA_TIME_PREF_24_HOUR_FORMAT =
+ "android.intent.extra.TIME_PREF_24_HOUR_FORMAT";
+
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Intent flags (see mFlags variable).
diff --git a/core/java/android/content/Loader.java b/core/java/android/content/Loader.java
index 911e49c..a045b3a 100644
--- a/core/java/android/content/Loader.java
+++ b/core/java/android/content/Loader.java
@@ -24,7 +24,7 @@
import java.io.PrintWriter;
/**
- * An abstract class that performs asynchronous loading of data. While Loaders are active
+ * A class that performs asynchronous loading of data. While Loaders are active
* they should monitor the source of their data and deliver new results when the contents
* change. See {@link android.app.LoaderManager} for more detail.
*
diff --git a/core/java/android/content/res/AssetManager.java b/core/java/android/content/res/AssetManager.java
index 418bdda..9ce17e4 100644
--- a/core/java/android/content/res/AssetManager.java
+++ b/core/java/android/content/res/AssetManager.java
@@ -537,7 +537,7 @@
public final class AssetInputStream extends InputStream {
public final int getAssetInt() {
- return (int) mAsset;
+ throw new UnsupportedOperationException();
}
/**
* @hide
diff --git a/core/java/android/debug/JNITest.java b/core/java/android/debug/JNITest.java
deleted file mode 100644
index 2ce374a..0000000
--- a/core/java/android/debug/JNITest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2006 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.debug;
-
-/**
- * Simple JNI verification test.
- */
-public class JNITest {
-
- public JNITest() {
- }
-
- public int test(int intArg, double doubleArg, String stringArg) {
- int[] intArray = { 42, 53, 65, 127 };
-
- return part1(intArg, doubleArg, stringArg, intArray);
- }
-
- private native int part1(int intArg, double doubleArg, String stringArg,
- int[] arrayArg);
-
- private int part2(double doubleArg, int fromArray, String stringArg) {
- int result;
-
- System.out.println(stringArg + " : " + (float) doubleArg + " : " +
- fromArray);
- result = part3(stringArg);
-
- return result + 6;
- }
-
- private static native int part3(String stringArg);
-}
-
diff --git a/core/java/android/hardware/SensorManager.java b/core/java/android/hardware/SensorManager.java
index b931313..ac9189d 100644
--- a/core/java/android/hardware/SensorManager.java
+++ b/core/java/android/hardware/SensorManager.java
@@ -1359,7 +1359,7 @@
float q2 = rotationVector[1];
float q3 = rotationVector[2];
- if (rotationVector.length == 4) {
+ if (rotationVector.length >= 4) {
q0 = rotationVector[3];
} else {
q0 = 1 - q1*q1 - q2*q2 - q3*q3;
@@ -1416,7 +1416,7 @@
* @param Q an array of floats in which to store the computed quaternion
*/
public static void getQuaternionFromVector(float[] Q, float[] rv) {
- if (rv.length == 4) {
+ if (rv.length >= 4) {
Q[0] = rv[3];
} else {
Q[0] = 1 - rv[0]*rv[0] - rv[1]*rv[1] - rv[2]*rv[2];
diff --git a/core/java/android/net/LocalSocketImpl.java b/core/java/android/net/LocalSocketImpl.java
index b2ee50a..119e533 100644
--- a/core/java/android/net/LocalSocketImpl.java
+++ b/core/java/android/net/LocalSocketImpl.java
@@ -326,6 +326,7 @@
}
s.fd = accept(fd, s);
+ s.mFdCreatedInternally = true;
}
/**
@@ -536,4 +537,3 @@
close();
}
}
-
diff --git a/core/java/android/net/nsd/NsdManager.java b/core/java/android/net/nsd/NsdManager.java
index 9c3e405..7b2c623 100644
--- a/core/java/android/net/nsd/NsdManager.java
+++ b/core/java/android/net/nsd/NsdManager.java
@@ -301,27 +301,36 @@
@Override
public void handleMessage(Message message) {
- Object listener = getListener(message.arg2);
- boolean listenerRemove = true;
switch (message.what) {
case AsyncChannel.CMD_CHANNEL_HALF_CONNECTED:
mAsyncChannel.sendMessage(AsyncChannel.CMD_CHANNEL_FULL_CONNECTION);
- break;
+ return;
case AsyncChannel.CMD_CHANNEL_FULLY_CONNECTED:
mConnected.countDown();
- break;
+ return;
case AsyncChannel.CMD_CHANNEL_DISCONNECTED:
Log.e(TAG, "Channel lost");
+ return;
+ default:
break;
+ }
+ Object listener = getListener(message.arg2);
+ if (listener == null) {
+ Log.d(TAG, "Stale key " + message.arg2);
+ return;
+ }
+ boolean listenerRemove = true;
+ NsdServiceInfo ns = getNsdService(message.arg2);
+ switch (message.what) {
case DISCOVER_SERVICES_STARTED:
- String s = ((NsdServiceInfo) message.obj).getServiceType();
+ String s = getNsdServiceInfoType((NsdServiceInfo) message.obj);
((DiscoveryListener) listener).onDiscoveryStarted(s);
// Keep listener until stop discovery
listenerRemove = false;
break;
case DISCOVER_SERVICES_FAILED:
- ((DiscoveryListener) listener).onStartDiscoveryFailed(
- getNsdService(message.arg2).getServiceType(), message.arg1);
+ ((DiscoveryListener) listener).onStartDiscoveryFailed(getNsdServiceInfoType(ns),
+ message.arg1);
break;
case SERVICE_FOUND:
((DiscoveryListener) listener).onServiceFound((NsdServiceInfo) message.obj);
@@ -334,16 +343,14 @@
listenerRemove = false;
break;
case STOP_DISCOVERY_FAILED:
- ((DiscoveryListener) listener).onStopDiscoveryFailed(
- getNsdService(message.arg2).getServiceType(), message.arg1);
+ ((DiscoveryListener) listener).onStopDiscoveryFailed(getNsdServiceInfoType(ns),
+ message.arg1);
break;
case STOP_DISCOVERY_SUCCEEDED:
- ((DiscoveryListener) listener).onDiscoveryStopped(
- getNsdService(message.arg2).getServiceType());
+ ((DiscoveryListener) listener).onDiscoveryStopped(getNsdServiceInfoType(ns));
break;
case REGISTER_SERVICE_FAILED:
- ((RegistrationListener) listener).onRegistrationFailed(
- getNsdService(message.arg2), message.arg1);
+ ((RegistrationListener) listener).onRegistrationFailed(ns, message.arg1);
break;
case REGISTER_SERVICE_SUCCEEDED:
((RegistrationListener) listener).onServiceRegistered(
@@ -352,16 +359,13 @@
listenerRemove = false;
break;
case UNREGISTER_SERVICE_FAILED:
- ((RegistrationListener) listener).onUnregistrationFailed(
- getNsdService(message.arg2), message.arg1);
+ ((RegistrationListener) listener).onUnregistrationFailed(ns, message.arg1);
break;
case UNREGISTER_SERVICE_SUCCEEDED:
- ((RegistrationListener) listener).onServiceUnregistered(
- getNsdService(message.arg2));
+ ((RegistrationListener) listener).onServiceUnregistered(ns);
break;
case RESOLVE_SERVICE_FAILED:
- ((ResolveListener) listener).onResolveFailed(
- getNsdService(message.arg2), message.arg1);
+ ((ResolveListener) listener).onResolveFailed(ns, message.arg1);
break;
case RESOLVE_SERVICE_SUCCEEDED:
((ResolveListener) listener).onServiceResolved((NsdServiceInfo) message.obj);
@@ -421,6 +425,11 @@
}
+ private String getNsdServiceInfoType(NsdServiceInfo s) {
+ if (s == null) return "?";
+ return s.getServiceType();
+ }
+
/**
* Initialize AsyncChannel
*/
diff --git a/core/java/android/nfc/tech/Ndef.java b/core/java/android/nfc/tech/Ndef.java
index 64aa2996..f16dc3b 100644
--- a/core/java/android/nfc/tech/Ndef.java
+++ b/core/java/android/nfc/tech/Ndef.java
@@ -278,6 +278,8 @@
throw new TagLostException();
}
return msg;
+ } else if (!tagService.isPresent(serviceHandle)) {
+ throw new TagLostException();
} else {
return null;
}
diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java
index 3470790..7425f67 100644
--- a/core/java/android/os/Parcel.java
+++ b/core/java/android/os/Parcel.java
@@ -1459,10 +1459,11 @@
}
/**
- * Use this function for customized exception handling.
- * customized method call this method for all unknown case
- * @param code exception code
- * @param msg exception message
+ * Throw an exception with the given message. Not intended for use
+ * outside the Parcel class.
+ *
+ * @param code Used to determine which exception class to throw.
+ * @param msg The exception message.
*/
public final void readException(int code, String msg) {
switch (code) {
diff --git a/core/java/android/os/SystemClock.java b/core/java/android/os/SystemClock.java
index 729c64b..672df6d 100644
--- a/core/java/android/os/SystemClock.java
+++ b/core/java/android/os/SystemClock.java
@@ -16,6 +16,9 @@
package android.os;
+import android.app.IAlarmManager;
+import android.content.Context;
+import android.util.Slog;
/**
* Core timekeeping facilities.
@@ -89,6 +92,8 @@
* </ul>
*/
public final class SystemClock {
+ private static final String TAG = "SystemClock";
+
/**
* This class is uninstantiable.
*/
@@ -134,7 +139,23 @@
*
* @return if the clock was successfully set to the specified time.
*/
- native public static boolean setCurrentTimeMillis(long millis);
+ public static boolean setCurrentTimeMillis(long millis) {
+ IBinder b = ServiceManager.getService(Context.ALARM_SERVICE);
+ IAlarmManager mgr = IAlarmManager.Stub.asInterface(b);
+ if (mgr == null) {
+ return false;
+ }
+
+ try {
+ return mgr.setTime(millis);
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Unable to set RTC", e);
+ } catch (SecurityException e) {
+ Slog.e(TAG, "Unable to set RTC", e);
+ }
+
+ return false;
+ }
/**
* Returns milliseconds since boot, not counting time spent in deep sleep.
diff --git a/core/java/android/util/Patterns.java b/core/java/android/util/Patterns.java
index 9522112..0f8da44 100644
--- a/core/java/android/util/Patterns.java
+++ b/core/java/android/util/Patterns.java
@@ -191,8 +191,6 @@
for (int i = 1; i <= numGroups; i++) {
String s = matcher.group(i);
- System.err.println("Group(" + i + ") : " + s);
-
if (s != null) {
b.append(s);
}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index b0bae46..bdf4141 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -10098,7 +10098,7 @@
* by the layout system and should not generally be called otherwise, because the property
* may be changed at any time by the layout.
*
- * @param left The bottom of this view, in pixels.
+ * @param left The left of this view, in pixels.
*/
public final void setLeft(int left) {
if (left != mLeft) {
@@ -10165,7 +10165,7 @@
* by the layout system and should not generally be called otherwise, because the property
* may be changed at any time by the layout.
*
- * @param right The bottom of this view, in pixels.
+ * @param right The right of this view, in pixels.
*/
public final void setRight(int right) {
if (right != mRight) {
@@ -11838,7 +11838,7 @@
}
/**
- * <p>Compute the vertical extent of the horizontal scrollbar's thumb
+ * <p>Compute the vertical extent of the vertical scrollbar's thumb
* within the vertical range. This value is used to compute the length
* of the thumb within the scrollbar's track.</p>
*
diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java
index 7674837..fe2fc96 100644
--- a/core/java/android/widget/AbsSeekBar.java
+++ b/core/java/android/widget/AbsSeekBar.java
@@ -292,7 +292,7 @@
// The extra space for the thumb to move on the track
available += mThumbOffset * 2;
- int thumbPos = (int) (scale * available);
+ int thumbPos = (int) (scale * available + 0.5f);
int topBound, bottomBound;
if (gap == Integer.MIN_VALUE) {
diff --git a/core/java/android/widget/AdapterView.java b/core/java/android/widget/AdapterView.java
index a5fad60..a06344f 100644
--- a/core/java/android/widget/AdapterView.java
+++ b/core/java/android/widget/AdapterView.java
@@ -663,7 +663,7 @@
/**
* When the current adapter is empty, the AdapterView can display a special view
- * call the empty view. The empty view is used to provide feedback to the user
+ * called the empty view. The empty view is used to provide feedback to the user
* that no data is available in this AdapterView.
*
* @return The view to show if the adapter is empty.
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 2e0acb1..ac70738 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -134,7 +134,6 @@
android_hardware_UsbDevice.cpp \
android_hardware_UsbDeviceConnection.cpp \
android_hardware_UsbRequest.cpp \
- android_debug_JNITest.cpp \
android_util_FileObserver.cpp \
android/opengl/poly_clip.cpp.arm \
android/opengl/util.cpp.arm \
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index b4599b6..649968e 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -131,7 +131,6 @@
extern int register_android_database_SQLiteConnection(JNIEnv* env);
extern int register_android_database_SQLiteGlobal(JNIEnv* env);
extern int register_android_database_SQLiteDebug(JNIEnv* env);
-extern int register_android_debug_JNITest(JNIEnv* env);
extern int register_android_nio_utils(JNIEnv* env);
extern int register_android_text_format_Time(JNIEnv* env);
extern int register_android_os_Debug(JNIEnv* env);
@@ -396,16 +395,16 @@
*
* This will cut up "extraOptsBuf" as we chop it into individual options.
*
+ * If "quotingArg" is non-null, it is passed before each extra option in mOptions.
+ *
* Adds the strings, if any, to mOptions.
*/
-void AndroidRuntime::parseExtraOpts(char* extraOptsBuf)
+void AndroidRuntime::parseExtraOpts(char* extraOptsBuf, const char* quotingArg)
{
JavaVMOption opt;
- char* start;
- char* end;
-
memset(&opt, 0, sizeof(opt));
- start = extraOptsBuf;
+ char* start = extraOptsBuf;
+ char* end = NULL;
while (*start != '\0') {
while (*start == ' ') /* skip leading whitespace */
start++;
@@ -419,6 +418,11 @@
*end++ = '\0'; /* mark end, advance to indicate more */
opt.optionString = start;
+ if (quotingArg != NULL) {
+ JavaVMOption quotingOpt;
+ quotingOpt.optionString = quotingArg;
+ mOptions.add(quotingOpt);
+ }
mOptions.add(opt);
start = end;
}
@@ -430,6 +434,14 @@
* Various arguments, most determined by system properties, are passed in.
* The "mOptions" vector is updated.
*
+ * CAUTION: when adding options in here, be careful not to put the
+ * char buffer inside a nested scope. Adding the buffer to the
+ * options using mOptions.add() does not copy the buffer, so if the
+ * buffer goes out of scope the option may be overwritten. It's best
+ * to put the buffer at the top of the function so that it is more
+ * unlikely that someone will surround it in a scope at a later time
+ * and thus introduce a bug.
+ *
* Returns 0 on success.
*/
int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv)
@@ -450,6 +462,9 @@
char gctypeOptsBuf[sizeof("-Xgc:")-1 + PROPERTY_VALUE_MAX];
char heaptargetutilizationOptsBuf[sizeof("-XX:HeapTargetUtilization=")-1 + PROPERTY_VALUE_MAX];
char jitcodecachesizeOptsBuf[sizeof("-Xjitcodecachesize:")-1 + PROPERTY_VALUE_MAX];
+ char dalvikVmLibBuf[PROPERTY_VALUE_MAX];
+ char dex2oatFlagsBuf[PROPERTY_VALUE_MAX];
+ char dex2oatImageFlagsBuf[PROPERTY_VALUE_MAX];
char extraOptsBuf[PROPERTY_VALUE_MAX];
char* stackTraceFile = NULL;
bool checkJni = false;
@@ -461,7 +476,15 @@
kEMIntFast,
kEMJitCompiler,
} executionMode = kEMDefault;
-
+ char profile_period[sizeof("-Xprofile-period:") + PROPERTY_VALUE_MAX];
+ char profile_duration[sizeof("-Xprofile-duration:") + PROPERTY_VALUE_MAX];
+ char profile_interval[sizeof("-Xprofile-interval:") + PROPERTY_VALUE_MAX];
+ char profile_backoff[sizeof("-Xprofile-backoff:") + PROPERTY_VALUE_MAX];
+ char langOption[sizeof("-Duser.language=") + 3];
+ char regionOption[sizeof("-Duser.region=") + 3];
+ char lockProfThresholdBuf[sizeof("-Xlockprofthreshold:") + sizeof(propBuf)];
+ char jitOpBuf[sizeof("-Xjitop:") + PROPERTY_VALUE_MAX];
+ char jitMethodBuf[sizeof("-Xjitmethod:") + PROPERTY_VALUE_MAX];
property_get("dalvik.vm.checkjni", propBuf, "");
if (strcmp(propBuf, "true") == 0) {
@@ -662,7 +685,6 @@
//mOptions.add(opt);
}
- char lockProfThresholdBuf[sizeof("-Xlockprofthreshold:") + sizeof(propBuf)];
property_get("dalvik.vm.lockprof.threshold", propBuf, "");
if (strlen(propBuf) > 0) {
strcpy(lockProfThresholdBuf, "-Xlockprofthreshold:");
@@ -672,7 +694,6 @@
}
/* Force interpreter-only mode for selected opcodes. Eg "1-0a,3c,f1-ff" */
- char jitOpBuf[sizeof("-Xjitop:") + PROPERTY_VALUE_MAX];
property_get("dalvik.vm.jit.op", propBuf, "");
if (strlen(propBuf) > 0) {
strcpy(jitOpBuf, "-Xjitop:");
@@ -682,7 +703,6 @@
}
/* Force interpreter-only mode for selected methods */
- char jitMethodBuf[sizeof("-Xjitmethod:") + PROPERTY_VALUE_MAX];
property_get("dalvik.vm.jit.method", propBuf, "");
if (strlen(propBuf) > 0) {
strcpy(jitMethodBuf, "-Xjitmethod:");
@@ -742,14 +762,26 @@
mOptions.add(opt);
}
+ // libart tolerates libdvm flags, but not vice versa, so only pass some options if libart.
+ property_get("persist.sys.dalvik.vm.lib.1", dalvikVmLibBuf, "libdvm.so");
+ bool libart = (strncmp(dalvikVmLibBuf, "libart", 6) == 0);
+
+ if (libart) {
+ // Extra options for DexClassLoader.
+ property_get("dalvik.vm.dex2oat-flags", dex2oatFlagsBuf, "");
+ parseExtraOpts(dex2oatFlagsBuf, "-Xcompiler-option");
+
+ // Extra options for boot.art/boot.oat image generation.
+ property_get("dalvik.vm.image-dex2oat-flags", dex2oatImageFlagsBuf, "");
+ parseExtraOpts(dex2oatImageFlagsBuf, "-Ximage-compiler-option");
+ }
+
/* extra options; parse this late so it overrides others */
property_get("dalvik.vm.extra-opts", extraOptsBuf, "");
- parseExtraOpts(extraOptsBuf);
+ parseExtraOpts(extraOptsBuf, NULL);
/* Set the properties for locale */
{
- char langOption[sizeof("-Duser.language=") + 3];
- char regionOption[sizeof("-Duser.region=") + 3];
strcpy(langOption, "-Duser.language=");
strcpy(regionOption, "-Duser.region=");
readLocale(langOption, regionOption);
@@ -760,6 +792,37 @@
mOptions.add(opt);
}
+ /*
+ * Set profiler options
+ */
+ if (libart) {
+ // Number of seconds during profile runs.
+ strcpy(profile_period, "-Xprofile-period:");
+ property_get("dalvik.vm.profile.period_secs", profile_period+17, "10");
+ opt.optionString = profile_period;
+ mOptions.add(opt);
+
+ // Length of each profile run (seconds).
+ strcpy(profile_duration, "-Xprofile-duration:");
+ property_get("dalvik.vm.profile.duration_secs", profile_duration+19, "30");
+ opt.optionString = profile_duration;
+ mOptions.add(opt);
+
+
+ // Polling interval during profile run (microseconds).
+ strcpy(profile_interval, "-Xprofile-interval:");
+ property_get("dalvik.vm.profile.interval_us", profile_interval+19, "10000");
+ opt.optionString = profile_interval;
+ mOptions.add(opt);
+
+ // Coefficient for period backoff. The the period is multiplied
+ // by this value after each profile run.
+ strcpy(profile_backoff, "-Xprofile-backoff:");
+ property_get("dalvik.vm.profile.backoff_coeff", profile_backoff+18, "2.0");
+ opt.optionString = profile_backoff;
+ mOptions.add(opt);
+ }
+
initArgs.version = JNI_VERSION_1_4;
initArgs.options = mOptions.editArray();
initArgs.nOptions = mOptions.size();
@@ -1093,7 +1156,6 @@
}
static const RegJNIRec gRegJNI[] = {
- REG_JNI(register_android_debug_JNITest),
REG_JNI(register_com_android_internal_os_RuntimeInit),
REG_JNI(register_android_os_SystemClock),
REG_JNI(register_android_util_EventLog),
diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp
index 56d903c..13c1fc8 100644
--- a/core/jni/android/graphics/BitmapFactory.cpp
+++ b/core/jni/android/graphics/BitmapFactory.cpp
@@ -106,17 +106,19 @@
chunk->paddingRight = int(chunk->paddingRight * scale + 0.5f);
chunk->paddingBottom = int(chunk->paddingBottom * scale + 0.5f);
+ int32_t* xDivs = chunk->getXDivs();
for (int i = 0; i < chunk->numXDivs; i++) {
- chunk->xDivs[i] = int(chunk->xDivs[i] * scale + 0.5f);
- if (i > 0 && chunk->xDivs[i] == chunk->xDivs[i - 1]) {
- chunk->xDivs[i]++;
+ xDivs[i] = int32_t(xDivs[i] * scale + 0.5f);
+ if (i > 0 && xDivs[i] == xDivs[i - 1]) {
+ xDivs[i]++;
}
}
+ int32_t* yDivs = chunk->getXDivs();
for (int i = 0; i < chunk->numYDivs; i++) {
- chunk->yDivs[i] = int(chunk->yDivs[i] * scale + 0.5f);
- if (i > 0 && chunk->yDivs[i] == chunk->yDivs[i - 1]) {
- chunk->yDivs[i]++;
+ yDivs[i] = int32_t(yDivs[i] * scale + 0.5f);
+ if (i > 0 && yDivs[i] == yDivs[i - 1]) {
+ yDivs[i]++;
}
}
}
@@ -365,7 +367,7 @@
return nullObjectReturn("primitive array == null");
}
- peeker.fPatch->serialize(array);
+ memcpy(array, peeker.fPatch, peeker.fPatchSize);
env->ReleasePrimitiveArrayCritical(ninePatchChunk, array, 0);
}
diff --git a/core/jni/android/graphics/NinePatchImpl.cpp b/core/jni/android/graphics/NinePatchImpl.cpp
index 01e7e3e..86ff13c 100644
--- a/core/jni/android/graphics/NinePatchImpl.cpp
+++ b/core/jni/android/graphics/NinePatchImpl.cpp
@@ -115,13 +115,15 @@
defaultPaint.setDither(true);
paint = &defaultPaint;
}
-
+
+ const int32_t* xDivs = chunk.getXDivs();
+ const int32_t* yDivs = chunk.getYDivs();
// if our SkCanvas were back by GL we should enable this and draw this as
// a mesh, which will be faster in most cases.
if (false) {
SkNinePatch::DrawMesh(canvas, bounds, bitmap,
- chunk.xDivs, chunk.numXDivs,
- chunk.yDivs, chunk.numYDivs,
+ xDivs, chunk.numXDivs,
+ yDivs, chunk.numYDivs,
paint);
return;
}
@@ -145,8 +147,8 @@
if (gTrace) {
ALOGV("======== ninepatch bounds [%g %g]\n", SkScalarToFloat(bounds.width()), SkScalarToFloat(bounds.height()));
ALOGV("======== ninepatch paint bm [%d,%d]\n", bitmap.width(), bitmap.height());
- ALOGV("======== ninepatch xDivs [%d,%d]\n", chunk.xDivs[0], chunk.xDivs[1]);
- ALOGV("======== ninepatch yDivs [%d,%d]\n", chunk.yDivs[0], chunk.yDivs[1]);
+ ALOGV("======== ninepatch xDivs [%d,%d]\n", xDivs[0], xDivs[1]);
+ ALOGV("======== ninepatch yDivs [%d,%d]\n", yDivs[0], yDivs[1]);
}
#endif
@@ -171,8 +173,8 @@
SkRect dst;
SkIRect src;
- const int32_t x0 = chunk.xDivs[0];
- const int32_t y0 = chunk.yDivs[0];
+ const int32_t x0 = xDivs[0];
+ const int32_t y0 = yDivs[0];
const SkColor initColor = ((SkPaint*)paint)->getColor();
const uint8_t numXDivs = chunk.numXDivs;
const uint8_t numYDivs = chunk.numYDivs;
@@ -191,12 +193,12 @@
int numStretchyXPixelsRemaining = 0;
for (i = 0; i < numXDivs; i += 2) {
- numStretchyXPixelsRemaining += chunk.xDivs[i + 1] - chunk.xDivs[i];
+ numStretchyXPixelsRemaining += xDivs[i + 1] - xDivs[i];
}
int numFixedXPixelsRemaining = bitmapWidth - numStretchyXPixelsRemaining;
int numStretchyYPixelsRemaining = 0;
for (i = 0; i < numYDivs; i += 2) {
- numStretchyYPixelsRemaining += chunk.yDivs[i + 1] - chunk.yDivs[i];
+ numStretchyYPixelsRemaining += yDivs[i + 1] - yDivs[i];
}
int numFixedYPixelsRemaining = bitmapHeight - numStretchyYPixelsRemaining;
@@ -235,7 +237,7 @@
src.fBottom = bitmapHeight;
dst.fBottom = bounds.fBottom;
} else {
- src.fBottom = chunk.yDivs[j];
+ src.fBottom = yDivs[j];
const int srcYSize = src.fBottom - src.fTop;
if (yIsStretchable) {
dst.fBottom = dst.fTop + calculateStretch(bounds.fBottom, dst.fTop,
@@ -252,15 +254,16 @@
xIsStretchable = initialXIsStretchable;
// The initial xDiv and whether the first column is considered
// stretchable or not depends on whether xDiv[0] was zero or not.
+ const uint32_t* colors = chunk.getColors();
for (i = xIsStretchable ? 1 : 0;
i <= numXDivs && src.fLeft < bitmapWidth;
i++, xIsStretchable = !xIsStretchable) {
- color = chunk.colors[colorIndex++];
+ color = colors[colorIndex++];
if (i == numXDivs) {
src.fRight = bitmapWidth;
dst.fRight = bounds.fRight;
} else {
- src.fRight = chunk.xDivs[i];
+ src.fRight = xDivs[i];
if (dstRightsHaveBeenCached) {
dst.fRight = dstRights[i];
} else {
diff --git a/core/jni/android/graphics/NinePatchPeeker.cpp b/core/jni/android/graphics/NinePatchPeeker.cpp
index df996af..51392ab 100644
--- a/core/jni/android/graphics/NinePatchPeeker.cpp
+++ b/core/jni/android/graphics/NinePatchPeeker.cpp
@@ -28,11 +28,11 @@
// You have to copy the data because it is owned by the png reader
Res_png_9patch* patchNew = (Res_png_9patch*) malloc(patchSize);
memcpy(patchNew, patch, patchSize);
- // this relies on deserialization being done in place
Res_png_9patch::deserialize(patchNew);
patchNew->fileToDevice();
free(fPatch);
fPatch = patchNew;
+ fPatchSize = patchSize;
//printf("9patch: (%d,%d)-(%d,%d)\n",
// fPatch.sizeLeft, fPatch.sizeTop,
// fPatch.sizeRight, fPatch.sizeBottom);
diff --git a/core/jni/android/graphics/NinePatchPeeker.h b/core/jni/android/graphics/NinePatchPeeker.h
index 10d268a..2043862 100644
--- a/core/jni/android/graphics/NinePatchPeeker.h
+++ b/core/jni/android/graphics/NinePatchPeeker.h
@@ -29,6 +29,7 @@
// the host lives longer than we do, so a raw ptr is safe
fHost = host;
fPatch = NULL;
+ fPatchSize = 0;
fLayoutBounds = NULL;
}
@@ -38,6 +39,7 @@
}
Res_png_9patch* fPatch;
+ size_t fPatchSize;
int *fLayoutBounds;
virtual bool peek(const char tag[], const void* data, size_t length);
diff --git a/core/jni/android_debug_JNITest.cpp b/core/jni/android_debug_JNITest.cpp
deleted file mode 100644
index 9147284..0000000
--- a/core/jni/android_debug_JNITest.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/* //device/libs/android_runtime/android_debug_JNITest.cpp
-**
-** Copyright 2006, 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.
-*/
-
-#define LOG_TAG "DebugJNI"
-
-#include "jni.h"
-#include "nativehelper/JNIHelp.h"
-#include "utils/Log.h"
-#include "utils/misc.h"
-//#include "android_runtime/AndroidRuntime.h"
-
-namespace android {
-
-/*
- * Implements:
- * native int part1(int intArg, double doubleArg, String stringArg,
- * int[] arrayArg)
- */
-static jint android_debug_JNITest_part1(JNIEnv* env, jobject object,
- jint intArg, jdouble doubleArg, jstring stringArg, jobjectArray arrayArg)
-{
- jclass clazz;
- jmethodID part2id;
- jsize arrayLen;
- jint arrayVal;
- int result = -2;
-
- ALOGI("JNI test: in part1, intArg=%d, doubleArg=%.3f\n", intArg, doubleArg);
-
- /* find "int part2(double doubleArg, int fromArray, String stringArg)" */
- clazz = env->GetObjectClass(object);
- part2id = env->GetMethodID(clazz,
- "part2", "(DILjava/lang/String;)I");
- if (part2id == NULL) {
- ALOGE("JNI test: unable to find part2\n");
- return -1;
- }
-
- /* get the length of the array */
- arrayLen = env->GetArrayLength(arrayArg);
- ALOGI(" array size is %d\n", arrayLen);
-
- /*
- * Get the last element in the array.
- * Use the Get<type>ArrayElements functions instead if you need access
- * to multiple elements.
- */
- arrayVal = (int) env->GetObjectArrayElement(arrayArg, arrayLen-1);
- ALOGI(" array val is %d\n", arrayVal);
-
- /* call this->part2 */
- result = env->CallIntMethod(object, part2id,
- doubleArg, arrayVal, stringArg);
-
- return result;
-}
-
-/*
- * Implements:
- * private static native int part3(String stringArg);
- */
-static jint android_debug_JNITest_part3(JNIEnv* env, jclass clazz,
- jstring stringArg)
-{
- const char* utfChars;
- jboolean isCopy;
-
- ALOGI("JNI test: in part3\n");
-
- utfChars = env->GetStringUTFChars(stringArg, &isCopy);
-
- ALOGI(" String is '%s', isCopy=%d\n", (const char*) utfChars, isCopy);
-
- env->ReleaseStringUTFChars(stringArg, utfChars);
-
- return 2000;
-}
-
-/*
- * JNI registration.
- */
-static JNINativeMethod gMethods[] = {
- /* name, signature, funcPtr */
- { "part1", "(IDLjava/lang/String;[I)I",
- (void*) android_debug_JNITest_part1 },
- { "part3", "(Ljava/lang/String;)I",
- (void*) android_debug_JNITest_part3 },
-};
-int register_android_debug_JNITest(JNIEnv* env)
-{
- return jniRegisterNativeMethods(env, "android/debug/JNITest",
- gMethods, NELEM(gMethods));
-}
-
-#if 0
-/* trampoline into C++ */
-extern "C"
-int register_android_debug_JNITest_C(JNIEnv* env)
-{
- return android::register_android_debug_JNITest(env);
-}
-#endif
-
-}; // namespace android
-
diff --git a/core/jni/android_media_AudioRecord.cpp b/core/jni/android_media_AudioRecord.cpp
index b22668b..ab70f25 100644
--- a/core/jni/android_media_AudioRecord.cpp
+++ b/core/jni/android_media_AudioRecord.cpp
@@ -18,6 +18,7 @@
#define LOG_TAG "AudioRecord-JNI"
+#include <inttypes.h>
#include <jni.h>
#include <JNIHelp.h>
#include <android_runtime/AndroidRuntime.h>
@@ -316,7 +317,7 @@
if (lpRecorder == NULL) {
return;
}
- ALOGV("About to delete lpRecorder: %x\n", (int)lpRecorder.get());
+ ALOGV("About to delete lpRecorder: %" PRIxPTR "\n", lpRecorder.get());
lpRecorder->stop();
audiorecord_callback_cookie *lpCookie = (audiorecord_callback_cookie *)env->GetLongField(
@@ -329,7 +330,7 @@
// delete the callback information
if (lpCookie) {
Mutex::Autolock l(sLock);
- ALOGV("deleting lpCookie: %x\n", (int)lpCookie);
+ ALOGV("deleting lpCookie: %" PRIxPTR "\n", lpCookie);
while (lpCookie->busy) {
if (lpCookie->cond.waitRelative(sLock,
milliseconds(CALLBACK_COND_WAIT_TIMEOUT_MS)) !=
diff --git a/core/jni/android_opengl_EGL14.cpp b/core/jni/android_opengl_EGL14.cpp
index 5b0a4b2..19e4d99 100644
--- a/core/jni/android_opengl_EGL14.cpp
+++ b/core/jni/android_opengl_EGL14.cpp
@@ -69,22 +69,22 @@
jclass eglconfigClassLocal = _env->FindClass("android/opengl/EGLConfig");
eglconfigClass = (jclass) _env->NewGlobalRef(eglconfigClassLocal);
- egldisplayGetHandleID = _env->GetMethodID(egldisplayClass, "getHandle", "()I");
- eglcontextGetHandleID = _env->GetMethodID(eglcontextClass, "getHandle", "()I");
- eglsurfaceGetHandleID = _env->GetMethodID(eglsurfaceClass, "getHandle", "()I");
- eglconfigGetHandleID = _env->GetMethodID(eglconfigClass, "getHandle", "()I");
+ egldisplayGetHandleID = _env->GetMethodID(egldisplayClass, "getNativeHandle", "()J");
+ eglcontextGetHandleID = _env->GetMethodID(eglcontextClass, "getNativeHandle", "()J");
+ eglsurfaceGetHandleID = _env->GetMethodID(eglsurfaceClass, "getNativeHandle", "()J");
+ eglconfigGetHandleID = _env->GetMethodID(eglconfigClass, "getNativeHandle", "()J");
- egldisplayConstructor = _env->GetMethodID(egldisplayClass, "<init>", "(I)V");
- eglcontextConstructor = _env->GetMethodID(eglcontextClass, "<init>", "(I)V");
- eglsurfaceConstructor = _env->GetMethodID(eglsurfaceClass, "<init>", "(I)V");
- eglconfigConstructor = _env->GetMethodID(eglconfigClass, "<init>", "(I)V");
+ egldisplayConstructor = _env->GetMethodID(egldisplayClass, "<init>", "(J)V");
+ eglcontextConstructor = _env->GetMethodID(eglcontextClass, "<init>", "(J)V");
+ eglsurfaceConstructor = _env->GetMethodID(eglsurfaceClass, "<init>", "(J)V");
+ eglconfigConstructor = _env->GetMethodID(eglconfigClass, "<init>", "(J)V");
- jobject localeglNoContextObject = _env->NewObject(eglcontextClass, eglcontextConstructor, (jint)EGL_NO_CONTEXT);
+ jobject localeglNoContextObject = _env->NewObject(eglcontextClass, eglcontextConstructor, reinterpret_cast<jlong>(EGL_NO_CONTEXT));
eglNoContextObject = _env->NewGlobalRef(localeglNoContextObject);
- jobject localeglNoDisplayObject = _env->NewObject(egldisplayClass, egldisplayConstructor, (jint)EGL_NO_DISPLAY);
+ jobject localeglNoDisplayObject = _env->NewObject(egldisplayClass, egldisplayConstructor, reinterpret_cast<jlong>(EGL_NO_DISPLAY));
eglNoDisplayObject = _env->NewGlobalRef(localeglNoDisplayObject);
- jobject localeglNoSurfaceObject = _env->NewObject(eglsurfaceClass, eglsurfaceConstructor, (jint)EGL_NO_SURFACE);
+ jobject localeglNoSurfaceObject = _env->NewObject(eglsurfaceClass, eglsurfaceConstructor, reinterpret_cast<jlong>(EGL_NO_SURFACE));
eglNoSurfaceObject = _env->NewGlobalRef(localeglNoSurfaceObject);
@@ -106,7 +106,8 @@
"Object is set to null.");
}
- return (void*) (_env->CallIntMethod(obj, mid));
+ jlong handle = _env->CallLongMethod(obj, mid);
+ return reinterpret_cast<void*>(handle);
}
static jobject
@@ -126,7 +127,7 @@
return eglNoSurfaceObject;
}
- return _env->NewObject(cls, con, (jint)handle);
+ return _env->NewObject(cls, con, reinterpret_cast<jlong>(handle));
}
// --------------------------------------------------------------------------
@@ -142,14 +143,26 @@
/* EGLDisplay eglGetDisplay ( EGLNativeDisplayType display_id ) */
static jobject
android_eglGetDisplay
- (JNIEnv *_env, jobject _this, jint display_id) {
+ (JNIEnv *_env, jobject _this, jlong display_id) {
EGLDisplay _returnValue = (EGLDisplay) 0;
_returnValue = eglGetDisplay(
- (EGLNativeDisplayType)display_id
+ reinterpret_cast<EGLNativeDisplayType>(display_id)
);
return toEGLHandle(_env, egldisplayClass, egldisplayConstructor, _returnValue);
}
+/* EGLDisplay eglGetDisplay ( EGLNativeDisplayType display_id ) */
+static jobject
+android_eglGetDisplayInt
+ (JNIEnv *_env, jobject _this, jint display_id) {
+
+ if ((EGLNativeDisplayType)display_id != EGL_DEFAULT_DISPLAY) {
+ jniThrowException(_env, "java/lang/UnsupportedOperationException", "eglGetDisplay");
+ return 0;
+ }
+ return android_eglGetDisplay(_env, _this, display_id);
+}
+
/* EGLBoolean eglInitialize ( EGLDisplay dpy, EGLint *major, EGLint *minor ) */
static jboolean
android_eglInitialize
@@ -852,7 +865,7 @@
/* EGLSurface eglCreatePbufferFromClientBuffer ( EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list ) */
static jobject
android_eglCreatePbufferFromClientBuffer
- (JNIEnv *_env, jobject _this, jobject dpy, jint buftype, jint buffer, jobject config, jintArray attrib_list_ref, jint offset) {
+ (JNIEnv *_env, jobject _this, jobject dpy, jint buftype, jlong buffer, jobject config, jintArray attrib_list_ref, jint offset) {
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
@@ -897,7 +910,7 @@
_returnValue = eglCreatePbufferFromClientBuffer(
(EGLDisplay)dpy_native,
(EGLenum)buftype,
- (EGLClientBuffer)buffer,
+ reinterpret_cast<EGLClientBuffer>(buffer),
(EGLConfig)config_native,
(EGLint *)attrib_list
);
@@ -913,6 +926,16 @@
return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue);
}
+static jobject
+android_eglCreatePbufferFromClientBufferInt
+ (JNIEnv *_env, jobject _this, jobject dpy, jint buftype, jint buffer, jobject config, jintArray attrib_list_ref, jint offset) {
+ if(sizeof(void*) != sizeof(uint32_t)) {
+ jniThrowException(_env, "java/lang/UnsupportedOperationException", "eglCreatePbufferFromClientBuffer");
+ return 0;
+ }
+ return android_eglCreatePbufferFromClientBuffer(_env, _this, dpy, buftype, buffer, config, attrib_list_ref, offset);
+}
+
/* EGLBoolean eglSurfaceAttrib ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value ) */
static jboolean
android_eglSurfaceAttrib
@@ -1207,7 +1230,8 @@
static JNINativeMethod methods[] = {
{"_nativeClassInit", "()V", (void*)nativeClassInit },
{"eglGetError", "()I", (void *) android_eglGetError },
-{"eglGetDisplay", "(I)Landroid/opengl/EGLDisplay;", (void *) android_eglGetDisplay },
+{"eglGetDisplay", "(I)Landroid/opengl/EGLDisplay;", (void *) android_eglGetDisplayInt },
+{"eglGetDisplay", "(J)Landroid/opengl/EGLDisplay;", (void *) android_eglGetDisplay },
{"eglInitialize", "(Landroid/opengl/EGLDisplay;[II[II)Z", (void *) android_eglInitialize },
{"eglTerminate", "(Landroid/opengl/EGLDisplay;)Z", (void *) android_eglTerminate },
{"eglQueryString", "(Landroid/opengl/EGLDisplay;I)Ljava/lang/String;", (void *) android_eglQueryString__Landroind_opengl_EGLDisplay_2I },
@@ -1224,7 +1248,8 @@
{"eglQueryAPI", "()I", (void *) android_eglQueryAPI },
{"eglWaitClient", "()Z", (void *) android_eglWaitClient },
{"eglReleaseThread", "()Z", (void *) android_eglReleaseThread },
-{"eglCreatePbufferFromClientBuffer", "(Landroid/opengl/EGLDisplay;IILandroid/opengl/EGLConfig;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreatePbufferFromClientBuffer },
+{"eglCreatePbufferFromClientBuffer", "(Landroid/opengl/EGLDisplay;IILandroid/opengl/EGLConfig;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreatePbufferFromClientBufferInt },
+{"eglCreatePbufferFromClientBuffer", "(Landroid/opengl/EGLDisplay;IJLandroid/opengl/EGLConfig;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreatePbufferFromClientBuffer },
{"eglSurfaceAttrib", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;II)Z", (void *) android_eglSurfaceAttrib },
{"eglBindTexImage", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;I)Z", (void *) android_eglBindTexImage },
{"eglReleaseTexImage", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;I)Z", (void *) android_eglReleaseTexImage },
diff --git a/core/jni/android_opengl_EGLExt.cpp b/core/jni/android_opengl_EGLExt.cpp
index 5179ddc..15899f5 100644
--- a/core/jni/android_opengl_EGLExt.cpp
+++ b/core/jni/android_opengl_EGLExt.cpp
@@ -70,22 +70,22 @@
jclass eglconfigClassLocal = _env->FindClass("android/opengl/EGLConfig");
eglconfigClass = (jclass) _env->NewGlobalRef(eglconfigClassLocal);
- egldisplayGetHandleID = _env->GetMethodID(egldisplayClass, "getHandle", "()I");
- eglcontextGetHandleID = _env->GetMethodID(eglcontextClass, "getHandle", "()I");
- eglsurfaceGetHandleID = _env->GetMethodID(eglsurfaceClass, "getHandle", "()I");
- eglconfigGetHandleID = _env->GetMethodID(eglconfigClass, "getHandle", "()I");
+ egldisplayGetHandleID = _env->GetMethodID(egldisplayClass, "getNativeHandle", "()J");
+ eglcontextGetHandleID = _env->GetMethodID(eglcontextClass, "getNativeHandle", "()J");
+ eglsurfaceGetHandleID = _env->GetMethodID(eglsurfaceClass, "getNativeHandle", "()J");
+ eglconfigGetHandleID = _env->GetMethodID(eglconfigClass, "getNativeHandle", "()J");
- egldisplayConstructor = _env->GetMethodID(egldisplayClass, "<init>", "(I)V");
- eglcontextConstructor = _env->GetMethodID(eglcontextClass, "<init>", "(I)V");
- eglsurfaceConstructor = _env->GetMethodID(eglsurfaceClass, "<init>", "(I)V");
- eglconfigConstructor = _env->GetMethodID(eglconfigClass, "<init>", "(I)V");
+ egldisplayConstructor = _env->GetMethodID(egldisplayClass, "<init>", "(J)V");
+ eglcontextConstructor = _env->GetMethodID(eglcontextClass, "<init>", "(J)V");
+ eglsurfaceConstructor = _env->GetMethodID(eglsurfaceClass, "<init>", "(J)V");
+ eglconfigConstructor = _env->GetMethodID(eglconfigClass, "<init>", "(J)V");
- jobject localeglNoContextObject = _env->NewObject(eglcontextClass, eglcontextConstructor, (jint)EGL_NO_CONTEXT);
+ jobject localeglNoContextObject = _env->NewObject(eglcontextClass, eglcontextConstructor, reinterpret_cast<jlong>(EGL_NO_CONTEXT));
eglNoContextObject = _env->NewGlobalRef(localeglNoContextObject);
- jobject localeglNoDisplayObject = _env->NewObject(egldisplayClass, egldisplayConstructor, (jint)EGL_NO_DISPLAY);
+ jobject localeglNoDisplayObject = _env->NewObject(egldisplayClass, egldisplayConstructor, reinterpret_cast<jlong>(EGL_NO_DISPLAY));
eglNoDisplayObject = _env->NewGlobalRef(localeglNoDisplayObject);
- jobject localeglNoSurfaceObject = _env->NewObject(eglsurfaceClass, eglsurfaceConstructor, (jint)EGL_NO_SURFACE);
+ jobject localeglNoSurfaceObject = _env->NewObject(eglsurfaceClass, eglsurfaceConstructor, reinterpret_cast<jlong>(EGL_NO_SURFACE));
eglNoSurfaceObject = _env->NewGlobalRef(localeglNoSurfaceObject);
@@ -107,7 +107,7 @@
"Object is set to null.");
}
- return (void*) (_env->CallIntMethod(obj, mid));
+ return reinterpret_cast<void*>(_env->CallLongMethod(obj, mid));
}
static jobject
@@ -127,7 +127,7 @@
return eglNoSurfaceObject;
}
- return _env->NewObject(cls, con, (jint)handle);
+ return _env->NewObject(cls, con, reinterpret_cast<jlong>(handle));
}
// --------------------------------------------------------------------------
diff --git a/core/jni/android_opengl_GLES10.cpp b/core/jni/android_opengl_GLES10.cpp
index cc34e99..21e19e1 100644
--- a/core/jni/android_opengl_GLES10.cpp
+++ b/core/jni/android_opengl_GLES10.cpp
@@ -111,7 +111,7 @@
getBasePointerID, buffer);
if (pointer != 0L) {
*array = NULL;
- return (void *) (jint) pointer;
+ return reinterpret_cast<void*>(pointer);
}
*array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
diff --git a/core/jni/android_opengl_GLES10Ext.cpp b/core/jni/android_opengl_GLES10Ext.cpp
index 9284384..bc83234 100644
--- a/core/jni/android_opengl_GLES10Ext.cpp
+++ b/core/jni/android_opengl_GLES10Ext.cpp
@@ -111,7 +111,7 @@
getBasePointerID, buffer);
if (pointer != 0L) {
*array = NULL;
- return (void *) (jint) pointer;
+ return reinterpret_cast<void*>(pointer);
}
*array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
diff --git a/core/jni/android_opengl_GLES11.cpp b/core/jni/android_opengl_GLES11.cpp
index 871e84d..a45f269 100644
--- a/core/jni/android_opengl_GLES11.cpp
+++ b/core/jni/android_opengl_GLES11.cpp
@@ -111,7 +111,7 @@
getBasePointerID, buffer);
if (pointer != 0L) {
*array = NULL;
- return (void *) (jint) pointer;
+ return reinterpret_cast<void*>(pointer);
}
*array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
@@ -578,7 +578,7 @@
(GLint)size,
(GLenum)type,
(GLsizei)stride,
- (GLvoid *)offset
+ reinterpret_cast<GLvoid *>(offset)
);
}
@@ -679,7 +679,7 @@
(GLenum)mode,
(GLsizei)count,
(GLenum)type,
- (GLvoid *)offset
+ reinterpret_cast<GLvoid *>(offset)
);
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2302,7 +2302,7 @@
glNormalPointer(
(GLenum)type,
(GLsizei)stride,
- (GLvoid *)offset
+ reinterpret_cast<GLvoid *>(offset)
);
}
@@ -2529,7 +2529,7 @@
(GLint)size,
(GLenum)type,
(GLsizei)stride,
- (GLvoid *)offset
+ reinterpret_cast<GLvoid *>(offset)
);
}
@@ -2937,7 +2937,7 @@
(GLint)size,
(GLenum)type,
(GLsizei)stride,
- (GLvoid *)offset
+ reinterpret_cast<GLvoid *>(offset)
);
}
diff --git a/core/jni/android_opengl_GLES11Ext.cpp b/core/jni/android_opengl_GLES11Ext.cpp
index 3e038ad..05728ef 100644
--- a/core/jni/android_opengl_GLES11Ext.cpp
+++ b/core/jni/android_opengl_GLES11Ext.cpp
@@ -111,7 +111,7 @@
getBasePointerID, buffer);
if (pointer != 0L) {
*array = NULL;
- return (void *) (jint) pointer;
+ return reinterpret_cast<void*>(pointer);
}
*array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
diff --git a/core/jni/android_opengl_GLES20.cpp b/core/jni/android_opengl_GLES20.cpp
index db03b70..d3e5014 100644
--- a/core/jni/android_opengl_GLES20.cpp
+++ b/core/jni/android_opengl_GLES20.cpp
@@ -111,7 +111,7 @@
getBasePointerID, buffer);
if (pointer != 0L) {
*array = NULL;
- return (void *) (jint) pointer;
+ return reinterpret_cast<void*>(pointer);
}
*array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
@@ -1180,7 +1180,7 @@
(GLenum)mode,
(GLsizei)count,
(GLenum)type,
- (GLvoid *)offset
+ reinterpret_cast<GLvoid *>(offset)
);
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1804,7 +1804,7 @@
(GLsizei *)length,
(GLint *)size,
(GLenum *)type,
- (char *)name
+ reinterpret_cast<char *>(name)
);
if (_typeArray) {
releasePointer(_env, _typeArray, type, JNI_TRUE);
@@ -2132,7 +2132,7 @@
(GLsizei *)length,
(GLint *)size,
(GLenum *)type,
- (char *)name
+ reinterpret_cast<char *>(name)
);
if (_typeArray) {
releasePointer(_env, _typeArray, type, JNI_TRUE);
@@ -3212,7 +3212,7 @@
(GLuint)shader,
(GLsizei)bufsize,
(GLsizei *)length,
- (char *)source
+ reinterpret_cast<char *>(source)
);
if (_array) {
releasePointer(_env, _array, length, JNI_TRUE);
@@ -5985,7 +5985,7 @@
(GLenum)type,
(GLboolean)normalized,
(GLsizei)stride,
- (GLvoid *)offset
+ reinterpret_cast<GLvoid *>(offset)
);
}
diff --git a/core/jni/android_opengl_GLES30.cpp b/core/jni/android_opengl_GLES30.cpp
index 4c62a75..8821352 100644
--- a/core/jni/android_opengl_GLES30.cpp
+++ b/core/jni/android_opengl_GLES30.cpp
@@ -111,7 +111,7 @@
getBasePointerID, buffer);
if (pointer != 0L) {
*array = NULL;
- return (void *) (jint) pointer;
+ return reinterpret_cast<void*>(pointer);
}
*array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
@@ -370,7 +370,7 @@
(GLuint)end,
(GLsizei)count,
(GLenum)type,
- (GLvoid *)offset
+ reinterpret_cast<GLvoid *>(offset)
);
}
@@ -419,7 +419,7 @@
(GLint)border,
(GLenum)format,
(GLenum)type,
- (GLvoid *)offset
+ reinterpret_cast<GLvoid *>(offset)
);
}
@@ -470,7 +470,7 @@
(GLsizei)depth,
(GLenum)format,
(GLenum)type,
- (GLvoid *)offset
+ reinterpret_cast<GLvoid *>(offset)
);
}
@@ -534,7 +534,7 @@
(GLsizei)depth,
(GLint)border,
(GLsizei)imageSize,
- (GLvoid *)offset
+ reinterpret_cast<GLvoid *>(offset)
);
}
@@ -585,7 +585,7 @@
(GLsizei)depth,
(GLenum)format,
(GLsizei)imageSize,
- (GLvoid *)offset
+ reinterpret_cast<GLvoid *>(offset)
);
}
@@ -2134,7 +2134,7 @@
(GLint)size,
(GLenum)type,
(GLsizei)stride,
- (GLvoid *)offset
+ reinterpret_cast<GLvoid *>(offset)
);
}
diff --git a/core/jni/android_os_SystemClock.cpp b/core/jni/android_os_SystemClock.cpp
index 5f4d570..62478442 100644
--- a/core/jni/android_os_SystemClock.cpp
+++ b/core/jni/android_os_SystemClock.cpp
@@ -19,13 +19,6 @@
* System clock functions.
*/
-#ifdef HAVE_ANDROID_OS
-#include <linux/ioctl.h>
-#include <linux/rtc.h>
-#include <utils/Atomic.h>
-#include <linux/android_alarm.h>
-#endif
-
#include <sys/time.h>
#include <limits.h>
#include <fcntl.h>
@@ -43,109 +36,6 @@
namespace android {
-static int setCurrentTimeMillisAlarmDriver(struct timeval *tv)
-{
- struct timespec ts;
- int fd;
- int res;
-
- fd = open("/dev/alarm", O_RDWR);
- if(fd < 0) {
- ALOGV("Unable to open alarm driver: %s\n", strerror(errno));
- return -1;
- }
- ts.tv_sec = tv->tv_sec;
- ts.tv_nsec = tv->tv_usec * 1000;
- res = ioctl(fd, ANDROID_ALARM_SET_RTC, &ts);
- if (res < 0)
- ALOGV("ANDROID_ALARM_SET_RTC ioctl failed: %s\n", strerror(errno));
- close(fd);
- return res;
-}
-
-static int setCurrentTimeMillisRtc(struct timeval *tv)
-{
- struct rtc_time rtc;
- struct tm tm, *gmtime_res;
- int fd;
- int res;
-
- fd = open("/dev/rtc0", O_RDWR);
- if (fd < 0) {
- ALOGV("Unable to open RTC driver: %s\n", strerror(errno));
- return -1;
- }
-
- res = settimeofday(tv, NULL);
- if (res < 0) {
- ALOGV("settimeofday() failed: %s\n", strerror(errno));
- goto done;
- }
-
- gmtime_res = gmtime_r(&tv->tv_sec, &tm);
- if (!gmtime_res) {
- ALOGV("gmtime_r() failed: %s\n", strerror(errno));
- res = -1;
- goto done;
- }
-
- memset(&rtc, 0, sizeof(rtc));
- rtc.tm_sec = tm.tm_sec;
- rtc.tm_min = tm.tm_min;
- rtc.tm_hour = tm.tm_hour;
- rtc.tm_mday = tm.tm_mday;
- rtc.tm_mon = tm.tm_mon;
- rtc.tm_year = tm.tm_year;
- rtc.tm_wday = tm.tm_wday;
- rtc.tm_yday = tm.tm_yday;
- rtc.tm_isdst = tm.tm_isdst;
- res = ioctl(fd, RTC_SET_TIME, &rtc);
- if (res < 0)
- ALOGV("RTC_SET_TIME ioctl failed: %s\n", strerror(errno));
-done:
- close(fd);
- return res;
-}
-
-/*
- * Set the current time. This only works when running as root.
- */
-static int setCurrentTimeMillis(int64_t millis)
-{
- struct timeval tv;
- int ret;
-
- if (millis <= 0 || millis / 1000LL >= INT_MAX) {
- return -1;
- }
-
- tv.tv_sec = (time_t) (millis / 1000LL);
- tv.tv_usec = (suseconds_t) ((millis % 1000LL) * 1000LL);
-
- ALOGD("Setting time of day to sec=%d\n", (int) tv.tv_sec);
-
- ret = setCurrentTimeMillisAlarmDriver(&tv);
- if (ret < 0)
- ret = setCurrentTimeMillisRtc(&tv);
-
- if(ret < 0) {
- ALOGW("Unable to set rtc to %ld: %s\n", tv.tv_sec, strerror(errno));
- ret = -1;
- }
- return ret;
-}
-
-/*
- * native public static void setCurrentTimeMillis(long millis)
- *
- * Set the current time. This only works when running as root.
- */
-static jboolean android_os_SystemClock_setCurrentTimeMillis(JNIEnv* env,
- jobject clazz, jlong millis)
-{
- return (setCurrentTimeMillis(millis) == 0);
-}
-
/*
* native public static long uptimeMillis();
*/
@@ -230,8 +120,6 @@
*/
static JNINativeMethod gMethods[] = {
/* name, signature, funcPtr */
- { "setCurrentTimeMillis", "(J)Z",
- (void*) android_os_SystemClock_setCurrentTimeMillis },
{ "uptimeMillis", "()J",
(void*) android_os_SystemClock_uptimeMillis },
{ "elapsedRealtime", "()J",
diff --git a/core/jni/com_google_android_gles_jni_GLImpl.cpp b/core/jni/com_google_android_gles_jni_GLImpl.cpp
index b3b0049..7975987 100644
--- a/core/jni/com_google_android_gles_jni_GLImpl.cpp
+++ b/core/jni/com_google_android_gles_jni_GLImpl.cpp
@@ -129,7 +129,7 @@
getBasePointerID, buffer);
if (pointer != 0L) {
*array = NULL;
- return (void *) (jint) pointer;
+ return reinterpret_cast<void *>(pointer);
}
*array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
@@ -4359,7 +4359,7 @@
(GLint)size,
(GLenum)type,
(GLsizei)stride,
- (GLvoid *)offset
+ reinterpret_cast<GLvoid *>(offset)
);
}
@@ -4460,7 +4460,7 @@
(GLenum)mode,
(GLsizei)count,
(GLenum)type,
- (GLvoid *)offset
+ reinterpret_cast<GLvoid *>(offset)
);
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -6099,7 +6099,7 @@
glNormalPointer(
(GLenum)type,
(GLsizei)stride,
- (GLvoid *)offset
+ reinterpret_cast<GLvoid *>(offset)
);
}
@@ -6326,7 +6326,7 @@
(GLint)size,
(GLenum)type,
(GLsizei)stride,
- (GLvoid *)offset
+ reinterpret_cast<GLvoid *>(offset)
);
}
@@ -6756,7 +6756,7 @@
(GLint)size,
(GLenum)type,
(GLsizei)stride,
- (GLvoid *)offset
+ reinterpret_cast<GLvoid *>(offset)
);
}
@@ -7196,7 +7196,7 @@
(GLint)size,
(GLenum)type,
(GLsizei)stride,
- (GLvoid *)offset
+ reinterpret_cast<GLvoid *>(offset)
);
}
@@ -7232,7 +7232,7 @@
(GLint)size,
(GLenum)type,
(GLsizei)stride,
- (GLvoid *)offset
+ reinterpret_cast<GLvoid *>(offset)
);
}
diff --git a/data/fonts/system_fonts.xml b/data/fonts/system_fonts.xml
index 16e4c7c..549f061b 100644
--- a/data/fonts/system_fonts.xml
+++ b/data/fonts/system_fonts.xml
@@ -75,7 +75,6 @@
<name>baskerville</name>
<name>goudy</name>
<name>fantasy</name>
- <name>cursive</name>
<name>ITC Stone Serif</name>
</nameset>
<fileset>
@@ -108,4 +107,32 @@
</fileset>
</family>
+ <family>
+ <nameset>
+ <name>casual</name>
+ </nameset>
+ <fileset>
+ <file>ComingSoon.ttf</file>
+ </fileset>
+ </family>
+
+ <family>
+ <nameset>
+ <name>cursive</name>
+ </nameset>
+ <fileset>
+ <file>DancingScript-Regular.ttf</file>
+ <file>DancingScript-Bold.ttf</file>
+ </fileset>
+ </family>
+
+ <family>
+ <nameset>
+ <name>sans-serif-smallcaps</name>
+ </nameset>
+ <fileset>
+ <file>CarroisGothicSC-Regular.ttf</file>
+ </fileset>
+ </family>
+
</familyset>
diff --git a/docs/html/guide/topics/manifest/activity-element.jd b/docs/html/guide/topics/manifest/activity-element.jd
index 8df1fdf..eabfa60 100644
--- a/docs/html/guide/topics/manifest/activity-element.jd
+++ b/docs/html/guide/topics/manifest/activity-element.jd
@@ -580,7 +580,7 @@
<a href="#nm"><code>android:name</code></a> attribute.
<p>The system reads this attribute to determine which activity should be started when
- the use presses the Up button in the action bar. The system can also use this information to
+ the user presses the Up button in the action bar. The system can also use this information to
synthesize a back stack of activities with {@link android.app.TaskStackBuilder}.</p>
<p>To support API levels 4 - 16, you can also declare the parent activity with a {@code
diff --git a/docs/html/tools/testing/testing_ui.jd b/docs/html/tools/testing/testing_ui.jd
index 701415e..4318a21 100644
--- a/docs/html/tools/testing/testing_ui.jd
+++ b/docs/html/tools/testing/testing_ui.jd
@@ -90,7 +90,7 @@
alt="User interface of uiautomatorviewer tool" height="327px" id="figure1"/>
</a>
<p class="img-caption">
- <strong>Figure 1.</strong> The {@code uiautomatorviewer} showing the captured interface of a test deviice.
+ <strong>Figure 1.</strong> The {@code uiautomatorviewer} showing the captured interface of a test device.
</p>
<p>To analyze the UI components of the application that you want to test:</p>
diff --git a/include/android_runtime/AndroidRuntime.h b/include/android_runtime/AndroidRuntime.h
index 0b3ce9a..649f4c3 100644
--- a/include/android_runtime/AndroidRuntime.h
+++ b/include/android_runtime/AndroidRuntime.h
@@ -115,7 +115,7 @@
private:
static int startReg(JNIEnv* env);
- void parseExtraOpts(char* extraOptsBuf);
+ void parseExtraOpts(char* extraOptsBuf, const char* quotingArg);
int startVm(JavaVM** pJavaVM, JNIEnv** pEnv);
Vector<JavaVMOption> mOptions;
diff --git a/include/androidfw/ResourceTypes.h b/include/androidfw/ResourceTypes.h
index a0bae12..b334aab 100644
--- a/include/androidfw/ResourceTypes.h
+++ b/include/androidfw/ResourceTypes.h
@@ -79,7 +79,7 @@
* two stretchable slices is exactly the ratio of their corresponding
* segment lengths.
*
- * xDivs and yDivs point to arrays of horizontal and vertical pixel
+ * xDivs and yDivs are arrays of horizontal and vertical pixel
* indices. The first pair of Divs (in either array) indicate the
* starting and ending points of the first stretchable segment in that
* axis. The next pair specifies the next stretchable segment, etc. So
@@ -92,32 +92,31 @@
* go to xDiv[0] and slices 2, 6 and 10 start at xDiv[1] and end at
* xDiv[2].
*
- * The array pointed to by the colors field lists contains hints for
- * each of the regions. They are ordered according left-to-right and
- * top-to-bottom as indicated above. For each segment that is a solid
- * color the array entry will contain that color value; otherwise it
- * will contain NO_COLOR. Segments that are completely transparent
- * will always have the value TRANSPARENT_COLOR.
+ * The colors array contains hints for each of the regions. They are
+ * ordered according left-to-right and top-to-bottom as indicated above.
+ * For each segment that is a solid color the array entry will contain
+ * that color value; otherwise it will contain NO_COLOR. Segments that
+ * are completely transparent will always have the value TRANSPARENT_COLOR.
*
* The PNG chunk type is "npTc".
*/
struct Res_png_9patch
{
- Res_png_9patch() : wasDeserialized(false), xDivs(NULL),
- yDivs(NULL), colors(NULL) { }
+ Res_png_9patch() : wasDeserialized(false), xDivsOffset(0),
+ yDivsOffset(0), colorsOffset(0) { }
int8_t wasDeserialized;
int8_t numXDivs;
int8_t numYDivs;
int8_t numColors;
- // These tell where the next section of a patch starts.
- // For example, the first patch includes the pixels from
- // 0 to xDivs[0]-1 and the second patch includes the pixels
- // from xDivs[0] to xDivs[1]-1.
- // Note: allocation/free of these pointers is left to the caller.
- int32_t* xDivs;
- int32_t* yDivs;
+ // The offset (from the start of this structure) to the xDivs & yDivs
+ // array for this 9patch. To get a pointer to this array, call
+ // getXDivs or getYDivs. Note that the serialized form for 9patches places
+ // the xDivs, yDivs and colors arrays immediately after the location
+ // of the Res_png_9patch struct.
+ uint32_t xDivsOffset;
+ uint32_t yDivsOffset;
int32_t paddingLeft, paddingRight;
int32_t paddingTop, paddingBottom;
@@ -129,22 +128,42 @@
// The 9 patch segment is completely transparent.
TRANSPARENT_COLOR = 0x00000000
};
- // Note: allocation/free of this pointer is left to the caller.
- uint32_t* colors;
+
+ // The offset (from the start of this structure) to the colors array
+ // for this 9patch.
+ uint32_t colorsOffset;
// Convert data from device representation to PNG file representation.
void deviceToFile();
// Convert data from PNG file representation to device representation.
void fileToDevice();
- // Serialize/Marshall the patch data into a newly malloc-ed block
- void* serialize();
- // Serialize/Marshall the patch data
- void serialize(void* outData);
+
+ // Serialize/Marshall the patch data into a newly malloc-ed block.
+ static void* serialize(const Res_png_9patch& patchHeader, const int32_t* xDivs,
+ const int32_t* yDivs, const uint32_t* colors);
+ // Serialize/Marshall the patch data into |outData|.
+ static void serialize(const Res_png_9patch& patchHeader, const int32_t* xDivs,
+ const int32_t* yDivs, const uint32_t* colors, void* outData);
// Deserialize/Unmarshall the patch data
- static Res_png_9patch* deserialize(const void* data);
+ static Res_png_9patch* deserialize(void* data);
// Compute the size of the serialized data structure
- size_t serializedSize();
-};
+ size_t serializedSize() const;
+
+ // These tell where the next section of a patch starts.
+ // For example, the first patch includes the pixels from
+ // 0 to xDivs[0]-1 and the second patch includes the pixels
+ // from xDivs[0] to xDivs[1]-1.
+ inline int32_t* getXDivs() const {
+ return reinterpret_cast<int32_t*>(reinterpret_cast<uintptr_t>(this) + xDivsOffset);
+ }
+ inline int32_t* getYDivs() const {
+ return reinterpret_cast<int32_t*>(reinterpret_cast<uintptr_t>(this) + yDivsOffset);
+ }
+ inline uint32_t* getColors() const {
+ return reinterpret_cast<uint32_t*>(reinterpret_cast<uintptr_t>(this) + colorsOffset);
+ }
+
+} __attribute__((packed));
/** ********************************************************************
* Base Types
diff --git a/libs/androidfw/BackupHelpers.cpp b/libs/androidfw/BackupHelpers.cpp
index b8d3f48..302fbf6 100644
--- a/libs/androidfw/BackupHelpers.cpp
+++ b/libs/androidfw/BackupHelpers.cpp
@@ -1083,7 +1083,7 @@
}
if (readSnapshot.size() != 4) {
- fprintf(stderr, "readSnapshot should be length 4 is %d\n", readSnapshot.size());
+ fprintf(stderr, "readSnapshot should be length 4 is %zu\n", readSnapshot.size());
return 1;
}
@@ -1095,8 +1095,8 @@
if (name != filenames[i] || states[i].modTime_sec != state.modTime_sec
|| states[i].modTime_nsec != state.modTime_nsec || states[i].mode != state.mode
|| states[i].size != state.size || states[i].crc32 != states[i].crc32) {
- fprintf(stderr, "state %d expected={%d/%d, 0x%08x, %04o, 0x%08x, %3d} '%s'\n"
- " actual={%d/%d, 0x%08x, %04o, 0x%08x, %3d} '%s'\n", i,
+ fprintf(stderr, "state %zu expected={%d/%d, 0x%08x, %04o, 0x%08x, %3d} '%s'\n"
+ " actual={%d/%d, 0x%08x, %04o, 0x%08x, %3zu} '%s'\n", i,
states[i].modTime_sec, states[i].modTime_nsec, states[i].mode, states[i].size,
states[i].crc32, name.length(), filenames[i].string(),
state.modTime_sec, state.modTime_nsec, state.mode, state.size, state.crc32,
@@ -1230,7 +1230,7 @@
goto finished;
}
if ((int)actualSize != bufSize) {
- fprintf(stderr, "ReadEntityHeader expected dataSize 0x%08x got 0x%08x\n", bufSize,
+ fprintf(stderr, "ReadEntityHeader expected dataSize 0x%08x got 0x%08zx\n", bufSize,
actualSize);
err = EINVAL;
goto finished;
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
index 51f59f6..98849e3 100644
--- a/libs/androidfw/ResourceTypes.cpp
+++ b/libs/androidfw/ResourceTypes.cpp
@@ -118,6 +118,12 @@
return BAD_TYPE;
}
+static void fill9patchOffsets(Res_png_9patch* patch) {
+ patch->xDivsOffset = sizeof(Res_png_9patch);
+ patch->yDivsOffset = patch->xDivsOffset + (patch->numXDivs * sizeof(int32_t));
+ patch->colorsOffset = patch->yDivsOffset + (patch->numYDivs * sizeof(int32_t));
+}
+
inline void Res_value::copyFrom_dtoh(const Res_value& src)
{
size = dtohs(src.size);
@@ -128,9 +134,11 @@
void Res_png_9patch::deviceToFile()
{
+ int32_t* xDivs = getXDivs();
for (int i = 0; i < numXDivs; i++) {
xDivs[i] = htonl(xDivs[i]);
}
+ int32_t* yDivs = getYDivs();
for (int i = 0; i < numYDivs; i++) {
yDivs[i] = htonl(yDivs[i]);
}
@@ -138,6 +146,7 @@
paddingRight = htonl(paddingRight);
paddingTop = htonl(paddingTop);
paddingBottom = htonl(paddingBottom);
+ uint32_t* colors = getColors();
for (int i=0; i<numColors; i++) {
colors[i] = htonl(colors[i]);
}
@@ -145,9 +154,11 @@
void Res_png_9patch::fileToDevice()
{
+ int32_t* xDivs = getXDivs();
for (int i = 0; i < numXDivs; i++) {
xDivs[i] = ntohl(xDivs[i]);
}
+ int32_t* yDivs = getYDivs();
for (int i = 0; i < numYDivs; i++) {
yDivs[i] = ntohl(yDivs[i]);
}
@@ -155,60 +166,49 @@
paddingRight = ntohl(paddingRight);
paddingTop = ntohl(paddingTop);
paddingBottom = ntohl(paddingBottom);
+ uint32_t* colors = getColors();
for (int i=0; i<numColors; i++) {
colors[i] = ntohl(colors[i]);
}
}
-size_t Res_png_9patch::serializedSize()
+size_t Res_png_9patch::serializedSize() const
{
// The size of this struct is 32 bytes on the 32-bit target system
// 4 * int8_t
// 4 * int32_t
- // 3 * pointer
+ // 3 * uint32_t
return 32
+ numXDivs * sizeof(int32_t)
+ numYDivs * sizeof(int32_t)
+ numColors * sizeof(uint32_t);
}
-void* Res_png_9patch::serialize()
+void* Res_png_9patch::serialize(const Res_png_9patch& patch, const int32_t* xDivs,
+ const int32_t* yDivs, const uint32_t* colors)
{
// Use calloc since we're going to leave a few holes in the data
// and want this to run cleanly under valgrind
- void* newData = calloc(1, serializedSize());
- serialize(newData);
+ void* newData = calloc(1, patch.serializedSize());
+ serialize(patch, xDivs, yDivs, colors, newData);
return newData;
}
-void Res_png_9patch::serialize(void * outData)
+void Res_png_9patch::serialize(const Res_png_9patch& patch, const int32_t* xDivs,
+ const int32_t* yDivs, const uint32_t* colors, void* outData)
{
- char* data = (char*) outData;
- memmove(data, &wasDeserialized, 4); // copy wasDeserialized, numXDivs, numYDivs, numColors
- memmove(data + 12, &paddingLeft, 16); // copy paddingXXXX
+ uint8_t* data = (uint8_t*) outData;
+ memcpy(data, &patch.wasDeserialized, 4); // copy wasDeserialized, numXDivs, numYDivs, numColors
+ memcpy(data + 12, &patch.paddingLeft, 16); // copy paddingXXXX
data += 32;
- memmove(data, this->xDivs, numXDivs * sizeof(int32_t));
- data += numXDivs * sizeof(int32_t);
- memmove(data, this->yDivs, numYDivs * sizeof(int32_t));
- data += numYDivs * sizeof(int32_t);
- memmove(data, this->colors, numColors * sizeof(uint32_t));
-}
+ memcpy(data, xDivs, patch.numXDivs * sizeof(int32_t));
+ data += patch.numXDivs * sizeof(int32_t);
+ memcpy(data, yDivs, patch.numYDivs * sizeof(int32_t));
+ data += patch.numYDivs * sizeof(int32_t);
+ memcpy(data, colors, patch.numColors * sizeof(uint32_t));
-static void deserializeInternal(const void* inData, Res_png_9patch* outData) {
- char* patch = (char*) inData;
- if (inData != outData) {
- memmove(&outData->wasDeserialized, patch, 4); // copy wasDeserialized, numXDivs, numYDivs, numColors
- memmove(&outData->paddingLeft, patch + 12, 4); // copy wasDeserialized, numXDivs, numYDivs, numColors
- }
- outData->wasDeserialized = true;
- char* data = (char*)outData;
- data += sizeof(Res_png_9patch);
- outData->xDivs = (int32_t*) data;
- data += outData->numXDivs * sizeof(int32_t);
- outData->yDivs = (int32_t*) data;
- data += outData->numYDivs * sizeof(int32_t);
- outData->colors = (uint32_t*) data;
+ fill9patchOffsets(reinterpret_cast<Res_png_9patch*>(outData));
}
static bool assertIdmapHeader(const uint32_t* map, size_t sizeBytes)
@@ -312,14 +312,14 @@
return NO_ERROR;
}
-Res_png_9patch* Res_png_9patch::deserialize(const void* inData)
+Res_png_9patch* Res_png_9patch::deserialize(void* inData)
{
- if (sizeof(void*) != sizeof(int32_t)) {
- ALOGE("Cannot deserialize on non 32-bit system\n");
- return NULL;
- }
- deserializeInternal(inData, (Res_png_9patch*) inData);
- return (Res_png_9patch*) inData;
+
+ Res_png_9patch* patch = reinterpret_cast<Res_png_9patch*>(inData);
+ patch->wasDeserialized = true;
+ fill9patchOffsets(patch);
+
+ return patch;
}
// --------------------------------------------------------------------
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h
index 326805a..842e028 100644
--- a/libs/hwui/DisplayListOp.h
+++ b/libs/hwui/DisplayListOp.h
@@ -1444,7 +1444,7 @@
DeferredDisplayList::kOpBatch_Text :
DeferredDisplayList::kOpBatch_ColorText;
- deferInfo.mergeId = (mergeid_t)mPaint->getColor();
+ deferInfo.mergeId = reinterpret_cast<mergeid_t>(mPaint->getColor());
// don't merge decorated text - the decorations won't draw in order
bool noDecorations = !(mPaint->getFlags() & (SkPaint::kUnderlineText_Flag |
diff --git a/libs/hwui/Patch.cpp b/libs/hwui/Patch.cpp
index 9b023f9..b2148b0 100644
--- a/libs/hwui/Patch.cpp
+++ b/libs/hwui/Patch.cpp
@@ -57,7 +57,7 @@
if (vertices) return vertices;
int8_t emptyQuads = 0;
- mColors = patch->colors;
+ mColors = patch->getColors();
const int8_t numColors = patch->numColors;
if (uint8_t(numColors) < sizeof(uint32_t) * 4) {
@@ -79,8 +79,8 @@
TextureVertex* tempVertices = new TextureVertex[maxVertices];
TextureVertex* vertex = tempVertices;
- const int32_t* xDivs = patch->xDivs;
- const int32_t* yDivs = patch->yDivs;
+ const int32_t* xDivs = patch->getXDivs();
+ const int32_t* yDivs = patch->getYDivs();
const uint32_t xStretchCount = (xCount + 1) >> 1;
const uint32_t yStretchCount = (yCount + 1) >> 1;
diff --git a/libs/hwui/Patch.h b/libs/hwui/Patch.h
index 763a785..b5e8838 100644
--- a/libs/hwui/Patch.h
+++ b/libs/hwui/Patch.h
@@ -66,7 +66,7 @@
void generateQuad(TextureVertex*& vertex, float x1, float y1, float x2, float y2,
float u1, float v1, float u2, float v2, uint32_t& quadCount);
- uint32_t* mColors;
+ const uint32_t* mColors;
UvMapper mUvMapper;
}; // struct Patch
diff --git a/libs/hwui/PatchCache.cpp b/libs/hwui/PatchCache.cpp
index dc0d98c..8a44604 100644
--- a/libs/hwui/PatchCache.cpp
+++ b/libs/hwui/PatchCache.cpp
@@ -129,7 +129,11 @@
Mutex::Autolock _l(mLock);
size_t count = mGarbage.size();
for (size_t i = 0; i < count; i++) {
- remove(patchesToRemove, mGarbage[i]);
+ Res_png_9patch* patch = mGarbage[i];
+ remove(patchesToRemove, patch);
+ // A Res_png_9patch is actually an array of byte that's larger
+ // than sizeof(Res_png_9patch). It must be freed as an array.
+ delete[] (int8_t*) patch;
}
mGarbage.clear();
}
diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp
index 5df6408..cf8adf8 100644
--- a/libs/hwui/PathCache.cpp
+++ b/libs/hwui/PathCache.cpp
@@ -395,7 +395,9 @@
Mutex::Autolock l(mLock);
size_t count = mGarbage.size();
for (size_t i = 0; i < count; i++) {
- remove(pathsToRemove, mGarbage.itemAt(i));
+ const path_pair_t& pair = mGarbage.itemAt(i);
+ remove(pathsToRemove, pair);
+ delete pair.getFirst();
}
mGarbage.clear();
}
diff --git a/libs/hwui/PixelBuffer.cpp b/libs/hwui/PixelBuffer.cpp
index 36e89c6..5b642b9 100644
--- a/libs/hwui/PixelBuffer.cpp
+++ b/libs/hwui/PixelBuffer.cpp
@@ -151,7 +151,7 @@
mCaches.bindPixelBuffer(mBuffer);
unmap();
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, width, height, mFormat,
- GL_UNSIGNED_BYTE, (void*) offset);
+ GL_UNSIGNED_BYTE, reinterpret_cast<void*>(offset));
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/libs/hwui/ResourceCache.cpp b/libs/hwui/ResourceCache.cpp
index 3f77021..d276a29 100644
--- a/libs/hwui/ResourceCache.cpp
+++ b/libs/hwui/ResourceCache.cpp
@@ -213,8 +213,9 @@
// If we're not tracking this resource, just delete it
if (Caches::hasInstance()) {
Caches::getInstance().pathCache.removeDeferred(resource);
+ } else {
+ delete resource;
}
- delete resource;
return;
}
ref->destroyed = true;
@@ -235,8 +236,9 @@
// If we're not tracking this resource, just delete it
if (Caches::hasInstance()) {
Caches::getInstance().textureCache.removeDeferred(resource);
+ } else {
+ delete resource;
}
- delete resource;
return;
}
ref->destroyed = true;
@@ -292,13 +294,14 @@
ssize_t index = mCache->indexOfKey(resource);
ResourceReference* ref = index >= 0 ? mCache->valueAt(index) : NULL;
if (ref == NULL) {
+ // If we're not tracking this resource, just delete it
if (Caches::hasInstance()) {
Caches::getInstance().patchCache.removeDeferred(resource);
+ } else {
+ // A Res_png_9patch is actually an array of byte that's larger
+ // than sizeof(Res_png_9patch). It must be freed as an array.
+ delete[] (int8_t*) resource;
}
- // If we're not tracking this resource, just delete it
- // A Res_png_9patch is actually an array of byte that's larger
- // than sizeof(Res_png_9patch). It must be freed as an array.
- delete[] (int8_t*) resource;
return;
}
ref->destroyed = true;
@@ -355,16 +358,18 @@
SkBitmap* bitmap = (SkBitmap*) resource;
if (Caches::hasInstance()) {
Caches::getInstance().textureCache.removeDeferred(bitmap);
+ } else {
+ delete bitmap;
}
- delete bitmap;
}
break;
case kPath: {
SkPath* path = (SkPath*) resource;
if (Caches::hasInstance()) {
Caches::getInstance().pathCache.removeDeferred(path);
+ } else {
+ delete path;
}
- delete path;
}
break;
case kShader: {
@@ -380,11 +385,12 @@
case kNinePatch: {
if (Caches::hasInstance()) {
Caches::getInstance().patchCache.removeDeferred((Res_png_9patch*) resource);
+ } else {
+ // A Res_png_9patch is actually an array of byte that's larger
+ // than sizeof(Res_png_9patch). It must be freed as an array.
+ int8_t* patch = (int8_t*) resource;
+ delete[] patch;
}
- // A Res_png_9patch is actually an array of byte that's larger
- // than sizeof(Res_png_9patch). It must be freed as an array.
- int8_t* patch = (int8_t*) resource;
- delete[] patch;
}
break;
case kLayer: {
diff --git a/libs/hwui/TextureCache.cpp b/libs/hwui/TextureCache.cpp
index ed0a79a..ad235a9 100644
--- a/libs/hwui/TextureCache.cpp
+++ b/libs/hwui/TextureCache.cpp
@@ -184,7 +184,9 @@
Mutex::Autolock _l(mLock);
size_t count = mGarbage.size();
for (size_t i = 0; i < count; i++) {
- mCache.remove(mGarbage.itemAt(i));
+ SkBitmap* bitmap = mGarbage.itemAt(i);
+ mCache.remove(bitmap);
+ delete bitmap;
}
mGarbage.clear();
}
diff --git a/media/jni/android_media_MediaExtractor.cpp b/media/jni/android_media_MediaExtractor.cpp
index 705de88..543cb6c 100644
--- a/media/jni/android_media_MediaExtractor.cpp
+++ b/media/jni/android_media_MediaExtractor.cpp
@@ -556,7 +556,7 @@
return JNI_FALSE;
}
- size_t numSubSamples = size / sizeof(size_t);
+ size_t numSubSamples = size / sizeof(int32_t);
if (numSubSamples == 0) {
return JNI_FALSE;
@@ -566,7 +566,7 @@
jboolean isCopy;
jint *dst = env->GetIntArrayElements(numBytesOfEncryptedDataObj, &isCopy);
for (size_t i = 0; i < numSubSamples; ++i) {
- dst[i] = ((const size_t *)data)[i];
+ dst[i] = ((const int32_t *)data)[i];
}
env->ReleaseIntArrayElements(numBytesOfEncryptedDataObj, dst, 0);
dst = NULL;
@@ -583,7 +583,7 @@
jboolean isCopy;
jint *dst = env->GetIntArrayElements(numBytesOfPlainDataObj, &isCopy);
for (size_t i = 0; i < numSubSamples; ++i) {
- dst[i] = ((const size_t *)data)[i];
+ dst[i] = ((const int32_t *)data)[i];
}
env->ReleaseIntArrayElements(numBytesOfPlainDataObj, dst, 0);
dst = NULL;
diff --git a/media/jni/android_media_MediaMetadataRetriever.cpp b/media/jni/android_media_MediaMetadataRetriever.cpp
index a52b24d..6176f0f 100644
--- a/media/jni/android_media_MediaMetadataRetriever.cpp
+++ b/media/jni/android_media_MediaMetadataRetriever.cpp
@@ -245,7 +245,7 @@
fields.createConfigMethod,
SkBitmap::kRGB_565_Config);
- size_t width, height;
+ uint32_t width, height;
bool swapWidthAndHeight = false;
if (videoFrame->mRotationAngle == 90 || videoFrame->mRotationAngle == 270) {
width = videoFrame->mHeight;
@@ -276,8 +276,8 @@
if (videoFrame->mDisplayWidth != videoFrame->mWidth ||
videoFrame->mDisplayHeight != videoFrame->mHeight) {
- size_t displayWidth = videoFrame->mDisplayWidth;
- size_t displayHeight = videoFrame->mDisplayHeight;
+ uint32_t displayWidth = videoFrame->mDisplayWidth;
+ uint32_t displayHeight = videoFrame->mDisplayHeight;
if (swapWidthAndHeight) {
displayWidth = videoFrame->mDisplayHeight;
displayHeight = videoFrame->mDisplayWidth;
diff --git a/opengl/java/android/opengl/EGL14.java b/opengl/java/android/opengl/EGL14.java
index b93557d..cf09c58 100644
--- a/opengl/java/android/opengl/EGL14.java
+++ b/opengl/java/android/opengl/EGL14.java
@@ -160,6 +160,13 @@
int display_id
);
+ /**
+ * {@hide}
+ */
+ public static native EGLDisplay eglGetDisplay(
+ long display_id
+ );
+
// C function EGLBoolean eglInitialize ( EGLDisplay dpy, EGLint *major, EGLint *minor )
public static native boolean eglInitialize(
@@ -324,7 +331,7 @@
);
// C function EGLSurface eglCreatePbufferFromClientBuffer ( EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list )
-
+ // TODO Deprecate the below method
public static native EGLSurface eglCreatePbufferFromClientBuffer(
EGLDisplay dpy,
int buftype,
@@ -333,6 +340,18 @@
int[] attrib_list,
int offset
);
+ // TODO Unhide the below method
+ /**
+ * {@hide}
+ */
+ public static native EGLSurface eglCreatePbufferFromClientBuffer(
+ EGLDisplay dpy,
+ int buftype,
+ long buffer,
+ EGLConfig config,
+ int[] attrib_list,
+ int offset
+ );
// C function EGLBoolean eglSurfaceAttrib ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value )
diff --git a/opengl/java/android/opengl/EGLConfig.java b/opengl/java/android/opengl/EGLConfig.java
index a7a6bbb..9881070 100644
--- a/opengl/java/android/opengl/EGLConfig.java
+++ b/opengl/java/android/opengl/EGLConfig.java
@@ -22,7 +22,7 @@
*
*/
public class EGLConfig extends EGLObjectHandle {
- private EGLConfig(int handle) {
+ private EGLConfig(long handle) {
super(handle);
}
@@ -32,6 +32,6 @@
if (!(o instanceof EGLConfig)) return false;
EGLConfig that = (EGLConfig) o;
- return getHandle() == that.getHandle();
+ return getNativeHandle() == that.getNativeHandle();
}
}
diff --git a/opengl/java/android/opengl/EGLContext.java b/opengl/java/android/opengl/EGLContext.java
index c93bd6e..f791e7e 100644
--- a/opengl/java/android/opengl/EGLContext.java
+++ b/opengl/java/android/opengl/EGLContext.java
@@ -22,7 +22,7 @@
*
*/
public class EGLContext extends EGLObjectHandle {
- private EGLContext(int handle) {
+ private EGLContext(long handle) {
super(handle);
}
@@ -32,6 +32,6 @@
if (!(o instanceof EGLContext)) return false;
EGLContext that = (EGLContext) o;
- return getHandle() == that.getHandle();
+ return getNativeHandle() == that.getNativeHandle();
}
}
diff --git a/opengl/java/android/opengl/EGLDisplay.java b/opengl/java/android/opengl/EGLDisplay.java
index 5b8043a..e872761 100644
--- a/opengl/java/android/opengl/EGLDisplay.java
+++ b/opengl/java/android/opengl/EGLDisplay.java
@@ -22,7 +22,7 @@
*
*/
public class EGLDisplay extends EGLObjectHandle {
- private EGLDisplay(int handle) {
+ private EGLDisplay(long handle) {
super(handle);
}
@@ -32,6 +32,6 @@
if (!(o instanceof EGLDisplay)) return false;
EGLDisplay that = (EGLDisplay) o;
- return getHandle() == that.getHandle();
+ return getNativeHandle() == that.getNativeHandle();
}
}
diff --git a/opengl/java/android/opengl/EGLObjectHandle.java b/opengl/java/android/opengl/EGLObjectHandle.java
index d2710de..e6e3976 100644
--- a/opengl/java/android/opengl/EGLObjectHandle.java
+++ b/opengl/java/android/opengl/EGLObjectHandle.java
@@ -22,12 +22,20 @@
*
*/
public abstract class EGLObjectHandle {
- private final int mHandle;
+ private final long mHandle;
+ // TODO Deprecate EGLObjectHandle(int) method
protected EGLObjectHandle(int handle) {
mHandle = handle;
}
-
+ // TODO Unhide the EGLObjectHandle(long) method
+ /**
+ * {@hide}
+ */
+ protected EGLObjectHandle(long handle) {
+ mHandle = handle;
+ }
+ // TODO Deprecate getHandle() method in favor of getNativeHandle()
/**
* Returns the native handle of the wrapped EGL object. This handle can be
* cast to the corresponding native type on the native side.
@@ -37,11 +45,27 @@
* @return the native handle of the wrapped EGL object.
*/
public int getHandle() {
- return mHandle;
+ if ((mHandle & 0xffffffffL) != mHandle) {
+ throw new UnsupportedOperationException();
+ }
+ return (int)mHandle;
}
+ // TODO Unhide getNativeHandle() method
+ /**
+ * {@hide}
+ */
+ public long getNativeHandle() {
+ return mHandle;
+ }
@Override
public int hashCode() {
- return getHandle();
+ /*
+ * Based on the algorithm suggested in
+ * http://developer.android.com/reference/java/lang/Object.html
+ */
+ int result = 17;
+ result = 31 * result + (int) (mHandle ^ (mHandle >>> 32));
+ return result;
}
}
diff --git a/opengl/java/android/opengl/EGLSurface.java b/opengl/java/android/opengl/EGLSurface.java
index c379dc9..c200f72 100644
--- a/opengl/java/android/opengl/EGLSurface.java
+++ b/opengl/java/android/opengl/EGLSurface.java
@@ -22,7 +22,7 @@
*
*/
public class EGLSurface extends EGLObjectHandle {
- private EGLSurface(int handle) {
+ private EGLSurface(long handle) {
super(handle);
}
@@ -32,6 +32,6 @@
if (!(o instanceof EGLSurface)) return false;
EGLSurface that = (EGLSurface) o;
- return getHandle() == that.getHandle();
+ return getNativeHandle() == that.getNativeHandle();
}
}
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index c33bd35..aeaa18f 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -3984,7 +3984,7 @@
telephonyService.silenceRinger();
} else if ((mIncallPowerBehavior
& Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR_HANGUP) != 0
- && telephonyService.isOffhook()) {
+ && telephonyService.isOffhook() && isScreenOn) {
// Otherwise, if "Power button ends call" is enabled,
// the Power button will hang up any current active call.
hungUp = telephonyService.endCall();
diff --git a/rs/java/android/renderscript/BaseObj.java b/rs/java/android/renderscript/BaseObj.java
index b386dd7..1372ab7 100644
--- a/rs/java/android/renderscript/BaseObj.java
+++ b/rs/java/android/renderscript/BaseObj.java
@@ -181,6 +181,10 @@
if (this == obj)
return true;
+ if (obj == null) {
+ return false;
+ }
+
if (getClass() != obj.getClass()) {
return false;
}
diff --git a/rs/java/android/renderscript/Element.java b/rs/java/android/renderscript/Element.java
index 2932770..aa5d687 100644
--- a/rs/java/android/renderscript/Element.java
+++ b/rs/java/android/renderscript/Element.java
@@ -803,8 +803,6 @@
void updateFromNative() {
super.updateFromNative();
- // FIXME: updateFromNative is broken in JNI for 64-bit
-
// we will pack mType; mKind; mNormalized; mVectorSize; NumSubElements
int[] dataBuffer = new int[5];
mRS.nElementGetNativeData(getID(mRS), dataBuffer);
@@ -831,7 +829,7 @@
mArraySizes = new int[numSubElements];
mOffsetInBytes = new int[numSubElements];
- int[] subElementIds = new int[numSubElements];
+ long[] subElementIds = new long[numSubElements];
mRS.nElementGetSubElements(getID(mRS), subElementIds, mElementNames, mArraySizes);
for(int i = 0; i < numSubElements; i ++) {
mElements[i] = new Element(subElementIds[i], mRS);
@@ -1090,10 +1088,9 @@
java.lang.System.arraycopy(mElementNames, 0, sin, 0, mCount);
java.lang.System.arraycopy(mArraySizes, 0, asin, 0, mCount);
- // FIXME: broken for 64-bit
- int[] ids = new int[ein.length];
+ long[] ids = new long[ein.length];
for (int ct = 0; ct < ein.length; ct++ ) {
- ids[ct] = (int)ein[ct].getID(mRS);
+ ids[ct] = ein[ct].getID(mRS);
}
long id = mRS.nElementCreate2(ids, sin, asin);
return new Element(id, mRS, ein, sin, asin);
diff --git a/rs/java/android/renderscript/Mesh.java b/rs/java/android/renderscript/Mesh.java
index 9ce3fb2..ca0da9d 100644
--- a/rs/java/android/renderscript/Mesh.java
+++ b/rs/java/android/renderscript/Mesh.java
@@ -154,8 +154,8 @@
int vtxCount = mRS.nMeshGetVertexBufferCount(getID(mRS));
int idxCount = mRS.nMeshGetIndexCount(getID(mRS));
- int[] vtxIDs = new int[vtxCount];
- int[] idxIDs = new int[idxCount];
+ long[] vtxIDs = new long[vtxCount];
+ long[] idxIDs = new long[idxCount];
int[] primitives = new int[idxCount];
mRS.nMeshGetVertices(getID(mRS), vtxIDs, vtxCount);
@@ -350,8 +350,8 @@
**/
public Mesh create() {
mRS.validate();
- int[] vtx = new int[mVertexTypeCount];
- int[] idx = new int[mIndexTypes.size()];
+ long[] vtx = new long[mVertexTypeCount];
+ long[] idx = new long[mIndexTypes.size()];
int[] prim = new int[mIndexTypes.size()];
Allocation[] vertexBuffers = new Allocation[mVertexTypeCount];
@@ -367,7 +367,7 @@
alloc = Allocation.createSized(mRS, entry.e, entry.size, mUsage);
}
vertexBuffers[ct] = alloc;
- vtx[ct] = (int)alloc.getID(mRS);
+ vtx[ct] = alloc.getID(mRS);
}
for(int ct = 0; ct < mIndexTypes.size(); ct ++) {
@@ -382,7 +382,7 @@
indexBuffers[ct] = alloc;
primitives[ct] = entry.prim;
- idx[ct] = (int)allocID;
+ idx[ct] = allocID;
prim[ct] = entry.prim.mID;
}
@@ -506,8 +506,8 @@
public Mesh create() {
mRS.validate();
- int[] vtx = new int[mVertexTypeCount];
- int[] idx = new int[mIndexTypes.size()];
+ long[] vtx = new long[mVertexTypeCount];
+ long[] idx = new long[mIndexTypes.size()];
int[] prim = new int[mIndexTypes.size()];
Allocation[] indexBuffers = new Allocation[mIndexTypes.size()];
@@ -517,7 +517,7 @@
for(int ct = 0; ct < mVertexTypeCount; ct ++) {
Entry entry = mVertexTypes[ct];
vertexBuffers[ct] = entry.a;
- vtx[ct] = (int)entry.a.getID(mRS);
+ vtx[ct] = entry.a.getID(mRS);
}
for(int ct = 0; ct < mIndexTypes.size(); ct ++) {
@@ -526,7 +526,7 @@
indexBuffers[ct] = entry.a;
primitives[ct] = entry.prim;
- idx[ct] = (int)allocID;
+ idx[ct] = allocID;
prim[ct] = entry.prim.mID;
}
diff --git a/rs/java/android/renderscript/ProgramFragment.java b/rs/java/android/renderscript/ProgramFragment.java
index 5e886a3..4bb527b 100644
--- a/rs/java/android/renderscript/ProgramFragment.java
+++ b/rs/java/android/renderscript/ProgramFragment.java
@@ -65,25 +65,25 @@
*/
public ProgramFragment create() {
mRS.validate();
- int[] tmp = new int[(mInputCount + mOutputCount + mConstantCount + mTextureCount) * 2];
+ long[] tmp = new long[(mInputCount + mOutputCount + mConstantCount + mTextureCount) * 2];
String[] texNames = new String[mTextureCount];
int idx = 0;
for (int i=0; i < mInputCount; i++) {
tmp[idx++] = ProgramParam.INPUT.mID;
- tmp[idx++] = (int)mInputs[i].getID(mRS);
+ tmp[idx++] = mInputs[i].getID(mRS);
}
for (int i=0; i < mOutputCount; i++) {
tmp[idx++] = ProgramParam.OUTPUT.mID;
- tmp[idx++] = (int)mOutputs[i].getID(mRS);
+ tmp[idx++] = mOutputs[i].getID(mRS);
}
for (int i=0; i < mConstantCount; i++) {
tmp[idx++] = ProgramParam.CONSTANT.mID;
- tmp[idx++] = (int)mConstants[i].getID(mRS);
+ tmp[idx++] = mConstants[i].getID(mRS);
}
for (int i=0; i < mTextureCount; i++) {
tmp[idx++] = ProgramParam.TEXTURE_TYPE.mID;
- tmp[idx++] = (int)mTextureTypes[i].mID;
+ tmp[idx++] = mTextureTypes[i].mID;
texNames[i] = mTextureNames[i];
}
diff --git a/rs/java/android/renderscript/ProgramFragmentFixedFunction.java b/rs/java/android/renderscript/ProgramFragmentFixedFunction.java
index 22aed0a..2fe68be 100644
--- a/rs/java/android/renderscript/ProgramFragmentFixedFunction.java
+++ b/rs/java/android/renderscript/ProgramFragmentFixedFunction.java
@@ -52,25 +52,25 @@
*/
public ProgramFragmentFixedFunction create() {
mRS.validate();
- int[] tmp = new int[(mInputCount + mOutputCount + mConstantCount + mTextureCount) * 2];
+ long[] tmp = new long[(mInputCount + mOutputCount + mConstantCount + mTextureCount) * 2];
String[] texNames = new String[mTextureCount];
int idx = 0;
for (int i=0; i < mInputCount; i++) {
tmp[idx++] = ProgramParam.INPUT.mID;
- tmp[idx++] = (int)mInputs[i].getID(mRS);
+ tmp[idx++] = mInputs[i].getID(mRS);
}
for (int i=0; i < mOutputCount; i++) {
tmp[idx++] = ProgramParam.OUTPUT.mID;
- tmp[idx++] = (int)mOutputs[i].getID(mRS);
+ tmp[idx++] = mOutputs[i].getID(mRS);
}
for (int i=0; i < mConstantCount; i++) {
tmp[idx++] = ProgramParam.CONSTANT.mID;
- tmp[idx++] = (int)mConstants[i].getID(mRS);
+ tmp[idx++] = mConstants[i].getID(mRS);
}
for (int i=0; i < mTextureCount; i++) {
tmp[idx++] = ProgramParam.TEXTURE_TYPE.mID;
- tmp[idx++] = (int)mTextureTypes[i].mID;
+ tmp[idx++] = mTextureTypes[i].mID;
texNames[i] = mTextureNames[i];
}
diff --git a/rs/java/android/renderscript/ProgramVertex.java b/rs/java/android/renderscript/ProgramVertex.java
index b6886e1..d3a51de 100644
--- a/rs/java/android/renderscript/ProgramVertex.java
+++ b/rs/java/android/renderscript/ProgramVertex.java
@@ -126,25 +126,25 @@
*/
public ProgramVertex create() {
mRS.validate();
- int[] tmp = new int[(mInputCount + mOutputCount + mConstantCount + mTextureCount) * 2];
+ long[] tmp = new long[(mInputCount + mOutputCount + mConstantCount + mTextureCount) * 2];
String[] texNames = new String[mTextureCount];
int idx = 0;
for (int i=0; i < mInputCount; i++) {
tmp[idx++] = ProgramParam.INPUT.mID;
- tmp[idx++] = (int)mInputs[i].getID(mRS);
+ tmp[idx++] = mInputs[i].getID(mRS);
}
for (int i=0; i < mOutputCount; i++) {
tmp[idx++] = ProgramParam.OUTPUT.mID;
- tmp[idx++] = (int)mOutputs[i].getID(mRS);
+ tmp[idx++] = mOutputs[i].getID(mRS);
}
for (int i=0; i < mConstantCount; i++) {
tmp[idx++] = ProgramParam.CONSTANT.mID;
- tmp[idx++] = (int)mConstants[i].getID(mRS);
+ tmp[idx++] = mConstants[i].getID(mRS);
}
for (int i=0; i < mTextureCount; i++) {
tmp[idx++] = ProgramParam.TEXTURE_TYPE.mID;
- tmp[idx++] = (int)mTextureTypes[i].mID;
+ tmp[idx++] = mTextureTypes[i].mID;
texNames[i] = mTextureNames[i];
}
diff --git a/rs/java/android/renderscript/ProgramVertexFixedFunction.java b/rs/java/android/renderscript/ProgramVertexFixedFunction.java
index c479c77..a350154 100644
--- a/rs/java/android/renderscript/ProgramVertexFixedFunction.java
+++ b/rs/java/android/renderscript/ProgramVertexFixedFunction.java
@@ -79,25 +79,25 @@
*/
public ProgramVertexFixedFunction create() {
mRS.validate();
- int[] tmp = new int[(mInputCount + mOutputCount + mConstantCount + mTextureCount) * 2];
+ long[] tmp = new long[(mInputCount + mOutputCount + mConstantCount + mTextureCount) * 2];
String[] texNames = new String[mTextureCount];
int idx = 0;
for (int i=0; i < mInputCount; i++) {
tmp[idx++] = ProgramParam.INPUT.mID;
- tmp[idx++] = (int)mInputs[i].getID(mRS);
+ tmp[idx++] = mInputs[i].getID(mRS);
}
for (int i=0; i < mOutputCount; i++) {
tmp[idx++] = ProgramParam.OUTPUT.mID;
- tmp[idx++] = (int)mOutputs[i].getID(mRS);
+ tmp[idx++] = mOutputs[i].getID(mRS);
}
for (int i=0; i < mConstantCount; i++) {
tmp[idx++] = ProgramParam.CONSTANT.mID;
- tmp[idx++] = (int)mConstants[i].getID(mRS);
+ tmp[idx++] = mConstants[i].getID(mRS);
}
for (int i=0; i < mTextureCount; i++) {
tmp[idx++] = ProgramParam.TEXTURE_TYPE.mID;
- tmp[idx++] = (int)mTextureTypes[i].mID;
+ tmp[idx++] = mTextureTypes[i].mID;
texNames[i] = mTextureNames[i];
}
diff --git a/rs/java/android/renderscript/RenderScript.java b/rs/java/android/renderscript/RenderScript.java
index b211c5a..eebeaa4 100644
--- a/rs/java/android/renderscript/RenderScript.java
+++ b/rs/java/android/renderscript/RenderScript.java
@@ -307,8 +307,8 @@
validate();
return rsnElementCreate(mContext, type, kind, norm, vecSize);
}
- native long rsnElementCreate2(long con, int[]elements, String[] names, int[] arraySizes);
- synchronized long nElementCreate2(int[] elements, String[] names, int[] arraySizes) {
+ native long rsnElementCreate2(long con, long[] elements, String[] names, int[] arraySizes);
+ synchronized long nElementCreate2(long[] elements, String[] names, int[] arraySizes) {
validate();
return rsnElementCreate2(mContext, elements, names, arraySizes);
}
@@ -318,8 +318,8 @@
rsnElementGetNativeData(mContext, id, elementData);
}
native void rsnElementGetSubElements(long con, long id,
- int[] IDs, String[] names, int[] arraySizes);
- synchronized void nElementGetSubElements(long id, int[] IDs, String[] names, int[] arraySizes) {
+ long[] IDs, String[] names, int[] arraySizes);
+ synchronized void nElementGetSubElements(long id, long[] IDs, String[] names, int[] arraySizes) {
validate();
rsnElementGetSubElements(mContext, id, IDs, names, arraySizes);
}
@@ -329,14 +329,14 @@
validate();
return rsnTypeCreate(mContext, eid, x, y, z, mips, faces, yuv);
}
- native void rsnTypeGetNativeData(long con, long id, int[] typeData);
- synchronized void nTypeGetNativeData(long id, int[] typeData) {
+ native void rsnTypeGetNativeData(long con, long id, long[] typeData);
+ synchronized void nTypeGetNativeData(long id, long[] typeData) {
validate();
rsnTypeGetNativeData(mContext, id, typeData);
}
- native long rsnAllocationCreateTyped(long con, long type, int mip, int usage, int pointer);
- synchronized long nAllocationCreateTyped(long type, int mip, int usage, int pointer) {
+ native long rsnAllocationCreateTyped(long con, long type, int mip, int usage, long pointer);
+ synchronized long nAllocationCreateTyped(long type, int mip, int usage, long pointer) {
validate();
return rsnAllocationCreateTyped(mContext, type, mip, usage, pointer);
}
@@ -704,8 +704,8 @@
return rsnScriptFieldIDCreate(mContext, sid, slot);
}
- native long rsnScriptGroupCreate(long con, int[] kernels, int[] src, int[] dstk, int[] dstf, int[] types);
- synchronized long nScriptGroupCreate(int[] kernels, int[] src, int[] dstk, int[] dstf, int[] types) {
+ native long rsnScriptGroupCreate(long con, long[] kernels, long[] src, long[] dstk, long[] dstf, long[] types);
+ synchronized long nScriptGroupCreate(long[] kernels, long[] src, long[] dstk, long[] dstf, long[] types) {
validate();
return rsnScriptGroupCreate(mContext, kernels, src, dstk, dstf, types);
}
@@ -768,19 +768,19 @@
validate();
rsnProgramBindSampler(mContext, vpf, slot, s);
}
- native long rsnProgramFragmentCreate(long con, String shader, String[] texNames, int[] params);
- synchronized long nProgramFragmentCreate(String shader, String[] texNames, int[] params) {
+ native long rsnProgramFragmentCreate(long con, String shader, String[] texNames, long[] params);
+ synchronized long nProgramFragmentCreate(String shader, String[] texNames, long[] params) {
validate();
return rsnProgramFragmentCreate(mContext, shader, texNames, params);
}
- native long rsnProgramVertexCreate(long con, String shader, String[] texNames, int[] params);
- synchronized long nProgramVertexCreate(String shader, String[] texNames, int[] params) {
+ native long rsnProgramVertexCreate(long con, String shader, String[] texNames, long[] params);
+ synchronized long nProgramVertexCreate(String shader, String[] texNames, long[] params) {
validate();
return rsnProgramVertexCreate(mContext, shader, texNames, params);
}
- native long rsnMeshCreate(long con, int[] vtx, int[] idx, int[] prim);
- synchronized long nMeshCreate(int[] vtx, int[] idx, int[] prim) {
+ native long rsnMeshCreate(long con, long[] vtx, long[] idx, int[] prim);
+ synchronized long nMeshCreate(long[] vtx, long[] idx, int[] prim) {
validate();
return rsnMeshCreate(mContext, vtx, idx, prim);
}
@@ -794,13 +794,13 @@
validate();
return rsnMeshGetIndexCount(mContext, id);
}
- native void rsnMeshGetVertices(long con, long id, int[] vtxIds, int vtxIdCount);
- synchronized void nMeshGetVertices(long id, int[] vtxIds, int vtxIdCount) {
+ native void rsnMeshGetVertices(long con, long id, long[] vtxIds, int vtxIdCount);
+ synchronized void nMeshGetVertices(long id, long[] vtxIds, int vtxIdCount) {
validate();
rsnMeshGetVertices(mContext, id, vtxIds, vtxIdCount);
}
- native void rsnMeshGetIndices(long con, long id, int[] idxIds, int[] primitives, int vtxIdCount);
- synchronized void nMeshGetIndices(long id, int[] idxIds, int[] primitives, int vtxIdCount) {
+ native void rsnMeshGetIndices(long con, long id, long[] idxIds, int[] primitives, int vtxIdCount);
+ synchronized void nMeshGetIndices(long id, long[] idxIds, int[] primitives, int vtxIdCount) {
validate();
rsnMeshGetIndices(mContext, id, idxIds, primitives, vtxIdCount);
}
@@ -1004,6 +1004,14 @@
}
}
+ void validateObject(BaseObj o) {
+ if (o != null) {
+ if (o.mRS != this) {
+ throw new RSIllegalArgumentException("Attempting to use an object across contexts.");
+ }
+ }
+ }
+
void validate() {
if (mContext == 0) {
throw new RSInvalidStateException("Calling RS with no Context active.");
diff --git a/rs/java/android/renderscript/Script.java b/rs/java/android/renderscript/Script.java
index a1f2287..0e46f94 100644
--- a/rs/java/android/renderscript/Script.java
+++ b/rs/java/android/renderscript/Script.java
@@ -128,6 +128,9 @@
*
*/
protected void forEach(int slot, Allocation ain, Allocation aout, FieldPacker v) {
+ mRS.validate();
+ mRS.validateObject(ain);
+ mRS.validateObject(aout);
if (ain == null && aout == null) {
throw new RSIllegalArgumentException(
"At least one of ain or aout is required to be non-null.");
@@ -152,6 +155,9 @@
*
*/
protected void forEach(int slot, Allocation ain, Allocation aout, FieldPacker v, LaunchOptions sc) {
+ mRS.validate();
+ mRS.validateObject(ain);
+ mRS.validateObject(aout);
if (ain == null && aout == null) {
throw new RSIllegalArgumentException(
"At least one of ain or aout is required to be non-null.");
@@ -187,6 +193,7 @@
*/
public void bindAllocation(Allocation va, int slot) {
mRS.validate();
+ mRS.validateObject(va);
if (va != null) {
if (mRS.getApplicationContext().getApplicationInfo().targetSdkVersion >= 20) {
final Type t = va.mType;
@@ -263,6 +270,8 @@
*
*/
public void setVar(int index, BaseObj o) {
+ mRS.validate();
+ mRS.validateObject(o);
mRS.nScriptSetVarObj(getID(mRS), index, (o == null) ? 0 : o.getID(mRS));
}
diff --git a/rs/java/android/renderscript/ScriptGroup.java b/rs/java/android/renderscript/ScriptGroup.java
index 48dba30..1200a66 100644
--- a/rs/java/android/renderscript/ScriptGroup.java
+++ b/rs/java/android/renderscript/ScriptGroup.java
@@ -380,7 +380,6 @@
* @return ScriptGroup The new ScriptGroup
*/
public ScriptGroup create() {
- // FIXME: this is broken for 64-bit
if (mNodes.size() == 0) {
throw new RSInvalidStateException("Empty script groups are not allowed");
@@ -395,13 +394,13 @@
ArrayList<IO> inputs = new ArrayList<IO>();
ArrayList<IO> outputs = new ArrayList<IO>();
- int[] kernels = new int[mKernelCount];
+ long[] kernels = new long[mKernelCount];
int idx = 0;
for (int ct=0; ct < mNodes.size(); ct++) {
Node n = mNodes.get(ct);
for (int ct2=0; ct2 < n.mKernels.size(); ct2++) {
final Script.KernelID kid = n.mKernels.get(ct2);
- kernels[idx++] = (int)kid.getID(mRS);
+ kernels[idx++] = kid.getID(mRS);
boolean hasInput = false;
boolean hasOutput = false;
@@ -428,21 +427,21 @@
throw new RSRuntimeException("Count mismatch, should not happen.");
}
- int[] src = new int[mLines.size()];
- int[] dstk = new int[mLines.size()];
- int[] dstf = new int[mLines.size()];
- int[] types = new int[mLines.size()];
+ long[] src = new long[mLines.size()];
+ long[] dstk = new long[mLines.size()];
+ long[] dstf = new long[mLines.size()];
+ long[] types = new long[mLines.size()];
for (int ct=0; ct < mLines.size(); ct++) {
ConnectLine cl = mLines.get(ct);
- src[ct] = (int)cl.mFrom.getID(mRS);
+ src[ct] = cl.mFrom.getID(mRS);
if (cl.mToK != null) {
- dstk[ct] = (int)cl.mToK.getID(mRS);
+ dstk[ct] = cl.mToK.getID(mRS);
}
if (cl.mToF != null) {
- dstf[ct] = (int)cl.mToF.getID(mRS);
+ dstf[ct] = cl.mToF.getID(mRS);
}
- types[ct] = (int)cl.mAllocationType.getID(mRS);
+ types[ct] = cl.mAllocationType.getID(mRS);
}
long id = mRS.nScriptGroupCreate(kernels, src, dstk, dstf, types);
diff --git a/rs/java/android/renderscript/Type.java b/rs/java/android/renderscript/Type.java
index 7bdd360..ce7f571 100644
--- a/rs/java/android/renderscript/Type.java
+++ b/rs/java/android/renderscript/Type.java
@@ -196,20 +196,18 @@
@Override
void updateFromNative() {
- // FIXME: rsaTypeGetNativeData needs 32-bit and 64-bit paths
-
- // We have 6 integer to obtain mDimX; mDimY; mDimZ;
+ // We have 6 integer/long to obtain mDimX; mDimY; mDimZ;
// mDimLOD; mDimFaces; mElement;
- int[] dataBuffer = new int[6];
- mRS.nTypeGetNativeData((int)getID(mRS), dataBuffer);
+ long[] dataBuffer = new long[6];
+ mRS.nTypeGetNativeData(getID(mRS), dataBuffer);
- mDimX = dataBuffer[0];
- mDimY = dataBuffer[1];
- mDimZ = dataBuffer[2];
+ mDimX = (int)dataBuffer[0];
+ mDimY = (int)dataBuffer[1];
+ mDimZ = (int)dataBuffer[2];
mDimMipmaps = dataBuffer[3] == 1 ? true : false;
mDimFaces = dataBuffer[4] == 1 ? true : false;
- int elementID = dataBuffer[5];
+ long elementID = dataBuffer[5];
if(elementID != 0) {
mElement = new Element(elementID, mRS);
mElement.updateFromNative();
diff --git a/rs/jni/android_renderscript_RenderScript.cpp b/rs/jni/android_renderscript_RenderScript.cpp
index 80a5da2..a8f92ce 100644
--- a/rs/jni/android_renderscript_RenderScript.cpp
+++ b/rs/jni/android_renderscript_RenderScript.cpp
@@ -412,13 +412,21 @@
static jlong
nElementCreate2(JNIEnv *_env, jobject _this, jlong con,
- jintArray _ids, jobjectArray _names, jintArray _arraySizes)
+ jlongArray _ids, jobjectArray _names, jintArray _arraySizes)
{
int fieldCount = _env->GetArrayLength(_ids);
LOG_API("nElementCreate2, con(%p)", (RsContext)con);
- jint *ids = _env->GetIntArrayElements(_ids, NULL);
- jint *arraySizes = _env->GetIntArrayElements(_arraySizes, NULL);
+ jlong *jIds = _env->GetLongArrayElements(_ids, NULL);
+ jint *jArraySizes = _env->GetIntArrayElements(_arraySizes, NULL);
+
+ RsElement *ids = (RsElement*)malloc(fieldCount * sizeof(RsElement));
+ uint32_t *arraySizes = (uint32_t *)malloc(fieldCount * sizeof(uint32_t));
+
+ for(int i = 0; i < fieldCount; i ++) {
+ ids[i] = (RsElement)jIds[i];
+ arraySizes[i] = (uint32_t)jArraySizes[i];
+ }
AutoJavaStringArrayToUTF8 names(_env, _names, fieldCount);
@@ -426,12 +434,15 @@
size_t *sizeArray = names.c_str_len();
jlong id = (jlong)rsElementCreate2((RsContext)con,
- (RsElement *)ids, fieldCount,
+ (const RsElement *)ids, fieldCount,
nameArray, fieldCount * sizeof(size_t), sizeArray,
(const uint32_t *)arraySizes, fieldCount);
- _env->ReleaseIntArrayElements(_ids, ids, JNI_ABORT);
- _env->ReleaseIntArrayElements(_arraySizes, arraySizes, JNI_ABORT);
+ free(ids);
+ free(arraySizes);
+ _env->ReleaseLongArrayElements(_ids, jIds, JNI_ABORT);
+ _env->ReleaseIntArrayElements(_arraySizes, jArraySizes, JNI_ABORT);
+
return (jlong)id;
}
@@ -448,30 +459,33 @@
rsaElementGetNativeData((RsContext)con, (RsElement)id, elementData, dataSize);
for(jint i = 0; i < dataSize; i ++) {
- _env->SetIntArrayRegion(_elementData, i, 1, (const jint*)&elementData[i]);
+ const jint data = (jint)elementData[i];
+ _env->SetIntArrayRegion(_elementData, i, 1, &data);
}
}
static void
nElementGetSubElements(JNIEnv *_env, jobject _this, jlong con, jlong id,
- jintArray _IDs,
+ jlongArray _IDs,
jobjectArray _names,
jintArray _arraySizes)
{
- int dataSize = _env->GetArrayLength(_IDs);
+ uint32_t dataSize = _env->GetArrayLength(_IDs);
LOG_API("nElementGetSubElements, con(%p)", (RsContext)con);
- uint32_t *ids = (uint32_t *)malloc((uint32_t)dataSize * sizeof(uint32_t));
- const char **names = (const char **)malloc((uint32_t)dataSize * sizeof(const char *));
- uint32_t *arraySizes = (uint32_t *)malloc((uint32_t)dataSize * sizeof(uint32_t));
+ uintptr_t *ids = (uintptr_t*)malloc(dataSize * sizeof(uintptr_t));
+ const char **names = (const char **)malloc(dataSize * sizeof(const char *));
+ size_t *arraySizes = (size_t *)malloc(dataSize * sizeof(size_t));
rsaElementGetSubElements((RsContext)con, (RsElement)id, ids, names, arraySizes, (uint32_t)dataSize);
- for(jint i = 0; i < dataSize; i++) {
+ for(uint32_t i = 0; i < dataSize; i++) {
+ const jlong id = (jlong)ids[i];
+ const jint arraySize = (jint)arraySizes[i];
_env->SetObjectArrayElement(_names, i, _env->NewStringUTF(names[i]));
- _env->SetIntArrayRegion(_IDs, i, 1, (const jint*)&ids[i]);
- _env->SetIntArrayRegion(_arraySizes, i, 1, (const jint*)&arraySizes[i]);
+ _env->SetLongArrayRegion(_IDs, i, 1, &id);
+ _env->SetIntArrayRegion(_arraySizes, i, 1, &arraySize);
}
free(ids);
@@ -492,7 +506,7 @@
}
static void
-nTypeGetNativeData(JNIEnv *_env, jobject _this, jlong con, jlong id, jintArray _typeData)
+nTypeGetNativeData(JNIEnv *_env, jobject _this, jlong con, jlong id, jlongArray _typeData)
{
// We are packing 6 items: mDimX; mDimY; mDimZ;
// mDimLOD; mDimFaces; mElement; into typeData
@@ -501,21 +515,22 @@
assert(elementCount == 6);
LOG_API("nTypeGetNativeData, con(%p)", (RsContext)con);
- uint32_t typeData[6];
+ uintptr_t typeData[6];
rsaTypeGetNativeData((RsContext)con, (RsType)id, typeData, 6);
for(jint i = 0; i < elementCount; i ++) {
- _env->SetIntArrayRegion(_typeData, i, 1, (const jint*)&typeData[i]);
+ const jlong data = (jlong)typeData[i];
+ _env->SetLongArrayRegion(_typeData, i, 1, &data);
}
}
// -----------------------------------
static jlong
-nAllocationCreateTyped(JNIEnv *_env, jobject _this, jlong con, jlong type, jint mips, jint usage, jint pointer)
+nAllocationCreateTyped(JNIEnv *_env, jobject _this, jlong con, jlong type, jint mips, jint usage, jlong pointer)
{
LOG_API("nAllocationCreateTyped, con(%p), type(%p), mip(%i), usage(%i), ptr(%p)", (RsContext)con, (RsElement)type, mips, usage, (void *)pointer);
- return (jlong) rsAllocationCreateTyped((RsContext)con, (RsType)type, (RsAllocationMipmapControl)mips, (uint32_t)usage, (uint32_t)pointer);
+ return (jlong) rsAllocationCreateTyped((RsContext)con, (RsType)type, (RsAllocationMipmapControl)mips, (uint32_t)usage, (uintptr_t)pointer);
}
static void
@@ -601,7 +616,7 @@
const void* ptr = bitmap.getPixels();
jlong id = (jlong)rsAllocationCreateTyped((RsContext)con,
(RsType)type, (RsAllocationMipmapControl)mip,
- (uint32_t)usage, (size_t)ptr);
+ (uint32_t)usage, (uintptr_t)ptr);
bitmap.unlockPixels();
return id;
}
@@ -1196,34 +1211,63 @@
}
static jlong
-nScriptGroupCreate(JNIEnv *_env, jobject _this, jlong con, jintArray _kernels, jintArray _src,
- jintArray _dstk, jintArray _dstf, jintArray _types)
+nScriptGroupCreate(JNIEnv *_env, jobject _this, jlong con, jlongArray _kernels, jlongArray _src,
+ jlongArray _dstk, jlongArray _dstf, jlongArray _types)
{
LOG_API("nScriptGroupCreate, con(%p)", (RsContext)con);
- jint kernelsLen = _env->GetArrayLength(_kernels) * sizeof(int);
- jint *kernelsPtr = _env->GetIntArrayElements(_kernels, NULL);
- jint srcLen = _env->GetArrayLength(_src) * sizeof(int);
- jint *srcPtr = _env->GetIntArrayElements(_src, NULL);
- jint dstkLen = _env->GetArrayLength(_dstk) * sizeof(int);
- jint *dstkPtr = _env->GetIntArrayElements(_dstk, NULL);
- jint dstfLen = _env->GetArrayLength(_dstf) * sizeof(int);
- jint *dstfPtr = _env->GetIntArrayElements(_dstf, NULL);
- jint typesLen = _env->GetArrayLength(_types) * sizeof(int);
- jint *typesPtr = _env->GetIntArrayElements(_types, NULL);
+ jint kernelsLen = _env->GetArrayLength(_kernels);
+ jlong *jKernelsPtr = _env->GetLongArrayElements(_kernels, NULL);
+ RsScriptKernelID* kernelsPtr = (RsScriptKernelID*) malloc(sizeof(RsScriptKernelID) * kernelsLen);
+ for(int i = 0; i < kernelsLen; ++i) {
+ kernelsPtr[i] = (RsScriptKernelID)jKernelsPtr[i];
+ }
- int id = (int)rsScriptGroupCreate((RsContext)con,
- (RsScriptKernelID *)kernelsPtr, kernelsLen,
- (RsScriptKernelID *)srcPtr, srcLen,
- (RsScriptKernelID *)dstkPtr, dstkLen,
- (RsScriptFieldID *)dstfPtr, dstfLen,
- (RsType *)typesPtr, typesLen);
+ jint srcLen = _env->GetArrayLength(_src);
+ jlong *jSrcPtr = _env->GetLongArrayElements(_src, NULL);
+ RsScriptKernelID* srcPtr = (RsScriptKernelID*) malloc(sizeof(RsScriptKernelID) * srcLen);
+ for(int i = 0; i < srcLen; ++i) {
+ srcPtr[i] = (RsScriptKernelID)jSrcPtr[i];
+ }
- _env->ReleaseIntArrayElements(_kernels, kernelsPtr, 0);
- _env->ReleaseIntArrayElements(_src, srcPtr, 0);
- _env->ReleaseIntArrayElements(_dstk, dstkPtr, 0);
- _env->ReleaseIntArrayElements(_dstf, dstfPtr, 0);
- _env->ReleaseIntArrayElements(_types, typesPtr, 0);
+ jint dstkLen = _env->GetArrayLength(_dstk);
+ jlong *jDstkPtr = _env->GetLongArrayElements(_dstk, NULL);
+ RsScriptKernelID* dstkPtr = (RsScriptKernelID*) malloc(sizeof(RsScriptKernelID) * dstkLen);
+ for(int i = 0; i < dstkLen; ++i) {
+ dstkPtr[i] = (RsScriptKernelID)jDstkPtr[i];
+ }
+
+ jint dstfLen = _env->GetArrayLength(_dstf);
+ jlong *jDstfPtr = _env->GetLongArrayElements(_dstf, NULL);
+ RsScriptKernelID* dstfPtr = (RsScriptKernelID*) malloc(sizeof(RsScriptKernelID) * dstfLen);
+ for(int i = 0; i < dstfLen; ++i) {
+ dstfPtr[i] = (RsScriptKernelID)jDstfPtr[i];
+ }
+
+ jint typesLen = _env->GetArrayLength(_types);
+ jlong *jTypesPtr = _env->GetLongArrayElements(_types, NULL);
+ RsType* typesPtr = (RsType*) malloc(sizeof(RsType) * typesLen);
+ for(int i = 0; i < typesLen; ++i) {
+ typesPtr[i] = (RsType)jTypesPtr[i];
+ }
+
+ jlong id = (jlong)rsScriptGroupCreate((RsContext)con,
+ (RsScriptKernelID *)kernelsPtr, kernelsLen * sizeof(RsScriptKernelID),
+ (RsScriptKernelID *)srcPtr, srcLen * sizeof(RsScriptKernelID),
+ (RsScriptKernelID *)dstkPtr, dstkLen * sizeof(RsScriptKernelID),
+ (RsScriptFieldID *)dstfPtr, dstfLen * sizeof(RsScriptKernelID),
+ (RsType *)typesPtr, typesLen * sizeof(RsType));
+
+ free(kernelsPtr);
+ free(srcPtr);
+ free(dstkPtr);
+ free(dstfPtr);
+ free(typesPtr);
+ _env->ReleaseLongArrayElements(_kernels, jKernelsPtr, 0);
+ _env->ReleaseLongArrayElements(_src, jSrcPtr, 0);
+ _env->ReleaseLongArrayElements(_dstk, jDstkPtr, 0);
+ _env->ReleaseLongArrayElements(_dstf, jDstfPtr, 0);
+ _env->ReleaseLongArrayElements(_types, jTypesPtr, 0);
return id;
}
@@ -1292,10 +1336,10 @@
static jlong
nProgramFragmentCreate(JNIEnv *_env, jobject _this, jlong con, jstring shader,
- jobjectArray texNames, jintArray params)
+ jobjectArray texNames, jlongArray params)
{
AutoJavaStringToUTF8 shaderUTF(_env, shader);
- jint *paramPtr = _env->GetIntArrayElements(params, NULL);
+ jlong *jParamPtr = _env->GetLongArrayElements(params, NULL);
jint paramLen = _env->GetArrayLength(params);
int texCount = _env->GetArrayLength(texNames);
@@ -1305,11 +1349,16 @@
LOG_API("nProgramFragmentCreate, con(%p), paramLen(%i)", (RsContext)con, paramLen);
+ uintptr_t * paramPtr = (uintptr_t*) malloc(sizeof(uintptr_t) * paramLen);
+ for(int i = 0; i < paramLen; ++i) {
+ paramPtr[i] = (uintptr_t)jParamPtr[i];
+ }
jlong ret = (jlong)rsProgramFragmentCreate((RsContext)con, shaderUTF.c_str(), shaderUTF.length(),
nameArray, texCount, sizeArray,
- (uint32_t *)paramPtr, paramLen);
+ paramPtr, paramLen);
- _env->ReleaseIntArrayElements(params, paramPtr, JNI_ABORT);
+ free(paramPtr);
+ _env->ReleaseLongArrayElements(params, jParamPtr, JNI_ABORT);
return ret;
}
@@ -1318,10 +1367,10 @@
static jlong
nProgramVertexCreate(JNIEnv *_env, jobject _this, jlong con, jstring shader,
- jobjectArray texNames, jintArray params)
+ jobjectArray texNames, jlongArray params)
{
AutoJavaStringToUTF8 shaderUTF(_env, shader);
- jint *paramPtr = _env->GetIntArrayElements(params, NULL);
+ jlong *jParamPtr = _env->GetLongArrayElements(params, NULL);
jint paramLen = _env->GetArrayLength(params);
LOG_API("nProgramVertexCreate, con(%p), paramLen(%i)", (RsContext)con, paramLen);
@@ -1331,11 +1380,17 @@
const char ** nameArray = names.c_str();
size_t* sizeArray = names.c_str_len();
+ uintptr_t * paramPtr = (uintptr_t*) malloc(sizeof(uintptr_t) * paramLen);
+ for(int i = 0; i < paramLen; ++i) {
+ paramPtr[i] = (uintptr_t)jParamPtr[i];
+ }
+
jlong ret = (jlong)rsProgramVertexCreate((RsContext)con, shaderUTF.c_str(), shaderUTF.length(),
nameArray, texCount, sizeArray,
- (uint32_t *)paramPtr, paramLen);
+ paramPtr, paramLen);
- _env->ReleaseIntArrayElements(params, paramPtr, JNI_ABORT);
+ free(paramPtr);
+ _env->ReleaseLongArrayElements(params, jParamPtr, JNI_ABORT);
return ret;
}
@@ -1416,24 +1471,36 @@
}
static jlong
-nMeshCreate(JNIEnv *_env, jobject _this, jlong con, jintArray _vtx, jintArray _idx, jintArray _prim)
+nMeshCreate(JNIEnv *_env, jobject _this, jlong con, jlongArray _vtx, jlongArray _idx, jintArray _prim)
{
LOG_API("nMeshCreate, con(%p)", (RsContext)con);
jint vtxLen = _env->GetArrayLength(_vtx);
- jint *vtxPtr = _env->GetIntArrayElements(_vtx, NULL);
+ jlong *jVtxPtr = _env->GetLongArrayElements(_vtx, NULL);
+ RsAllocation* vtxPtr = (RsAllocation*) malloc(sizeof(RsAllocation) * vtxLen);
+ for(int i = 0; i < vtxLen; ++i) {
+ vtxPtr[i] = (RsAllocation)(uintptr_t)jVtxPtr[i];
+ }
+
jint idxLen = _env->GetArrayLength(_idx);
- jint *idxPtr = _env->GetIntArrayElements(_idx, NULL);
+ jlong *jIdxPtr = _env->GetLongArrayElements(_idx, NULL);
+ RsAllocation* idxPtr = (RsAllocation*) malloc(sizeof(RsAllocation) * idxLen);
+ for(int i = 0; i < idxLen; ++i) {
+ idxPtr[i] = (RsAllocation)(uintptr_t)jIdxPtr[i];
+ }
+
jint primLen = _env->GetArrayLength(_prim);
jint *primPtr = _env->GetIntArrayElements(_prim, NULL);
- int id = (int)rsMeshCreate((RsContext)con,
+ jlong id = (jlong)rsMeshCreate((RsContext)con,
(RsAllocation *)vtxPtr, vtxLen,
(RsAllocation *)idxPtr, idxLen,
(uint32_t *)primPtr, primLen);
- _env->ReleaseIntArrayElements(_vtx, vtxPtr, 0);
- _env->ReleaseIntArrayElements(_idx, idxPtr, 0);
+ free(vtxPtr);
+ free(idxPtr);
+ _env->ReleaseLongArrayElements(_vtx, jVtxPtr, 0);
+ _env->ReleaseLongArrayElements(_idx, jIdxPtr, 0);
_env->ReleaseIntArrayElements(_prim, primPtr, 0);
return id;
}
@@ -1457,7 +1524,7 @@
}
static void
-nMeshGetVertices(JNIEnv *_env, jobject _this, jlong con, jlong mesh, jintArray _ids, int numVtxIDs)
+nMeshGetVertices(JNIEnv *_env, jobject _this, jlong con, jlong mesh, jlongArray _ids, jint numVtxIDs)
{
LOG_API("nMeshGetVertices, con(%p), Mesh(%p)", (RsContext)con, (RsMesh)mesh);
@@ -1465,14 +1532,15 @@
rsaMeshGetVertices((RsContext)con, (RsMesh)mesh, allocs, (uint32_t)numVtxIDs);
for(jint i = 0; i < numVtxIDs; i ++) {
- _env->SetIntArrayRegion(_ids, i, 1, (const jint*)&allocs[i]);
+ const jlong alloc = (jlong)allocs[i];
+ _env->SetLongArrayRegion(_ids, i, 1, &alloc);
}
free(allocs);
}
static void
-nMeshGetIndices(JNIEnv *_env, jobject _this, jlong con, jlong mesh, jintArray _idxIds, jintArray _primitives, int numIndices)
+nMeshGetIndices(JNIEnv *_env, jobject _this, jlong con, jlong mesh, jlongArray _idxIds, jintArray _primitives, jint numIndices)
{
LOG_API("nMeshGetVertices, con(%p), Mesh(%p)", (RsContext)con, (RsMesh)mesh);
@@ -1482,8 +1550,10 @@
rsaMeshGetIndices((RsContext)con, (RsMesh)mesh, allocs, prims, (uint32_t)numIndices);
for(jint i = 0; i < numIndices; i ++) {
- _env->SetIntArrayRegion(_idxIds, i, 1, (const jint*)&allocs[i]);
- _env->SetIntArrayRegion(_primitives, i, 1, (const jint*)&prims[i]);
+ const jlong alloc = (jlong)allocs[i];
+ const jint prim = (jint)prims[i];
+ _env->SetLongArrayRegion(_idxIds, i, 1, &alloc);
+ _env->SetIntArrayRegion(_primitives, i, 1, &prim);
}
free(allocs);
@@ -1536,14 +1606,14 @@
{"rsnFontCreateFromAsset", "(JLandroid/content/res/AssetManager;Ljava/lang/String;FI)J", (void*)nFontCreateFromAsset },
{"rsnElementCreate", "(JJIZI)J", (void*)nElementCreate },
-{"rsnElementCreate2", "(J[I[Ljava/lang/String;[I)J", (void*)nElementCreate2 },
+{"rsnElementCreate2", "(J[J[Ljava/lang/String;[I)J", (void*)nElementCreate2 },
{"rsnElementGetNativeData", "(JJ[I)V", (void*)nElementGetNativeData },
-{"rsnElementGetSubElements", "(JJ[I[Ljava/lang/String;[I)V", (void*)nElementGetSubElements },
+{"rsnElementGetSubElements", "(JJ[J[Ljava/lang/String;[I)V", (void*)nElementGetSubElements },
{"rsnTypeCreate", "(JJIIIZZI)J", (void*)nTypeCreate },
-{"rsnTypeGetNativeData", "(JJ[I)V", (void*)nTypeGetNativeData },
+{"rsnTypeGetNativeData", "(JJ[J)V", (void*)nTypeGetNativeData },
-{"rsnAllocationCreateTyped", "(JJIII)J", (void*)nAllocationCreateTyped },
+{"rsnAllocationCreateTyped", "(JJIIJ)J", (void*)nAllocationCreateTyped },
{"rsnAllocationCreateFromBitmap", "(JJILandroid/graphics/Bitmap;I)J", (void*)nAllocationCreateFromBitmap },
{"rsnAllocationCreateBitmapBackedAllocation", "(JJILandroid/graphics/Bitmap;I)J", (void*)nAllocationCreateBitmapBackedAllocation },
{"rsnAllocationCubeCreateFromBitmap","(JJILandroid/graphics/Bitmap;I)J", (void*)nAllocationCubeCreateFromBitmap },
@@ -1594,7 +1664,7 @@
{"rsnScriptIntrinsicCreate", "(JIJ)J", (void*)nScriptIntrinsicCreate },
{"rsnScriptKernelIDCreate", "(JJII)J", (void*)nScriptKernelIDCreate },
{"rsnScriptFieldIDCreate", "(JJI)J", (void*)nScriptFieldIDCreate },
-{"rsnScriptGroupCreate", "(J[I[I[I[I[I)J", (void*)nScriptGroupCreate },
+{"rsnScriptGroupCreate", "(J[J[J[J[J[J)J", (void*)nScriptGroupCreate },
{"rsnScriptGroupSetInput", "(JJJJ)V", (void*)nScriptGroupSetInput },
{"rsnScriptGroupSetOutput", "(JJJJ)V", (void*)nScriptGroupSetOutput },
{"rsnScriptGroupExecute", "(JJ)V", (void*)nScriptGroupExecute },
@@ -1605,9 +1675,9 @@
{"rsnProgramBindTexture", "(JJIJ)V", (void*)nProgramBindTexture },
{"rsnProgramBindSampler", "(JJIJ)V", (void*)nProgramBindSampler },
-{"rsnProgramFragmentCreate", "(JLjava/lang/String;[Ljava/lang/String;[I)J", (void*)nProgramFragmentCreate },
+{"rsnProgramFragmentCreate", "(JLjava/lang/String;[Ljava/lang/String;[J)J", (void*)nProgramFragmentCreate },
{"rsnProgramRasterCreate", "(JZI)J", (void*)nProgramRasterCreate },
-{"rsnProgramVertexCreate", "(JLjava/lang/String;[Ljava/lang/String;[I)J", (void*)nProgramVertexCreate },
+{"rsnProgramVertexCreate", "(JLjava/lang/String;[Ljava/lang/String;[J)J", (void*)nProgramVertexCreate },
{"rsnContextBindRootScript", "(JI)V", (void*)nContextBindRootScript },
{"rsnContextBindProgramStore", "(JI)V", (void*)nContextBindProgramStore },
@@ -1618,12 +1688,12 @@
{"rsnSamplerCreate", "(JIIIIIF)J", (void*)nSamplerCreate },
{"rsnPathCreate", "(JIZJJF)J", (void*)nPathCreate },
-{"rsnMeshCreate", "(J[I[I[I)J", (void*)nMeshCreate },
+{"rsnMeshCreate", "(J[J[J[I)J", (void*)nMeshCreate },
{"rsnMeshGetVertexBufferCount", "(JJ)I", (void*)nMeshGetVertexBufferCount },
{"rsnMeshGetIndexCount", "(JJ)I", (void*)nMeshGetIndexCount },
-{"rsnMeshGetVertices", "(JJ[II)V", (void*)nMeshGetVertices },
-{"rsnMeshGetIndices", "(JJ[I[II)V", (void*)nMeshGetIndices },
+{"rsnMeshGetVertices", "(JJ[JI)V", (void*)nMeshGetVertices },
+{"rsnMeshGetIndices", "(JJ[J[II)V", (void*)nMeshGetIndices },
};
diff --git a/services/java/com/android/server/AlarmManagerService.java b/services/java/com/android/server/AlarmManagerService.java
index 2e1b0af..defc6ef 100644
--- a/services/java/com/android/server/AlarmManagerService.java
+++ b/services/java/com/android/server/AlarmManagerService.java
@@ -669,12 +669,19 @@
}
}
- public void setTime(long millis) {
+ public boolean setTime(long millis) {
mContext.enforceCallingOrSelfPermission(
"android.permission.SET_TIME",
"setTime");
- SystemClock.setCurrentTimeMillis(millis);
+ if (mNativeData == 0) {
+ Slog.w(TAG, "Not setting time since no alarm driver is available.");
+ return false;
+ }
+
+ synchronized (mLock) {
+ return setKernelTime(mNativeData, millis) == 0;
+ }
}
public void setTimeZone(String tz) {
@@ -1018,6 +1025,7 @@
private native void close(long nativeData);
private native void set(long nativeData, int type, long seconds, long nanoseconds);
private native int waitForAlarm(long nativeData);
+ private native int setKernelTime(long nativeData, long millis);
private native int setKernelTimezone(long nativeData, int minuteswest);
private void triggerAlarmsLocked(ArrayList<Alarm> triggerList, long nowELAPSED, long nowRTC) {
diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java
index 8f480dd..b4a982e 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -452,6 +452,9 @@
* @param userId the new active user's UserId
*/
private void switchUser(int userId) {
+ if (mCurrentUserId == userId) {
+ return;
+ }
mBlacklist.switchUser(userId);
mLocationHandler.removeMessages(MSG_LOCATION_CHANGED);
synchronized (mLock) {
diff --git a/services/java/com/android/server/NsdService.java b/services/java/com/android/server/NsdService.java
index 16d2468..9379955 100644
--- a/services/java/com/android/server/NsdService.java
+++ b/services/java/com/android/server/NsdService.java
@@ -152,25 +152,40 @@
class DefaultState extends State {
@Override
public boolean processMessage(Message msg) {
+ ClientInfo cInfo = null;
switch (msg.what) {
case AsyncChannel.CMD_CHANNEL_HALF_CONNECTED:
if (msg.arg1 == AsyncChannel.STATUS_SUCCESSFUL) {
AsyncChannel c = (AsyncChannel) msg.obj;
if (DBG) Slog.d(TAG, "New client listening to asynchronous messages");
c.sendMessage(AsyncChannel.CMD_CHANNEL_FULLY_CONNECTED);
- ClientInfo cInfo = new ClientInfo(c, msg.replyTo);
+ cInfo = new ClientInfo(c, msg.replyTo);
mClients.put(msg.replyTo, cInfo);
} else {
Slog.e(TAG, "Client connection failure, error=" + msg.arg1);
}
break;
case AsyncChannel.CMD_CHANNEL_DISCONNECTED:
- if (msg.arg1 == AsyncChannel.STATUS_SEND_UNSUCCESSFUL) {
- Slog.e(TAG, "Send failed, client connection lost");
- } else {
- if (DBG) Slog.d(TAG, "Client connection lost with reason: " + msg.arg1);
+ switch (msg.arg1) {
+ case AsyncChannel.STATUS_SEND_UNSUCCESSFUL:
+ Slog.e(TAG, "Send failed, client connection lost");
+ break;
+ case AsyncChannel.STATUS_REMOTE_DISCONNECTION:
+ if (DBG) Slog.d(TAG, "Client disconnected");
+ break;
+ default:
+ if (DBG) Slog.d(TAG, "Client connection lost with reason: " + msg.arg1);
+ break;
}
- mClients.remove(msg.replyTo);
+ cInfo = mClients.get(msg.replyTo);
+ if (cInfo != null) {
+ cInfo.expungeAllRequests();
+ mClients.remove(msg.replyTo);
+ }
+ //Last client
+ if (mClients.size() == 0) {
+ stopMDnsDaemon();
+ }
break;
case AsyncChannel.CMD_CHANNEL_FULL_CONNECTION:
AsyncChannel ac = new AsyncChannel();
@@ -248,13 +263,15 @@
return false;
}
- private void storeRequestMap(int clientId, int globalId, ClientInfo clientInfo) {
+ private void storeRequestMap(int clientId, int globalId, ClientInfo clientInfo, int what) {
clientInfo.mClientIds.put(clientId, globalId);
+ clientInfo.mClientRequests.put(clientId, what);
mIdToClientInfoMap.put(globalId, clientInfo);
}
private void removeRequestMap(int clientId, int globalId, ClientInfo clientInfo) {
clientInfo.mClientIds.remove(clientId);
+ clientInfo.mClientRequests.remove(clientId);
mIdToClientInfoMap.remove(globalId);
}
@@ -274,10 +291,6 @@
result = NOT_HANDLED;
break;
case AsyncChannel.CMD_CHANNEL_DISCONNECTED:
- //Last client
- if (mClients.size() == 1) {
- stopMDnsDaemon();
- }
result = NOT_HANDLED;
break;
case NsdManager.DISABLE:
@@ -301,7 +314,7 @@
Slog.d(TAG, "Discover " + msg.arg2 + " " + id +
servInfo.getServiceType());
}
- storeRequestMap(msg.arg2, id, clientInfo);
+ storeRequestMap(msg.arg2, id, clientInfo, msg.what);
replyToMessage(msg, NsdManager.DISCOVER_SERVICES_STARTED, servInfo);
} else {
stopServiceDiscovery(id);
@@ -340,7 +353,7 @@
id = getUniqueId();
if (registerService(id, (NsdServiceInfo) msg.obj)) {
if (DBG) Slog.d(TAG, "Register " + msg.arg2 + " " + id);
- storeRequestMap(msg.arg2, id, clientInfo);
+ storeRequestMap(msg.arg2, id, clientInfo, msg.what);
// Return success after mDns reports success
} else {
unregisterService(id);
@@ -381,7 +394,7 @@
id = getUniqueId();
if (resolveService(id, servInfo)) {
clientInfo.mResolvedService = new NsdServiceInfo();
- storeRequestMap(msg.arg2, id, clientInfo);
+ storeRequestMap(msg.arg2, id, clientInfo, msg.what);
} else {
replyToMessage(msg, NsdManager.RESOLVE_SERVICE_FAILED,
NsdManager.FAILURE_INTERNAL_ERROR);
@@ -487,7 +500,7 @@
int id2 = getUniqueId();
if (getAddrInfo(id2, cooked[3])) {
- storeRequestMap(clientId, id2, clientInfo);
+ storeRequestMap(clientId, id2, clientInfo, NsdManager.RESOLVE_SERVICE);
} else {
clientInfo.mChannel.sendMessage(NsdManager.RESOLVE_SERVICE_FAILED,
NsdManager.FAILURE_INTERNAL_ERROR, clientId);
@@ -827,6 +840,9 @@
/* A map from client id to unique id sent to mDns */
private SparseArray<Integer> mClientIds = new SparseArray<Integer>();
+ /* A map from client id to the type of the request we had received */
+ private SparseArray<Integer> mClientRequests = new SparseArray<Integer>();
+
private ClientInfo(AsyncChannel c, Messenger m) {
mChannel = c;
mMessenger = m;
@@ -840,10 +856,41 @@
sb.append("mMessenger ").append(mMessenger).append("\n");
sb.append("mResolvedService ").append(mResolvedService).append("\n");
for(int i = 0; i< mClientIds.size(); i++) {
- sb.append("clientId ").append(mClientIds.keyAt(i));
- sb.append(" mDnsId ").append(mClientIds.valueAt(i)).append("\n");
+ int clientID = mClientIds.keyAt(i);
+ sb.append("clientId ").append(clientID).
+ append(" mDnsId ").append(mClientIds.valueAt(i)).
+ append(" type ").append(mClientRequests.get(clientID)).append("\n");
}
return sb.toString();
}
+
+ // Remove any pending requests from the global map when we get rid of a client,
+ // and send cancellations to the daemon.
+ private void expungeAllRequests() {
+ int globalId, clientId, i;
+ for (i = 0; i < mClientIds.size(); i++) {
+ clientId = mClientIds.keyAt(i);
+ globalId = mClientIds.valueAt(i);
+ mIdToClientInfoMap.remove(globalId);
+ if (DBG) Slog.d(TAG, "Terminating client-ID " + clientId +
+ " global-ID " + globalId + " type " + mClientRequests.get(clientId));
+ switch (mClientRequests.get(clientId)) {
+ case NsdManager.DISCOVER_SERVICES:
+ stopServiceDiscovery(globalId);
+ break;
+ case NsdManager.RESOLVE_SERVICE:
+ stopResolveService(globalId);
+ break;
+ case NsdManager.REGISTER_SERVICE:
+ unregisterService(globalId);
+ break;
+ default:
+ break;
+ }
+ }
+ mClientIds.clear();
+ mClientRequests.clear();
+ }
+
}
}
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index fc66e45..91565e3 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -1058,6 +1058,7 @@
static final int IMMERSIVE_MODE_LOCK_MSG = 37;
static final int PERSIST_URI_GRANTS_MSG = 38;
static final int REQUEST_ALL_PSS_MSG = 39;
+ static final int UPDATE_TIME = 40;
static final int FIRST_ACTIVITY_STACK_MSG = 100;
static final int FIRST_BROADCAST_QUEUE_MSG = 200;
@@ -1668,6 +1669,22 @@
requestPssAllProcsLocked(SystemClock.uptimeMillis(), true, false);
break;
}
+ case UPDATE_TIME: {
+ synchronized (ActivityManagerService.this) {
+ for (int i = mLruProcesses.size() - 1 ; i >= 0 ; i--) {
+ ProcessRecord r = mLruProcesses.get(i);
+ if (r.thread != null) {
+ try {
+ r.thread.updateTimePrefs(msg.arg1 == 0 ? false : true);
+ } catch (RemoteException ex) {
+ Slog.w(TAG, "Failed to update preferences for: " + r.info.processName);
+ }
+ }
+ }
+ }
+
+ break;
+ }
}
}
};
@@ -13430,11 +13447,20 @@
* of all currently running processes. This message will get queued up before the broadcast
* happens.
*/
- if (intent.ACTION_TIMEZONE_CHANGED.equals(intent.getAction())) {
+ if (Intent.ACTION_TIMEZONE_CHANGED.equals(intent.getAction())) {
mHandler.sendEmptyMessage(UPDATE_TIME_ZONE);
}
- if (intent.ACTION_CLEAR_DNS_CACHE.equals(intent.getAction())) {
+ /*
+ * If the user set the time, let all running processes know.
+ */
+ if (Intent.ACTION_TIME_CHANGED.equals(intent.getAction())) {
+ final int is24Hour = intent.getBooleanExtra(
+ Intent.EXTRA_TIME_PREF_24_HOUR_FORMAT, false) ? 1 : 0;
+ mHandler.sendMessage(mHandler.obtainMessage(UPDATE_TIME, is24Hour, 0));
+ }
+
+ if (Intent.ACTION_CLEAR_DNS_CACHE.equals(intent.getAction())) {
mHandler.sendEmptyMessage(CLEAR_DNS_CACHE_MSG);
}
diff --git a/services/java/com/android/server/am/CoreSettingsObserver.java b/services/java/com/android/server/am/CoreSettingsObserver.java
index 10ea67c..4c887dd 100644
--- a/services/java/com/android/server/am/CoreSettingsObserver.java
+++ b/services/java/com/android/server/am/CoreSettingsObserver.java
@@ -37,11 +37,16 @@
private static final String LOG_TAG = CoreSettingsObserver.class.getSimpleName();
// mapping form property name to its type
- private static final Map<String, Class<?>> sCoreSettingToTypeMap = new HashMap<
+ private static final Map<String, Class<?>> sSecureSettingToTypeMap = new HashMap<
+ String, Class<?>>();
+ private static final Map<String, Class<?>> sSystemSettingToTypeMap = new HashMap<
String, Class<?>>();
static {
- sCoreSettingToTypeMap.put(Settings.Secure.LONG_PRESS_TIMEOUT, int.class);
- // add other core settings here...
+ sSecureSettingToTypeMap.put(Settings.Secure.LONG_PRESS_TIMEOUT, int.class);
+ // add other secure settings here...
+
+ sSystemSettingToTypeMap.put(Settings.System.TIME_12_24, String.class);
+ // add other system settings here...
}
private final Bundle mCoreSettings = new Bundle();
@@ -67,39 +72,62 @@
}
private void sendCoreSettings() {
- populateCoreSettings(mCoreSettings);
+ populateSettings(mCoreSettings, sSecureSettingToTypeMap);
+ populateSettings(mCoreSettings, sSystemSettingToTypeMap);
mActivityManagerService.onCoreSettingsChange(mCoreSettings);
}
private void beginObserveCoreSettings() {
- for (String setting : sCoreSettingToTypeMap.keySet()) {
+ for (String setting : sSecureSettingToTypeMap.keySet()) {
Uri uri = Settings.Secure.getUriFor(setting);
mActivityManagerService.mContext.getContentResolver().registerContentObserver(
uri, false, this);
}
+
+ for (String setting : sSystemSettingToTypeMap.keySet()) {
+ Uri uri = Settings.System.getUriFor(setting);
+ mActivityManagerService.mContext.getContentResolver().registerContentObserver(
+ uri, false, this);
+ }
}
- private void populateCoreSettings(Bundle snapshot) {
+ private void populateSettings(Bundle snapshot, Map<String, Class<?>> map) {
Context context = mActivityManagerService.mContext;
- for (Map.Entry<String, Class<?>> entry : sCoreSettingToTypeMap.entrySet()) {
+ for (Map.Entry<String, Class<?>> entry : map.entrySet()) {
String setting = entry.getKey();
Class<?> type = entry.getValue();
try {
if (type == String.class) {
- String value = Settings.Secure.getString(context.getContentResolver(),
- setting);
+ final String value;
+ if (map == sSecureSettingToTypeMap) {
+ value = Settings.Secure.getString(context.getContentResolver(), setting);
+ } else {
+ value = Settings.System.getString(context.getContentResolver(), setting);
+ }
snapshot.putString(setting, value);
} else if (type == int.class) {
- int value = Settings.Secure.getInt(context.getContentResolver(),
- setting);
+ final int value;
+ if (map == sSecureSettingToTypeMap) {
+ value = Settings.Secure.getInt(context.getContentResolver(), setting);
+ } else {
+ value = Settings.System.getInt(context.getContentResolver(), setting);
+ }
snapshot.putInt(setting, value);
} else if (type == float.class) {
- float value = Settings.Secure.getFloat(context.getContentResolver(),
- setting);
+ final float value;
+ if (map == sSecureSettingToTypeMap) {
+ value = Settings.Secure.getFloat(context.getContentResolver(), setting);
+ } else {
+ value = Settings.System.getFloat(context.getContentResolver(), setting);
+ }
snapshot.putFloat(setting, value);
} else if (type == long.class) {
- long value = Settings.Secure.getLong(context.getContentResolver(),
- setting);
+ final long value;
+ if (map == sSecureSettingToTypeMap) {
+ value = Settings.Secure.getLong(context.getContentResolver(), setting);
+ } else {
+ value = Settings.System.getLong(context.getContentResolver(), setting);
+ }
snapshot.putLong(setting, value);
}
} catch (SettingNotFoundException snfe) {
diff --git a/services/java/com/android/server/pm/Installer.java b/services/java/com/android/server/pm/Installer.java
index 11a6498..54acda2 100644
--- a/services/java/com/android/server/pm/Installer.java
+++ b/services/java/com/android/server/pm/Installer.java
@@ -208,6 +208,19 @@
builder.append(' ');
builder.append(uid);
builder.append(isPublic ? " 1" : " 0");
+ builder.append(" *"); // No pkgName arg present
+ return execute(builder.toString());
+ }
+
+ public int dexopt(String apkPath, int uid, boolean isPublic, String pkgName) {
+ StringBuilder builder = new StringBuilder("dexopt");
+ builder.append(' ');
+ builder.append(apkPath);
+ builder.append(' ');
+ builder.append(uid);
+ builder.append(isPublic ? " 1" : " 0");
+ builder.append(' ');
+ builder.append(pkgName);
return execute(builder.toString());
}
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index 74a66d6..1bac1db 100755
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -1209,7 +1209,7 @@
continue;
}
try {
- if (dalvik.system.DexFile.isDexOptNeeded(lib)) {
+ if (dalvik.system.DexFile.isDexOptNeededInternal(lib, null, false)) {
alreadyDexOpted.add(lib);
mInstaller.dexopt(lib, Process.SYSTEM_UID, true);
didDexOpt = true;
@@ -1253,7 +1253,7 @@
continue;
}
try {
- if (dalvik.system.DexFile.isDexOptNeeded(path)) {
+ if (dalvik.system.DexFile.isDexOptNeededInternal(path, null, false)) {
mInstaller.dexopt(path, Process.SYSTEM_UID, true);
didDexOpt = true;
}
@@ -3674,6 +3674,7 @@
updatedPkg = mSettings.getDisabledSystemPkgLPr(ps != null ? ps.name : pkg.packageName);
if (DEBUG_INSTALL && updatedPkg != null) Slog.d(TAG, "updatedPkg = " + updatedPkg);
}
+ boolean updatedPkgBetter = false;
// First check if this is a system package that may involve an update
if (updatedPkg != null && (parseFlags&PackageParser.PARSE_IS_SYSTEM) != 0) {
if (ps != null && !ps.codePath.equals(scanFile)) {
@@ -3728,6 +3729,7 @@
synchronized (mPackages) {
mSettings.enableSystemPackageLPw(ps.name);
}
+ updatedPkgBetter = true;
}
}
}
@@ -3804,7 +3806,7 @@
String codePath = null;
String resPath = null;
- if ((parseFlags & PackageParser.PARSE_FORWARD_LOCK) != 0) {
+ if ((parseFlags & PackageParser.PARSE_FORWARD_LOCK) != 0 && !updatedPkgBetter) {
if (ps != null && ps.resourcePathString != null) {
resPath = ps.resourcePathString;
} else {
@@ -3986,7 +3988,8 @@
String path = pkg.mScanPath;
int ret = 0;
try {
- if (forceDex || dalvik.system.DexFile.isDexOptNeeded(path)) {
+ if (forceDex || dalvik.system.DexFile.isDexOptNeededInternal(path, pkg.packageName,
+ defer)) {
if (!forceDex && defer) {
if (mDeferredDexOpt == null) {
mDeferredDexOpt = new HashSet<PackageParser.Package>();
@@ -3996,7 +3999,8 @@
} else {
Log.i(TAG, "Running dexopt on: " + pkg.applicationInfo.packageName);
final int sharedGid = UserHandle.getSharedAppGid(pkg.applicationInfo.uid);
- ret = mInstaller.dexopt(path, sharedGid, !isForwardLocked(pkg));
+ ret = mInstaller.dexopt(path, sharedGid, !isForwardLocked(pkg),
+ pkg.packageName);
pkg.mDidDexOpt = true;
performed = true;
}
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 6d47fcf..5da3e3e 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -3480,8 +3480,9 @@
Task newTask = mTaskIdToTask.get(groupId);
if (newTask == null) {
newTask = createTask(groupId, oldTask.mStack.mStackId, oldTask.mUserId, atoken);
+ } else {
+ newTask.mAppTokens.add(atoken);
}
- newTask.mAppTokens.add(atoken);
}
}
diff --git a/services/jni/com_android_server_AlarmManagerService.cpp b/services/jni/com_android_server_AlarmManagerService.cpp
index 342515b..c26a516 100644
--- a/services/jni/com_android_server_AlarmManagerService.cpp
+++ b/services/jni/com_android_server_AlarmManagerService.cpp
@@ -36,6 +36,7 @@
#include <unistd.h>
#include <linux/ioctl.h>
#include <linux/android_alarm.h>
+#include <linux/rtc.h>
namespace android {
@@ -58,6 +59,7 @@
virtual ~AlarmImpl();
virtual int set(int type, struct timespec *ts) = 0;
+ virtual int setTime(struct timeval *tv) = 0;
virtual int waitForAlarm() = 0;
protected:
@@ -71,6 +73,7 @@
AlarmImplAlarmDriver(int fd) : AlarmImpl(&fd, 1) { }
int set(int type, struct timespec *ts);
+ int setTime(struct timeval *tv);
int waitForAlarm();
};
@@ -82,6 +85,7 @@
~AlarmImplTimerFd();
int set(int type, struct timespec *ts);
+ int setTime(struct timeval *tv);
int waitForAlarm();
private:
@@ -107,6 +111,19 @@
return ioctl(fds[0], ANDROID_ALARM_SET(type), ts);
}
+int AlarmImplAlarmDriver::setTime(struct timeval *tv)
+{
+ struct timespec ts;
+ int res;
+
+ ts.tv_sec = tv->tv_sec;
+ ts.tv_nsec = tv->tv_usec * 1000;
+ res = ioctl(fds[0], ANDROID_ALARM_SET_RTC, &ts);
+ if (res < 0)
+ ALOGV("ANDROID_ALARM_SET_RTC ioctl failed: %s\n", strerror(errno));
+ return res;
+}
+
int AlarmImplAlarmDriver::waitForAlarm()
{
return ioctl(fds[0], ANDROID_ALARM_WAIT);
@@ -140,6 +157,50 @@
return timerfd_settime(fds[type], TFD_TIMER_ABSTIME, &spec, NULL);
}
+int AlarmImplTimerFd::setTime(struct timeval *tv)
+{
+ struct rtc_time rtc;
+ struct tm tm, *gmtime_res;
+ int fd;
+ int res;
+
+ res = settimeofday(tv, NULL);
+ if (res < 0) {
+ ALOGV("settimeofday() failed: %s\n", strerror(errno));
+ return -1;
+ }
+
+ fd = open("/dev/rtc0", O_RDWR);
+ if (fd < 0) {
+ ALOGV("Unable to open RTC driver: %s\n", strerror(errno));
+ return res;
+ }
+
+ gmtime_res = gmtime_r(&tv->tv_sec, &tm);
+ if (!gmtime_res) {
+ ALOGV("gmtime_r() failed: %s\n", strerror(errno));
+ res = -1;
+ goto done;
+ }
+
+ memset(&rtc, 0, sizeof(rtc));
+ rtc.tm_sec = tm.tm_sec;
+ rtc.tm_min = tm.tm_min;
+ rtc.tm_hour = tm.tm_hour;
+ rtc.tm_mday = tm.tm_mday;
+ rtc.tm_mon = tm.tm_mon;
+ rtc.tm_year = tm.tm_year;
+ rtc.tm_wday = tm.tm_wday;
+ rtc.tm_yday = tm.tm_yday;
+ rtc.tm_isdst = tm.tm_isdst;
+ res = ioctl(fd, RTC_SET_TIME, &rtc);
+ if (res < 0)
+ ALOGV("RTC_SET_TIME ioctl failed: %s\n", strerror(errno));
+done:
+ close(fd);
+ return res;
+}
+
int AlarmImplTimerFd::waitForAlarm()
{
epoll_event events[N_ANDROID_TIMERFDS];
@@ -168,6 +229,30 @@
return result;
}
+static jint android_server_AlarmManagerService_setKernelTime(JNIEnv*, jobject, jlong nativeData, jlong millis)
+{
+ AlarmImpl *impl = reinterpret_cast<AlarmImpl *>(nativeData);
+ struct timeval tv;
+ int ret;
+
+ if (millis <= 0 || millis / 1000LL >= INT_MAX) {
+ return -1;
+ }
+
+ tv.tv_sec = (time_t) (millis / 1000LL);
+ tv.tv_usec = (suseconds_t) ((millis % 1000LL) * 1000LL);
+
+ ALOGD("Setting time of day to sec=%d\n", (int) tv.tv_sec);
+
+ ret = impl->setTime(&tv);
+
+ if(ret < 0) {
+ ALOGW("Unable to set rtc to %ld: %s\n", tv.tv_sec, strerror(errno));
+ ret = -1;
+ }
+ return ret;
+}
+
static jint android_server_AlarmManagerService_setKernelTimezone(JNIEnv*, jobject, jlong, jint minswest)
{
struct timezone tz;
@@ -309,6 +394,7 @@
{"close", "(J)V", (void*)android_server_AlarmManagerService_close},
{"set", "(JIJJ)V", (void*)android_server_AlarmManagerService_set},
{"waitForAlarm", "(J)I", (void*)android_server_AlarmManagerService_waitForAlarm},
+ {"setKernelTime", "(JJ)I", (void*)android_server_AlarmManagerService_setKernelTime},
{"setKernelTimezone", "(JI)I", (void*)android_server_AlarmManagerService_setKernelTimezone},
};
diff --git a/tools/aapt/Images.cpp b/tools/aapt/Images.cpp
index 25a948d..db74831 100644
--- a/tools/aapt/Images.cpp
+++ b/tools/aapt/Images.cpp
@@ -35,7 +35,9 @@
// This holds an image as 8bpp RGBA.
struct image_info
{
- image_info() : rows(NULL), is9Patch(false), allocRows(NULL) { }
+ image_info() : rows(NULL), is9Patch(false),
+ xDivs(NULL), yDivs(NULL), colors(NULL), allocRows(NULL) { }
+
~image_info() {
if (rows && rows != allocRows) {
free(rows);
@@ -46,9 +48,15 @@
}
free(allocRows);
}
- free(info9Patch.xDivs);
- free(info9Patch.yDivs);
- free(info9Patch.colors);
+ free(xDivs);
+ free(yDivs);
+ free(colors);
+ }
+
+ void* serialize9patch() {
+ void* serialized = Res_png_9patch::serialize(info9Patch, xDivs, yDivs, colors);
+ reinterpret_cast<Res_png_9patch*>(serialized)->deviceToFile();
+ return serialized;
}
png_uint_32 width;
@@ -58,6 +66,9 @@
// 9-patch info.
bool is9Patch;
Res_png_9patch info9Patch;
+ int32_t* xDivs;
+ int32_t* yDivs;
+ uint32_t* colors;
// Layout padding, if relevant
bool haveLayoutBounds;
@@ -430,10 +441,10 @@
{
int left, right, top, bottom;
select_patch(
- hpatch, image->info9Patch.xDivs[0], image->info9Patch.xDivs[1],
+ hpatch, image->xDivs[0], image->xDivs[1],
image->width, &left, &right);
select_patch(
- vpatch, image->info9Patch.yDivs[0], image->info9Patch.yDivs[1],
+ vpatch, image->yDivs[0], image->yDivs[1],
image->height, &top, &bottom);
//printf("Selecting h=%d v=%d: (%d,%d)-(%d,%d)\n",
// hpatch, vpatch, left, top, right, bottom);
@@ -452,8 +463,8 @@
int maxSizeXDivs = W * sizeof(int32_t);
int maxSizeYDivs = H * sizeof(int32_t);
- int32_t* xDivs = image->info9Patch.xDivs = (int32_t*) malloc(maxSizeXDivs);
- int32_t* yDivs = image->info9Patch.yDivs = (int32_t*) malloc(maxSizeYDivs);
+ int32_t* xDivs = image->xDivs = (int32_t*) malloc(maxSizeXDivs);
+ int32_t* yDivs = image->yDivs = (int32_t*) malloc(maxSizeYDivs);
uint8_t numXDivs = 0;
uint8_t numYDivs = 0;
@@ -609,7 +620,7 @@
numColors = numRows * numCols;
image->info9Patch.numColors = numColors;
- image->info9Patch.colors = (uint32_t*)malloc(numColors * sizeof(uint32_t));
+ image->colors = (uint32_t*)malloc(numColors * sizeof(uint32_t));
// Fill in color information for each patch.
@@ -652,7 +663,7 @@
right = xDivs[i];
}
c = get_color(image->rows, left, top, right - 1, bottom - 1);
- image->info9Patch.colors[colorIndex++] = c;
+ image->colors[colorIndex++] = c;
NOISY(if (c != Res_png_9patch::NO_COLOR) hasColor = true);
left = right;
}
@@ -664,14 +675,10 @@
for (i=0; i<numColors; i++) {
if (hasColor) {
if (i == 0) printf("Colors in %s:\n ", imageName);
- printf(" #%08x", image->info9Patch.colors[i]);
+ printf(" #%08x", image->colors[i]);
if (i == numColors - 1) printf("\n");
}
}
-
- image->is9Patch = true;
- image->info9Patch.deviceToFile();
-
getout:
if (errorMsg) {
fprintf(stderr,
@@ -691,14 +698,10 @@
return NO_ERROR;
}
-static void checkNinePatchSerialization(Res_png_9patch* inPatch, void * data)
+static void checkNinePatchSerialization(Res_png_9patch* inPatch, void* data)
{
- if (sizeof(void*) != sizeof(int32_t)) {
- // can't deserialize on a non-32 bit system
- return;
- }
size_t patchSize = inPatch->serializedSize();
- void * newData = malloc(patchSize);
+ void* newData = malloc(patchSize);
memcpy(newData, data, patchSize);
Res_png_9patch* outPatch = inPatch->deserialize(newData);
// deserialization is done in place, so outPatch == newData
@@ -721,34 +724,6 @@
free(newData);
}
-static bool patch_equals(Res_png_9patch& patch1, Res_png_9patch& patch2) {
- if (!(patch1.numXDivs == patch2.numXDivs &&
- patch1.numYDivs == patch2.numYDivs &&
- patch1.numColors == patch2.numColors &&
- patch1.paddingLeft == patch2.paddingLeft &&
- patch1.paddingRight == patch2.paddingRight &&
- patch1.paddingTop == patch2.paddingTop &&
- patch1.paddingBottom == patch2.paddingBottom)) {
- return false;
- }
- for (int i = 0; i < patch1.numColors; i++) {
- if (patch1.colors[i] != patch2.colors[i]) {
- return false;
- }
- }
- for (int i = 0; i < patch1.numXDivs; i++) {
- if (patch1.xDivs[i] != patch2.xDivs[i]) {
- return false;
- }
- }
- for (int i = 0; i < patch1.numYDivs; i++) {
- if (patch1.yDivs[i] != patch2.yDivs[i]) {
- return false;
- }
- }
- return true;
-}
-
static void dump_image(int w, int h, png_bytepp rows, int color_type)
{
int i, j, rr, gg, bb, aa;
@@ -1061,7 +1036,7 @@
: (png_byte*)"npTc";
NOISY(printf("Adding 9-patch info...\n"));
strcpy((char*)unknowns[p_index].name, "npTc");
- unknowns[p_index].data = (png_byte*)imageInfo.info9Patch.serialize();
+ unknowns[p_index].data = (png_byte*)imageInfo.serialize9patch();
unknowns[p_index].size = imageInfo.info9Patch.serializedSize();
// TODO: remove the check below when everything works
checkNinePatchSerialization(&imageInfo.info9Patch, unknowns[p_index].data);
diff --git a/tools/aidl/Type.cpp b/tools/aidl/Type.cpp
index d572af6..2267750 100644
--- a/tools/aidl/Type.cpp
+++ b/tools/aidl/Type.cpp
@@ -1,5 +1,7 @@
#include "Type.h"
+#include <sys/types.h>
+
Namespace NAMES;
Type* VOID_TYPE;
diff --git a/tools/layoutlib/bridge/src/android/graphics/BitmapFactory_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/BitmapFactory_Delegate.java
index f5c4677..06673c1 100644
--- a/tools/layoutlib/bridge/src/android/graphics/BitmapFactory_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/BitmapFactory_Delegate.java
@@ -44,62 +44,13 @@
*/
/*package*/ class BitmapFactory_Delegate {
- // ------ Java delegates ------
-
- @LayoutlibDelegate
- /*package*/ static Bitmap finishDecode(Bitmap bm, Rect outPadding, Options opts) {
- if (bm == null || opts == null) {
- return bm;
- }
-
- final int density = opts.inDensity;
- if (density == 0) {
- return bm;
- }
-
- bm.setDensity(density);
- final int targetDensity = opts.inTargetDensity;
- if (targetDensity == 0 || density == targetDensity || density == opts.inScreenDensity) {
- return bm;
- }
-
- byte[] np = bm.getNinePatchChunk();
- final boolean isNinePatch = np != null && NinePatch.isNinePatchChunk(np);
- // DELEGATE CHANGE: never scale 9-patch
- if (opts.inScaled && isNinePatch == false) {
- float scale = targetDensity / (float)density;
- // TODO: This is very inefficient and should be done in native by Skia
- final Bitmap oldBitmap = bm;
- bm = Bitmap.createScaledBitmap(oldBitmap, (int) (bm.getWidth() * scale + 0.5f),
- (int) (bm.getHeight() * scale + 0.5f), true);
- oldBitmap.recycle();
-
- if (isNinePatch) {
- np = nativeScaleNinePatch(np, scale, outPadding);
- bm.setNinePatchChunk(np);
- }
- bm.setDensity(targetDensity);
- }
-
- return bm;
- }
-
-
// ------ Native Delegates ------
@LayoutlibDelegate
/*package*/ static Bitmap nativeDecodeStream(InputStream is, byte[] storage,
Rect padding, Options opts) {
- return nativeDecodeStream(is, storage, padding, opts, false, 1.f);
- }
-
- @LayoutlibDelegate
- /*package*/ static Bitmap nativeDecodeStream(InputStream is, byte[] storage,
- Rect padding, Options opts, boolean applyScale, float scale) {
Bitmap bm = null;
- //TODO support rescaling
-
Density density = Density.MEDIUM;
Set<BitmapCreateFlags> bitmapCreateFlags = EnumSet.of(BitmapCreateFlags.MUTABLE);
if (opts != null) {
@@ -157,13 +108,6 @@
}
@LayoutlibDelegate
- /*package*/ static Bitmap nativeDecodeAsset(long asset, Rect padding, Options opts,
- boolean applyScale, float scale) {
- opts.inBitmap = null;
- return null;
- }
-
- @LayoutlibDelegate
/*package*/ static Bitmap nativeDecodeByteArray(byte[] data, int offset,
int length, Options opts) {
opts.inBitmap = null;
@@ -171,13 +115,6 @@
}
@LayoutlibDelegate
- /*package*/ static byte[] nativeScaleNinePatch(byte[] chunk, float scale, Rect pad) {
- // don't scale for now. This should not be called anyway since we re-implement
- // BitmapFactory.finishDecode();
- return chunk;
- }
-
- @LayoutlibDelegate
/*package*/ static boolean nativeIsSeekable(FileDescriptor fd) {
return true;
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
index f6abaa1..89d7e23 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
@@ -314,6 +314,13 @@
}
@LayoutlibDelegate
+ /*package*/ static void nativeReconfigure(long nativeBitmap, int width, int height,
+ int config, int allocSize) {
+ Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
+ "Bitmap.reconfigure() is not supported", null /*data*/);
+ }
+
+ @LayoutlibDelegate
/*package*/ static boolean nativeCompress(long nativeBitmap, int format, int quality,
OutputStream stream, byte[] tempStorage) {
Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
@@ -342,28 +349,6 @@
}
@LayoutlibDelegate
- /*package*/ static int nativeWidth(long nativeBitmap) {
- // get the delegate from the native int.
- Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
- if (delegate == null) {
- return 0;
- }
-
- return delegate.mImage.getWidth();
- }
-
- @LayoutlibDelegate
- /*package*/ static int nativeHeight(long nativeBitmap) {
- // get the delegate from the native int.
- Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
- if (delegate == null) {
- return 0;
- }
-
- return delegate.mImage.getHeight();
- }
-
- @LayoutlibDelegate
/*package*/ static int nativeRowBytes(long nativeBitmap) {
// get the delegate from the native int.
Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
@@ -408,19 +393,21 @@
}
@LayoutlibDelegate
- /*package*/ static int nativeGetPixel(long nativeBitmap, int x, int y) {
+ /*package*/ static int nativeGetPixel(long nativeBitmap, int x, int y,
+ boolean isPremultiplied) {
// get the delegate from the native int.
Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
if (delegate == null) {
return 0;
}
+ // TODO: Support isPremultiplied.
return delegate.mImage.getRGB(x, y);
}
@LayoutlibDelegate
/*package*/ static void nativeGetPixels(long nativeBitmap, int[] pixels, int offset,
- int stride, int x, int y, int width, int height) {
+ int stride, int x, int y, int width, int height, boolean isPremultiplied) {
Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
if (delegate == null) {
return;
@@ -431,7 +418,8 @@
@LayoutlibDelegate
- /*package*/ static void nativeSetPixel(long nativeBitmap, int x, int y, int color) {
+ /*package*/ static void nativeSetPixel(long nativeBitmap, int x, int y, int color,
+ boolean isPremultiplied) {
Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
if (delegate == null) {
return;
@@ -442,7 +430,7 @@
@LayoutlibDelegate
/*package*/ static void nativeSetPixels(long nativeBitmap, int[] colors, int offset,
- int stride, int x, int y, int width, int height) {
+ int stride, int x, int y, int width, int height, boolean isPremultiplied) {
Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
if (delegate == null) {
return;
diff --git a/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java
index a5c52e55..38745ce 100644
--- a/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java
@@ -167,6 +167,7 @@
return sManager.addNewDelegate(newDelegate);
}
+ @LayoutlibDelegate
/*package*/ static void nativeFinalize(long chunk) {
sManager.removeJavaReferenceFor(chunk);
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java
index f3b56d9..6f6ef20 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java
@@ -401,17 +401,17 @@
}
@LayoutlibDelegate
- /*package*/ static void native_addPath(long nPath, int src, float dx, float dy) {
+ /*package*/ static void native_addPath(long nPath, long src, float dx, float dy) {
addPath(nPath, src, AffineTransform.getTranslateInstance(dx, dy));
}
@LayoutlibDelegate
- /*package*/ static void native_addPath(long nPath, int src) {
+ /*package*/ static void native_addPath(long nPath, long src) {
addPath(nPath, src, null /*transform*/);
}
@LayoutlibDelegate
- /*package*/ static void native_addPath(long nPath, int src, long matrix) {
+ /*package*/ static void native_addPath(long nPath, long src, long matrix) {
Matrix_Delegate matrixDelegate = Matrix_Delegate.getDelegate(matrix);
if (matrixDelegate == null) {
return;
@@ -474,6 +474,12 @@
}
@LayoutlibDelegate
+ /*package*/ static boolean native_op(long nPath1, long nPath2, int op, long result) {
+ Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED, "Path.op() not supported", null);
+ return false;
+ }
+
+ @LayoutlibDelegate
/*package*/ static void finalizer(long nPath) {
sManager.removeJavaReferenceFor(nPath);
}
diff --git a/tools/layoutlib/bridge/src/android/os/SystemClock_Delegate.java b/tools/layoutlib/bridge/src/android/os/SystemClock_Delegate.java
index fd594f7..5f0d98b 100644
--- a/tools/layoutlib/bridge/src/android/os/SystemClock_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/os/SystemClock_Delegate.java
@@ -33,11 +33,6 @@
private static long sBootTime = System.currentTimeMillis();
private static long sBootTimeNano = System.nanoTime();
- @LayoutlibDelegate
- /*package*/ static boolean setCurrentTimeMillis(long millis) {
- return true;
- }
-
/**
* Returns milliseconds since boot, not counting time spent in deep sleep.
* <b>Note:</b> This value may get reset occasionally (before it would
diff --git a/tools/layoutlib/bridge/src/libcore/icu/DateIntervalFormat_Delegate.java b/tools/layoutlib/bridge/src/libcore/icu/DateIntervalFormat_Delegate.java
index a773d93..d94c205 100644
--- a/tools/layoutlib/bridge/src/libcore/icu/DateIntervalFormat_Delegate.java
+++ b/tools/layoutlib/bridge/src/libcore/icu/DateIntervalFormat_Delegate.java
@@ -21,6 +21,7 @@
import com.android.ide.common.rendering.api.LayoutLog;
import com.android.layoutlib.bridge.Bridge;
import com.android.layoutlib.bridge.impl.DelegateManager;
+import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
import com.ibm.icu.text.DateIntervalFormat;
import com.ibm.icu.util.DateInterval;
import com.ibm.icu.util.TimeZone;
@@ -38,6 +39,7 @@
// ---- native methods ----
+ @LayoutlibDelegate
/*package*/static String formatDateInterval(long address, long fromDate, long toDate) {
DateIntervalFormat_Delegate delegate = sManager.getDelegate((int)address);
if (delegate == null) {
@@ -52,6 +54,7 @@
return sb.toString();
}
+ @LayoutlibDelegate
/*package*/ static long createDateIntervalFormat(String skeleton, String localeName,
String tzName) {
TimeZone prevDefaultTz = TimeZone.getDefault();
@@ -63,6 +66,7 @@
return sManager.addNewDelegate(newDelegate);
}
+ @LayoutlibDelegate
/*package*/ static void destroyDateIntervalFormat(long address) {
sManager.removeJavaReferenceFor((int)address);
}
diff --git a/tools/layoutlib/bridge/src/libcore/icu/ICU_Delegate.java b/tools/layoutlib/bridge/src/libcore/icu/ICU_Delegate.java
index 06ae804..998b08b 100644
--- a/tools/layoutlib/bridge/src/libcore/icu/ICU_Delegate.java
+++ b/tools/layoutlib/bridge/src/libcore/icu/ICU_Delegate.java
@@ -46,7 +46,7 @@
// --- Native methods accessing ICU's database.
@LayoutlibDelegate
- /*package*/ static String getBestDateTimePattern(String skeleton, String localeName) {
+ /*package*/ static String getBestDateTimePatternNative(String skeleton, String localeName) {
return DateTimePatternGenerator.getInstance(new ULocale(localeName))
.getBestPattern(skeleton);
}
@@ -137,6 +137,11 @@
}
@LayoutlibDelegate
+ /*package*/ static String getDisplayScriptNative(String variantCode, String locale) {
+ return "";
+ }
+
+ @LayoutlibDelegate
/*package*/ static String getISO3CountryNative(String locale) {
return "";
}
@@ -166,8 +171,19 @@
return Locale.getISOCountries();
}
+
@LayoutlibDelegate
- /*package*/ static boolean initLocaleDataImpl(String locale, LocaleData result) {
+ /*package*/ static String localeForLanguageTag(String languageTag, boolean strict) {
+ return "";
+ }
+
+ @LayoutlibDelegate
+ /*package*/ static String languageTagForLocale(String locale) {
+ return "";
+ }
+
+ @LayoutlibDelegate
+ /*package*/ static boolean initLocaleDataNative(String locale, LocaleData result) {
// Used by Calendar.
result.firstDayOfWeek = Integer.valueOf(1);
@@ -215,7 +231,7 @@
result.percent = '%';
result.perMill = '\u2030';
result.monetarySeparator = ' ';
- result.minusSign = '-';
+ result.minusSign = "-";
result.exponentSeparator = "e";
result.infinity = "\u221E";
result.NaN = "NaN";
diff --git a/tools/preload/Android.mk b/tools/preload/Android.mk
index f325870..14a4547 100644
--- a/tools/preload/Android.mk
+++ b/tools/preload/Android.mk
@@ -20,4 +20,4 @@
include $(BUILD_HOST_JAVA_LIBRARY)
-include $(call all-subdir-makefiles)
+include $(call all-makefiles-under,$(LOCAL_PATH))