diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/text/format/TimeFormatter.java | 137 | ||||
-rw-r--r-- | core/java/android/widget/AbsListView.java | 4 | ||||
-rw-r--r-- | core/java/com/android/internal/app/ExternalMediaFormatActivity.java | 5 | ||||
-rw-r--r-- | core/java/com/android/internal/os/ZygoteInit.java | 68 | ||||
-rw-r--r-- | core/jni/AndroidRuntime.cpp | 2 | ||||
-rw-r--r-- | core/jni/android_net_LocalSocketImpl.cpp | 44 | ||||
-rw-r--r-- | core/jni/android_os_MessageQueue.cpp | 4 | ||||
-rw-r--r-- | core/jni/android_os_SELinux.cpp | 2 | ||||
-rw-r--r-- | core/jni/android_server_NetworkManagementSocketTagger.cpp | 4 | ||||
-rw-r--r-- | core/jni/android_util_Binder.cpp | 27 | ||||
-rw-r--r-- | core/jni/android_util_Process.cpp | 6 | ||||
-rw-r--r-- | core/jni/com_android_internal_os_ZygoteInit.cpp | 18 | ||||
-rw-r--r-- | core/res/res/values/config.xml | 20 |
13 files changed, 129 insertions, 212 deletions
diff --git a/core/java/android/text/format/TimeFormatter.java b/core/java/android/text/format/TimeFormatter.java index ec79b3650cb2..3a63805defe0 100644 --- a/core/java/android/text/format/TimeFormatter.java +++ b/core/java/android/text/format/TimeFormatter.java @@ -22,8 +22,7 @@ package android.text.format; import android.content.res.Resources; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; +import java.nio.CharBuffer; import java.util.Formatter; import java.util.Locale; import java.util.TimeZone; @@ -31,15 +30,13 @@ import libcore.icu.LocaleData; import libcore.util.ZoneInfo; /** - * Formatting logic for {@link Time}. Contains a port of Bionic's broken strftime_tz to Java. The - * main issue with this implementation is the treatment of characters as ASCII, despite returning - * localized (UTF-16) strings from the LocaleData. + * Formatting logic for {@link Time}. Contains a port of Bionic's broken strftime_tz to Java. * * <p>This class is not thread safe. */ class TimeFormatter { - // An arbitrary value outside the range representable by a byte / ASCII character code. - private static final int FORCE_LOWER_CASE = 0x100; + // An arbitrary value outside the range representable by a char. + private static final int FORCE_LOWER_CASE = -1; private static final int SECSPERMIN = 60; private static final int MINSPERHOUR = 60; @@ -62,10 +59,9 @@ class TimeFormatter { private final String dateTimeFormat; private final String timeOnlyFormat; private final String dateOnlyFormat; - private final Locale locale; private StringBuilder outputBuilder; - private Formatter outputFormatter; + private Formatter numberFormatter; public TimeFormatter() { synchronized (TimeFormatter.class) { @@ -84,7 +80,6 @@ class TimeFormatter { this.dateTimeFormat = sDateTimeFormat; this.timeOnlyFormat = sTimeOnlyFormat; this.dateOnlyFormat = sDateOnlyFormat; - this.locale = locale; localeData = sLocaleData; } } @@ -97,19 +92,21 @@ class TimeFormatter { StringBuilder stringBuilder = new StringBuilder(); outputBuilder = stringBuilder; - outputFormatter = new Formatter(stringBuilder, locale); + // This uses the US locale because number localization is handled separately (see below) + // and locale sensitive strings are output directly using outputBuilder. + numberFormatter = new Formatter(stringBuilder, Locale.US); formatInternal(pattern, wallTime, zoneInfo); String result = stringBuilder.toString(); // This behavior is the source of a bug since some formats are defined as being - // in ASCII. Generally localization is very broken. + // in ASCII and not localized. if (localeData.zeroDigit != '0') { result = localizeDigits(result); } return result; } finally { outputBuilder = null; - outputFormatter = null; + numberFormatter = null; } } @@ -132,38 +129,30 @@ class TimeFormatter { * {@link #outputBuilder}. */ private void formatInternal(String pattern, ZoneInfo.WallTime wallTime, ZoneInfo zoneInfo) { - // Convert to ASCII bytes to be compatible with old implementation behavior. - byte[] bytes = pattern.getBytes(StandardCharsets.US_ASCII); - if (bytes.length == 0) { - return; - } - - ByteBuffer formatBuffer = ByteBuffer.wrap(bytes); + CharBuffer formatBuffer = CharBuffer.wrap(pattern); while (formatBuffer.remaining() > 0) { - boolean outputCurrentByte = true; - char currentByteAsChar = convertToChar(formatBuffer.get(formatBuffer.position())); - if (currentByteAsChar == '%') { - outputCurrentByte = handleToken(formatBuffer, wallTime, zoneInfo); + boolean outputCurrentChar = true; + char currentChar = formatBuffer.get(formatBuffer.position()); + if (currentChar == '%') { + outputCurrentChar = handleToken(formatBuffer, wallTime, zoneInfo); } - if (outputCurrentByte) { - currentByteAsChar = convertToChar(formatBuffer.get(formatBuffer.position())); - outputBuilder.append(currentByteAsChar); + if (outputCurrentChar) { + outputBuilder.append(formatBuffer.get(formatBuffer.position())); } - formatBuffer.position(formatBuffer.position() + 1); } } - private boolean handleToken(ByteBuffer formatBuffer, ZoneInfo.WallTime wallTime, + private boolean handleToken(CharBuffer formatBuffer, ZoneInfo.WallTime wallTime, ZoneInfo zoneInfo) { - // The byte at formatBuffer.position() is expected to be '%' at this point. + // The char at formatBuffer.position() is expected to be '%' at this point. int modifier = 0; while (formatBuffer.remaining() > 1) { - // Increment the position then get the new current byte. + // Increment the position then get the new current char. formatBuffer.position(formatBuffer.position() + 1); - char currentByteAsChar = convertToChar(formatBuffer.get(formatBuffer.position())); - switch (currentByteAsChar) { + char currentChar = formatBuffer.get(formatBuffer.position()); + switch (currentChar) { case 'A': modifyAndAppend((wallTime.getWeekDay() < 0 || wallTime.getWeekDay() >= DAYSPERWEEK) @@ -206,7 +195,7 @@ class TimeFormatter { formatInternal("%m/%d/%y", wallTime, zoneInfo); return false; case 'd': - outputFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), + numberFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), wallTime.getMonthDay()); return false; case 'E': @@ -218,46 +207,46 @@ class TimeFormatter { case '0': case '^': case '#': - modifier = currentByteAsChar; + modifier = currentChar; continue; case 'e': - outputFormatter.format(getFormat(modifier, "%2d", "%2d", "%d", "%02d"), + numberFormatter.format(getFormat(modifier, "%2d", "%2d", "%d", "%02d"), wallTime.getMonthDay()); return false; case 'F': formatInternal("%Y-%m-%d", wallTime, zoneInfo); return false; case 'H': - outputFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), + numberFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), wallTime.getHour()); return false; case 'I': int hour = (wallTime.getHour() % 12 != 0) ? (wallTime.getHour() % 12) : 12; - outputFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), hour); + numberFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), hour); return false; case 'j': int yearDay = wallTime.getYearDay() + 1; - outputFormatter.format(getFormat(modifier, "%03d", "%3d", "%d", "%03d"), + numberFormatter.format(getFormat(modifier, "%03d", "%3d", "%d", "%03d"), yearDay); return false; case 'k': - outputFormatter.format(getFormat(modifier, "%2d", "%2d", "%d", "%02d"), + numberFormatter.format(getFormat(modifier, "%2d", "%2d", "%d", "%02d"), wallTime.getHour()); return false; case 'l': int n2 = (wallTime.getHour() % 12 != 0) ? (wallTime.getHour() % 12) : 12; - outputFormatter.format(getFormat(modifier, "%2d", "%2d", "%d", "%02d"), n2); + numberFormatter.format(getFormat(modifier, "%2d", "%2d", "%d", "%02d"), n2); return false; case 'M': - outputFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), + numberFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), wallTime.getMinute()); return false; case 'm': - outputFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), + numberFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), wallTime.getMonth() + 1); return false; case 'n': - modifyAndAppend("\n", modifier); + outputBuilder.append('\n'); return false; case 'p': modifyAndAppend((wallTime.getHour() >= (HOURSPERDAY / 2)) ? localeData.amPm[1] @@ -274,27 +263,27 @@ class TimeFormatter { formatInternal("%I:%M:%S %p", wallTime, zoneInfo); return false; case 'S': - outputFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), + numberFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), wallTime.getSecond()); return false; case 's': int timeInSeconds = wallTime.mktime(zoneInfo); - modifyAndAppend(Integer.toString(timeInSeconds), modifier); + outputBuilder.append(Integer.toString(timeInSeconds)); return false; case 'T': formatInternal("%H:%M:%S", wallTime, zoneInfo); return false; case 't': - modifyAndAppend("\t", modifier); + outputBuilder.append('\t'); return false; case 'U': - outputFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), + numberFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), (wallTime.getYearDay() + DAYSPERWEEK - wallTime.getWeekDay()) / DAYSPERWEEK); return false; case 'u': int day = (wallTime.getWeekDay() == 0) ? DAYSPERWEEK : wallTime.getWeekDay(); - outputFormatter.format("%d", day); + numberFormatter.format("%d", day); return false; case 'V': /* ISO 8601 week number */ case 'G': /* ISO 8601 year (four digits) */ @@ -326,9 +315,9 @@ class TimeFormatter { --year; yday += isLeap(year) ? DAYSPERLYEAR : DAYSPERNYEAR; } - if (currentByteAsChar == 'V') { - outputFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), w); - } else if (currentByteAsChar == 'g') { + if (currentChar == 'V') { + numberFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), w); + } else if (currentChar == 'g') { outputYear(year, false, true, modifier); } else { outputYear(year, true, true, modifier); @@ -342,10 +331,10 @@ class TimeFormatter { int n = (wallTime.getYearDay() + DAYSPERWEEK - ( wallTime.getWeekDay() != 0 ? (wallTime.getWeekDay() - 1) : (DAYSPERWEEK - 1))) / DAYSPERWEEK; - outputFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), n); + numberFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), n); return false; case 'w': - outputFormatter.format("%d", wallTime.getWeekDay()); + numberFormatter.format("%d", wallTime.getWeekDay()); return false; case 'X': formatInternal(timeOnlyFormat, wallTime, zoneInfo); @@ -371,17 +360,17 @@ class TimeFormatter { return false; } int diff = wallTime.getGmtOffset(); - String sign; + char sign; if (diff < 0) { - sign = "-"; + sign = '-'; diff = -diff; } else { - sign = "+"; + sign = '+'; } - modifyAndAppend(sign, modifier); + outputBuilder.append(sign); diff /= SECSPERMIN; diff = (diff / MINSPERHOUR) * 100 + (diff % MINSPERHOUR); - outputFormatter.format(getFormat(modifier, "%04d", "%4d", "%d", "%04d"), diff); + numberFormatter.format(getFormat(modifier, "%04d", "%4d", "%d", "%04d"), diff); return false; } case '+': @@ -422,7 +411,6 @@ class TimeFormatter { break; default: outputBuilder.append(str); - } } @@ -443,14 +431,14 @@ class TimeFormatter { } if (outputTop) { if (lead == 0 && trail < 0) { - modifyAndAppend("-0", modifier); + outputBuilder.append("-0"); } else { - outputFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), lead); + numberFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), lead); } } if (outputBottom) { int n = ((trail < 0) ? -trail : trail); - outputFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), n); + numberFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"), n); } } @@ -472,24 +460,24 @@ class TimeFormatter { } /** - * A broken implementation of {@link Character#isUpperCase(char)} that assumes ASCII in order to - * be compatible with the old native implementation. + * A broken implementation of {@link Character#isUpperCase(char)} that assumes ASCII codes in + * order to be compatible with the old native implementation. */ private static boolean brokenIsUpper(char toCheck) { return toCheck >= 'A' && toCheck <= 'Z'; } /** - * A broken implementation of {@link Character#isLowerCase(char)} that assumes ASCII in order to - * be compatible with the old native implementation. + * A broken implementation of {@link Character#isLowerCase(char)} that assumes ASCII codes in + * order to be compatible with the old native implementation. */ private static boolean brokenIsLower(char toCheck) { return toCheck >= 'a' && toCheck <= 'z'; } /** - * A broken implementation of {@link Character#toLowerCase(char)} that assumes ASCII in order to - * be compatible with the old native implementation. + * A broken implementation of {@link Character#toLowerCase(char)} that assumes ASCII codes in + * order to be compatible with the old native implementation. */ private static char brokenToLower(char input) { if (input >= 'A' && input <= 'Z') { @@ -499,8 +487,8 @@ class TimeFormatter { } /** - * A broken implementation of {@link Character#toUpperCase(char)} that assumes ASCII in order to - * be compatible with the old native implementation. + * A broken implementation of {@link Character#toUpperCase(char)} that assumes ASCII codes in + * order to be compatible with the old native implementation. */ private static char brokenToUpper(char input) { if (input >= 'a' && input <= 'z') { @@ -509,11 +497,4 @@ class TimeFormatter { return input; } - /** - * Safely convert a byte containing an ASCII character to a char, even for character codes - * > 127. - */ - private static char convertToChar(byte b) { - return (char) (b & 0xFF); - } } diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index eb93745ac29d..012a6aa00a5c 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -2378,7 +2378,9 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te 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 6ed3bdcb9b90..fc213c563e8e 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.DialogInterface; 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 @@ public class ExternalMediaFormatActivity extends AlertActivity implements Dialog 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/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java index 051de6e5d1f8..87e8ebdb49b6 100644 --- a/core/java/com/android/internal/os/ZygoteInit.java +++ b/core/java/com/android/internal/os/ZygoteInit.java @@ -91,12 +91,6 @@ public class ZygoteInit { 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"; @@ -293,11 +287,6 @@ public class ZygoteInit { 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); @@ -316,15 +305,6 @@ public class ZygoteInit { 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); @@ -354,8 +334,6 @@ public class ZygoteInit { // 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); @@ -373,10 +351,7 @@ public class ZygoteInit { private static void preloadResources() { final VMRuntime runtime = VMRuntime.getRuntime(); - Debug.startAllocCounting(); try { - System.gc(); - runtime.runFinalizationSync(); mResources = Resources.getSystem(); mResources.startPreloading(); if (PRELOAD_RESOURCES) { @@ -401,22 +376,12 @@ public class ZygoteInit { 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)); @@ -437,14 +402,6 @@ public class ZygoteInit { 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)); @@ -466,7 +423,7 @@ public class ZygoteInit { * 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, @@ -475,9 +432,6 @@ public class ZygoteInit { System.gc(); runtime.runFinalizationSync(); System.gc(); - runtime.runFinalizationSync(); - System.gc(); - runtime.runFinalizationSync(); } /** @@ -668,7 +622,7 @@ public class ZygoteInit { 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. @@ -737,27 +691,9 @@ public class ZygoteInit { 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); diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 62d803690616..d61dd3054046 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -876,7 +876,7 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) 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 98f4bed1fc90..a408a96cd2fa 100644 --- a/core/jni/android_net_LocalSocketImpl.cpp +++ b/core/jni/android_net_LocalSocketImpl.cpp @@ -57,7 +57,7 @@ socket_connect_local(JNIEnv *env, jobject object, fd = jniGetFDFromFileDescriptor(env, fileDescriptor); - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionCheck()) { return; } @@ -95,7 +95,7 @@ socket_bind_local (JNIEnv *env, jobject object, jobject fileDescriptor, fd = jniGetFDFromFileDescriptor(env, fileDescriptor); - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionCheck()) { return; } @@ -118,7 +118,7 @@ socket_listen (JNIEnv *env, jobject object, jobject fileDescriptor, jint backlog fd = jniGetFDFromFileDescriptor(env, fileDescriptor); - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionCheck()) { return; } @@ -154,7 +154,7 @@ socket_accept (JNIEnv *env, jobject object, jobject fileDescriptor, jobject s) fd = jniGetFDFromFileDescriptor(env, fileDescriptor); - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionCheck()) { return NULL; } @@ -184,7 +184,7 @@ socket_shutdown (JNIEnv *env, jobject object, jobject fileDescriptor, fd = jniGetFDFromFileDescriptor(env, fileDescriptor); - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionCheck()) { return; } @@ -246,7 +246,7 @@ socket_getOption(JNIEnv *env, jobject object, jobject fileDescriptor, jint optID fd = jniGetFDFromFileDescriptor(env, fileDescriptor); - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionCheck()) { return 0; } @@ -293,7 +293,7 @@ static void socket_setOption( fd = jniGetFDFromFileDescriptor(env, fileDescriptor); - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionCheck()) { return; } @@ -353,7 +353,7 @@ static jint socket_pending (JNIEnv *env, jobject object, fd = jniGetFDFromFileDescriptor(env, fileDescriptor); - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionCheck()) { return (jint)-1; } @@ -378,7 +378,7 @@ static jint socket_available (JNIEnv *env, jobject object, fd = jniGetFDFromFileDescriptor(env, fileDescriptor); - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionCheck()) { return (jint)-1; } @@ -459,20 +459,20 @@ static int socket_process_cmsg(JNIEnv *env, jobject thisJ, struct msghdr * pMsg) 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 @@ static int socket_write_all(JNIEnv *env, jobject object, int fd, = (jobjectArray)env->GetObjectField( object, field_outboundFileDescriptors); - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionCheck()) { return -1; } @@ -570,18 +570,18 @@ static int socket_write_all(JNIEnv *env, jobject object, int fd, // 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 @@ static jint socket_read (JNIEnv *env, jobject object, jobject fileDescriptor) fd = jniGetFDFromFileDescriptor(env, fileDescriptor); - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionCheck()) { return (jint)0; } @@ -683,7 +683,7 @@ static jint socket_readba (JNIEnv *env, jobject object, fd = jniGetFDFromFileDescriptor(env, fileDescriptor); - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionCheck()) { return (jint)-1; } @@ -717,7 +717,7 @@ static void socket_write (JNIEnv *env, jobject object, fd = jniGetFDFromFileDescriptor(env, fileDescriptor); - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionCheck()) { return; } @@ -745,7 +745,7 @@ static void socket_writeba (JNIEnv *env, jobject object, fd = jniGetFDFromFileDescriptor(env, fileDescriptor); - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionCheck()) { return; } @@ -777,7 +777,7 @@ static jobject socket_get_peer_credentials(JNIEnv *env, fd = jniGetFDFromFileDescriptor(env, fileDescriptor); - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionCheck()) { return NULL; } @@ -816,7 +816,7 @@ static jobject socket_getSockName(JNIEnv *env, 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 a8ed89554261..15d62a2bd476 100644 --- a/core/jni/android_os_MessageQueue.cpp +++ b/core/jni/android_os_MessageQueue.cpp @@ -54,8 +54,8 @@ MessageQueue::~MessageQueue() { } 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 ffa569e7e0fa..c28254973346 100644 --- a/core/jni/android_os_SELinux.cpp +++ b/core/jni/android_os_SELinux.cpp @@ -97,7 +97,7 @@ static jstring getPeerCon(JNIEnv *env, jobject, jobject fileDescriptor) { } 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 7e12b1ea71b6..ca21fd716a5f 100644 --- a/core/jni/android_server_NetworkManagementSocketTagger.cpp +++ b/core/jni/android_server_NetworkManagementSocketTagger.cpp @@ -35,7 +35,7 @@ static jint QTagUid_tagSocketFd(JNIEnv* env, jclass, 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 @@ static jint QTagUid_untagSocketFd(JNIEnv* env, jclass, 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 81e887de781e..7f7cfcebd879 100644 --- a/core/jni/android_util_Binder.cpp +++ b/core/jni/android_util_Binder.cpp @@ -272,9 +272,9 @@ protected: //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 @@ protected: 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 @@ public: 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 @@ static void conditionally_log_binder_call(int64_t start_millis, } // 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 aaa680f8cd5b..65061900ffbb 100644 --- a/core/jni/android_util_Process.cpp +++ b/core/jni/android_util_Process.cpp @@ -271,7 +271,7 @@ static void android_os_Process_setCanSelfBackground(JNIEnv* env, jobject clazz, // 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 @@ void android_os_Process_setThreadPriority(JNIEnv* env, jobject clazz, // 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_setThreadPriority(JNIEnv* env, jobject clazz, 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_ZygoteInit.cpp b/core/jni/com_android_internal_os_ZygoteInit.cpp index 2233ee3e012b..10c6e2ce3a83 100644 --- a/core/jni/com_android_internal_os_ZygoteInit.cpp +++ b/core/jni/com_android_internal_os_ZygoteInit.cpp @@ -96,7 +96,7 @@ static void com_android_internal_os_ZygoteInit_reopenStdio(JNIEnv* env, fd = jniGetFDFromFileDescriptor(env, in); - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionCheck()) { return; } @@ -106,7 +106,7 @@ static void com_android_internal_os_ZygoteInit_reopenStdio(JNIEnv* env, fd = jniGetFDFromFileDescriptor(env, out); - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionCheck()) { return; } @@ -116,7 +116,7 @@ static void com_android_internal_os_ZygoteInit_reopenStdio(JNIEnv* env, fd = jniGetFDFromFileDescriptor(env, errfd); - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionCheck()) { return; } @@ -134,7 +134,7 @@ static void com_android_internal_os_ZygoteInit_setCloseOnExec (JNIEnv *env, fd = jniGetFDFromFileDescriptor(env, descriptor); - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionCheck()) { return; } @@ -170,7 +170,7 @@ static jint com_android_internal_os_ZygoteInit_selectReadable ( jsize length = env->GetArrayLength(fds); fd_set fdset; - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionCheck()) { return -1; } @@ -179,14 +179,14 @@ static jint com_android_internal_os_ZygoteInit_selectReadable ( 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 @@ static jint com_android_internal_os_ZygoteInit_selectReadable ( 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 af213ba06f56..ad520b3b7383 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -503,10 +503,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> @@ -1004,7 +1004,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 @@ -1016,7 +1016,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. @@ -1024,7 +1024,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. @@ -1209,7 +1209,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> @@ -1482,17 +1482,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. @@ -1505,7 +1505,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. --> |