summaryrefslogtreecommitdiffstats
path: root/tests/CoreTests
diff options
context:
space:
mode:
authorBrian Carlstrom <bdc@google.com>2010-02-09 11:23:40 -0800
committerBrian Carlstrom <bdc@google.com>2010-02-23 15:58:00 -0800
commit778ce486656a00c21ae9b51cda1f504fc11004f6 (patch)
tree0dc6dae87ec75fa90aad9d28dab514f516a846c8 /tests/CoreTests
parentc23844c60452a337a87875cd7d9d8ceb638fb36c (diff)
downloadframeworks_base-778ce486656a00c21ae9b51cda1f504fc11004f6.zip
frameworks_base-778ce486656a00c21ae9b51cda1f504fc11004f6.tar.gz
frameworks_base-778ce486656a00c21ae9b51cda1f504fc11004f6.tar.bz2
Issue 5697: getContextClassLoader returns a non-application classloader
ActivityThread should try to set the value for Java Thread.getContextClassLoader to the PathClassLoader that loaded the APK's classes so that Java frameworks that use the Java context class loader, which is not to be confused with the android.content.Context.getClassLoader which serves a similar purpose in the Android framework. However, we avoid setting the Java context ClassLoader to the APK's PathClassLoader if there is a static indication that multiple packages may share the VM, since they could load in an unpredictable order leading to different values for the thread local Java context ClassLoader. In this case, we instead use a specially created WarningContextClassLoader that warns the user the first time the Java context ClassLoader. Currently the static indications that a package might share a VM with other packages are the presence in the AndroidManifest of a sharedUserId or requesting a non-default application process name.
Diffstat (limited to 'tests/CoreTests')
-rw-r--r--tests/CoreTests/android/core/MiscRegressionTest.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/CoreTests/android/core/MiscRegressionTest.java b/tests/CoreTests/android/core/MiscRegressionTest.java
index 8fe064c..8281db0 100644
--- a/tests/CoreTests/android/core/MiscRegressionTest.java
+++ b/tests/CoreTests/android/core/MiscRegressionTest.java
@@ -110,6 +110,16 @@ public class MiscRegressionTest extends TestCase {
Logger.global.finest("This has logging Level.FINEST, should become VERBOSE");
}
+ // Regression test for Issue 5697:
+ // getContextClassLoader returns a non-application classloader
+ // http://code.google.com/p/android/issues/detail?id=5697
+ //
+ @MediumTest
+ public void testJavaContextClassLoader() throws Exception {
+ Assert.assertNotNull("Must hava a Java context ClassLoader",
+ Thread.currentThread().getContextClassLoader());
+ }
+
// Regression test for #1045939: Different output for Method.toString()
@SmallTest
public void testMethodToString() {