am e5df9fa9: am 05a2c7ef: Merge "Remove ability to enable/disable phoneaccounts (1/6)" into lmp-dev
* commit 'e5df9fa9b2ac33f89cb542578f06d6639b12a3cc':
Remove ability to enable/disable phoneaccounts (1/6)
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index b4877de..99f77dd 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -1944,7 +1944,7 @@
if (dumpFullInfo) {
printRow(pw, HEAP_FULL_COLUMN, "", "Pss", "Pss", "Shared", "Private",
"Shared", "Private", "Swapped", "Heap", "Heap", "Heap");
- printRow(pw, HEAP_FULL_COLUMN, "", "Total", "Clean", "Dirty", "",
+ printRow(pw, HEAP_FULL_COLUMN, "", "Total", "Clean", "Dirty", "Dirty",
"Clean", "Clean", "Dirty", "Size", "Alloc", "Free");
printRow(pw, HEAP_FULL_COLUMN, "", "------", "------", "------", "------",
"------", "------", "------", "------", "------", "------");
diff --git a/core/java/android/app/Fragment.java b/core/java/android/app/Fragment.java
index a95abab..f8b321e 100644
--- a/core/java/android/app/Fragment.java
+++ b/core/java/android/app/Fragment.java
@@ -219,8 +219,8 @@
* state of its view hierarchy has been restored.
* <li> {@link #onStart} makes the fragment visible to the user (based on its
* containing activity being started).
- * <li> {@link #onResume} makes the fragment interacting with the user (based on its
- * containing activity being resumed).
+ * <li> {@link #onResume} makes the fragment begin interacting with the user
+ * (based on its containing activity being resumed).
* </ol>
*
* <p>As a fragment is no longer being used, it goes through a reverse
@@ -564,7 +564,7 @@
* and later retrieved by the Fragment with {@link #getArguments}.
*
* <p>Applications should generally not implement a constructor. The
- * first place application code an run where the fragment is ready to
+ * first place application code can run where the fragment is ready to
* be used is in {@link #onAttach(Activity)}, the point where the fragment
* is actually associated with its activity. Some applications may also
* want to implement {@link #onInflate} to retrieve attributes from a
@@ -720,8 +720,7 @@
}
/**
- * Return the arguments supplied when the fragment was instantiated,
- * if any.
+ * Return the arguments supplied to {@link #setArguments}, if any.
*/
final public Bundle getArguments() {
return mArguments;
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java
index ef69fdd..b87b022 100644
--- a/core/java/android/app/FragmentManager.java
+++ b/core/java/android/app/FragmentManager.java
@@ -70,7 +70,7 @@
* with {@link FragmentTransaction#addToBackStack(String)
* FragmentTransaction.addToBackStack()}. Entries can later be
* retrieved with {@link FragmentManager#getBackStackEntryAt(int)
- * FragmentManager.getBackStackEntry()}.
+ * FragmentManager.getBackStackEntryAt()}.
*
* <p>Note that you should never hold on to a BackStackEntry object;
* the identifier as returned by {@link #getId} is the only thing that
@@ -260,7 +260,7 @@
/**
* Return the BackStackEntry at index <var>index</var> in the back stack;
- * entries start index 0 being the bottom of the stack.
+ * where the item on the bottom of the stack has index 0.
*/
public abstract BackStackEntry getBackStackEntryAt(int index);
diff --git a/core/java/android/app/FragmentTransaction.java b/core/java/android/app/FragmentTransaction.java
index 25cd3cc..dc7075c 100644
--- a/core/java/android/app/FragmentTransaction.java
+++ b/core/java/android/app/FragmentTransaction.java
@@ -26,7 +26,7 @@
/**
* Add a fragment to the activity state. This fragment may optionally
* also have its view (if {@link Fragment#onCreateView Fragment.onCreateView}
- * returns non-null) into a container view of the activity.
+ * returns non-null) inserted into a container view of the activity.
*
* @param containerViewId Optional identifier of the container this fragment is
* to be placed in. If 0, it will not be placed in a container.
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 1e0dc53..09bcede 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -493,7 +493,8 @@
* <p>Applications targeting this or a later release will get these
* new changes in behavior:</p>
* <ul>
- * <li> The default result of {android.preference.PreferenceActivity#isValidFragment
+ * <li> The default result of
+ * {@link android.preference.PreferenceActivity#isValidFragment(String)
* PreferenceActivity.isValueFragment} becomes false instead of true.</li>
* <li> In {@link android.webkit.WebView}, apps targeting earlier versions will have
* JS URLs evaluated directly and any result of the evaluation will not replace
diff --git a/core/java/android/provider/DocumentsProvider.java b/core/java/android/provider/DocumentsProvider.java
index 270d786..932e873 100644
--- a/core/java/android/provider/DocumentsProvider.java
+++ b/core/java/android/provider/DocumentsProvider.java
@@ -355,7 +355,7 @@
}
/**
- * Return documents that that match the given query under the requested
+ * Return documents that match the given query under the requested
* root. The returned documents should be sorted by relevance in descending
* order. How documents are matched against the query string is an
* implementation detail left to each provider, but it's suggested that at
diff --git a/core/java/android/text/Html.java b/core/java/android/text/Html.java
index 2fcc597..dc93bc2 100644
--- a/core/java/android/text/Html.java
+++ b/core/java/android/text/Html.java
@@ -61,7 +61,7 @@
*/
public static interface ImageGetter {
/**
- * This methos is called when the HTML parser encounters an
+ * This method is called when the HTML parser encounters an
* <img> tag. The <code>source</code> argument is the
* string from the "src" attribute; the return value should be
* a Drawable representation of the image or <code>null</code>
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 4e1db90..59ed701 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -6322,8 +6322,8 @@
/**
* Information about how wide the view wants to be. Can be one of the
- * constants FILL_PARENT (replaced by MATCH_PARENT ,
- * in API Level 8) or WRAP_CONTENT. or an exact size.
+ * constants FILL_PARENT (replaced by MATCH_PARENT
+ * in API Level 8) or WRAP_CONTENT, or an exact size.
*/
@ViewDebug.ExportedProperty(category = "layout", mapping = {
@ViewDebug.IntToString(from = MATCH_PARENT, to = "MATCH_PARENT"),
@@ -6333,8 +6333,8 @@
/**
* Information about how tall the view wants to be. Can be one of the
- * constants FILL_PARENT (replaced by MATCH_PARENT ,
- * in API Level 8) or WRAP_CONTENT. or an exact size.
+ * constants FILL_PARENT (replaced by MATCH_PARENT
+ * in API Level 8) or WRAP_CONTENT, or an exact size.
*/
@ViewDebug.ExportedProperty(category = "layout", mapping = {
@ViewDebug.IntToString(from = MATCH_PARENT, to = "MATCH_PARENT"),
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 081bfdf..68f5dad 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -2144,7 +2144,7 @@
/**
* In addition to the FindListener that the user may set via the WebView.setFindListener
* API, FindActionModeCallback will register it's own FindListener. We keep them separate
- * via this class so that that the two FindListeners can potentially exist at once.
+ * via this class so that the two FindListeners can potentially exist at once.
*/
private class FindListenerDistributor implements FindListener {
private FindListener mFindDialogFindListener;
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index af53ec8..38eab28 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -2378,7 +2378,9 @@
lp.itemId = mAdapter.getItemId(position);
}
lp.viewType = mAdapter.getItemViewType(position);
- child.setLayoutParams(lp);
+ if (lp != vlp) {
+ child.setLayoutParams(lp);
+ }
}
class ListItemAccessibilityDelegate extends AccessibilityDelegate {
diff --git a/core/java/com/android/internal/app/ExternalMediaFormatActivity.java b/core/java/com/android/internal/app/ExternalMediaFormatActivity.java
index 6ed3bdc..fc213c5 100644
--- a/core/java/com/android/internal/app/ExternalMediaFormatActivity.java
+++ b/core/java/com/android/internal/app/ExternalMediaFormatActivity.java
@@ -25,6 +25,7 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
+import android.os.storage.StorageVolume;
import android.util.Log;
/**
@@ -94,6 +95,10 @@
if (which == POSITIVE_BUTTON) {
Intent intent = new Intent(ExternalStorageFormatter.FORMAT_ONLY);
intent.setComponent(ExternalStorageFormatter.COMPONENT_NAME);
+ // Transfer the storage volume to the new intent
+ final StorageVolume storageVolume = getIntent().getParcelableExtra(
+ StorageVolume.EXTRA_STORAGE_VOLUME);
+ intent.putExtra(StorageVolume.EXTRA_STORAGE_VOLUME, storageVolume);
startService(intent);
}
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java
index c579a15..f23326c 100644
--- a/core/java/com/android/internal/os/Zygote.java
+++ b/core/java/com/android/internal/os/Zygote.java
@@ -20,12 +20,9 @@
import dalvik.system.ZygoteHooks;
import android.system.ErrnoException;
import android.system.Os;
-import android.os.SystemClock;
-import android.util.Slog;
/** @hide */
public final class Zygote {
- private static final String TAG = "Zygote";
/*
* Bit values for "debugFlags" argument. The definitions are duplicated
* in the native code.
@@ -86,15 +83,11 @@
public static int forkAndSpecialize(int uid, int gid, int[] gids, int debugFlags,
int[][] rlimits, int mountExternal, String seInfo, String niceName, int[] fdsToClose,
String instructionSet) {
- long startTime = SystemClock.elapsedRealtime();
VM_HOOKS.preFork();
- checkTime(startTime, "Zygote.preFork");
int pid = nativeForkAndSpecialize(
uid, gid, gids, debugFlags, rlimits, mountExternal, seInfo, niceName, fdsToClose,
instructionSet);
- checkTime(startTime, "Zygote.nativeForkAndSpecialize");
VM_HOOKS.postForkCommon();
- checkTime(startTime, "Zygote.postForkCommon");
return pid;
}
@@ -103,18 +96,6 @@
String instructionSet);
/**
- * Temporary hack: check time since start time and log if over a fixed threshold.
- *
- */
- private static void checkTime(long startTime, String where) {
- long now = SystemClock.elapsedRealtime();
- if ((now-startTime) > 1000) {
- // If we are taking more than a second, log about it.
- Slog.w(TAG, "Slow operation: " + (now-startTime) + "ms so far, now at " + where);
- }
- }
-
- /**
* Special method to start the system server process. In addition to the
* common actions performed in forkAndSpecialize, the pid of the child
* process is recorded such that the death of the child process will cause
@@ -150,9 +131,7 @@
int[][] rlimits, long permittedCapabilities, long effectiveCapabilities);
private static void callPostForkChildHooks(int debugFlags, String instructionSet) {
- long startTime = SystemClock.elapsedRealtime();
VM_HOOKS.postForkChild(debugFlags, instructionSet);
- checkTime(startTime, "Zygote.callPostForkChildHooks");
}
diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java
index fb50b25..8388037 100644
--- a/core/java/com/android/internal/os/ZygoteConnection.java
+++ b/core/java/com/android/internal/os/ZygoteConnection.java
@@ -37,8 +37,6 @@
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import libcore.io.IoUtils;
-import android.os.SystemClock;
-import android.util.Slog;
/**
* A connection that can make spawn requests.
@@ -105,23 +103,11 @@
}
/**
- * Temporary hack: check time since start time and log if over a fixed threshold.
- *
- */
- private void checkTime(long startTime, String where) {
- long now = SystemClock.elapsedRealtime();
- if ((now-startTime) > 1000) {
- // If we are taking more than a second, log about it.
- Slog.w(TAG, "Slow operation: " + (now-startTime) + "ms so far, now at " + where);
- }
- }
-
- /**
* Returns the file descriptor of the associated socket.
*
* @return null-ok; file descriptor
*/
- FileDescriptor getFileDescriptor() {
+ FileDescriptor getFileDesciptor() {
return mSocket.getFileDescriptor();
}
@@ -145,8 +131,6 @@
Arguments parsedArgs = null;
FileDescriptor[] descriptors;
- long startTime = SystemClock.elapsedRealtime();
-
try {
args = readArgumentList();
descriptors = mSocket.getAncillaryFileDescriptors();
@@ -156,7 +140,6 @@
return true;
}
- checkTime(startTime, "zygoteConnection.runOnce: readArgumentList");
if (args == null) {
// EOF reached.
closeSocket();
@@ -188,19 +171,14 @@
", effective=0x" + Long.toHexString(parsedArgs.effectiveCapabilities));
}
-
applyUidSecurityPolicy(parsedArgs, peer, peerSecurityContext);
applyRlimitSecurityPolicy(parsedArgs, peer, peerSecurityContext);
applyInvokeWithSecurityPolicy(parsedArgs, peer, peerSecurityContext);
applyseInfoSecurityPolicy(parsedArgs, peer, peerSecurityContext);
- checkTime(startTime, "zygoteConnection.runOnce: apply security policies");
-
applyDebuggerSystemProperty(parsedArgs);
applyInvokeWithSystemProperty(parsedArgs);
- checkTime(startTime, "zygoteConnection.runOnce: apply security policies");
-
int[][] rlimits = null;
if (parsedArgs.rlimits != null) {
@@ -242,11 +220,9 @@
fd = null;
- checkTime(startTime, "zygoteConnection.runOnce: preForkAndSpecialize");
pid = Zygote.forkAndSpecialize(parsedArgs.uid, parsedArgs.gid, parsedArgs.gids,
parsedArgs.debugFlags, rlimits, parsedArgs.mountExternal, parsedArgs.seInfo,
parsedArgs.niceName, fdsToClose, parsedArgs.instructionSet);
- checkTime(startTime, "zygoteConnection.runOnce: postForkAndSpecialize");
} catch (IOException ex) {
logAndPrintError(newStderr, "Exception creating pipe", ex);
} catch (ErrnoException ex) {
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
index 40c9ed2..3baaac0 100644
--- a/core/java/com/android/internal/os/ZygoteInit.java
+++ b/core/java/com/android/internal/os/ZygoteInit.java
@@ -91,12 +91,6 @@
private static Resources mResources;
/**
- * The number of times that the main Zygote loop
- * should run before calling gc() again.
- */
- static final int GC_LOOP_COUNT = 10;
-
- /**
* The name of a resource file that contains classes to preload.
*/
private static final String PRELOADED_CLASSES = "preloaded-classes";
@@ -301,11 +295,6 @@
float defaultUtilization = runtime.getTargetHeapUtilization();
runtime.setTargetHeapUtilization(0.8f);
- // Start with a clean slate.
- System.gc();
- runtime.runFinalizationSync();
- Debug.startAllocCounting();
-
try {
BufferedReader br
= new BufferedReader(new InputStreamReader(is), 256);
@@ -324,15 +313,6 @@
Log.v(TAG, "Preloading " + line + "...");
}
Class.forName(line);
- if (Debug.getGlobalAllocSize() > PRELOAD_GC_THRESHOLD) {
- if (false) {
- Log.v(TAG,
- " GC at " + Debug.getGlobalAllocSize());
- }
- System.gc();
- runtime.runFinalizationSync();
- Debug.resetGlobalAllocSize();
- }
count++;
} catch (ClassNotFoundException e) {
Log.w(TAG, "Class not found for preloading: " + line);
@@ -362,8 +342,6 @@
// Fill in dex caches with classes, fields, and methods brought in by preloading.
runtime.preloadDexCaches();
- Debug.stopAllocCounting();
-
// Bring back root. We'll need it later.
setEffectiveUser(ROOT_UID);
setEffectiveGroup(ROOT_GID);
@@ -381,10 +359,7 @@
private static void preloadResources() {
final VMRuntime runtime = VMRuntime.getRuntime();
- Debug.startAllocCounting();
try {
- System.gc();
- runtime.runFinalizationSync();
mResources = Resources.getSystem();
mResources.startPreloading();
if (PRELOAD_RESOURCES) {
@@ -409,22 +384,12 @@
mResources.finishPreloading();
} catch (RuntimeException e) {
Log.w(TAG, "Failure preloading resources", e);
- } finally {
- Debug.stopAllocCounting();
}
}
private static int preloadColorStateLists(VMRuntime runtime, TypedArray ar) {
int N = ar.length();
for (int i=0; i<N; i++) {
- if (Debug.getGlobalAllocSize() > PRELOAD_GC_THRESHOLD) {
- if (false) {
- Log.v(TAG, " GC at " + Debug.getGlobalAllocSize());
- }
- System.gc();
- runtime.runFinalizationSync();
- Debug.resetGlobalAllocSize();
- }
int id = ar.getResourceId(i, 0);
if (false) {
Log.v(TAG, "Preloading resource #" + Integer.toHexString(id));
@@ -445,14 +410,6 @@
private static int preloadDrawables(VMRuntime runtime, TypedArray ar) {
int N = ar.length();
for (int i=0; i<N; i++) {
- if (Debug.getGlobalAllocSize() > PRELOAD_GC_THRESHOLD) {
- if (false) {
- Log.v(TAG, " GC at " + Debug.getGlobalAllocSize());
- }
- System.gc();
- runtime.runFinalizationSync();
- Debug.resetGlobalAllocSize();
- }
int id = ar.getResourceId(i, 0);
if (false) {
Log.v(TAG, "Preloading resource #" + Integer.toHexString(id));
@@ -474,7 +431,7 @@
* softly- and final-reachable objects, along with any other garbage.
* This is only useful just before a fork().
*/
- /*package*/ static void gc() {
+ /*package*/ static void gcAndFinalize() {
final VMRuntime runtime = VMRuntime.getRuntime();
/* runFinalizationSync() lets finalizers be called in Zygote,
@@ -483,9 +440,6 @@
System.gc();
runtime.runFinalizationSync();
System.gc();
- runtime.runFinalizationSync();
- System.gc();
- runtime.runFinalizationSync();
}
/**
@@ -676,7 +630,7 @@
SamplingProfilerIntegration.writeZygoteSnapshot();
// Do an initial gc to clean up after startup
- gc();
+ gcAndFinalize();
// Disable tracing so that forked processes do not inherit stale tracing tags from
// Zygote.
@@ -745,27 +699,9 @@
fds.add(sServerSocket.getFileDescriptor());
peers.add(null);
- int loopCount = GC_LOOP_COUNT;
while (true) {
int index;
- /*
- * Call gc() before we block in select().
- * It's work that has to be done anyway, and it's better
- * to avoid making every child do it. It will also
- * madvise() any free memory as a side-effect.
- *
- * Don't call it every time, because walking the entire
- * heap is a lot of overhead to free a few hundred bytes.
- */
- if (loopCount <= 0) {
- gc();
- loopCount = GC_LOOP_COUNT;
- } else {
- loopCount--;
- }
-
-
try {
fdArray = fds.toArray(fdArray);
index = selectReadable(fdArray);
@@ -778,7 +714,7 @@
} else if (index == 0) {
ZygoteConnection newPeer = acceptCommandPeer(abiList);
peers.add(newPeer);
- fds.add(newPeer.getFileDescriptor());
+ fds.add(newPeer.getFileDesciptor());
} else {
boolean done;
done = peers.get(index).runOnce();
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 1573106..b23374c 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -856,7 +856,7 @@
parseRuntimeOption("dalvik.vm.profiler.type", profileType, "-Xprofile-type:");
// Depth of bounded stack data
- parseRuntimeOption("dalvik.vm.profile.max-stack-depth",
+ parseRuntimeOption("dalvik.vm.profile.stack-depth",
profileMaxStackDepth,
"-Xprofile-max-stack-depth:");
diff --git a/core/jni/android_net_LocalSocketImpl.cpp b/core/jni/android_net_LocalSocketImpl.cpp
index 98f4bed..a408a96 100644
--- a/core/jni/android_net_LocalSocketImpl.cpp
+++ b/core/jni/android_net_LocalSocketImpl.cpp
@@ -57,7 +57,7 @@
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return;
}
@@ -95,7 +95,7 @@
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return;
}
@@ -118,7 +118,7 @@
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return;
}
@@ -154,7 +154,7 @@
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return NULL;
}
@@ -184,7 +184,7 @@
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return;
}
@@ -246,7 +246,7 @@
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return 0;
}
@@ -293,7 +293,7 @@
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return;
}
@@ -353,7 +353,7 @@
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return (jint)-1;
}
@@ -378,7 +378,7 @@
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return (jint)-1;
}
@@ -459,20 +459,20 @@
jobject fdObject
= jniCreateFileDescriptor(env, pDescriptors[i]);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return -1;
}
env->SetObjectArrayElement(fdArray, i, fdObject);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return -1;
}
}
env->SetObjectField(thisJ, field_inboundFileDescriptors, fdArray);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return -1;
}
}
@@ -558,7 +558,7 @@
= (jobjectArray)env->GetObjectField(
object, field_outboundFileDescriptors);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return -1;
}
@@ -570,18 +570,18 @@
// Add any pending outbound file descriptors to the message
if (outboundFds != NULL) {
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return -1;
}
for (int i = 0; i < countFds; i++) {
jobject fdObject = env->GetObjectArrayElement(outboundFds, i);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return -1;
}
fds[i] = jniGetFDFromFileDescriptor(env, fdObject);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return -1;
}
}
@@ -638,7 +638,7 @@
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return (jint)0;
}
@@ -683,7 +683,7 @@
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return (jint)-1;
}
@@ -717,7 +717,7 @@
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return;
}
@@ -745,7 +745,7 @@
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return;
}
@@ -777,7 +777,7 @@
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return NULL;
}
@@ -816,7 +816,7 @@
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return NULL;
}
diff --git a/core/jni/android_os_MessageQueue.cpp b/core/jni/android_os_MessageQueue.cpp
index a8ed895..15d62a2 100644
--- a/core/jni/android_os_MessageQueue.cpp
+++ b/core/jni/android_os_MessageQueue.cpp
@@ -54,8 +54,8 @@
}
bool MessageQueue::raiseAndClearException(JNIEnv* env, const char* msg) {
- jthrowable exceptionObj = env->ExceptionOccurred();
- if (exceptionObj) {
+ if (env->ExceptionCheck()) {
+ jthrowable exceptionObj = env->ExceptionOccurred();
env->ExceptionClear();
raiseException(env, msg, exceptionObj);
env->DeleteLocalRef(exceptionObj);
diff --git a/core/jni/android_os_SELinux.cpp b/core/jni/android_os_SELinux.cpp
index ffa569e..c282549 100644
--- a/core/jni/android_os_SELinux.cpp
+++ b/core/jni/android_os_SELinux.cpp
@@ -97,7 +97,7 @@
}
int fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
ALOGE("getPeerCon => getFD for %p failed", fileDescriptor);
return NULL;
}
diff --git a/core/jni/android_server_NetworkManagementSocketTagger.cpp b/core/jni/android_server_NetworkManagementSocketTagger.cpp
index 7e12b1e..ca21fd7 100644
--- a/core/jni/android_server_NetworkManagementSocketTagger.cpp
+++ b/core/jni/android_server_NetworkManagementSocketTagger.cpp
@@ -35,7 +35,7 @@
jint tagNum, jint uid) {
int userFd = jniGetFDFromFileDescriptor(env, fileDescriptor);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
ALOGE("Can't get FileDescriptor num");
return (jint)-1;
}
@@ -51,7 +51,7 @@
jobject fileDescriptor) {
int userFd = jniGetFDFromFileDescriptor(env, fileDescriptor);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
ALOGE("Can't get FileDescriptor num");
return (jint)-1;
}
diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp
index 81e887d..7f7cfce 100644
--- a/core/jni/android_util_Binder.cpp
+++ b/core/jni/android_util_Binder.cpp
@@ -272,9 +272,9 @@
//printf("\n");
jboolean res = env->CallBooleanMethod(mObject, gBinderOffsets.mExecTransact,
code, reinterpret_cast<jlong>(&data), reinterpret_cast<jlong>(reply), flags);
- jthrowable excep = env->ExceptionOccurred();
- if (excep) {
+ if (env->ExceptionCheck()) {
+ jthrowable excep = env->ExceptionOccurred();
report_exception(env, excep,
"*** Uncaught remote exception! "
"(Exceptions are not yet supported across processes.)");
@@ -296,12 +296,12 @@
set_dalvik_blockguard_policy(env, strict_policy_before);
}
- jthrowable excep2 = env->ExceptionOccurred();
- if (excep2) {
- report_exception(env, excep2,
+ if (env->ExceptionCheck()) {
+ jthrowable excep = env->ExceptionOccurred();
+ report_exception(env, excep,
"*** Uncaught exception in onBinderStrictModePolicyChange");
/* clean up JNI local ref -- we don't return to Java code */
- env->DeleteLocalRef(excep2);
+ env->DeleteLocalRef(excep);
}
// Need to always call through the native implementation of
@@ -403,8 +403,8 @@
env->CallStaticVoidMethod(gBinderProxyOffsets.mClass,
gBinderProxyOffsets.mSendDeathNotice, mObject);
- jthrowable excep = env->ExceptionOccurred();
- if (excep) {
+ if (env->ExceptionCheck()) {
+ jthrowable excep = env->ExceptionOccurred();
report_exception(env, excep,
"*** Uncaught exception returned from death notification!");
}
@@ -1068,16 +1068,9 @@
}
// We only measure binder call durations to potentially log them if
-// we're on the main thread. Unfortunately sim-eng doesn't seem to
-// have gettid, so we just ignore this and don't log if we can't
-// get the thread id.
+// we're on the main thread.
static bool should_time_binder_calls() {
-#ifdef HAVE_GETTID
- return (getpid() == androidGetTid());
-#else
-#warning no gettid(), so not logging Binder calls...
- return false;
-#endif
+ return (getpid() == gettid());
}
static jboolean android_os_BinderProxy_transact(JNIEnv* env, jobject obj,
diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp
index aaa680f..6506190 100644
--- a/core/jni/android_util_Process.cpp
+++ b/core/jni/android_util_Process.cpp
@@ -271,7 +271,7 @@
// Establishes the calling thread as illegal to put into the background.
// Typically used only for the system process's main looper.
#if GUARD_THREAD_PRIORITY
- ALOGV("Process.setCanSelfBackground(%d) : tid=%d", bgOk, androidGetTid());
+ ALOGV("Process.setCanSelfBackground(%d) : tid=%d", bgOk, gettid());
{
Mutex::Autolock _l(gKeyCreateMutex);
if (gBgKey == -1) {
@@ -306,7 +306,7 @@
// if we're putting the current thread into the background, check the TLS
// to make sure this thread isn't guarded. If it is, raise an exception.
if (pri >= ANDROID_PRIORITY_BACKGROUND) {
- if (pid == androidGetTid()) {
+ if (pid == gettid()) {
void* bgOk = pthread_getspecific(gBgKey);
if (bgOk == ((void*)0xbaad)) {
ALOGE("Thread marked fg-only put self in background!");
@@ -333,7 +333,7 @@
void android_os_Process_setCallingThreadPriority(JNIEnv* env, jobject clazz,
jint pri)
{
- android_os_Process_setThreadPriority(env, clazz, androidGetTid(), pri);
+ android_os_Process_setThreadPriority(env, clazz, gettid(), pri);
}
jint android_os_Process_getThreadPriority(JNIEnv* env, jobject clazz,
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 451d97a..f029cf0 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -43,7 +43,6 @@
#include <utils/String8.h>
#include <selinux/android.h>
#include <processgroup/processgroup.h>
-#include <inttypes.h>
#include "android_runtime/AndroidRuntime.h"
#include "JNIHelp.h"
@@ -399,22 +398,6 @@
}
}
- // Temporary timing check.
-uint64_t MsTime() {
- timespec now;
- clock_gettime(CLOCK_MONOTONIC, &now);
- return static_cast<uint64_t>(now.tv_sec) * UINT64_C(1000) + now.tv_nsec / UINT64_C(1000000);
-}
-
-
-void ckTime(uint64_t start, const char* where) {
- uint64_t now = MsTime();
- if ((now-start) > 1000) {
- // If we are taking more than a second, log about it.
- ALOGW("Slow operation: %"PRIu64" ms in %s", (uint64_t)(now-start), where);
- }
-}
-
// Utility routine to fork zygote and specialize the child process.
static pid_t ForkAndSpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray javaGids,
jint debug_flags, jobjectArray javaRlimits,
@@ -423,9 +406,7 @@
jstring java_se_info, jstring java_se_name,
bool is_system_server, jintArray fdsToClose,
jstring instructionSet) {
- uint64_t start = MsTime();
SetSigChldHandler();
- ckTime(start, "ForkAndSpecializeCommon:SetSigChldHandler");
pid_t pid = fork();
@@ -433,12 +414,9 @@
// The child process.
gMallocLeakZygoteChild = 1;
-
// Clean up any descriptors which must be closed immediately
DetachDescriptors(env, fdsToClose);
- ckTime(start, "ForkAndSpecializeCommon:Fork and detach");
-
// Keep capabilities across UID change, unless we're staying root.
if (uid != 0) {
EnableKeepCapabilities(env);
@@ -541,11 +519,8 @@
UnsetSigChldHandler();
- ckTime(start, "ForkAndSpecializeCommon:child process setup");
-
env->CallStaticVoidMethod(gZygoteClass, gCallPostForkChildHooks, debug_flags,
is_system_server ? NULL : instructionSet);
- ckTime(start, "ForkAndSpecializeCommon:PostForkChildHooks returns");
if (env->ExceptionCheck()) {
ALOGE("Error calling post fork hooks.");
RuntimeAbort(env);
diff --git a/core/jni/com_android_internal_os_ZygoteInit.cpp b/core/jni/com_android_internal_os_ZygoteInit.cpp
index 2233ee3..10c6e2ce 100644
--- a/core/jni/com_android_internal_os_ZygoteInit.cpp
+++ b/core/jni/com_android_internal_os_ZygoteInit.cpp
@@ -96,7 +96,7 @@
fd = jniGetFDFromFileDescriptor(env, in);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return;
}
@@ -106,7 +106,7 @@
fd = jniGetFDFromFileDescriptor(env, out);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return;
}
@@ -116,7 +116,7 @@
fd = jniGetFDFromFileDescriptor(env, errfd);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return;
}
@@ -134,7 +134,7 @@
fd = jniGetFDFromFileDescriptor(env, descriptor);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return;
}
@@ -170,7 +170,7 @@
jsize length = env->GetArrayLength(fds);
fd_set fdset;
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return -1;
}
@@ -179,14 +179,14 @@
int nfds = 0;
for (jsize i = 0; i < length; i++) {
jobject fdObj = env->GetObjectArrayElement(fds, i);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return -1;
}
if (fdObj == NULL) {
continue;
}
int fd = jniGetFDFromFileDescriptor(env, fdObj);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return -1;
}
@@ -209,14 +209,14 @@
for (jsize i = 0; i < length; i++) {
jobject fdObj = env->GetObjectArrayElement(fds, i);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return -1;
}
if (fdObj == NULL) {
continue;
}
int fd = jniGetFDFromFileDescriptor(env, fdObj);
- if (env->ExceptionOccurred() != NULL) {
+ if (env->ExceptionCheck()) {
return -1;
}
if (FD_ISSET(fd, &fdset)) {
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index e95d735..654b06f 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -566,10 +566,10 @@
<integer name="config_shortPressOnPowerBehavior">1</integer>
<!-- Package name for default keyguard appwidget [DO NOT TRANSLATE] -->
- <string name="widget_default_package_name"></string>
+ <string name="widget_default_package_name" translatable="false"></string>
<!-- Class name for default keyguard appwidget [DO NOT TRANSLATE] -->
- <string name="widget_default_class_name"></string>
+ <string name="widget_default_class_name" translatable="false"></string>
<!-- Indicate whether the SD card is accessible without removing the battery. -->
<bool name="config_batterySdCardAccessibility">false</bool>
@@ -1070,7 +1070,7 @@
PERSIST may improve performance by reducing how often journal blocks are
reallocated (compared to truncation) resulting in better data block locality
and less churn of the storage media. -->
- <string name="db_default_journal_mode">PERSIST</string>
+ <string name="db_default_journal_mode" translatable="false">PERSIST</string>
<!-- Maximum size of the persistent journal file in bytes.
If the journal file grows to be larger than this amount then SQLite will
@@ -1082,7 +1082,7 @@
NORMAL also preserves durability in non-WAL modes and uses checksums to ensure
integrity although there is a small chance that an error might go unnoticed.
Choices are: FULL, NORMAL, OFF. -->
- <string name="db_default_sync_mode">FULL</string>
+ <string name="db_default_sync_mode" translatable="false">FULL</string>
<!-- The database synchronization mode when using Write-Ahead Logging.
FULL is safest and preserves durability at the cost of extra fsyncs.
@@ -1090,7 +1090,7 @@
and after checkpoint operations. If checkpoints are infrequent and power loss
occurs, then committed transactions could be lost and applications might break.
Choices are: FULL, NORMAL, OFF. -->
- <string name="db_wal_sync_mode">FULL</string>
+ <string name="db_wal_sync_mode" translatable="false">FULL</string>
<!-- The Write-Ahead Log auto-checkpoint interval in database pages (typically 1 to 4KB).
The log is checkpointed automatically whenever it exceeds this many pages.
@@ -1275,7 +1275,7 @@
<!-- If supported and enabled, are dreams activated when asleep and charging? (by default) -->
<bool name="config_dreamsActivatedOnSleepByDefault">false</bool>
<!-- ComponentName of the default dream (Settings.Secure.DEFAULT_SCREENSAVER_COMPONENT) -->
- <string name="config_dreamsDefaultComponent">com.google.android.deskclock/com.android.deskclock.Screensaver</string>
+ <string name="config_dreamsDefaultComponent" translatable="false">com.google.android.deskclock/com.android.deskclock.Screensaver</string>
<!-- Are we allowed to dream while not plugged in? -->
<bool name="config_dreamsEnabledOnBattery">false</bool>
@@ -1556,17 +1556,17 @@
<!-- Class name of the framework account picker activity.
Can be customized for other product types -->
- <string name="config_chooseAccountActivity"
+ <string name="config_chooseAccountActivity" translatable="false"
>android/android.accounts.ChooseAccountActivity</string>
<!-- Class name of the account type and account picker activity.
Can be customized for other product types -->
- <string name="config_chooseTypeAndAccountActivity"
+ <string name="config_chooseTypeAndAccountActivity" translatable="false"
>android/android.accounts.ChooseTypeAndAccountActivity</string>
<!-- Component name of a custom ResolverActivity (Intent resolver) to be used instead of
the default framework version. If left empty, then the framework version will be used.
Example: com.google.android.myapp/.resolver.MyResolverActivity -->
- <string name="config_customResolverActivity"></string>
+ <string name="config_customResolverActivity" translatable="false"></string>
<!-- Name of the activity or service that prompts the user to reject, accept, or whitelist
an adb host's public key, when an unwhitelisted host connects to the local adbd.
@@ -1579,7 +1579,7 @@
>com.android.vpndialogs/com.android.vpndialogs.ConfirmDialog</string>
<!-- Apps that are authorized to access shared accounts, overridden by product overlays -->
- <string name="config_appsAuthorizedForSharedAccounts">;com.android.settings;</string>
+ <string name="config_appsAuthorizedForSharedAccounts" translatable="false">;com.android.settings;</string>
<!-- Flag indicating that the media framework should not allow changes or mute on any
stream or master volumes. -->
diff --git a/docs/html/guide/appendix/glossary.jd b/docs/html/guide/appendix/glossary.jd
index af60eb7..db518f9 100644
--- a/docs/html/guide/appendix/glossary.jd
+++ b/docs/html/guide/appendix/glossary.jd
@@ -94,7 +94,7 @@
Plugin, DDMS is integrated into your development environment. See <a
href="{@docRoot}tools/debugging/ddms.html">Using DDMS</a> to learn more about the program.</dd>
- <dt id="dialog">Dialog</dt> <dd> A floating window that that acts as a lightweight
+ <dt id="dialog">Dialog</dt> <dd> A floating window that acts as a lightweight
form. A dialog can have button controls only and is intended to perform a
simple action (such as button choice) and perhaps return a value. A dialog
is not intended to persist in the history stack, contain complex layout,
diff --git a/docs/html/guide/faq/commontasks.jd b/docs/html/guide/faq/commontasks.jd
index 086721f..2943aef 100644
--- a/docs/html/guide/faq/commontasks.jd
+++ b/docs/html/guide/faq/commontasks.jd
@@ -653,7 +653,7 @@
<p>You can highlight or style the formatting of strings or substrings of text in
a TextView object. There are two ways to do this:</p>
<ul>
- <li>If you use a <a href="{@docRoot}guide/topics/resources/available-resources.html#stringresources">string resource</a>,
+ <li>If you use a <a href="{@docRoot}guide/topics/resources/string-resource.html">string resource</a>,
you can add some simple styling, such as bold or italic using HTML notation.
The currently supported tags are: <code>B</code> (bold),
<code>I</code> (italic), <code>U</code> (underline),
@@ -661,8 +661,8 @@
<code>SUP</code> (superscript), <code>SUB</code> (subscript),
and <code>STRIKE</code> (strikethrough).
So, for example, in res/values/strings.xml you could declare this:<br />
- <code><resource><br />
- <string id="@+id/styled_welcome_message">We
+ <code><resources><br />
+ <string name="styled_welcome_message">We
are <b><i>so</i></b> glad to see you.</string><br />
</resources></code></li>
<li>To style text on the fly, or to add highlighting or more complex styling,
diff --git a/docs/html/guide/topics/graphics/2d-graphics.jd b/docs/html/guide/topics/graphics/2d-graphics.jd
index 4b5a121..9cae53c 100644
--- a/docs/html/guide/topics/graphics/2d-graphics.jd
+++ b/docs/html/guide/topics/graphics/2d-graphics.jd
@@ -228,9 +228,9 @@
<p>The following code snippet demonstrates how to build an {@link android.widget.ImageView} that
uses an image from drawable resources and add it to the layout.</p>
<pre>
- LinearLayout mLinearLayout;
+LinearLayout mLinearLayout;
- protected void onCreate(Bundle savedInstanceState) {
+protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Create a LinearLayout in which to add the ImageView
@@ -241,20 +241,20 @@
i.setImageResource(R.drawable.my_image);
i.setAdjustViewBounds(true); // set the ImageView bounds to match the Drawable's dimensions
i.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT,
- LayoutParams.WRAP_CONTENT));
+ LayoutParams.WRAP_CONTENT));
// Add the ImageView to the layout and set the layout as the content view
mLinearLayout.addView(i);
setContentView(mLinearLayout);
- }
+}
</pre>
<p>In other cases, you may want to handle your image resource as a
{@link android.graphics.drawable.Drawable} object.
To do so, create a Drawable from the resource like so:
<pre>
- Resources res = mContext.getResources();
- Drawable myImage = res.getDrawable(R.drawable.my_image);
- </pre>
+Resources res = mContext.getResources();
+Drawable myImage = res.getDrawable(R.drawable.my_image);
+</pre>
<p class="warning"><strong>Note:</strong> Each unique resource in your project can maintain only
one state, no matter how many different objects you may instantiate for it. For example, if you
@@ -269,12 +269,12 @@
<p>The XML snippet below shows how to add a resource Drawable to an
{@link android.widget.ImageView} in the XML layout (with some red tint just for fun).
<pre>
- <ImageView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:tint="#55ff0000"
- android:src="@drawable/my_image"/>
- </pre>
+<ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:tint="#55ff0000"
+ android:src="@drawable/my_image"/>
+</pre>
<p>For more information on using project resources, read about
<a href="{@docRoot}guide/topics/resources/index.html">Resources and Assets</a>.</p>
@@ -305,22 +305,22 @@
<h4 id="drawable-xml-example">Example</h4>
<p>Here's some XML that defines a TransitionDrawable:</p>
<pre>
- <transition xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:drawable="@drawable/image_expand">
- <item android:drawable="@drawable/image_collapse">
- </transition>
- </pre>
+<transition xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:drawable="@drawable/image_expand">
+ <item android:drawable="@drawable/image_collapse">
+</transition>
+</pre>
<p>With this XML saved in the file <code>res/drawable/expand_collapse.xml</code>,
the following code will instantiate the TransitionDrawable and set it as the content of an
ImageView:</p>
<pre>
- Resources res = mContext.getResources();
- TransitionDrawable transition = (TransitionDrawable)
-res.getDrawable(R.drawable.expand_collapse);
- ImageView image = (ImageView) findViewById(R.id.toggle_image);
- image.setImageDrawable(transition);
- </pre>
+Resources res = mContext.getResources();
+TransitionDrawable transition = (TransitionDrawable)
+ res.getDrawable(R.drawable.expand_collapse);
+ImageView image = (ImageView) findViewById(R.id.toggle_image);
+image.setImageDrawable(transition);
+</pre>
<p>Then this transition can be run forward (for 1 second) with:</p>
<pre>transition.startTransition(1000);</pre>
@@ -337,7 +337,7 @@
primitive shapes and style them in any way imaginable.</p>
<p>A ShapeDrawable is an extension of {@link android.graphics.drawable.Drawable}, so you can use
-one where ever
+one wherever
a Drawable is expected — perhaps for the background of a View, set with
{@link android.view.View#setBackgroundDrawable(android.graphics.drawable.Drawable)
setBackgroundDrawable()}.
@@ -349,27 +349,27 @@
Here's a basic extension of the View class that does just this, to draw a ShapeDrawable as a
View:</p>
<pre>
- public class CustomDrawableView extends View {
- private ShapeDrawable mDrawable;
+public class CustomDrawableView extends View {
+ private ShapeDrawable mDrawable;
- public CustomDrawableView(Context context) {
- super(context);
+ public CustomDrawableView(Context context) {
+ super(context);
- int x = 10;
- int y = 10;
- int width = 300;
- int height = 50;
+ int x = 10;
+ int y = 10;
+ int width = 300;
+ int height = 50;
- mDrawable = new ShapeDrawable(new OvalShape());
- mDrawable.getPaint().setColor(0xff74AC23);
- mDrawable.setBounds(x, y, x + width, y + height);
- }
+ mDrawable = new ShapeDrawable(new OvalShape());
+ mDrawable.getPaint().setColor(0xff74AC23);
+ mDrawable.setBounds(x, y, x + width, y + height);
+ }
- protected void onDraw(Canvas canvas) {
- mDrawable.draw(canvas);
- }
- }
- </pre>
+ protected void onDraw(Canvas canvas) {
+ mDrawable.draw(canvas);
+ }
+}
+</pre>
<p>In the constructor, a ShapeDrawable is defines as an {@link
android.graphics.drawable.shapes.OvalShape}.
@@ -379,15 +379,15 @@
<p>With the custom View defined, it can be drawn any way you like. With the sample above, we can
draw the shape programmatically in an Activity:</p>
<pre>
- CustomDrawableView mCustomDrawableView;
+CustomDrawableView mCustomDrawableView;
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- mCustomDrawableView = new CustomDrawableView(this);
+protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mCustomDrawableView = new CustomDrawableView(this);
- setContentView(mCustomDrawableView);
- }
- </pre>
+ setContentView(mCustomDrawableView);
+}
+</pre>
<p>If you'd like to draw this custom drawable from the XML layout instead of from the Activity,
then the CustomDrawable class must override the {@link
@@ -396,11 +396,11 @@
instantiating a View via inflation from XML. Then add a CustomDrawable element to the XML,
like so:</p>
<pre>
- <com.example.shapedrawable.CustomDrawableView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- />
- </pre>
+<com.example.shapedrawable.CustomDrawableView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ />
+</pre>
<p>The ShapeDrawable class (like many other Drawable types in the {@link
android.graphics.drawable} package)
diff --git a/docs/html/guide/topics/manifest/service-element.jd b/docs/html/guide/topics/manifest/service-element.jd
index 2213b72..e26f263 100644
--- a/docs/html/guide/topics/manifest/service-element.jd
+++ b/docs/html/guide/topics/manifest/service-element.jd
@@ -138,7 +138,7 @@
</p></dd>
<dt><a name="prmsn"></a>{@code android:permission}</dt>
-<dd>The name of a permission that that an entity must have in order to
+<dd>The name of a permission that an entity must have in order to
launch the service or bind to it. If a caller of
<code>{@link android.content.Context#startService startService()}</code>,
<code>{@link android.content.Context#bindService bindService()}</code>, or
@@ -156,7 +156,7 @@
<p>
For more information on permissions, see the
-<a href="{@docRoot}guide/topics/manifest/manifest-intro.html#sectperm">Permissions</a>
+<a href="{@docRoot}guide/topics/manifest/manifest-intro.html#perms">Permissions</a>
section in the introduction and a separate document,
<a href="{@docRoot}guide/topics/security/security.html">Security and Permissions</a>.
</p></dd>
diff --git a/docs/html/guide/topics/search/searchable-config.jd b/docs/html/guide/topics/search/searchable-config.jd
index fc13c04..e38024c 100644
--- a/docs/html/guide/topics/search/searchable-config.jd
+++ b/docs/html/guide/topics/search/searchable-config.jd
@@ -329,7 +329,7 @@
<dt><code>android:suggestActionMsg</code></dt>
<dd><em>String</em>. An action message to be sent if the action key is pressed while a
suggestion is in focus. This is added to the
- intent that that the system passes to your searchable activity (using the action
+ intent that the system passes to your searchable activity (using the action
you've defined for the suggestion). To examine the string,
use {@link android.content.Intent#getStringExtra
getStringExtra(SearchManager.ACTION_MSG)}. This should only be used if all your
diff --git a/docs/html/guide/topics/ui/settings.jd b/docs/html/guide/topics/ui/settings.jd
index f454c4e..02f1255 100644
--- a/docs/html/guide/topics/ui/settings.jd
+++ b/docs/html/guide/topics/ui/settings.jd
@@ -801,7 +801,7 @@
<h3 id="Listening">Listening for preference changes</h3>
-<p>There are several reasons you might want to be notified as soon as the use changes one of the
+<p>There are several reasons you might want to be notified as soon as the user changes one of the
preferences. In order to receive a callback when a change happens to any one of the preferences,
implement the {@link android.content.SharedPreferences.OnSharedPreferenceChangeListener
SharedPreference.OnSharedPreferenceChangeListener} interface and register the listener for the
diff --git a/docs/html/reference/com/google/android/gms/cast/MediaMetadata.html b/docs/html/reference/com/google/android/gms/cast/MediaMetadata.html
index 81de8cc..140f63b 100644
--- a/docs/html/reference/com/google/android/gms/cast/MediaMetadata.html
+++ b/docs/html/reference/com/google/android/gms/cast/MediaMetadata.html
@@ -1037,7 +1037,7 @@
<tr class="alt-color api apilevel-" >
<td class="jd-typecol">int</td>
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/cast/MediaMetadata.html#MEDIA_TYPE_TV_SHOW">MEDIA_TYPE_TV_SHOW</a></td>
- <td class="jd-descrcol" width="100%">A media type representing an TV show.</td>
+ <td class="jd-descrcol" width="100%">A media type representing a TV show.</td>
</tr>
@@ -2696,7 +2696,7 @@
</div>
<div class="jd-details-descr">
- <div class="jd-tagdata jd-tagdescr"><p>A media type representing an TV show. </p></div>
+ <div class="jd-tagdata jd-tagdescr"><p>A media type representing a TV show. </p></div>
<div class="jd-tagdata">
diff --git a/docs/html/reference/com/google/android/gms/location/LocationRequest.html b/docs/html/reference/com/google/android/gms/location/LocationRequest.html
index a34975a..c1a44e0 100644
--- a/docs/html/reference/com/google/android/gms/location/LocationRequest.html
+++ b/docs/html/reference/com/google/android/gms/location/LocationRequest.html
@@ -2480,7 +2480,7 @@
<p>This interval is inexact. You may not receive updates at all (if no location sources
are available), or you may receive them slower than requested. You may also receive them
faster than requested (if other applications are requesting location at a faster interval).
- The fastest rate that that you will receive updates can be controlled with
+ The fastest rate that you will receive updates can be controlled with
<code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setFastestInterval(long)">setFastestInterval(long)</a></code>. By default this fastest rate is 6x the interval frequency.
<p>Applications with only the coarse location permission may have their interval silently
diff --git a/docs/html/tools/debugging/ddms.jd b/docs/html/tools/debugging/ddms.jd
index d2fb47a..1b59875 100644
--- a/docs/html/tools/debugging/ddms.jd
+++ b/docs/html/tools/debugging/ddms.jd
@@ -140,7 +140,7 @@
<li>Click <strong>Get Allocations</strong> to see a list of objects that have been allocated
since you clicked on the <strong>Start Tracking</strong> button. You can click on <strong>Get
- Allocations</strong> again to append to the list new objects that that have been
+ Allocations</strong> again to append to the list new objects that have been
allocated.</li>
<li>To stop tracking or to clear the data and start over, click the <strong>Stop Tracking
diff --git a/docs/html/tools/help/monkey.jd b/docs/html/tools/help/monkey.jd
index b6300a7..941f5d9 100644
--- a/docs/html/tools/help/monkey.jd
+++ b/docs/html/tools/help/monkey.jd
@@ -12,7 +12,7 @@
<a name="overview"></a>
<h2>Overview</h2>
-<p>The Monkey is a command-line tool that that you can run on any emulator
+<p>The Monkey is a command-line tool that you can run on any emulator
instance or on a device. It sends a pseudo-random stream of
user events into the system, which acts as a stress test on the application software you are
developing.</p>
diff --git a/docs/html/tools/testing/testing_eclipse.jd b/docs/html/tools/testing/testing_eclipse.jd
index 7d3be47..6c9d55b 100644
--- a/docs/html/tools/testing/testing_eclipse.jd
+++ b/docs/html/tools/testing/testing_eclipse.jd
@@ -218,7 +218,7 @@
<p>
Another useful convention is to add the method <code>testPreconditions()</code> to your test
class. Use this method to test that the application under test is initialized correctly. If this
- test fails, you know that that the initial conditions were in error. When this happens, further
+ test fails, you know that the initial conditions were in error. When this happens, further
test results are suspect, regardless of whether or not the tests succeeded.
</p>
<p>
diff --git a/docs/html/tools/testing/testing_otheride.jd b/docs/html/tools/testing/testing_otheride.jd
index 9484158..a774087 100644
--- a/docs/html/tools/testing/testing_otheride.jd
+++ b/docs/html/tools/testing/testing_otheride.jd
@@ -281,7 +281,7 @@
<p>
Another useful convention is to add the method <code>testPreConditions()</code> to your test
class. Use this method to test that the application under test is initialized correctly. If this
- test fails, you know that that the initial conditions were in error. When this happens, further
+ test fails, you know that the initial conditions were in error. When this happens, further
test results are suspect, regardless of whether or not the tests succeeded.
</p>
<p>
diff --git a/docs/html/wear/design/index.jd b/docs/html/wear/design/index.jd
index 247cc87..e01d17f 100644
--- a/docs/html/wear/design/index.jd
+++ b/docs/html/wear/design/index.jd
@@ -164,7 +164,7 @@
<img src="{@docRoot}wear/images/circle_voice_B.png" height="200" style="float:right;margin:0 0 20px 40px" />
<img src="{@docRoot}wear/images/circle_voice_A.png" height="200" style="float:right;margin:0 0 20px 40px" />
-<p>Voice replies are primarily used by messaging applications to provide a hands-free way of dictating a short message. You can also provide a up to five suggested replies or “canned responses” that are useful in a wide range of cases. These canned responses can be tapped by the user, allowing for a fast method of sending simple replies in cases where speaking may not be desirable.</p>
+<p>Voice replies are primarily used by messaging applications to provide a hands-free way of dictating a short message. You can also provide up to five suggested replies or “canned responses” that are useful in a wide range of cases. These canned responses can be tapped by the user, allowing for a fast method of sending simple replies in cases where speaking may not be desirable.</p>
<p>You should attempt to cover a range of simple, neutral replies in your choices. Longer voice replies may be automatically truncated in the Voice reply UI.</p>
diff --git a/graphics/java/android/graphics/drawable/GradientDrawable.java b/graphics/java/android/graphics/drawable/GradientDrawable.java
index cd6297b..3092f96 100644
--- a/graphics/java/android/graphics/drawable/GradientDrawable.java
+++ b/graphics/java/android/graphics/drawable/GradientDrawable.java
@@ -489,9 +489,9 @@
/**
* <p>Sets the colors used to draw the gradient. Each color is specified as an
* ARGB integer and the array must contain at least 2 colors.</p>
- * <p><strong>Note</strong>: changing orientation will affect all instances
+ * <p><strong>Note</strong>: changing colors will affect all instances
* of a drawable loaded from a resource. It is recommended to invoke
- * {@link #mutate()} before changing the orientation.</p>
+ * {@link #mutate()} before changing the colors.</p>
*
* @param colors 2 or more ARGB colors
*
diff --git a/include/androidfw/ResourceTypes.h b/include/androidfw/ResourceTypes.h
index c65efe4..605cae6 100644
--- a/include/androidfw/ResourceTypes.h
+++ b/include/androidfw/ResourceTypes.h
@@ -693,25 +693,25 @@
// These are available for all nodes:
int32_t getCommentID() const;
- const uint16_t* getComment(size_t* outLen) const;
+ const char16_t* getComment(size_t* outLen) const;
uint32_t getLineNumber() const;
// This is available for TEXT:
int32_t getTextID() const;
- const uint16_t* getText(size_t* outLen) const;
+ const char16_t* getText(size_t* outLen) const;
ssize_t getTextValue(Res_value* outValue) const;
// These are available for START_NAMESPACE and END_NAMESPACE:
int32_t getNamespacePrefixID() const;
- const uint16_t* getNamespacePrefix(size_t* outLen) const;
+ const char16_t* getNamespacePrefix(size_t* outLen) const;
int32_t getNamespaceUriID() const;
- const uint16_t* getNamespaceUri(size_t* outLen) const;
+ const char16_t* getNamespaceUri(size_t* outLen) const;
// These are available for START_TAG and END_TAG:
int32_t getElementNamespaceID() const;
- const uint16_t* getElementNamespace(size_t* outLen) const;
+ const char16_t* getElementNamespace(size_t* outLen) const;
int32_t getElementNameID() const;
- const uint16_t* getElementName(size_t* outLen) const;
+ const char16_t* getElementName(size_t* outLen) const;
// Remaining methods are for retrieving information about attributes
// associated with a START_TAG:
@@ -720,10 +720,10 @@
// Returns -1 if no namespace, -2 if idx out of range.
int32_t getAttributeNamespaceID(size_t idx) const;
- const uint16_t* getAttributeNamespace(size_t idx, size_t* outLen) const;
+ const char16_t* getAttributeNamespace(size_t idx, size_t* outLen) const;
int32_t getAttributeNameID(size_t idx) const;
- const uint16_t* getAttributeName(size_t idx, size_t* outLen) const;
+ const char16_t* getAttributeName(size_t idx, size_t* outLen) const;
uint32_t getAttributeNameResID(size_t idx) const;
// These will work only if the underlying string pool is UTF-8.
@@ -731,7 +731,7 @@
const char* getAttributeName8(size_t idx, size_t* outLen) const;
int32_t getAttributeValueStringID(size_t idx) const;
- const uint16_t* getAttributeStringValue(size_t idx, size_t* outLen) const;
+ const char16_t* getAttributeStringValue(size_t idx, size_t* outLen) const;
int32_t getAttributeDataType(size_t idx) const;
int32_t getAttributeData(size_t idx) const;
@@ -1670,7 +1670,7 @@
size_t defPackageLen = 0,
uint32_t* outTypeSpecFlags = NULL) const;
- static bool expandResourceRef(const uint16_t* refStr, size_t refLen,
+ static bool expandResourceRef(const char16_t* refStr, size_t refLen,
String16* outPackage,
String16* outType,
String16* outName,
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
index 690b1d6..9e592c4 100644
--- a/libs/androidfw/ResourceTypes.cpp
+++ b/libs/androidfw/ResourceTypes.cpp
@@ -87,9 +87,9 @@
// range checked; guaranteed to NUL-terminate within the stated number of available slots
// NOTE: if this truncates the dst string due to running out of space, no attempt is
// made to avoid splitting surrogate pairs.
-static void strcpy16_dtoh(uint16_t* dst, const uint16_t* src, size_t avail)
+static void strcpy16_dtoh(char16_t* dst, const char16_t* src, size_t avail)
{
- uint16_t* last = dst + avail - 1;
+ char16_t* last = dst + avail - 1;
while (*src && (dst < last)) {
char16_t s = dtohs(*src);
*dst++ = s;
@@ -689,7 +689,7 @@
return len;
}
-const uint16_t* ResStringPool::stringAt(size_t idx, size_t* u16len) const
+const char16_t* ResStringPool::stringAt(size_t idx, size_t* u16len) const
{
if (mError == NO_ERROR && idx < mHeader->stringCount) {
const bool isUTF8 = (mHeader->flags&ResStringPool_header::UTF8_FLAG) != 0;
@@ -1013,7 +1013,7 @@
return mCurNode != NULL ? dtohl(mCurNode->comment.index) : -1;
}
-const uint16_t* ResXMLParser::getComment(size_t* outLen) const
+const char16_t* ResXMLParser::getComment(size_t* outLen) const
{
int32_t id = getCommentID();
return id >= 0 ? mTree.mStrings.stringAt(id, outLen) : NULL;
@@ -1032,7 +1032,7 @@
return -1;
}
-const uint16_t* ResXMLParser::getText(size_t* outLen) const
+const char16_t* ResXMLParser::getText(size_t* outLen) const
{
int32_t id = getTextID();
return id >= 0 ? mTree.mStrings.stringAt(id, outLen) : NULL;
@@ -1055,7 +1055,7 @@
return -1;
}
-const uint16_t* ResXMLParser::getNamespacePrefix(size_t* outLen) const
+const char16_t* ResXMLParser::getNamespacePrefix(size_t* outLen) const
{
int32_t id = getNamespacePrefixID();
//printf("prefix=%d event=%p\n", id, mEventCode);
@@ -1070,7 +1070,7 @@
return -1;
}
-const uint16_t* ResXMLParser::getNamespaceUri(size_t* outLen) const
+const char16_t* ResXMLParser::getNamespaceUri(size_t* outLen) const
{
int32_t id = getNamespaceUriID();
//printf("uri=%d event=%p\n", id, mEventCode);
@@ -1088,7 +1088,7 @@
return -1;
}
-const uint16_t* ResXMLParser::getElementNamespace(size_t* outLen) const
+const char16_t* ResXMLParser::getElementNamespace(size_t* outLen) const
{
int32_t id = getElementNamespaceID();
return id >= 0 ? mTree.mStrings.stringAt(id, outLen) : NULL;
@@ -1105,7 +1105,7 @@
return -1;
}
-const uint16_t* ResXMLParser::getElementName(size_t* outLen) const
+const char16_t* ResXMLParser::getElementName(size_t* outLen) const
{
int32_t id = getElementNameID();
return id >= 0 ? mTree.mStrings.stringAt(id, outLen) : NULL;
@@ -1134,7 +1134,7 @@
return -2;
}
-const uint16_t* ResXMLParser::getAttributeNamespace(size_t idx, size_t* outLen) const
+const char16_t* ResXMLParser::getAttributeNamespace(size_t idx, size_t* outLen) const
{
int32_t id = getAttributeNamespaceID(idx);
//printf("attribute namespace=%d idx=%d event=%p\n", id, idx, mEventCode);
@@ -1165,7 +1165,7 @@
return -1;
}
-const uint16_t* ResXMLParser::getAttributeName(size_t idx, size_t* outLen) const
+const char16_t* ResXMLParser::getAttributeName(size_t idx, size_t* outLen) const
{
int32_t id = getAttributeNameID(idx);
//printf("attribute name=%d idx=%d event=%p\n", id, idx, mEventCode);
@@ -1205,7 +1205,7 @@
return -1;
}
-const uint16_t* ResXMLParser::getAttributeStringValue(size_t idx, size_t* outLen) const
+const char16_t* ResXMLParser::getAttributeStringValue(size_t idx, size_t* outLen) const
{
int32_t id = getAttributeValueStringID(idx);
//XML_NOISY(printf("getAttributeValue 0x%x=0x%x\n", idx, id));
@@ -4235,7 +4235,7 @@
return 0;
}
-bool ResTable::expandResourceRef(const uint16_t* refStr, size_t refLen,
+bool ResTable::expandResourceRef(const char16_t* refStr, size_t refLen,
String16* outPackage,
String16* outType,
String16* outName,
diff --git a/libs/androidfw/ZipFileRO.cpp b/libs/androidfw/ZipFileRO.cpp
index 1ab18ad..5f6e831 100644
--- a/libs/androidfw/ZipFileRO.cpp
+++ b/libs/androidfw/ZipFileRO.cpp
@@ -50,7 +50,10 @@
ZipEntryName name;
void *cookie;
- _ZipEntryRO() : cookie(NULL) {
+ _ZipEntryRO() : cookie(NULL) {}
+
+ ~_ZipEntryRO() {
+ EndIteration(cookie);
}
private:
@@ -83,15 +86,15 @@
ZipEntryRO ZipFileRO::findEntryByName(const char* entryName) const
{
_ZipEntryRO* data = new _ZipEntryRO;
- const int32_t error = FindEntry(mHandle, entryName, &(data->entry));
+
+ data->name = ZipEntryName(entryName);
+
+ const int32_t error = FindEntry(mHandle, data->name, &(data->entry));
if (error) {
delete data;
return NULL;
}
- data->name.name = entryName;
- data->name.name_length = strlen(entryName);
-
return (ZipEntryRO) data;
}
diff --git a/location/java/android/location/LocationRequest.java b/location/java/android/location/LocationRequest.java
index 271f2bb..39fe4ea 100644
--- a/location/java/android/location/LocationRequest.java
+++ b/location/java/android/location/LocationRequest.java
@@ -292,7 +292,7 @@
* no location sources are available), or you may receive them
* slower than requested. You may also receive them faster than
* requested (if other applications are requesting location at a
- * faster interval). The fastest rate that that you will receive
+ * faster interval). The fastest rate that you will receive
* updates can be controlled with {@link #setFastestInterval}.
*
* <p>Applications with only the coarse location permission may have their
diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
index dce5c37..f804736 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
@@ -28,6 +28,7 @@
import android.os.UserHandle;
import android.os.storage.StorageEventListener;
import android.os.storage.StorageManager;
+import android.os.storage.StorageVolume;
import android.provider.Settings;
import android.util.Log;
@@ -198,6 +199,8 @@
*/
Intent intent = new Intent();
intent.setClass(mContext, com.android.internal.app.ExternalMediaFormatActivity.class);
+ intent.putExtra(StorageVolume.EXTRA_STORAGE_VOLUME,
+ getVolumeByPath(mStorageManager.getVolumeList(), path));
PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0);
setMediaStorageNotification(
@@ -212,6 +215,8 @@
*/
Intent intent = new Intent();
intent.setClass(mContext, com.android.internal.app.ExternalMediaFormatActivity.class);
+ intent.putExtra(StorageVolume.EXTRA_STORAGE_VOLUME,
+ getVolumeByPath(mStorageManager.getVolumeList(), path));
PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0);
setMediaStorageNotification(
@@ -247,6 +252,19 @@
}
/**
+ * Get the corresponding StorageVolume object for a specific path.
+ */
+ private final StorageVolume getVolumeByPath(StorageVolume[] volumes, String path) {
+ for (StorageVolume volume : volumes) {
+ if (volume.getPath().equals(path)) {
+ return volume;
+ }
+ }
+ Log.w(TAG, "No storage found");
+ return null;
+ }
+
+ /**
* Update the state of the USB mass storage notification
*/
void updateUsbMassStorageNotification(boolean available) {
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 02adef4..983f768 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -3915,7 +3915,7 @@
topIsFullscreen = (fl & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0
|| (mLastSystemUiFlags & View.SYSTEM_UI_FLAG_FULLSCREEN) != 0;
// The subtle difference between the window for mTopFullscreenOpaqueWindowState
- // and mTopIsFullscreen is that that mTopIsFullscreen is set only if the window
+ // and mTopIsFullscreen is that mTopIsFullscreen is set only if the window
// has the FLAG_FULLSCREEN set. Not sure if there is another way that to be the
// case though.
if (mStatusBarController.isTransientShowing()) {
diff --git a/rs/java/android/renderscript/RenderScript.java b/rs/java/android/renderscript/RenderScript.java
index 6c5c508..2ee4ff2 100644
--- a/rs/java/android/renderscript/RenderScript.java
+++ b/rs/java/android/renderscript/RenderScript.java
@@ -605,52 +605,14 @@
validate();
rsnScriptInvoke(mContext, id, slot);
}
- native void rsnScriptForEach(long con, long id, int slot, long ain, long aout, byte[] params);
- native void rsnScriptForEach(long con, long id, int slot, long ain, long aout);
- native void rsnScriptForEachClipped(long con, long id, int slot, long ain, long aout, byte[] params,
- int xstart, int xend, int ystart, int yend, int zstart, int zend);
- native void rsnScriptForEachClipped(long con, long id, int slot, long ain, long aout,
- int xstart, int xend, int ystart, int yend, int zstart, int zend);
- synchronized void nScriptForEach(long id, int slot, long ain, long aout, byte[] params) {
+
+ native void rsnScriptForEach(long con, long id, int slot, long[] ains,
+ long aout, byte[] params, int[] limits);
+
+ synchronized void nScriptForEach(long id, int slot, long[] ains, long aout,
+ byte[] params, int[] limits) {
validate();
- if (params == null) {
- rsnScriptForEach(mContext, id, slot, ain, aout);
- } else {
- rsnScriptForEach(mContext, id, slot, ain, aout, params);
- }
- }
-
- synchronized void nScriptForEachClipped(long id, int slot, long ain, long aout, byte[] params,
- int xstart, int xend, int ystart, int yend, int zstart, int zend) {
- validate();
- if (params == null) {
- rsnScriptForEachClipped(mContext, id, slot, ain, aout, xstart, xend, ystart, yend, zstart, zend);
- } else {
- rsnScriptForEachClipped(mContext, id, slot, ain, aout, params, xstart, xend, ystart, yend, zstart, zend);
- }
- }
-
- /**
- * Multi-input code.
- *
- */
-
- // @hide
- native void rsnScriptForEachMultiClipped(long con, long id, int slot, long[] ains, long aout, byte[] params,
- int xstart, int xend, int ystart, int yend, int zstart, int zend);
- // @hide
- native void rsnScriptForEachMultiClipped(long con, long id, int slot, long[] ains, long aout,
- int xstart, int xend, int ystart, int yend, int zstart, int zend);
-
- // @hide
- synchronized void nScriptForEachMultiClipped(long id, int slot, long[] ains, long aout, byte[] params,
- int xstart, int xend, int ystart, int yend, int zstart, int zend) {
- validate();
- if (params == null) {
- rsnScriptForEachMultiClipped(mContext, id, slot, ains, aout, xstart, xend, ystart, yend, zstart, zend);
- } else {
- rsnScriptForEachMultiClipped(mContext, id, slot, ains, aout, params, xstart, xend, ystart, yend, zstart, zend);
- }
+ rsnScriptForEach(mContext, id, slot, ains, aout, params, limits);
}
native void rsnScriptInvokeV(long con, long id, int slot, byte[] params);
diff --git a/rs/java/android/renderscript/Script.java b/rs/java/android/renderscript/Script.java
index c49ef94..eb1687a 100644
--- a/rs/java/android/renderscript/Script.java
+++ b/rs/java/android/renderscript/Script.java
@@ -48,7 +48,8 @@
/**
* Only to be used by generated reflected classes.
*/
- protected KernelID createKernelID(int slot, int sig, Element ein, Element eout) {
+ protected KernelID createKernelID(int slot, int sig, Element ein,
+ Element eout) {
KernelID k = mKIDs.get(slot);
if (k != null) {
return k;
@@ -127,59 +128,56 @@
* Only intended for use by generated reflected code.
*
*/
- 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.");
- }
- long in_id = 0;
- if (ain != null) {
- in_id = ain.getID(mRS);
- }
- long out_id = 0;
- if (aout != null) {
- out_id = aout.getID(mRS);
- }
- byte[] params = null;
- if (v != null) {
- params = v.getData();
- }
- mRS.nScriptForEach(getID(mRS), slot, in_id, out_id, params);
+ protected void forEach(int slot, Allocation ain, Allocation aout,
+ FieldPacker v) {
+ forEach(slot, ain, aout, v, null);
}
/**
* Only intended for use by generated reflected code.
*
*/
- protected void forEach(int slot, Allocation ain, Allocation aout, FieldPacker v, LaunchOptions sc) {
+ protected void forEach(int slot, Allocation ain, Allocation aout,
+ FieldPacker v, LaunchOptions sc) {
+ // TODO: Is this necessary if nScriptForEach calls validate as well?
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.");
}
- if (sc == null) {
- forEach(slot, ain, aout, v);
- return;
- }
- long in_id = 0;
+ long[] in_ids = null;
if (ain != null) {
- in_id = ain.getID(mRS);
+ in_ids = mInIdsBuffer;
+ in_ids[0] = ain.getID(mRS);
}
+
long out_id = 0;
if (aout != null) {
out_id = aout.getID(mRS);
}
+
byte[] params = null;
if (v != null) {
params = v.getData();
}
- mRS.nScriptForEachClipped(getID(mRS), slot, in_id, out_id, params, sc.xstart, sc.xend, sc.ystart, sc.yend, sc.zstart, sc.zend);
+
+ int[] limits = null;
+ if (sc != null) {
+ limits = new int[6];
+
+ limits[0] = sc.xstart;
+ limits[1] = sc.xend;
+ limits[2] = sc.ystart;
+ limits[3] = sc.yend;
+ limits[4] = sc.zstart;
+ limits[5] = sc.zend;
+ }
+
+ mRS.nScriptForEach(getID(mRS), slot, in_ids, out_id, params, limits);
}
/**
@@ -187,8 +185,9 @@
*
* @hide
*/
- protected void forEach(int slot, Allocation[] ains, Allocation aout, FieldPacker v) {
- forEach(slot, ains, aout, v, new LaunchOptions());
+ protected void forEach(int slot, Allocation[] ains, Allocation aout,
+ FieldPacker v) {
+ forEach(slot, ains, aout, v, null);
}
/**
@@ -196,24 +195,20 @@
*
* @hide
*/
- protected void forEach(int slot, Allocation[] ains, Allocation aout, FieldPacker v, LaunchOptions sc) {
+ protected void forEach(int slot, Allocation[] ains, Allocation aout,
+ FieldPacker v, LaunchOptions sc) {
+ // TODO: Is this necessary if nScriptForEach calls validate as well?
mRS.validate();
-
for (Allocation ain : ains) {
mRS.validateObject(ain);
}
-
mRS.validateObject(aout);
+
if (ains == null && aout == null) {
throw new RSIllegalArgumentException(
"At least one of ain or aout is required to be non-null.");
}
- if (sc == null) {
- forEach(slot, ains, aout, v);
- return;
- }
-
long[] in_ids = new long[ains.length];
for (int index = 0; index < ains.length; ++index) {
in_ids[index] = ains[index].getID(mRS);
@@ -223,15 +218,33 @@
if (aout != null) {
out_id = aout.getID(mRS);
}
+
byte[] params = null;
if (v != null) {
params = v.getData();
}
- mRS.nScriptForEachMultiClipped(getID(mRS), slot, in_ids, out_id, params, sc.xstart, sc.xend, sc.ystart, sc.yend, sc.zstart, sc.zend);
+
+ int[] limits = null;
+ if (sc != null) {
+ limits = new int[6];
+
+ limits[0] = sc.xstart;
+ limits[1] = sc.xend;
+ limits[2] = sc.ystart;
+ limits[3] = sc.yend;
+ limits[4] = sc.zstart;
+ limits[5] = sc.zend;
+ }
+
+ mRS.nScriptForEach(getID(mRS), slot, in_ids, out_id, params, limits);
}
+ long[] mInIdsBuffer;
+
Script(long id, RenderScript rs) {
super(id, rs);
+
+ mInIdsBuffer = new long[1];
}
@@ -243,11 +256,17 @@
mRS.validate();
mRS.validateObject(va);
if (va != null) {
- if (mRS.getApplicationContext().getApplicationInfo().targetSdkVersion >= 20) {
+
+ android.content.Context context = mRS.getApplicationContext();
+
+ if (context.getApplicationInfo().targetSdkVersion >= 20) {
final Type t = va.mType;
- if (t.hasMipmaps() || t.hasFaces() || (t.getY() != 0) || (t.getZ() != 0)) {
+ if (t.hasMipmaps() || t.hasFaces() || (t.getY() != 0) ||
+ (t.getZ() != 0)) {
+
throw new RSIllegalArgumentException(
- "API 20+ only allows simple 1D allocations to be used with bind.");
+ "API 20+ only allows simple 1D allocations to be " +
+ "used with bind.");
}
}
mRS.nScriptBindAllocation(getID(mRS), va.getID(mRS), slot);
@@ -378,11 +397,14 @@
protected Allocation mAllocation;
protected void init(RenderScript rs, int dimx) {
- mAllocation = Allocation.createSized(rs, mElement, dimx, Allocation.USAGE_SCRIPT);
+ mAllocation = Allocation.createSized(rs, mElement, dimx,
+ Allocation.USAGE_SCRIPT);
}
protected void init(RenderScript rs, int dimx, int usages) {
- mAllocation = Allocation.createSized(rs, mElement, dimx, Allocation.USAGE_SCRIPT | usages);
+ mAllocation =
+ Allocation.createSized(rs, mElement, dimx,
+ Allocation.USAGE_SCRIPT | usages);
}
protected FieldBase() {
diff --git a/rs/jni/Android.mk b/rs/jni/Android.mk
index f1ddc07..f2c2e98 100644
--- a/rs/jni/Android.mk
+++ b/rs/jni/Android.mk
@@ -25,7 +25,7 @@
frameworks/rs \
$(rs_generated_include_dir)
-LOCAL_CFLAGS += -Wno-unused-parameter
+LOCAL_CFLAGS += -Wno-unused-parameter -std=c++11
LOCAL_ADDITIONAL_DEPENDENCIES := $(addprefix $(rs_generated_include_dir)/,rsgApiFuncDecl.h)
LOCAL_MODULE:= librs_jni
diff --git a/rs/jni/android_renderscript_RenderScript.cpp b/rs/jni/android_renderscript_RenderScript.cpp
index 13a649a..2d94131 100644
--- a/rs/jni/android_renderscript_RenderScript.cpp
+++ b/rs/jni/android_renderscript_RenderScript.cpp
@@ -49,7 +49,7 @@
#define PER_ARRAY_TYPE(flag, fnc, readonly, ...) { \
jint len = 0; \
- void *ptr = NULL; \
+ void *ptr = nullptr; \
size_t typeBytes = 0; \
jint relFlag = 0; \
if (readonly) { \
@@ -112,7 +112,7 @@
class AutoJavaStringToUTF8 {
public:
AutoJavaStringToUTF8(JNIEnv* env, jstring str) : fEnv(env), fJStr(str) {
- fCStr = env->GetStringUTFChars(str, NULL);
+ fCStr = env->GetStringUTFChars(str, nullptr);
fLength = env->GetStringUTFLength(str);
}
~AutoJavaStringToUTF8() {
@@ -132,14 +132,14 @@
public:
AutoJavaStringArrayToUTF8(JNIEnv* env, jobjectArray strings, jsize stringsLength)
: mEnv(env), mStrings(strings), mStringsLength(stringsLength) {
- mCStrings = NULL;
- mSizeArray = NULL;
+ mCStrings = nullptr;
+ mSizeArray = nullptr;
if (stringsLength > 0) {
mCStrings = (const char **)calloc(stringsLength, sizeof(char *));
mSizeArray = (size_t*)calloc(stringsLength, sizeof(size_t));
for (jsize ct = 0; ct < stringsLength; ct ++) {
jstring s = (jstring)mEnv->GetObjectArrayElement(mStrings, ct);
- mCStrings[ct] = mEnv->GetStringUTFChars(s, NULL);
+ mCStrings[ct] = mEnv->GetStringUTFChars(s, nullptr);
mSizeArray[ct] = mEnv->GetStringUTFLength(s);
}
}
@@ -201,10 +201,10 @@
nGetName(JNIEnv *_env, jobject _this, jlong con, jlong obj)
{
LOG_API("nGetName, con(%p), obj(%p)", (RsContext)con, (void *)obj);
- const char *name = NULL;
+ const char *name = nullptr;
rsaGetName((RsContext)con, (void *)obj, &name);
- if(name == NULL || strlen(name) == 0) {
- return NULL;
+ if(name == nullptr || strlen(name) == 0) {
+ return nullptr;
}
return _env->NewStringUTF(name);
}
@@ -284,8 +284,8 @@
{
LOG_API("nContextSetSurface, con(%p), width(%i), height(%i), surface(%p)", (RsContext)con, width, height, (Surface *)wnd);
- ANativeWindow * window = NULL;
- if (wnd == NULL) {
+ ANativeWindow * window = nullptr;
+ if (wnd == nullptr) {
} else {
window = android_view_Surface_getNativeWindow(_env, wnd).get();
@@ -346,7 +346,7 @@
{
jint len = _env->GetArrayLength(data);
LOG_API("nContextGetMessage, con(%p), len(%i)", (RsContext)con, len);
- jint *ptr = _env->GetIntArrayElements(data, NULL);
+ jint *ptr = _env->GetIntArrayElements(data, nullptr);
size_t receiveLen;
uint32_t subID;
int id = rsContextGetMessage((RsContext)con,
@@ -364,7 +364,7 @@
nContextPeekMessage(JNIEnv *_env, jobject _this, jlong con, jintArray auxData)
{
LOG_API("nContextPeekMessage, con(%p)", (RsContext)con);
- jint *auxDataPtr = _env->GetIntArrayElements(auxData, NULL);
+ jint *auxDataPtr = _env->GetIntArrayElements(auxData, nullptr);
size_t receiveLen;
uint32_t subID;
int id = rsContextPeekMessage((RsContext)con, &receiveLen, sizeof(receiveLen),
@@ -390,11 +390,11 @@
static void
nContextSendMessage(JNIEnv *_env, jobject _this, jlong con, jint id, jintArray data)
{
- jint *ptr = NULL;
+ jint *ptr = nullptr;
jint len = 0;
if (data) {
len = _env->GetArrayLength(data);
- ptr = _env->GetIntArrayElements(data, NULL);
+ ptr = _env->GetIntArrayElements(data, nullptr);
}
LOG_API("nContextSendMessage, con(%p), id(%i), len(%i)", (RsContext)con, id, len);
rsContextSendMessage((RsContext)con, id, (const uint8_t *)ptr, len * sizeof(int));
@@ -419,8 +419,8 @@
int fieldCount = _env->GetArrayLength(_ids);
LOG_API("nElementCreate2, con(%p)", (RsContext)con);
- jlong *jIds = _env->GetLongArrayElements(_ids, NULL);
- jint *jArraySizes = _env->GetIntArrayElements(_arraySizes, NULL);
+ jlong *jIds = _env->GetLongArrayElements(_ids, nullptr);
+ jint *jArraySizes = _env->GetIntArrayElements(_arraySizes, nullptr);
RsElement *ids = (RsElement*)malloc(fieldCount * sizeof(RsElement));
uint32_t *arraySizes = (uint32_t *)malloc(fieldCount * sizeof(uint32_t));
@@ -549,7 +549,7 @@
IGraphicBufferProducer *v = (IGraphicBufferProducer *)rsAllocationGetSurface((RsContext)con, (RsAllocation)a);
sp<IGraphicBufferProducer> bp = v;
- v->decStrong(NULL);
+ v->decStrong(nullptr);
jobject o = android_view_Surface_createFromIGraphicBufferProducer(_env, bp);
return o;
@@ -685,7 +685,7 @@
RsAllocation *alloc = (RsAllocation *)_alloc;
LOG_API("nAllocation1DData, con(%p), adapter(%p), offset(%i), count(%i), sizeBytes(%i), dataType(%i)",
(RsContext)con, (RsAllocation)alloc, offset, count, sizeBytes, dataType);
- PER_ARRAY_TYPE(NULL, rsAllocation1DData, true, (RsContext)con, alloc, offset, lod, count, ptr, sizeBytes);
+ PER_ARRAY_TYPE(nullptr, rsAllocation1DData, true, (RsContext)con, alloc, offset, lod, count, ptr, sizeBytes);
}
// Copies from the Java array data into the Allocation pointed to by alloc.
@@ -695,7 +695,7 @@
{
jint len = _env->GetArrayLength(data);
LOG_API("nAllocationElementData1D, con(%p), alloc(%p), offset(%i), comp(%i), len(%i), sizeBytes(%i)", (RsContext)con, (RsAllocation)alloc, offset, compIdx, len, sizeBytes);
- jbyte *ptr = _env->GetByteArrayElements(data, NULL);
+ jbyte *ptr = _env->GetByteArrayElements(data, nullptr);
rsAllocation1DElementData((RsContext)con, (RsAllocation)alloc, offset, lod, ptr, sizeBytes, compIdx);
_env->ReleaseByteArrayElements(data, ptr, JNI_ABORT);
}
@@ -709,7 +709,7 @@
RsAllocationCubemapFace face = (RsAllocationCubemapFace)_face;
LOG_API("nAllocation2DData, con(%p), adapter(%p), xoff(%i), yoff(%i), w(%i), h(%i), len(%i) type(%i)",
(RsContext)con, alloc, xoff, yoff, w, h, sizeBytes, dataType);
- PER_ARRAY_TYPE(NULL, rsAllocation2DData, true, (RsContext)con, alloc, xoff, yoff, lod, face, w, h, ptr, sizeBytes, 0);
+ PER_ARRAY_TYPE(nullptr, rsAllocation2DData, true, (RsContext)con, alloc, xoff, yoff, lod, face, w, h, ptr, sizeBytes, 0);
}
// Copies from the Allocation pointed to by srcAlloc into the Allocation
@@ -746,7 +746,7 @@
RsAllocation *alloc = (RsAllocation *)_alloc;
LOG_API("nAllocation3DData, con(%p), alloc(%p), xoff(%i), yoff(%i), zoff(%i), lod(%i), w(%i), h(%i), d(%i), sizeBytes(%i)",
(RsContext)con, (RsAllocation)alloc, xoff, yoff, zoff, lod, w, h, d, sizeBytes);
- PER_ARRAY_TYPE(NULL, rsAllocation3DData, true, (RsContext)con, alloc, xoff, yoff, zoff, lod, w, h, d, ptr, sizeBytes, 0);
+ PER_ARRAY_TYPE(nullptr, rsAllocation3DData, true, (RsContext)con, alloc, xoff, yoff, zoff, lod, w, h, d, ptr, sizeBytes, 0);
}
// Copies from the Allocation pointed to by srcAlloc into the Allocation
@@ -836,13 +836,13 @@
nFileA3DCreateFromAsset(JNIEnv *_env, jobject _this, jlong con, jobject _assetMgr, jstring _path)
{
AssetManager* mgr = assetManagerForJavaObject(_env, _assetMgr);
- if (mgr == NULL) {
+ if (mgr == nullptr) {
return 0;
}
AutoJavaStringToUTF8 str(_env, _path);
Asset* asset = mgr->open(str.c_str(), Asset::ACCESS_BUFFER);
- if (asset == NULL) {
+ if (asset == nullptr) {
return 0;
}
@@ -924,13 +924,13 @@
jfloat fontSize, jint dpi)
{
AssetManager* mgr = assetManagerForJavaObject(_env, _assetMgr);
- if (mgr == NULL) {
+ if (mgr == nullptr) {
return 0;
}
AutoJavaStringToUTF8 str(_env, _path);
Asset* asset = mgr->open(str.c_str(), Asset::ACCESS_BUFFER);
- if (asset == NULL) {
+ if (asset == nullptr) {
return 0;
}
@@ -1027,7 +1027,7 @@
{
LOG_API("nScriptSetVarV, con(%p), s(%p), slot(%i)", (RsContext)con, (void *)script, slot);
jint len = _env->GetArrayLength(data);
- jbyte *ptr = _env->GetByteArrayElements(data, NULL);
+ jbyte *ptr = _env->GetByteArrayElements(data, nullptr);
rsScriptSetVarV((RsContext)con, (RsScript)script, slot, ptr, len);
_env->ReleaseByteArrayElements(data, ptr, JNI_ABORT);
}
@@ -1037,7 +1037,7 @@
{
LOG_API("nScriptSetVarV, con(%p), s(%p), slot(%i)", (RsContext)con, (void *)script, slot);
jint len = _env->GetArrayLength(data);
- jbyte *ptr = _env->GetByteArrayElements(data, NULL);
+ jbyte *ptr = _env->GetByteArrayElements(data, nullptr);
rsScriptGetVarV((RsContext)con, (RsScript)script, slot, ptr, len);
_env->ReleaseByteArrayElements(data, ptr, 0);
}
@@ -1047,9 +1047,9 @@
{
LOG_API("nScriptSetVarVE, con(%p), s(%p), slot(%i)", (RsContext)con, (void *)script, slot);
jint len = _env->GetArrayLength(data);
- jbyte *ptr = _env->GetByteArrayElements(data, NULL);
+ jbyte *ptr = _env->GetByteArrayElements(data, nullptr);
jint dimsLen = _env->GetArrayLength(dims) * sizeof(int);
- jint *dimsPtr = _env->GetIntArrayElements(dims, NULL);
+ jint *dimsPtr = _env->GetIntArrayElements(dims, nullptr);
rsScriptSetVarVE((RsContext)con, (RsScript)script, slot, ptr, len, (RsElement)elem,
(const uint32_t*) dimsPtr, dimsLen);
_env->ReleaseByteArrayElements(data, ptr, JNI_ABORT);
@@ -1085,165 +1085,88 @@
{
LOG_API("nScriptInvokeV, con(%p), s(%p), slot(%i)", (RsContext)con, (void *)script, slot);
jint len = _env->GetArrayLength(data);
- jbyte *ptr = _env->GetByteArrayElements(data, NULL);
+ jbyte *ptr = _env->GetByteArrayElements(data, nullptr);
rsScriptInvokeV((RsContext)con, (RsScript)script, slot, ptr, len);
_env->ReleaseByteArrayElements(data, ptr, JNI_ABORT);
}
static void
-nScriptForEach(JNIEnv *_env, jobject _this, jlong con,
- jlong script, jint slot, jlong ain, jlong aout)
+nScriptForEach(JNIEnv *_env, jobject _this, jlong con, jlong script, jint slot,
+ jlongArray ains, jlong aout, jbyteArray params,
+ jintArray limits)
{
- LOG_API("nScriptForEach, con(%p), s(%p), slot(%i)", (RsContext)con, (void *)script, slot);
- rsScriptForEach((RsContext)con, (RsScript)script, slot, (RsAllocation)ain, (RsAllocation)aout, NULL, 0, NULL, 0);
-}
-static void
-nScriptForEachV(JNIEnv *_env, jobject _this, jlong con,
- jlong script, jint slot, jlong ain, jlong aout, jbyteArray params)
-{
- LOG_API("nScriptForEach, con(%p), s(%p), slot(%i)", (RsContext)con, (void *)script, slot);
- jint len = _env->GetArrayLength(params);
- jbyte *ptr = _env->GetByteArrayElements(params, NULL);
- rsScriptForEach((RsContext)con, (RsScript)script, slot, (RsAllocation)ain, (RsAllocation)aout, ptr, len, NULL, 0);
- _env->ReleaseByteArrayElements(params, ptr, JNI_ABORT);
-}
+ LOG_API("nScriptForEach, con(%p), s(%p), slot(%i)", (RsContext)con,
+ (void *)script, slot);
-static void
-nScriptForEachClipped(JNIEnv *_env, jobject _this, jlong con,
- jlong script, jint slot, jlong ain, jlong aout,
- jint xstart, jint xend,
- jint ystart, jint yend, jint zstart, jint zend)
-{
- LOG_API("nScriptForEachClipped, con(%p), s(%p), slot(%i)", (RsContext)con, (void *)script, slot);
- RsScriptCall sc;
- sc.xStart = xstart;
- sc.xEnd = xend;
- sc.yStart = ystart;
- sc.yEnd = yend;
- sc.zStart = zstart;
- sc.zEnd = zend;
- sc.strategy = RS_FOR_EACH_STRATEGY_DONT_CARE;
- sc.arrayStart = 0;
- sc.arrayEnd = 0;
- rsScriptForEach((RsContext)con, (RsScript)script, slot, (RsAllocation)ain, (RsAllocation)aout, NULL, 0, &sc, sizeof(sc));
-}
+ jint in_len = 0;
+ jlong *in_ptr = nullptr;
-static void
-nScriptForEachClippedV(JNIEnv *_env, jobject _this, jlong con,
- jlong script, jint slot, jlong ain, jlong aout,
- jbyteArray params, jint xstart, jint xend,
- jint ystart, jint yend, jint zstart, jint zend)
-{
- LOG_API("nScriptForEachClipped, con(%p), s(%p), slot(%i)", (RsContext)con, (void *)script, slot);
- jint len = _env->GetArrayLength(params);
- jbyte *ptr = _env->GetByteArrayElements(params, NULL);
- RsScriptCall sc;
- sc.xStart = xstart;
- sc.xEnd = xend;
- sc.yStart = ystart;
- sc.yEnd = yend;
- sc.zStart = zstart;
- sc.zEnd = zend;
- sc.strategy = RS_FOR_EACH_STRATEGY_DONT_CARE;
- sc.arrayStart = 0;
- sc.arrayEnd = 0;
- rsScriptForEach((RsContext)con, (RsScript)script, slot, (RsAllocation)ain, (RsAllocation)aout, ptr, len, &sc, sizeof(sc));
- _env->ReleaseByteArrayElements(params, ptr, JNI_ABORT);
-}
+ RsAllocation *in_allocs = nullptr;
-static void
-nScriptForEachMultiClipped(JNIEnv *_env, jobject _this, jlong con,
- jlong script, jint slot, jlongArray ains, jlong aout,
- jint xstart, jint xend,
- jint ystart, jint yend, jint zstart, jint zend)
-{
- LOG_API("nScriptForEachMultiClipped, con(%p), s(%p), slot(%i)", (RsContext)con, (void *)script, slot);
+ if (ains != nullptr) {
+ in_len = _env->GetArrayLength(ains);
+ in_ptr = _env->GetLongArrayElements(ains, nullptr);
- jint in_len = _env->GetArrayLength(ains);
- jlong* in_ptr = _env->GetLongArrayElements(ains, NULL);
+ if (sizeof(RsAllocation) == sizeof(jlong)) {
+ in_allocs = (RsAllocation*)in_ptr;
- RsAllocation *in_allocs = NULL;
+ } else {
+ // Convert from 64-bit jlong types to the native pointer type.
- if (sizeof(RsAllocation) == sizeof(jlong)) {
- in_allocs = (RsAllocation*)in_ptr;
+ in_allocs = (RsAllocation*)alloca(in_len * sizeof(RsAllocation));
- } else {
- // Convert from 64-bit jlong types to the native pointer type.
-
- in_allocs = new RsAllocation[in_len];
-
- for (int index = in_len; --index >= 0;) {
- in_allocs[index] = (RsAllocation)in_ptr[index];
- }
+ for (int index = in_len; --index >= 0;) {
+ in_allocs[index] = (RsAllocation)in_ptr[index];
+ }
+ }
}
- RsScriptCall sc;
- sc.xStart = xstart;
- sc.xEnd = xend;
- sc.yStart = ystart;
- sc.yEnd = yend;
- sc.zStart = zstart;
- sc.zEnd = zend;
- sc.strategy = RS_FOR_EACH_STRATEGY_DONT_CARE;
- sc.arrayStart = 0;
- sc.arrayEnd = 0;
+ jint param_len = 0;
+ jbyte *param_ptr = nullptr;
- rsScriptForEachMulti((RsContext)con, (RsScript)script, slot, in_allocs, in_len, (RsAllocation)aout, NULL, 0, &sc, sizeof(sc));
-
- if (sizeof(RsAllocation) != sizeof(jlong)) {
- delete[] in_allocs;
+ if (params != nullptr) {
+ param_len = _env->GetArrayLength(params);
+ param_ptr = _env->GetByteArrayElements(params, nullptr);
}
- _env->ReleaseLongArrayElements(ains, in_ptr, JNI_ABORT);
-}
+ RsScriptCall sc, *sca = nullptr;
+ uint32_t sc_size = 0;
-static void
-nScriptForEachMultiClippedV(JNIEnv *_env, jobject _this, jlong con,
- jlong script, jint slot, jlongArray ains, jlong aout,
- jbyteArray params, jint xstart, jint xend,
- jint ystart, jint yend, jint zstart, jint zend)
-{
- LOG_API("nScriptForEachMultiClippedV, con(%p), s(%p), slot(%i)", (RsContext)con, (void *)script, slot);
+ jint limit_len = 0;
+ jint *limit_ptr = nullptr;
- jint in_len = _env->GetArrayLength(ains);
- jlong* in_ptr = _env->GetLongArrayElements(ains, NULL);
+ if (limits != nullptr) {
+ limit_len = _env->GetArrayLength(limits);
+ limit_ptr = _env->GetIntArrayElements(limits, nullptr);
- RsAllocation *in_allocs = NULL;
+ assert(limit_len == 6);
- if (sizeof(RsAllocation) == sizeof(jlong)) {
- in_allocs = (RsAllocation*)in_ptr;
+ sc.xStart = limit_ptr[0];
+ sc.xEnd = limit_ptr[1];
+ sc.yStart = limit_ptr[2];
+ sc.yEnd = limit_ptr[3];
+ sc.zStart = limit_ptr[4];
+ sc.zEnd = limit_ptr[5];
+ sc.strategy = RS_FOR_EACH_STRATEGY_DONT_CARE;
- } else {
- // Convert from 64-bit jlong types to the native pointer type.
-
- in_allocs = new RsAllocation[in_len];
-
- for (int index = in_len; --index >= 0;) {
- in_allocs[index] = (RsAllocation)in_ptr[index];
- }
+ sca = ≻
}
- jint param_len = _env->GetArrayLength(params);
- jbyte* param_ptr = _env->GetByteArrayElements(params, NULL);
+ rsScriptForEachMulti((RsContext)con, (RsScript)script, slot,
+ in_allocs, in_len, (RsAllocation)aout,
+ param_ptr, param_len, sca, sc_size);
- RsScriptCall sc;
- sc.xStart = xstart;
- sc.xEnd = xend;
- sc.yStart = ystart;
- sc.yEnd = yend;
- sc.zStart = zstart;
- sc.zEnd = zend;
- sc.strategy = RS_FOR_EACH_STRATEGY_DONT_CARE;
- sc.arrayStart = 0;
- sc.arrayEnd = 0;
- rsScriptForEachMulti((RsContext)con, (RsScript)script, slot, in_allocs, in_len, (RsAllocation)aout, param_ptr, param_len, &sc, sizeof(sc));
-
- if (sizeof(RsAllocation) != sizeof(jlong)) {
- delete[] in_allocs;
+ if (ains != nullptr) {
+ _env->ReleaseLongArrayElements(ains, in_ptr, JNI_ABORT);
}
- _env->ReleaseLongArrayElements(ains, in_ptr, JNI_ABORT);
- _env->ReleaseByteArrayElements(params, param_ptr, JNI_ABORT);
+ if (params != nullptr) {
+ _env->ReleaseByteArrayElements(params, param_ptr, JNI_ABORT);
+ }
+
+ if (limits != nullptr) {
+ _env->ReleaseIntArrayElements(limits, limit_ptr, JNI_ABORT);
+ }
}
// -----------------------------------
@@ -1258,7 +1181,7 @@
AutoJavaStringToUTF8 resNameUTF(_env, resName);
AutoJavaStringToUTF8 cacheDirUTF(_env, cacheDir);
jlong ret = 0;
- jbyte* script_ptr = NULL;
+ jbyte* script_ptr = nullptr;
jint _exception = 0;
jint remaining;
if (!scriptRef) {
@@ -1325,35 +1248,35 @@
LOG_API("nScriptGroupCreate, con(%p)", (RsContext)con);
jint kernelsLen = _env->GetArrayLength(_kernels);
- jlong *jKernelsPtr = _env->GetLongArrayElements(_kernels, NULL);
+ jlong *jKernelsPtr = _env->GetLongArrayElements(_kernels, nullptr);
RsScriptKernelID* kernelsPtr = (RsScriptKernelID*) malloc(sizeof(RsScriptKernelID) * kernelsLen);
for(int i = 0; i < kernelsLen; ++i) {
kernelsPtr[i] = (RsScriptKernelID)jKernelsPtr[i];
}
jint srcLen = _env->GetArrayLength(_src);
- jlong *jSrcPtr = _env->GetLongArrayElements(_src, NULL);
+ jlong *jSrcPtr = _env->GetLongArrayElements(_src, nullptr);
RsScriptKernelID* srcPtr = (RsScriptKernelID*) malloc(sizeof(RsScriptKernelID) * srcLen);
for(int i = 0; i < srcLen; ++i) {
srcPtr[i] = (RsScriptKernelID)jSrcPtr[i];
}
jint dstkLen = _env->GetArrayLength(_dstk);
- jlong *jDstkPtr = _env->GetLongArrayElements(_dstk, NULL);
+ jlong *jDstkPtr = _env->GetLongArrayElements(_dstk, nullptr);
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);
+ jlong *jDstfPtr = _env->GetLongArrayElements(_dstf, nullptr);
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);
+ jlong *jTypesPtr = _env->GetLongArrayElements(_types, nullptr);
RsType* typesPtr = (RsType*) malloc(sizeof(RsType) * typesLen);
for(int i = 0; i < typesLen; ++i) {
typesPtr[i] = (RsType)jTypesPtr[i];
@@ -1447,7 +1370,7 @@
jobjectArray texNames, jlongArray params)
{
AutoJavaStringToUTF8 shaderUTF(_env, shader);
- jlong *jParamPtr = _env->GetLongArrayElements(params, NULL);
+ jlong *jParamPtr = _env->GetLongArrayElements(params, nullptr);
jint paramLen = _env->GetArrayLength(params);
int texCount = _env->GetArrayLength(texNames);
@@ -1478,7 +1401,7 @@
jobjectArray texNames, jlongArray params)
{
AutoJavaStringToUTF8 shaderUTF(_env, shader);
- jlong *jParamPtr = _env->GetLongArrayElements(params, NULL);
+ jlong *jParamPtr = _env->GetLongArrayElements(params, nullptr);
jint paramLen = _env->GetArrayLength(params);
LOG_API("nProgramVertexCreate, con(%p), paramLen(%i)", (RsContext)con, paramLen);
@@ -1584,21 +1507,21 @@
LOG_API("nMeshCreate, con(%p)", (RsContext)con);
jint vtxLen = _env->GetArrayLength(_vtx);
- jlong *jVtxPtr = _env->GetLongArrayElements(_vtx, NULL);
+ jlong *jVtxPtr = _env->GetLongArrayElements(_vtx, nullptr);
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);
- jlong *jIdxPtr = _env->GetLongArrayElements(_idx, NULL);
+ jlong *jIdxPtr = _env->GetLongArrayElements(_idx, nullptr);
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);
+ jint *primPtr = _env->GetIntArrayElements(_prim, nullptr);
jlong id = (jlong)(uintptr_t)rsMeshCreate((RsContext)con,
(RsAllocation *)vtxPtr, vtxLen,
@@ -1757,12 +1680,9 @@
{"rsnScriptSetTimeZone", "(JJ[B)V", (void*)nScriptSetTimeZone },
{"rsnScriptInvoke", "(JJI)V", (void*)nScriptInvoke },
{"rsnScriptInvokeV", "(JJI[B)V", (void*)nScriptInvokeV },
-{"rsnScriptForEach", "(JJIJJ)V", (void*)nScriptForEach },
-{"rsnScriptForEach", "(JJIJJ[B)V", (void*)nScriptForEachV },
-{"rsnScriptForEachClipped", "(JJIJJIIIIII)V", (void*)nScriptForEachClipped },
-{"rsnScriptForEachClipped", "(JJIJJ[BIIIIII)V", (void*)nScriptForEachClippedV },
-{"rsnScriptForEachMultiClipped", "(JJI[JJIIIIII)V", (void*)nScriptForEachMultiClipped },
-{"rsnScriptForEachMultiClipped", "(JJI[JJ[BIIIIII)V", (void*)nScriptForEachMultiClippedV },
+
+{"rsnScriptForEach", "(JJI[JJ[B[I)V", (void*)nScriptForEach },
+
{"rsnScriptSetVarI", "(JJII)V", (void*)nScriptSetVarI },
{"rsnScriptGetVarI", "(JJI)I", (void*)nScriptGetVarI },
{"rsnScriptSetVarJ", "(JJIJ)V", (void*)nScriptSetVarJ },
@@ -1824,14 +1744,14 @@
jint JNI_OnLoad(JavaVM* vm, void* reserved)
{
- JNIEnv* env = NULL;
+ JNIEnv* env = nullptr;
jint result = -1;
if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
ALOGE("ERROR: GetEnv failed\n");
goto bail;
}
- assert(env != NULL);
+ assert(env != nullptr);
if (registerFuncs(env) < 0) {
ALOGE("ERROR: Renderscript native registration failed\n");
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
old mode 100755
new mode 100644
diff --git a/services/core/java/com/android/server/pm/SELinuxMMAC.java b/services/core/java/com/android/server/pm/SELinuxMMAC.java
index 81302b9..98f2997 100644
--- a/services/core/java/com/android/server/pm/SELinuxMMAC.java
+++ b/services/core/java/com/android/server/pm/SELinuxMMAC.java
@@ -137,6 +137,14 @@
}
public static boolean readInstallPolicy() {
+ return readInstallPolicy(MAC_PERMISSIONS);
+ }
+
+ public static boolean readInstallPolicy(String macPermsPath) {
+ if (macPermsPath == null) {
+ throw new NullPointerException("mac_permissions.xml file path is null");
+ }
+
// Temp structures to hold the rules while we parse the xml file.
// We add all the rules together once we know there's no structural problems.
HashMap<Signature, Policy> sigSeinfo = new HashMap<Signature, Policy>();
@@ -144,8 +152,8 @@
FileReader policyFile = null;
try {
- policyFile = new FileReader(MAC_PERMISSIONS);
- Slog.d(TAG, "Using policy file " + MAC_PERMISSIONS);
+ policyFile = new FileReader(macPermsPath);
+ Slog.d(TAG, "Using policy file " + macPermsPath);
XmlPullParser parser = Xml.newPullParser();
parser.setInput(policyFile);
@@ -190,10 +198,10 @@
}
}
} catch (XmlPullParserException xpe) {
- Slog.w(TAG, "Got exception parsing " + MAC_PERMISSIONS, xpe);
+ Slog.w(TAG, "Got exception parsing " + macPermsPath, xpe);
return false;
} catch (IOException ioe) {
- Slog.w(TAG, "Got exception parsing " + MAC_PERMISSIONS, ioe);
+ Slog.w(TAG, "Got exception parsing " + macPermsPath, ioe);
return false;
} finally {
IoUtils.closeQuietly(policyFile);
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
index 41d8502..bc0d3ee2 100644
--- a/tools/aapt/Command.cpp
+++ b/tools/aapt/Command.cpp
@@ -212,14 +212,10 @@
}
const ResTable& res = assets.getResources(false);
- if (&res == NULL) {
- printf("\nNo resource table found.\n");
- } else {
#ifndef HAVE_ANDROID_OS
- printf("\nResource table:\n");
- res.print(false);
+ printf("\nResource table:\n");
+ res.print(false);
#endif
- }
Asset* manifestAsset = assets.openNonAsset("AndroidManifest.xml",
Asset::ACCESS_BUFFER);
@@ -617,10 +613,7 @@
assets.setConfiguration(config);
const ResTable& res = assets.getResources(false);
- if (&res == NULL) {
- fprintf(stderr, "ERROR: dump failed because no resource table was found\n");
- return 1;
- } else if (res.getError() != NO_ERROR) {
+ if (res.getError() != NO_ERROR) {
fprintf(stderr, "ERROR: dump failed because the resource table is invalid/corrupt.\n");
return 1;
}
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index afec5ed..3ab3d59 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -261,7 +261,7 @@
ssize_t minSdkIndex = block.indexOfAttribute(RESOURCES_ANDROID_NAMESPACE,
"minSdkVersion");
if (minSdkIndex >= 0) {
- const uint16_t* minSdk16 = block.getAttributeStringValue(minSdkIndex, &len);
+ const char16_t* minSdk16 = block.getAttributeStringValue(minSdkIndex, &len);
const char* minSdk8 = strdup(String8(minSdk16).string());
bundle->setManifestMinSdkVersion(minSdk8);
}
@@ -450,7 +450,7 @@
size_t len;
ssize_t index = parser.indexOfAttribute(ns, attr);
- const uint16_t* str;
+ const char16_t* str;
Res_value value;
if (index >= 0 && parser.getAttributeValue(index, &value) >= 0) {
const ResStringPool* pool = &parser.getStrings();
@@ -1668,7 +1668,7 @@
}
size_t len;
ssize_t index = block.indexOfAttribute(RESOURCES_ANDROID_NAMESPACE, "name");
- const uint16_t* id = block.getAttributeStringValue(index, &len);
+ const char16_t* id = block.getAttributeStringValue(index, &len);
if (id == NULL) {
fprintf(stderr, "%s:%d: missing name attribute in element <%s>.\n",
manifestPath.string(), block.getLineNumber(),
@@ -1711,7 +1711,7 @@
hasErrors = true;
}
syms->addStringSymbol(String8(e), idStr, srcPos);
- const uint16_t* cmt = block.getComment(&len);
+ const char16_t* cmt = block.getComment(&len);
if (cmt != NULL && *cmt != 0) {
//printf("Comment of %s: %s\n", String8(e).string(),
// String8(cmt).string());
diff --git a/tools/aapt/ResourceIdCache.cpp b/tools/aapt/ResourceIdCache.cpp
index d60a07fc..d7b2d10 100644
--- a/tools/aapt/ResourceIdCache.cpp
+++ b/tools/aapt/ResourceIdCache.cpp
@@ -9,7 +9,6 @@
#include <utils/Log.h>
#include "ResourceIdCache.h"
#include <map>
-using namespace std;
static size_t mHits = 0;
@@ -29,7 +28,7 @@
CacheEntry(const android::String16& name, uint32_t resId) : hashedName(name), id(resId) { }
};
-static map< uint32_t, CacheEntry > mIdMap;
+static std::map< uint32_t, CacheEntry > mIdMap;
// djb2; reasonable choice for strings when collisions aren't particularly important
@@ -63,7 +62,7 @@
bool onlyPublic) {
const String16 hashedName = makeHashableName(package, type, name, onlyPublic);
const uint32_t hashcode = hash(hashedName);
- map<uint32_t, CacheEntry>::iterator item = mIdMap.find(hashcode);
+ std::map<uint32_t, CacheEntry>::iterator item = mIdMap.find(hashcode);
if (item == mIdMap.end()) {
// cache miss
mMisses++;
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index 8341de6..dccc363 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -388,7 +388,7 @@
ssize_t l10nIdx = block.indexOfAttribute(NULL, "localization");
if (l10nIdx >= 0) {
- const uint16_t* str = block.getAttributeStringValue(l10nIdx, &len);
+ const char16_t* str = block.getAttributeStringValue(l10nIdx, &len);
bool error;
uint32_t l10n_required = parse_flags(str, len, l10nRequiredFlags, &error);
if (error) {
@@ -1314,7 +1314,7 @@
size_t n = block.getAttributeCount();
for (size_t i = 0; i < n; i++) {
size_t length;
- const uint16_t* attr = block.getAttributeName(i, &length);
+ const char16_t* attr = block.getAttributeName(i, &length);
if (strcmp16(attr, name16.string()) == 0) {
name.setTo(block.getAttributeStringValue(i, &length));
} else if (strcmp16(attr, translatable16.string()) == 0) {
@@ -1430,14 +1430,14 @@
// translatable.
for (size_t i = 0; i < n; i++) {
size_t length;
- const uint16_t* attr = block.getAttributeName(i, &length);
+ const char16_t* attr = block.getAttributeName(i, &length);
if (strcmp16(attr, formatted16.string()) == 0) {
- const uint16_t* value = block.getAttributeStringValue(i, &length);
+ const char16_t* value = block.getAttributeStringValue(i, &length);
if (strcmp16(value, false16.string()) == 0) {
curIsFormatted = false;
}
} else if (strcmp16(attr, translatable16.string()) == 0) {
- const uint16_t* value = block.getAttributeStringValue(i, &length);
+ const char16_t* value = block.getAttributeStringValue(i, &length);
if (strcmp16(value, false16.string()) == 0) {
isTranslatable = false;
}
diff --git a/tools/aapt/StringPool.cpp b/tools/aapt/StringPool.cpp
index 06769e4..19ecf69 100644
--- a/tools/aapt/StringPool.cpp
+++ b/tools/aapt/StringPool.cpp
@@ -21,7 +21,7 @@
#define NOISY(x) //x
-void strcpy16_htod(uint16_t* dst, const uint16_t* src)
+void strcpy16_htod(char16_t* dst, const char16_t* src)
{
while (*src) {
char16_t s = htods(*src);
@@ -455,9 +455,9 @@
strncpy((char*)strings, encStr, encSize+1);
} else {
- uint16_t* strings = (uint16_t*)dat;
+ char16_t* strings = (char16_t*)dat;
- ENCODE_LENGTH(strings, sizeof(uint16_t), strSize)
+ ENCODE_LENGTH(strings, sizeof(char16_t), strSize)
strcpy16_htod(strings, ent.value);
}
diff --git a/tools/aapt/StringPool.h b/tools/aapt/StringPool.h
index 1b3abfd..1b5a7ba 100644
--- a/tools/aapt/StringPool.h
+++ b/tools/aapt/StringPool.h
@@ -26,7 +26,7 @@
#define PRINT_STRING_METRICS 0
-void strcpy16_htod(uint16_t* dst, const uint16_t* src);
+void strcpy16_htod(char16_t* dst, const char16_t* src);
void printStringPool(const ResStringPool* pool);
diff --git a/tools/aapt/XMLNode.cpp b/tools/aapt/XMLNode.cpp
index 607d419..03c66c1 100644
--- a/tools/aapt/XMLNode.cpp
+++ b/tools/aapt/XMLNode.cpp
@@ -234,9 +234,9 @@
const String8 element8(element16);
size_t nslen;
- const uint16_t* ns = inXml->getElementNamespace(&nslen);
+ const char16_t* ns = inXml->getElementNamespace(&nslen);
if (ns == NULL) {
- ns = (const uint16_t*)"\0\0";
+ ns = (const char16_t*)"\0\0";
nslen = 0;
}
const String8 nspace(String16(ns, nslen));
@@ -291,9 +291,9 @@
} else if (code == ResXMLTree::END_TAG) {
size_t nslen;
- const uint16_t* ns = inXml->getElementNamespace(&nslen);
+ const char16_t* ns = inXml->getElementNamespace(&nslen);
if (ns == NULL) {
- ns = (const uint16_t*)"\0\0";
+ ns = (const char16_t*)"\0\0";
nslen = 0;
}
const String8 nspace(String16(ns, nslen));
@@ -422,7 +422,7 @@
}
static String8 build_namespace(const Vector<namespace_entry>& namespaces,
- const uint16_t* ns)
+ const char16_t* ns)
{
String8 str;
if (ns != NULL) {
@@ -453,9 +453,9 @@
int i;
if (code == ResXMLTree::START_TAG) {
size_t len;
- const uint16_t* ns16 = block->getElementNamespace(&len);
+ const char16_t* ns16 = block->getElementNamespace(&len);
String8 elemNs = build_namespace(namespaces, ns16);
- const uint16_t* com16 = block->getComment(&len);
+ const char16_t* com16 = block->getComment(&len);
if (com16) {
printf("%s <!-- %s -->\n", prefix.string(), String8(com16).string());
}
@@ -503,7 +503,7 @@
} else if (code == ResXMLTree::START_NAMESPACE) {
namespace_entry ns;
size_t len;
- const uint16_t* prefix16 = block->getNamespacePrefix(&len);
+ const char16_t* prefix16 = block->getNamespacePrefix(&len);
if (prefix16) {
ns.prefix = String8(prefix16);
} else {
@@ -518,7 +518,7 @@
depth--;
const namespace_entry& ns = namespaces.top();
size_t len;
- const uint16_t* prefix16 = block->getNamespacePrefix(&len);
+ const char16_t* prefix16 = block->getNamespacePrefix(&len);
String8 pr;
if (prefix16) {
pr = String8(prefix16);
diff --git a/tools/obbtool/Main.cpp b/tools/obbtool/Main.cpp
index b2152e8..64808c0 100644
--- a/tools/obbtool/Main.cpp
+++ b/tools/obbtool/Main.cpp
@@ -89,7 +89,7 @@
" Prints the OBB signature information of a file.\n\n", gProgName);
}
-void doAdd(const char* filename, struct PackageInfo* info) {
+void doAdd(const char* filename, PackageInfo* info) {
ObbFile *obb = new ObbFile();
if (obb->readFrom(filename)) {
fprintf(stderr, "ERROR: %s: OBB signature already present\n", filename);
@@ -182,7 +182,7 @@
{
int opt;
int option_index = 0;
- struct PackageInfo package_info;
+ PackageInfo package_info;
int result = 1; // pessimistically assume an error.
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java b/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java
index d65d03e..92c7e36 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java
@@ -77,6 +77,7 @@
public boolean setDeviceType(int deviceType) {
if (deviceType >= WFD_SOURCE && deviceType <= SOURCE_OR_PRIMARY_SINK) {
+ mDeviceInfo &= ~DEVICE_TYPE;
mDeviceInfo |= deviceType;
return true;
}