merge from open-source master
This commit is contained in:
@@ -1028,7 +1028,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String parseHost() {
|
private String parseHost() {
|
||||||
String authority = getAuthority();
|
String authority = getEncodedAuthority();
|
||||||
if (authority == null) {
|
if (authority == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1037,9 +1037,11 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
|
|||||||
int userInfoSeparator = authority.indexOf('@');
|
int userInfoSeparator = authority.indexOf('@');
|
||||||
int portSeparator = authority.indexOf(':', userInfoSeparator);
|
int portSeparator = authority.indexOf(':', userInfoSeparator);
|
||||||
|
|
||||||
return portSeparator == NOT_FOUND
|
String encodedHost = portSeparator == NOT_FOUND
|
||||||
? authority.substring(userInfoSeparator + 1)
|
? authority.substring(userInfoSeparator + 1)
|
||||||
: authority.substring(userInfoSeparator + 1, portSeparator);
|
: authority.substring(userInfoSeparator + 1, portSeparator);
|
||||||
|
|
||||||
|
return decode(encodedHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
private volatile int port = NOT_CALCULATED;
|
private volatile int port = NOT_CALCULATED;
|
||||||
@@ -1051,7 +1053,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int parsePort() {
|
private int parsePort() {
|
||||||
String authority = getAuthority();
|
String authority = getEncodedAuthority();
|
||||||
if (authority == null) {
|
if (authority == null) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -1065,7 +1067,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
String portString = authority.substring(portSeparator + 1);
|
String portString = decode(authority.substring(portSeparator + 1));
|
||||||
try {
|
try {
|
||||||
return Integer.parseInt(portString);
|
return Integer.parseInt(portString);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ enum media_error_type {
|
|||||||
// 'notify' is invoked with the following:
|
// 'notify' is invoked with the following:
|
||||||
// 'msg' is set to MEDIA_INFO.
|
// 'msg' is set to MEDIA_INFO.
|
||||||
// 'ext1' should be a value from the enum media_info_type.
|
// '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.
|
// more details. Should default to 0 when not used.
|
||||||
//
|
//
|
||||||
// The codes are distributed as follow:
|
// The codes are distributed as follow:
|
||||||
|
|||||||
@@ -870,8 +870,10 @@ public class MediaPlayer
|
|||||||
* Returns the width of the video.
|
* Returns the width of the video.
|
||||||
*
|
*
|
||||||
* @return the width of the video, or 0 if there is no video,
|
* @return the width of the video, or 0 if there is no video,
|
||||||
* no display surface was set, or prepare()/prepareAsync()
|
* no display surface was set, or the width has not been determined
|
||||||
* have not completed yet
|
* yet. The OnVideoSizeChangedListener can be registered via
|
||||||
|
* {@link #setOnVideoSizeChangedListener(OnVideoSizeChangedListener)}
|
||||||
|
* to provide a notification when the width is available.
|
||||||
*/
|
*/
|
||||||
public native int getVideoWidth();
|
public native int getVideoWidth();
|
||||||
|
|
||||||
@@ -879,8 +881,10 @@ public class MediaPlayer
|
|||||||
* Returns the height of the video.
|
* Returns the height of the video.
|
||||||
*
|
*
|
||||||
* @return the height of the video, or 0 if there is no video,
|
* @return the height of the video, or 0 if there is no video,
|
||||||
* no display surface was set, or prepare()/prepareAsync()
|
* no display surface was set, or the height has not been determined
|
||||||
* have not completed yet
|
* yet. The OnVideoSizeChangedListener can be registered via
|
||||||
|
* {@link #setOnVideoSizeChangedListener(OnVideoSizeChangedListener)}
|
||||||
|
* to provide a notification when the height is available.
|
||||||
*/
|
*/
|
||||||
public native int getVideoHeight();
|
public native int getVideoHeight();
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ import android.content.Context;
|
|||||||
* Context.
|
* Context.
|
||||||
* You can create and inject alternative types of Contexts by calling
|
* You can create and inject alternative types of Contexts by calling
|
||||||
* {@link AndroidTestCase#setContext(Context) setContext()}. You must do this <i>before</i> 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},
|
* number of alternatives for Context, including {@link android.test.mock.MockContext MockContext},
|
||||||
* {@link android.test.RenamingDelegatingContext RenamingDelegatingContext}, and
|
* {@link android.test.RenamingDelegatingContext RenamingDelegatingContext}, and
|
||||||
* {@link android.content.ContextWrapper ContextWrapper}.
|
* {@link android.content.ContextWrapper ContextWrapper}.
|
||||||
|
|||||||
@@ -171,6 +171,11 @@ public class UriTest extends TestCase {
|
|||||||
assertEquals("bob lee", uri.getUserInfo());
|
assertEquals("bob lee", uri.getUserInfo());
|
||||||
assertEquals("bob%20lee", uri.getEncodedUserInfo());
|
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");
|
uri = Uri.parse("http://localhost");
|
||||||
assertEquals("localhost", uri.getHost());
|
assertEquals("localhost", uri.getHost());
|
||||||
assertEquals(-1, uri.getPort());
|
assertEquals(-1, uri.getPort());
|
||||||
|
|||||||
Reference in New Issue
Block a user