diff options
65 files changed, 252 insertions, 203 deletions
diff --git a/cmds/interrupter/Android.mk b/cmds/interrupter/Android.mk new file mode 100644 index 0000000..e324627 --- /dev/null +++ b/cmds/interrupter/Android.mk @@ -0,0 +1,21 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + interrupter.c +LOCAL_MODULE := interrupter +LOCAL_MODULE_TAGS := eng tests +LOCAL_LDFLAGS := -ldl + +include $(BUILD_SHARED_LIBRARY) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + interrupter.c +LOCAL_MODULE := interrupter +LOCAL_MODULE_TAGS := eng tests +LOCAL_LDFLAGS := -ldl + +include $(BUILD_HOST_SHARED_LIBRARY)
\ No newline at end of file diff --git a/cmds/interrupter/interrupter.c b/cmds/interrupter/interrupter.c new file mode 100644 index 0000000..ae55515 --- /dev/null +++ b/cmds/interrupter/interrupter.c @@ -0,0 +1,53 @@ +/* + * Copyright 2012, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/** + * The probability of a syscall failing from 0.0 to 1.0 + */ +#define PROBABILITY 0.9 + + + +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> + +/* for various intercepted calls */ +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/stat.h> +#include <fcntl.h> + +/* For builds on glibc */ +#define __USE_GNU +#include <dlfcn.h> + +#include "interrupter.h" + +static int probability = PROBABILITY * RAND_MAX; + +static int maybe_interrupt() { + if (rand() < probability) { + return 1; + } + return 0; +} + +DEFINE_INTERCEPT(read, ssize_t, int, void*, size_t); +DEFINE_INTERCEPT(write, ssize_t, int, const void*, size_t); +DEFINE_INTERCEPT(accept, int, int, struct sockaddr*, socklen_t*); +DEFINE_INTERCEPT(creat, int, const char*, mode_t); diff --git a/cmds/interrupter/interrupter.h b/cmds/interrupter/interrupter.h new file mode 100644 index 0000000..9ad0277 --- /dev/null +++ b/cmds/interrupter/interrupter.h @@ -0,0 +1,79 @@ +/* + * Copyright 2012, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define CONCATENATE(arg1, arg2) CONCATENATE1(arg1, arg2) +#define CONCATENATE1(arg1, arg2) CONCATENATE2(arg1, arg2) +#define CONCATENATE2(arg1, arg2) arg1##arg2 + +#define INTERRUPTER(sym) \ + if (real_##sym == NULL) \ + __init_##sym(); \ + if (maybe_interrupt()) { \ + errno = EINTR; \ + return -1; \ + } + +#define CALL_FUNCTION_1(sym, ret, type1) \ +ret (*real_##sym)(type1) = NULL; \ +ret sym(type1 arg1) { \ + INTERRUPTER(sym) \ + return real_##sym(arg1); \ +} + +#define CALL_FUNCTION_2(sym, ret, type1, type2) \ +ret (*real_##sym)(type1, type2) = NULL; \ +ret sym(type1 arg1, type2 arg2) { \ + INTERRUPTER(sym) \ + return real_##sym(arg1, arg2); \ +} + +#define CALL_FUNCTION_3(sym, ret, type1, type2, type3) \ +ret (*real_##sym)(type1, type2, type3) = NULL; \ +ret sym(type1 arg1, type2 arg2, type3 arg3) { \ + INTERRUPTER(sym) \ + return real_##sym(arg1, arg2, arg3); \ +} + +#define CALL_FUNCTION_4(sym, ret, type1, type2, type3, type4) \ +ret (*real_##sym)(type1, type2, type3, type4) = NULL; \ +ret sym(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ + INTERRUPTER(sym) \ + return real_##sym(arg1, arg2, arg3, arg4); \ +} + +#define CALL_FUNCTION_5(sym, ret, type1, type2, type3, type4, type5) \ +ret (*real_##sym)(type1, type2, type3, type4, type5) = NULL; \ +ret sym(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \ + INTERRUPTER(sym) \ + return real_##sym(arg1, arg2, arg3, arg4, arg5); \ +} + +#define DEFINE_INTERCEPT_N(N, sym, ret, ...) \ +static void __init_##sym(void); \ +CONCATENATE(CALL_FUNCTION_, N)(sym, ret, __VA_ARGS__) \ +static void __init_##sym(void) { \ + real_##sym = dlsym(RTLD_NEXT, #sym); \ + if (real_##sym == NULL) { \ + fprintf(stderr, "Error hooking " #sym ": %s\n", dlerror()); \ + } \ +} + +#define INTERCEPT_NARG(...) INTERCEPT_NARG_N(__VA_ARGS__, INTERCEPT_RSEQ_N()) +#define INTERCEPT_NARG_N(...) INTERCEPT_ARG_N(__VA_ARGS__) +#define INTERCEPT_ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, N, ...) N +#define INTERCEPT_RSEQ_N() 8, 7, 6, 5, 4, 3, 2, 1, 0 + +#define DEFINE_INTERCEPT(sym, ret, ...) DEFINE_INTERCEPT_N(INTERCEPT_NARG(__VA_ARGS__), sym, ret, __VA_ARGS__) diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index d880817..22fd9a9 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -4492,6 +4492,8 @@ public final class ActivityThread { + "snatched provider from the jaws of death"); } prc.removePending = false; + // There is a race! It fails to remove the message, which + // will be handled in completeRemoveProvider(). mH.removeMessages(H.REMOVE_PROVIDER, prc); } else { unstableDelta = 0; @@ -4671,6 +4673,11 @@ public final class ActivityThread { return; } + // More complicated race!! Some client managed to acquire the + // provider and release it before the removal was completed. + // Continue the removal, and abort the next remove message. + prc.removePending = false; + final IBinder jBinder = prc.holder.provider.asBinder(); ProviderRefCount existingPrc = mProviderRefCountMap.get(jBinder); if (existingPrc == prc) { diff --git a/core/java/android/bluetooth/BluetoothA2dp.java b/core/java/android/bluetooth/BluetoothA2dp.java index 6fdf3b4..6fdf3b4 100755..100644 --- a/core/java/android/bluetooth/BluetoothA2dp.java +++ b/core/java/android/bluetooth/BluetoothA2dp.java diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java index 6367e16..6367e16 100755..100644 --- a/core/java/android/bluetooth/BluetoothAdapter.java +++ b/core/java/android/bluetooth/BluetoothAdapter.java diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java index 4cc22b4..4cc22b4 100755..100644 --- a/core/java/android/bluetooth/BluetoothDevice.java +++ b/core/java/android/bluetooth/BluetoothDevice.java diff --git a/core/java/android/bluetooth/BluetoothHeadset.java b/core/java/android/bluetooth/BluetoothHeadset.java index 793d798..793d798 100755..100644 --- a/core/java/android/bluetooth/BluetoothHeadset.java +++ b/core/java/android/bluetooth/BluetoothHeadset.java diff --git a/core/java/android/bluetooth/BluetoothInputDevice.java b/core/java/android/bluetooth/BluetoothInputDevice.java index db7e424..db7e424 100755..100644 --- a/core/java/android/bluetooth/BluetoothInputDevice.java +++ b/core/java/android/bluetooth/BluetoothInputDevice.java diff --git a/core/java/android/bluetooth/BluetoothPbap.java b/core/java/android/bluetooth/BluetoothPbap.java index b5280e5..b5280e5 100755..100644 --- a/core/java/android/bluetooth/BluetoothPbap.java +++ b/core/java/android/bluetooth/BluetoothPbap.java diff --git a/core/java/android/bluetooth/BluetoothProfile.java b/core/java/android/bluetooth/BluetoothProfile.java index 1920efa..1920efa 100755..100644 --- a/core/java/android/bluetooth/BluetoothProfile.java +++ b/core/java/android/bluetooth/BluetoothProfile.java diff --git a/core/java/android/bluetooth/IBluetoothInputDevice.aidl b/core/java/android/bluetooth/IBluetoothInputDevice.aidl index 1ebb9ca..1ebb9ca 100755..100644 --- a/core/java/android/bluetooth/IBluetoothInputDevice.aidl +++ b/core/java/android/bluetooth/IBluetoothInputDevice.aidl diff --git a/core/java/android/bluetooth/IBluetoothManager.aidl b/core/java/android/bluetooth/IBluetoothManager.aidl index ed8777c..ed8777c 100755..100644 --- a/core/java/android/bluetooth/IBluetoothManager.aidl +++ b/core/java/android/bluetooth/IBluetoothManager.aidl diff --git a/core/java/android/text/format/DateUtils.java b/core/java/android/text/format/DateUtils.java index 7e9d811..5a88cf6 100644 --- a/core/java/android/text/format/DateUtils.java +++ b/core/java/android/text/format/DateUtils.java @@ -39,7 +39,6 @@ public class DateUtils { private static final Object sLock = new Object(); private static Configuration sLastConfig; - private static java.text.DateFormat sStatusTimeFormat; private static String sElapsedFormatMMSS; private static String sElapsedFormatHMMSS; @@ -95,14 +94,14 @@ public class DateUtils // translated. /** * This is not actually the preferred 24-hour date format in all locales. - * @deprecated use {@link java.text.SimpleDateFormat} instead. + * @deprecated Use {@link java.text.SimpleDateFormat} instead. */ @Deprecated public static final String HOUR_MINUTE_24 = "%H:%M"; public static final String MONTH_FORMAT = "%B"; /** * This is not actually a useful month name in all locales. - * @deprecated use {@link java.text.SimpleDateFormat} instead. + * @deprecated Use {@link java.text.SimpleDateFormat} instead. */ @Deprecated public static final String ABBREV_MONTH_FORMAT = "%b"; @@ -118,7 +117,7 @@ public class DateUtils // The index is constructed from a bit-wise OR of the boolean values: // {showTime, showYear, showWeekDay}. For example, if showYear and // showWeekDay are both true, then the index would be 3. - /** @deprecated do not use. */ + /** @deprecated Do not use. */ public static final int sameYearTable[] = { com.android.internal.R.string.same_year_md1_md2, com.android.internal.R.string.same_year_wday1_md1_wday2_md2, @@ -145,7 +144,7 @@ public class DateUtils // The index is constructed from a bit-wise OR of the boolean values: // {showTime, showYear, showWeekDay}. For example, if showYear and // showWeekDay are both true, then the index would be 3. - /** @deprecated do not use. */ + /** @deprecated Do not use. */ public static final int sameMonthTable[] = { com.android.internal.R.string.same_month_md1_md2, com.android.internal.R.string.same_month_wday1_md1_wday2_md2, @@ -172,7 +171,7 @@ public class DateUtils * * @more <p> * e.g. "Sunday" or "January" - * @deprecated use {@link java.text.SimpleDateFormat} instead. + * @deprecated Use {@link java.text.SimpleDateFormat} instead. */ @Deprecated public static final int LENGTH_LONG = 10; @@ -183,7 +182,7 @@ public class DateUtils * * @more <p> * e.g. "Sun" or "Jan" - * @deprecated use {@link java.text.SimpleDateFormat} instead. + * @deprecated Use {@link java.text.SimpleDateFormat} instead. */ @Deprecated public static final int LENGTH_MEDIUM = 20; @@ -195,7 +194,7 @@ public class DateUtils * <p>e.g. "Su" or "Jan" * <p>In most languages, the results returned for LENGTH_SHORT will be the same as * the results returned for {@link #LENGTH_MEDIUM}. - * @deprecated use {@link java.text.SimpleDateFormat} instead. + * @deprecated Use {@link java.text.SimpleDateFormat} instead. */ @Deprecated public static final int LENGTH_SHORT = 30; @@ -204,7 +203,7 @@ public class DateUtils * Request an even shorter abbreviated version of the name. * Do not use this. Currently this will always return the same result * as {@link #LENGTH_SHORT}. - * @deprecated use {@link java.text.SimpleDateFormat} instead. + * @deprecated Use {@link java.text.SimpleDateFormat} instead. */ @Deprecated public static final int LENGTH_SHORTER = 40; @@ -216,7 +215,7 @@ public class DateUtils * <p>e.g. "S", "T", "T" or "J" * <p>In some languages, the results returned for LENGTH_SHORTEST will be the same as * the results returned for {@link #LENGTH_SHORT}. - * @deprecated use {@link java.text.SimpleDateFormat} instead. + * @deprecated Use {@link java.text.SimpleDateFormat} instead. */ @Deprecated public static final int LENGTH_SHORTEST = 50; @@ -232,7 +231,7 @@ public class DateUtils * Undefined lengths will return {@link #LENGTH_MEDIUM} * but may return something different in the future. * @throws IndexOutOfBoundsException if the dayOfWeek is out of bounds. - * @deprecated use {@link java.text.SimpleDateFormat} instead. + * @deprecated Use {@link java.text.SimpleDateFormat} instead. */ @Deprecated public static String getDayOfWeekString(int dayOfWeek, int abbrev) { @@ -254,7 +253,7 @@ public class DateUtils * @param ampm Either {@link Calendar#AM Calendar.AM} or {@link Calendar#PM Calendar.PM}. * @throws IndexOutOfBoundsException if the ampm is out of bounds. * @return Localized version of "AM" or "PM". - * @deprecated use {@link java.text.SimpleDateFormat} instead. + * @deprecated Use {@link java.text.SimpleDateFormat} instead. */ @Deprecated public static String getAMPMString(int ampm) { @@ -270,7 +269,7 @@ public class DateUtils * Undefined lengths will return {@link #LENGTH_MEDIUM} * but may return something different in the future. * @return Localized month of the year. - * @deprecated use {@link java.text.SimpleDateFormat} instead. + * @deprecated Use {@link java.text.SimpleDateFormat} instead. */ @Deprecated public static String getMonthString(int month, int abbrev) { @@ -514,7 +513,6 @@ public class DateUtils Configuration cfg = r.getConfiguration(); if (sLastConfig == null || !sLastConfig.equals(cfg)) { sLastConfig = cfg; - sStatusTimeFormat = java.text.DateFormat.getTimeInstance(java.text.DateFormat.SHORT); sElapsedFormatMMSS = r.getString(com.android.internal.R.string.elapsed_time_short_format_mm_ss); sElapsedFormatHMMSS = r.getString(com.android.internal.R.string.elapsed_time_short_format_h_mm_ss); } @@ -651,99 +649,6 @@ public class DateUtils } /** - * Return a string containing the date and time in RFC2445 format. - * Ensures that the time is written in UTC. The Calendar class doesn't - * really help out with this, so this is slower than it ought to be. - * - * @param cal the date and time to write - * @hide - * @deprecated use {@link android.text.format.Time} - */ - public static String writeDateTime(Calendar cal) - { - TimeZone tz = TimeZone.getTimeZone("GMT"); - GregorianCalendar c = new GregorianCalendar(tz); - c.setTimeInMillis(cal.getTimeInMillis()); - return writeDateTime(c, true); - } - - /** - * Return a string containing the date and time in RFC2445 format. - * - * @param cal the date and time to write - * @param zulu If the calendar is in UTC, pass true, and a Z will - * be written at the end as per RFC2445. Otherwise, the time is - * considered in localtime. - * @hide - * @deprecated use {@link android.text.format.Time} - */ - public static String writeDateTime(Calendar cal, boolean zulu) - { - StringBuilder sb = new StringBuilder(); - sb.ensureCapacity(16); - if (zulu) { - sb.setLength(16); - sb.setCharAt(15, 'Z'); - } else { - sb.setLength(15); - } - return writeDateTime(cal, sb); - } - - /** - * Return a string containing the date and time in RFC2445 format. - * - * @param cal the date and time to write - * @param sb a StringBuilder to use. It is assumed that setLength - * has already been called on sb to the appropriate length - * which is sb.setLength(zulu ? 16 : 15) - * @hide - * @deprecated use {@link android.text.format.Time} - */ - public static String writeDateTime(Calendar cal, StringBuilder sb) - { - int n; - - n = cal.get(Calendar.YEAR); - sb.setCharAt(3, (char)('0'+n%10)); - n /= 10; - sb.setCharAt(2, (char)('0'+n%10)); - n /= 10; - sb.setCharAt(1, (char)('0'+n%10)); - n /= 10; - sb.setCharAt(0, (char)('0'+n%10)); - - n = cal.get(Calendar.MONTH) + 1; - sb.setCharAt(5, (char)('0'+n%10)); - n /= 10; - sb.setCharAt(4, (char)('0'+n%10)); - - n = cal.get(Calendar.DAY_OF_MONTH); - sb.setCharAt(7, (char)('0'+n%10)); - n /= 10; - sb.setCharAt(6, (char)('0'+n%10)); - - sb.setCharAt(8, 'T'); - - n = cal.get(Calendar.HOUR_OF_DAY); - sb.setCharAt(10, (char)('0'+n%10)); - n /= 10; - sb.setCharAt(9, (char)('0'+n%10)); - - n = cal.get(Calendar.MINUTE); - sb.setCharAt(12, (char)('0'+n%10)); - n /= 10; - sb.setCharAt(11, (char)('0'+n%10)); - - n = cal.get(Calendar.SECOND); - sb.setCharAt(14, (char)('0'+n%10)); - n /= 10; - sb.setCharAt(13, (char)('0'+n%10)); - - return sb.toString(); - } - - /** * Formats a date or a time range according to the local conventions. * <p> * Note that this is a convenience method. Using it involves creating an diff --git a/core/java/android/text/format/Formatter.java b/core/java/android/text/format/Formatter.java index 121c6f2..9c98b98 100644 --- a/core/java/android/text/format/Formatter.java +++ b/core/java/android/text/format/Formatter.java @@ -95,16 +95,12 @@ public final class Formatter { } /** - * Returns a string in the canonical IP format ###.###.###.### from a packed integer containing - * the IP address. The IP address is expected to be in little-endian format (LSB first). That - * is, 0x01020304 will return "4.3.2.1". + * Returns a string in the canonical IPv4 format ###.###.###.### from a packed integer + * containing the IP address. The IPv4 address is expected to be in little-endian + * format (LSB first). That is, 0x01020304 will return "4.3.2.1". * - * @param ipv4Address the IP address as a packed integer with LSB first. - * @return string with canonical IP address format. - * - * @deprecated this method doesn't support IPv6 addresses. Prefer {@link - * java.net.InetAddress#getHostAddress()}, which supports both IPv4 and - * IPv6 addresses. + * @deprecated Use {@link java.net.InetAddress#getHostAddress()}, which supports both IPv4 and + * IPv6 addresses. This method does not support IPv6 addresses. */ @Deprecated public static String formatIpAddress(int ipv4Address) { diff --git a/core/jni/android_ddm_DdmHandleNativeHeap.cpp b/core/jni/android_ddm_DdmHandleNativeHeap.cpp index 42d408d..f5eaf94 100644 --- a/core/jni/android_ddm_DdmHandleNativeHeap.cpp +++ b/core/jni/android_ddm_DdmHandleNativeHeap.cpp @@ -2,16 +2,16 @@ ** ** Copyright 2006, The Android Open Source Project ** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at ** -** http://www.apache.org/licenses/LICENSE-2.0 +** http://www.apache.org/licenses/LICENSE-2.0 ** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and ** limitations under the License. */ @@ -23,20 +23,17 @@ #include <android_runtime/AndroidRuntime.h> #include <utils/Log.h> +#include <utils/String8.h> #include <fcntl.h> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> -#if defined(__arm__) -extern "C" void get_malloc_leak_info(uint8_t** info, size_t* overallSize, - size_t* infoSize, size_t* totalMemory, size_t* backtraceSize); - -extern "C" void free_malloc_leak_info(uint8_t* info); -#endif +extern "C" void get_malloc_leak_info(uint8_t** info, size_t* overallSize, + size_t* infoSize, size_t* totalMemory, size_t* backtraceSize); -#define MAPS_FILE_SIZE 65 * 1024 +extern "C" void free_malloc_leak_info(uint8_t* info); struct Header { size_t mapSize; @@ -48,96 +45,57 @@ struct Header { namespace android { +static void ReadFile(const char* path, String8& s) { + int fd = open(path, O_RDONLY); + if (fd != -1) { + char bytes[1024]; + ssize_t byteCount; + while ((byteCount = TEMP_FAILURE_RETRY(read(fd, bytes, sizeof(bytes)))) > 0) { + s.append(bytes, byteCount); + } + close(fd); + } +} + /* - * Retrieve the native heap information and the info from /proc/<self>/maps, + * Retrieve the native heap information and the info from /proc/self/maps, * copy them into a byte[] with a "struct Header" that holds data offsets, * and return the array. */ -static jbyteArray getLeakInfo(JNIEnv *env, jobject clazz) -{ -#if defined(__arm__) - // get the info in /proc/[pid]/map +static jbyteArray DdmHandleNativeHeap_getLeakInfo(JNIEnv* env, jobject) { Header header; memset(&header, 0, sizeof(header)); - pid_t pid = getpid(); - - char path[FILENAME_MAX]; - sprintf(path, "/proc/%d/maps", pid); - - struct stat sb; - int ret = stat(path, &sb); - - uint8_t* mapsFile = NULL; - if (ret == 0) { - mapsFile = (uint8_t*)malloc(MAPS_FILE_SIZE); - int fd = open(path, O_RDONLY); - - if (mapsFile != NULL && fd != -1) { - int amount = 0; - do { - uint8_t* ptr = mapsFile + header.mapSize; - amount = read(fd, ptr, MAPS_FILE_SIZE); - if (amount <= 0) { - if (errno != EINTR) - break; - else - continue; - } - header.mapSize += amount; - } while (header.mapSize < MAPS_FILE_SIZE); - - ALOGD("**** read %d bytes from '%s'", (int) header.mapSize, path); - } - } + String8 maps; + ReadFile("/proc/self/maps", maps); + header.mapSize = maps.size(); uint8_t* allocBytes; - get_malloc_leak_info(&allocBytes, &header.allocSize, &header.allocInfoSize, - &header.totalMemory, &header.backtraceSize); + get_malloc_leak_info(&allocBytes, &header.allocSize, &header.allocInfoSize, + &header.totalMemory, &header.backtraceSize); - jbyte* bytes = NULL; - jbyte* ptr = NULL; - jbyteArray array = env->NewByteArray(sizeof(Header) + header.mapSize + header.allocSize); - if (array == NULL) { - goto done; - } - - bytes = env->GetByteArrayElements(array, NULL); - ptr = bytes; - -// ALOGD("*** mapSize: %d allocSize: %d allocInfoSize: %d totalMemory: %d", -// header.mapSize, header.allocSize, header.allocInfoSize, header.totalMemory); + ALOGD("*** mapSize: %d allocSize: %d allocInfoSize: %d totalMemory: %d", + header.mapSize, header.allocSize, header.allocInfoSize, header.totalMemory); - memcpy(ptr, &header, sizeof(header)); - ptr += sizeof(header); - - if (header.mapSize > 0 && mapsFile != NULL) { - memcpy(ptr, mapsFile, header.mapSize); - ptr += header.mapSize; + jbyteArray array = env->NewByteArray(sizeof(Header) + header.mapSize + header.allocSize); + if (array != NULL) { + env->SetByteArrayRegion(array, 0, + sizeof(header), reinterpret_cast<jbyte*>(&header)); + env->SetByteArrayRegion(array, sizeof(header), + maps.size(), reinterpret_cast<const jbyte*>(maps.string())); + env->SetByteArrayRegion(array, sizeof(header) + maps.size(), + header.allocSize, reinterpret_cast<jbyte*>(allocBytes)); } - - memcpy(ptr, allocBytes, header.allocSize); - env->ReleaseByteArrayElements(array, bytes, 0); -done: - if (mapsFile != NULL) { - free(mapsFile); - } - // free the info up! free_malloc_leak_info(allocBytes); - return array; -#else - return NULL; -#endif } static JNINativeMethod method_table[] = { - { "getLeakInfo", "()[B", (void*)getLeakInfo }, + { "getLeakInfo", "()[B", (void*) DdmHandleNativeHeap_getLeakInfo }, }; -int register_android_ddm_DdmHandleNativeHeap(JNIEnv *env) -{ +int register_android_ddm_DdmHandleNativeHeap(JNIEnv* env) { return AndroidRuntime::registerNativeMethods(env, "android/ddm/DdmHandleNativeHeap", method_table, NELEM(method_table)); } diff --git a/core/res/res/values-mcc286/config.xml b/core/res/res/values-mcc286/config.xml index d99d051..d99d051 100755..100644 --- a/core/res/res/values-mcc286/config.xml +++ b/core/res/res/values-mcc286/config.xml diff --git a/core/res/res/xml/kg_password_kbd_numeric.xml b/core/res/res/xml/kg_password_kbd_numeric.xml index 93b32af..93b32af 100755..100644 --- a/core/res/res/xml/kg_password_kbd_numeric.xml +++ b/core/res/res/xml/kg_password_kbd_numeric.xml diff --git a/data/sounds/AudioPackage10.mk b/data/sounds/AudioPackage10.mk index b40e385..b40e385 100755..100644 --- a/data/sounds/AudioPackage10.mk +++ b/data/sounds/AudioPackage10.mk diff --git a/data/sounds/AudioPackage8.mk b/data/sounds/AudioPackage8.mk index 93c43da..93c43da 100755..100644 --- a/data/sounds/AudioPackage8.mk +++ b/data/sounds/AudioPackage8.mk diff --git a/data/sounds/AudioPackage9.mk b/data/sounds/AudioPackage9.mk index 73e4fd3..73e4fd3 100755..100644 --- a/data/sounds/AudioPackage9.mk +++ b/data/sounds/AudioPackage9.mk diff --git a/data/sounds/alarms/ogg/Krypton.ogg b/data/sounds/alarms/ogg/Krypton.ogg Binary files differindex 48f956b..48f956b 100755..100644 --- a/data/sounds/alarms/ogg/Krypton.ogg +++ b/data/sounds/alarms/ogg/Krypton.ogg diff --git a/data/sounds/alarms/wav/Argon.wav b/data/sounds/alarms/wav/Argon.wav Binary files differindex 56e57fc..56e57fc 100755..100644 --- a/data/sounds/alarms/wav/Argon.wav +++ b/data/sounds/alarms/wav/Argon.wav diff --git a/data/sounds/alarms/wav/Carbon.wav b/data/sounds/alarms/wav/Carbon.wav Binary files differindex 2b855e1..2b855e1 100755..100644 --- a/data/sounds/alarms/wav/Carbon.wav +++ b/data/sounds/alarms/wav/Carbon.wav diff --git a/data/sounds/alarms/wav/Osmium.wav b/data/sounds/alarms/wav/Osmium.wav Binary files differindex 2dcc47f..2dcc47f 100755..100644 --- a/data/sounds/alarms/wav/Osmium.wav +++ b/data/sounds/alarms/wav/Osmium.wav diff --git a/data/sounds/alarms/wav/Platinum.wav b/data/sounds/alarms/wav/Platinum.wav Binary files differindex 08ea03e..08ea03e 100755..100644 --- a/data/sounds/alarms/wav/Platinum.wav +++ b/data/sounds/alarms/wav/Platinum.wav diff --git a/data/sounds/alarms/wav/Promethium.wav b/data/sounds/alarms/wav/Promethium.wav Binary files differindex 08ea03e..08ea03e 100755..100644 --- a/data/sounds/alarms/wav/Promethium.wav +++ b/data/sounds/alarms/wav/Promethium.wav diff --git a/docs/html/google/play/billing/v2/billing_integrate.jd b/docs/html/google/play/billing/v2/billing_integrate.jd index 7b748a3..7b748a3 100755..100644 --- a/docs/html/google/play/billing/v2/billing_integrate.jd +++ b/docs/html/google/play/billing/v2/billing_integrate.jd diff --git a/docs/html/images/ui/notifications/custom_message.png b/docs/html/images/ui/notifications/custom_message.png Binary files differindex 00b7632..00b7632 100755..100644 --- a/docs/html/images/ui/notifications/custom_message.png +++ b/docs/html/images/ui/notifications/custom_message.png diff --git a/docs/html/images/ui/notifications/notifications_window.png b/docs/html/images/ui/notifications/notifications_window.png Binary files differindex 0354ee9..0354ee9 100755..100644 --- a/docs/html/images/ui/notifications/notifications_window.png +++ b/docs/html/images/ui/notifications/notifications_window.png diff --git a/docs/html/images/ui/notifications/status_bar.png b/docs/html/images/ui/notifications/status_bar.png Binary files differindex f0240a5..f0240a5 100755..100644 --- a/docs/html/images/ui/notifications/status_bar.png +++ b/docs/html/images/ui/notifications/status_bar.png diff --git a/docs/html/training/animation/anim_card_flip.mp4 b/docs/html/training/animation/anim_card_flip.mp4 Binary files differindex e885f98..e885f98 100755..100644 --- a/docs/html/training/animation/anim_card_flip.mp4 +++ b/docs/html/training/animation/anim_card_flip.mp4 diff --git a/docs/html/training/animation/anim_card_flip.ogv b/docs/html/training/animation/anim_card_flip.ogv Binary files differindex 33cd86c..33cd86c 100755..100644 --- a/docs/html/training/animation/anim_card_flip.ogv +++ b/docs/html/training/animation/anim_card_flip.ogv diff --git a/docs/html/training/animation/anim_card_flip.webm b/docs/html/training/animation/anim_card_flip.webm Binary files differindex a670d78..a670d78 100755..100644 --- a/docs/html/training/animation/anim_card_flip.webm +++ b/docs/html/training/animation/anim_card_flip.webm diff --git a/docs/html/training/animation/anim_screenslide.mp4 b/docs/html/training/animation/anim_screenslide.mp4 Binary files differindex 3e65026..3e65026 100755..100644 --- a/docs/html/training/animation/anim_screenslide.mp4 +++ b/docs/html/training/animation/anim_screenslide.mp4 diff --git a/docs/html/training/animation/anim_screenslide.ogv b/docs/html/training/animation/anim_screenslide.ogv Binary files differindex c45ebd4..c45ebd4 100755..100644 --- a/docs/html/training/animation/anim_screenslide.ogv +++ b/docs/html/training/animation/anim_screenslide.ogv diff --git a/docs/html/training/animation/anim_screenslide.webm b/docs/html/training/animation/anim_screenslide.webm Binary files differindex c72adbc..c72adbc 100755..100644 --- a/docs/html/training/animation/anim_screenslide.webm +++ b/docs/html/training/animation/anim_screenslide.webm diff --git a/keystore/java/android/security/Credentials.java b/keystore/java/android/security/Credentials.java index d8109ce..166849d 100644 --- a/keystore/java/android/security/Credentials.java +++ b/keystore/java/android/security/Credentials.java @@ -49,6 +49,8 @@ public class Credentials { public static final String INSTALL_ACTION = "android.credentials.INSTALL"; + public static final String INSTALL_AS_USER_ACTION = "android.credentials.INSTALL_AS_USER"; + public static final String UNLOCK_ACTION = "com.android.credentials.UNLOCK"; /** Key prefix for CA certificates. */ @@ -83,6 +85,12 @@ public class Credentials { public static final String EXTENSION_PFX = ".pfx"; /** + * Intent extra: install the certificate bundle as this UID instead of + * system. + */ + public static final String EXTRA_INSTALL_AS_UID = "install_as_uid"; + + /** * Intent extra: name for the user's private key. */ public static final String EXTRA_USER_PRIVATE_KEY_NAME = "user_private_key_name"; diff --git a/libs/hwui/Dither.cpp b/libs/hwui/Dither.cpp index e80b325..e80b325 100755..100644 --- a/libs/hwui/Dither.cpp +++ b/libs/hwui/Dither.cpp diff --git a/libs/hwui/Dither.h b/libs/hwui/Dither.h index 34cf9bf..34cf9bf 100755..100644 --- a/libs/hwui/Dither.h +++ b/libs/hwui/Dither.h diff --git a/media/jni/mediaeditor/VideoBrowserMain.c b/media/jni/mediaeditor/VideoBrowserMain.c index c6c6000..c6c6000 100755..100644 --- a/media/jni/mediaeditor/VideoBrowserMain.c +++ b/media/jni/mediaeditor/VideoBrowserMain.c diff --git a/media/tests/EffectsTest/Android.mk b/media/tests/EffectsTest/Android.mk index 25b4fe4..25b4fe4 100755..100644 --- a/media/tests/EffectsTest/Android.mk +++ b/media/tests/EffectsTest/Android.mk diff --git a/media/tests/EffectsTest/AndroidManifest.xml b/media/tests/EffectsTest/AndroidManifest.xml index 9b59891..9b59891 100755..100644 --- a/media/tests/EffectsTest/AndroidManifest.xml +++ b/media/tests/EffectsTest/AndroidManifest.xml diff --git a/media/tests/EffectsTest/res/drawable/icon.png b/media/tests/EffectsTest/res/drawable/icon.png Binary files differindex 64e3601..64e3601 100755..100644 --- a/media/tests/EffectsTest/res/drawable/icon.png +++ b/media/tests/EffectsTest/res/drawable/icon.png diff --git a/media/tests/EffectsTest/res/drawable/stop.png b/media/tests/EffectsTest/res/drawable/stop.png Binary files differindex 83f012c..83f012c 100755..100644 --- a/media/tests/EffectsTest/res/drawable/stop.png +++ b/media/tests/EffectsTest/res/drawable/stop.png diff --git a/media/tests/EffectsTest/res/layout/bassboosttest.xml b/media/tests/EffectsTest/res/layout/bassboosttest.xml index ac912c8..ac912c8 100755..100644 --- a/media/tests/EffectsTest/res/layout/bassboosttest.xml +++ b/media/tests/EffectsTest/res/layout/bassboosttest.xml diff --git a/media/tests/EffectsTest/res/layout/effectstest.xml b/media/tests/EffectsTest/res/layout/effectstest.xml index 9af4eb6..9af4eb6 100755..100644 --- a/media/tests/EffectsTest/res/layout/effectstest.xml +++ b/media/tests/EffectsTest/res/layout/effectstest.xml diff --git a/media/tests/EffectsTest/res/layout/envreverbtest.xml b/media/tests/EffectsTest/res/layout/envreverbtest.xml index 01c3240..01c3240 100755..100644 --- a/media/tests/EffectsTest/res/layout/envreverbtest.xml +++ b/media/tests/EffectsTest/res/layout/envreverbtest.xml diff --git a/media/tests/EffectsTest/res/layout/equalizertest.xml b/media/tests/EffectsTest/res/layout/equalizertest.xml index 5ef035d..5ef035d 100755..100644 --- a/media/tests/EffectsTest/res/layout/equalizertest.xml +++ b/media/tests/EffectsTest/res/layout/equalizertest.xml diff --git a/media/tests/EffectsTest/res/layout/presetreverbtest.xml b/media/tests/EffectsTest/res/layout/presetreverbtest.xml index cd7fbd3..cd7fbd3 100755..100644 --- a/media/tests/EffectsTest/res/layout/presetreverbtest.xml +++ b/media/tests/EffectsTest/res/layout/presetreverbtest.xml diff --git a/media/tests/EffectsTest/res/layout/virtualizertest.xml b/media/tests/EffectsTest/res/layout/virtualizertest.xml index 1fafeab..1fafeab 100755..100644 --- a/media/tests/EffectsTest/res/layout/virtualizertest.xml +++ b/media/tests/EffectsTest/res/layout/virtualizertest.xml diff --git a/media/tests/EffectsTest/res/layout/visualizertest.xml b/media/tests/EffectsTest/res/layout/visualizertest.xml index 50ac7bb..50ac7bb 100755..100644 --- a/media/tests/EffectsTest/res/layout/visualizertest.xml +++ b/media/tests/EffectsTest/res/layout/visualizertest.xml diff --git a/media/tests/EffectsTest/res/values/strings.xml b/media/tests/EffectsTest/res/values/strings.xml index 2a85184..2a85184 100755..100644 --- a/media/tests/EffectsTest/res/values/strings.xml +++ b/media/tests/EffectsTest/res/values/strings.xml diff --git a/media/tests/EffectsTest/src/com/android/effectstest/BassBoostTest.java b/media/tests/EffectsTest/src/com/android/effectstest/BassBoostTest.java index 1a10d64..1a10d64 100755..100644 --- a/media/tests/EffectsTest/src/com/android/effectstest/BassBoostTest.java +++ b/media/tests/EffectsTest/src/com/android/effectstest/BassBoostTest.java diff --git a/media/tests/EffectsTest/src/com/android/effectstest/EffectParameter.java b/media/tests/EffectsTest/src/com/android/effectstest/EffectParameter.java index 95077e7..95077e7 100755..100644 --- a/media/tests/EffectsTest/src/com/android/effectstest/EffectParameter.java +++ b/media/tests/EffectsTest/src/com/android/effectstest/EffectParameter.java diff --git a/media/tests/EffectsTest/src/com/android/effectstest/EffectsTest.java b/media/tests/EffectsTest/src/com/android/effectstest/EffectsTest.java index 7020246..7020246 100755..100644 --- a/media/tests/EffectsTest/src/com/android/effectstest/EffectsTest.java +++ b/media/tests/EffectsTest/src/com/android/effectstest/EffectsTest.java diff --git a/media/tests/EffectsTest/src/com/android/effectstest/EnvReverbTest.java b/media/tests/EffectsTest/src/com/android/effectstest/EnvReverbTest.java index 594e844..594e844 100755..100644 --- a/media/tests/EffectsTest/src/com/android/effectstest/EnvReverbTest.java +++ b/media/tests/EffectsTest/src/com/android/effectstest/EnvReverbTest.java diff --git a/media/tests/EffectsTest/src/com/android/effectstest/EqualizerTest.java b/media/tests/EffectsTest/src/com/android/effectstest/EqualizerTest.java index f30a26f..f30a26f 100755..100644 --- a/media/tests/EffectsTest/src/com/android/effectstest/EqualizerTest.java +++ b/media/tests/EffectsTest/src/com/android/effectstest/EqualizerTest.java diff --git a/media/tests/EffectsTest/src/com/android/effectstest/PresetReverbTest.java b/media/tests/EffectsTest/src/com/android/effectstest/PresetReverbTest.java index 91d7948..91d7948 100755..100644 --- a/media/tests/EffectsTest/src/com/android/effectstest/PresetReverbTest.java +++ b/media/tests/EffectsTest/src/com/android/effectstest/PresetReverbTest.java diff --git a/media/tests/EffectsTest/src/com/android/effectstest/VirtualizerTest.java b/media/tests/EffectsTest/src/com/android/effectstest/VirtualizerTest.java index bb32e6f..bb32e6f 100755..100644 --- a/media/tests/EffectsTest/src/com/android/effectstest/VirtualizerTest.java +++ b/media/tests/EffectsTest/src/com/android/effectstest/VirtualizerTest.java diff --git a/media/tests/EffectsTest/src/com/android/effectstest/VisualizerTest.java b/media/tests/EffectsTest/src/com/android/effectstest/VisualizerTest.java index 60583e0..60583e0 100755..100644 --- a/media/tests/EffectsTest/src/com/android/effectstest/VisualizerTest.java +++ b/media/tests/EffectsTest/src/com/android/effectstest/VisualizerTest.java diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/GestureRecorder.java b/packages/SystemUI/src/com/android/systemui/statusbar/GestureRecorder.java index 0f894a1..0f894a1 100755..100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/GestureRecorder.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/GestureRecorder.java diff --git a/policy/src/com/android/internal/policy/impl/GlobalActions.java b/policy/src/com/android/internal/policy/impl/GlobalActions.java index 3dc77d4..3dc77d4 100755..100644 --- a/policy/src/com/android/internal/policy/impl/GlobalActions.java +++ b/policy/src/com/android/internal/policy/impl/GlobalActions.java diff --git a/services/java/com/android/server/BluetoothManagerService.java b/services/java/com/android/server/BluetoothManagerService.java index 5a2088c..5a2088c 100755..100644 --- a/services/java/com/android/server/BluetoothManagerService.java +++ b/services/java/com/android/server/BluetoothManagerService.java diff --git a/services/java/com/android/server/pm/SELinuxMMAC.java b/services/java/com/android/server/pm/SELinuxMMAC.java index 15d2a5a..4bbdb5e 100644 --- a/services/java/com/android/server/pm/SELinuxMMAC.java +++ b/services/java/com/android/server/pm/SELinuxMMAC.java @@ -206,10 +206,10 @@ public final class SELinuxMMAC { String tagName = parser.getName(); if ("seinfo".equals(tagName)) { String seinfoValue = parser.getAttributeValue(null, "value"); - if (seinfoValue != null) { + if (validateValue(seinfoValue)) { seinfo = seinfoValue; } else { - Slog.w(TAG, "<seinfo> without value at " + Slog.w(TAG, "<seinfo> without valid value at " + parser.getPositionDescription()); } } @@ -219,6 +219,28 @@ public final class SELinuxMMAC { } /** + * General validation routine for tag values. + * Returns a boolean indicating if the passed string + * contains only letters or underscores. + */ + private static boolean validateValue(String name) { + if (name == null) + return false; + + final int N = name.length(); + if (N == 0) + return false; + + for (int i = 0; i < N; i++) { + final char c = name.charAt(i); + if ((c < 'a' || c > 'z') && (c < 'A' || c > 'Z') && (c != '_')) { + return false; + } + } + return true; + } + + /** * Labels a package based on an seinfo tag from install policy. * The label is attached to the ApplicationInfo instance of the package. * @param PackageParser.Package object representing the package |