diff options
| author | Jean-Baptiste Queru <jbq@google.com> | 2009-09-16 16:22:13 -0700 |
|---|---|---|
| committer | Jean-Baptiste Queru <jbq@google.com> | 2009-09-16 16:22:13 -0700 |
| commit | e525eef4b8e284ac8eb023bd0df4eeed37916d4b (patch) | |
| tree | 565020de633597ec0e49429478918b1c27b47d22 | |
| parent | ea8844811d1b0965f5c2f43006c0a08bcd73f23a (diff) | |
| parent | 62e73f466e52b98ecc2eef85010618a655b40924 (diff) | |
| download | frameworks_base-e525eef4b8e284ac8eb023bd0df4eeed37916d4b.zip frameworks_base-e525eef4b8e284ac8eb023bd0df4eeed37916d4b.tar.gz frameworks_base-e525eef4b8e284ac8eb023bd0df4eeed37916d4b.tar.bz2 | |
merge from open-source master
| -rw-r--r-- | core/java/android/net/Uri.java | 10 | ||||
| -rw-r--r-- | include/media/mediaplayer.h | 2 | ||||
| -rw-r--r-- | media/java/android/media/MediaPlayer.java | 12 | ||||
| -rw-r--r-- | test-runner/android/test/ApplicationTestCase.java | 2 | ||||
| -rw-r--r-- | tests/AndroidTests/src/com/android/unit_tests/UriTest.java | 5 |
5 files changed, 21 insertions, 10 deletions
diff --git a/core/java/android/net/Uri.java b/core/java/android/net/Uri.java index 298be3b..9a1b65d 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<Uri> { } 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<Uri> { 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<Uri> { } 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<Uri> { 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/include/media/mediaplayer.h b/include/media/mediaplayer.h index 26b054bd..3e1b1bf 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: diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java index f80fb6e..b6815ae 100644 --- a/media/java/android/media/MediaPlayer.java +++ b/media/java/android/media/MediaPlayer.java @@ -870,8 +870,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(); @@ -879,8 +881,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(); diff --git a/test-runner/android/test/ApplicationTestCase.java b/test-runner/android/test/ApplicationTestCase.java index 31b226a..ae5fa4d 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 <i>before</i> 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}. diff --git a/tests/AndroidTests/src/com/android/unit_tests/UriTest.java b/tests/AndroidTests/src/com/android/unit_tests/UriTest.java index 0abbc9a..d17e2c3 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()); |
