From ae5d46fddf39e784427a9c344a782001dd6f195c Mon Sep 17 00:00:00 2001 From: Simon Schoar Date: Wed, 10 Jun 2009 20:49:56 +0200 Subject: [PATCH 1/4] Javadoc used startApplication() which doesnt exists, changed to createApplication() --- test-runner/android/test/ApplicationTestCase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-runner/android/test/ApplicationTestCase.java b/test-runner/android/test/ApplicationTestCase.java index 31b226a2afb3e..ae5fa4da8e5e6 100644 --- a/test-runner/android/test/ApplicationTestCase.java +++ b/test-runner/android/test/ApplicationTestCase.java @@ -53,7 +53,7 @@ import android.content.Context; * Context. * You can create and inject alternative types of Contexts by calling * {@link AndroidTestCase#setContext(Context) setContext()}. You must do this before calling - * startApplication(). The test framework provides a + * {@link #createApplication()}. The test framework provides a * number of alternatives for Context, including {@link android.test.mock.MockContext MockContext}, * {@link android.test.RenamingDelegatingContext RenamingDelegatingContext}, and * {@link android.content.ContextWrapper ContextWrapper}. From fc01794f33057862a361a0d0113630c58befc21b Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Sun, 12 Jul 2009 10:33:28 -0500 Subject: [PATCH 2/4] Make Uri.parseUserPart, parseHost, and parsePort symmetric Currently parseUserPart uses the encoded authority to split the URI into user and non-user parts, but the parseHost and parsePort uses the decoded URI to split the URI into non-host, host, and port parts. This gives unexpected results when %40 ('@') and %3a (':') is used in a URI: Uri test = Uri.parse("http://bob%40lee%3ajr@example.com:42/"); test.getUserInfo() => "bob@lee:jr" test.getHost() => "lee:jr@example.com" (should be "example.com") test.getPort() => -1 (should be 42) --- core/java/android/net/Uri.java | 10 ++++++---- .../src/com/android/unit_tests/UriTest.java | 5 +++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/core/java/android/net/Uri.java b/core/java/android/net/Uri.java index 298be3bd44991..9a1b65de15915 100644 --- a/core/java/android/net/Uri.java +++ b/core/java/android/net/Uri.java @@ -1028,7 +1028,7 @@ public abstract class Uri implements Parcelable, Comparable { } private String parseHost() { - String authority = getAuthority(); + String authority = getEncodedAuthority(); if (authority == null) { return null; } @@ -1037,9 +1037,11 @@ public abstract class Uri implements Parcelable, Comparable { int userInfoSeparator = authority.indexOf('@'); int portSeparator = authority.indexOf(':', userInfoSeparator); - return portSeparator == NOT_FOUND + String encodedHost = portSeparator == NOT_FOUND ? authority.substring(userInfoSeparator + 1) : authority.substring(userInfoSeparator + 1, portSeparator); + + return decode(encodedHost); } private volatile int port = NOT_CALCULATED; @@ -1051,7 +1053,7 @@ public abstract class Uri implements Parcelable, Comparable { } private int parsePort() { - String authority = getAuthority(); + String authority = getEncodedAuthority(); if (authority == null) { return -1; } @@ -1065,7 +1067,7 @@ public abstract class Uri implements Parcelable, Comparable { return -1; } - String portString = authority.substring(portSeparator + 1); + String portString = decode(authority.substring(portSeparator + 1)); try { return Integer.parseInt(portString); } catch (NumberFormatException e) { diff --git a/tests/AndroidTests/src/com/android/unit_tests/UriTest.java b/tests/AndroidTests/src/com/android/unit_tests/UriTest.java index 0abbc9a9a3a30..d17e2c3791da6 100644 --- a/tests/AndroidTests/src/com/android/unit_tests/UriTest.java +++ b/tests/AndroidTests/src/com/android/unit_tests/UriTest.java @@ -171,6 +171,11 @@ public class UriTest extends TestCase { assertEquals("bob lee", uri.getUserInfo()); assertEquals("bob%20lee", uri.getEncodedUserInfo()); + uri = Uri.parse("http://bob%40lee%3ajr@local%68ost:4%32"); + assertEquals("bob@lee:jr", uri.getUserInfo()); + assertEquals("localhost", uri.getHost()); + assertEquals(42, uri.getPort()); + uri = Uri.parse("http://localhost"); assertEquals("localhost", uri.getHost()); assertEquals(-1, uri.getPort()); From ea5f767246ad201a9e2bba0d657404e002cd7c70 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Queru Date: Wed, 16 Sep 2009 15:06:25 -0700 Subject: [PATCH 3/4] Update documentation for getVideoWidth and getVideoHeight. Ref: http://code.google.com/p/android/issues/detail?id=3024 --- media/java/android/media/MediaPlayer.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java index fe768be6fb442..e94137e7bb679 100644 --- a/media/java/android/media/MediaPlayer.java +++ b/media/java/android/media/MediaPlayer.java @@ -794,8 +794,10 @@ public class MediaPlayer * Returns the width of the video. * * @return the width of the video, or 0 if there is no video, - * no display surface was set, or prepare()/prepareAsync() - * have not completed yet + * no display surface was set, or the width has not been determined + * yet. The OnVideoSizeChangedListener can be registered via + * {@link #setOnVideoSizeChangedListener(OnVideoSizeChangedListener)} + * to provide a notification when the width is available. */ public native int getVideoWidth(); @@ -803,8 +805,10 @@ public class MediaPlayer * Returns the height of the video. * * @return the height of the video, or 0 if there is no video, - * no display surface was set, or prepare()/prepareAsync() - * have not completed yet + * no display surface was set, or the height has not been determined + * yet. The OnVideoSizeChangedListener can be registered via + * {@link #setOnVideoSizeChangedListener(OnVideoSizeChangedListener)} + * to provide a notification when the height is available. */ public native int getVideoHeight(); From 62e73f466e52b98ecc2eef85010618a655b40924 Mon Sep 17 00:00:00 2001 From: Ravi K Yenduri Date: Sun, 21 Jun 2009 17:19:58 -0500 Subject: [PATCH 4/4] Update comment in mediaplayer.h. When sending a MEDIA_INFO message, the second integer is supposed to be an "info" code instead of an "error" code. --- include/media/mediaplayer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/media/mediaplayer.h b/include/media/mediaplayer.h index 513ffe1acabbc..0355c16f33c88 100644 --- a/include/media/mediaplayer.h +++ b/include/media/mediaplayer.h @@ -75,7 +75,7 @@ enum media_error_type { // 'notify' is invoked with the following: // 'msg' is set to MEDIA_INFO. // 'ext1' should be a value from the enum media_info_type. -// 'ext2' contains an implementation dependant error code to provide +// 'ext2' contains an implementation dependant info code to provide // more details. Should default to 0 when not used. // // The codes are distributed as follow: