Merge "Fix missing AOSP copyright headers for more files" into honeycomb-mr1
diff --git a/core/java/android/webkit/HTML5VideoFullScreen.java b/core/java/android/webkit/HTML5VideoFullScreen.java
index 993d694..6be988e 100644
--- a/core/java/android/webkit/HTML5VideoFullScreen.java
+++ b/core/java/android/webkit/HTML5VideoFullScreen.java
@@ -25,7 +25,30 @@
implements MediaPlayerControl, MediaPlayer.OnPreparedListener,
View.OnTouchListener {
- private SurfaceView mSurfaceView;
+ // Add this sub-class to handle the resizing when rotating screen.
+ private class VideoSurfaceView extends SurfaceView {
+
+ public VideoSurfaceView(Context context) {
+ super(context);
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ int width = getDefaultSize(mVideoWidth, widthMeasureSpec);
+ int height = getDefaultSize(mVideoHeight, heightMeasureSpec);
+ if (mVideoWidth > 0 && mVideoHeight > 0) {
+ if ( mVideoWidth * height > width * mVideoHeight ) {
+ height = width * mVideoHeight / mVideoWidth;
+ } else if ( mVideoWidth * height < width * mVideoHeight ) {
+ width = height * mVideoWidth / mVideoHeight;
+ }
+ }
+ setMeasuredDimension(width, height);
+ }
+ }
+
+ // This view will contain the video.
+ private VideoSurfaceView mVideoSurfaceView;
// We need the full screen state to decide which surface to render to and
// when to create the MediaPlayer accordingly.
@@ -51,6 +74,11 @@
// The container for the progress view and video view
private static FrameLayout mLayout;
+ // The video size will be ready when prepared. Used to make sure the aspect
+ // ratio is correct.
+ private int mVideoWidth;
+ private int mVideoHeight;
+
SurfaceHolder.Callback mSHCallback = new SurfaceHolder.Callback()
{
public void surfaceChanged(SurfaceHolder holder, int format,
@@ -82,14 +110,16 @@
}
};
- public SurfaceView getSurfaceView() {
- return mSurfaceView;
+ private SurfaceView getSurfaceView() {
+ return mVideoSurfaceView;
}
HTML5VideoFullScreen(Context context, int videoLayerId, int position,
boolean autoStart) {
- mSurfaceView = new SurfaceView(context);
+ mVideoSurfaceView = new VideoSurfaceView(context);
mFullScreenMode = FULLSCREEN_OFF;
+ mVideoWidth = 0;
+ mVideoHeight = 0;
init(videoLayerId, position, autoStart);
}
@@ -101,7 +131,7 @@
private void attachMediaController() {
if (mPlayer != null && mMediaController != null) {
mMediaController.setMediaPlayer(this);
- mMediaController.setAnchorView(mSurfaceView);
+ mMediaController.setAnchorView(mVideoSurfaceView);
//Will be enabled when prepared
mMediaController.setEnabled(false);
}
@@ -112,8 +142,7 @@
mPlayer.setDisplay(mSurfaceHolder);
}
- @Override
- public void prepareForFullScreen() {
+ private void prepareForFullScreen() {
// So in full screen, we reset the MediaPlayer
mPlayer.reset();
setMediaController(new MediaController(mProxy.getContext()));
@@ -134,7 +163,7 @@
public void onPrepared(MediaPlayer mp) {
super.onPrepared(mp);
- mSurfaceView.setOnTouchListener(this);
+ mVideoSurfaceView.setOnTouchListener(this);
// Get the capabilities of the player for this stream
Metadata data = mp.getMetadata(MediaPlayer.METADATA_ALL,
MediaPlayer.BYPASS_METADATA_FILTER);
@@ -165,6 +194,11 @@
mLayout.removeView(mProgressView);
mProgressView = null;
}
+
+ mVideoWidth = mp.getVideoWidth();
+ mVideoHeight = mp.getVideoHeight();
+ // This will trigger the onMeasure to get the display size right.
+ mVideoSurfaceView.getHolder().setFixedSize(mVideoWidth, mVideoHeight);
}
@@ -202,11 +236,11 @@
mPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener);
mProxy = proxy;
- mSurfaceView.getHolder().addCallback(mSHCallback);
- mSurfaceView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
- mSurfaceView.setFocusable(true);
- mSurfaceView.setFocusableInTouchMode(true);
- mSurfaceView.requestFocus();
+ mVideoSurfaceView.getHolder().addCallback(mSHCallback);
+ mVideoSurfaceView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
+ mVideoSurfaceView.setFocusable(true);
+ mVideoSurfaceView.setFocusableInTouchMode(true);
+ mVideoSurfaceView.requestFocus();
// Create a FrameLayout that will contain the VideoView and the
// progress view (if any).
diff --git a/core/java/android/webkit/HTML5VideoView.java b/core/java/android/webkit/HTML5VideoView.java
index ade7106..663497c 100644
--- a/core/java/android/webkit/HTML5VideoView.java
+++ b/core/java/android/webkit/HTML5VideoView.java
@@ -243,16 +243,9 @@
return false;
}
- public SurfaceView getSurfaceView() {
- return null;
- }
-
public void decideDisplayMode() {
}
- public void prepareForFullScreen() {
- }
-
public boolean getReadyToUseSurfTex() {
return false;
}
diff --git a/core/res/res/values-fr/strings.xml b/core/res/res/values-fr/strings.xml
index ca27ac7..7e7b24e 100644
--- a/core/res/res/values-fr/strings.xml
+++ b/core/res/res/values-fr/strings.xml
@@ -460,7 +460,7 @@
<string name="permdesc_readDictionary" msgid="1082972603576360690">"Permet à une application de lire tous les mots, noms et expressions que l\'utilisateur a pu enregistrer dans son dictionnaire personnel."</string>
<string name="permlab_writeDictionary" msgid="6703109511836343341">"Enregistrement dans le dictionnaire défini par l\'utilisateur"</string>
<string name="permdesc_writeDictionary" msgid="2241256206524082880">"Permet à une application d\'enregistrer de nouveaux mots dans le dictionnaire personnel de l\'utilisateur."</string>
- <string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"modifier/supprimer le contenu de la mémoire de stockage USB"</string>
+ <string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"modif./suppr. contenu mémoire USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modifier/supprimer le contenu de la carte SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6594393334785738252">"Autorise une application à écrire sur la mémoire USB."</string>
<string name="permdesc_sdcardWrite" product="default" msgid="6643963204976471878">"Autorise une application à écrire sur la carte SD."</string>
@@ -919,7 +919,7 @@
<string name="ext_media_unmountable_notification_title" product="default" msgid="6410723906019100189">"Carte SD endommagée"</string>
<string name="ext_media_unmountable_notification_message" product="nosdcard" msgid="529021299294450667">"La mémoire de stockage USB est endommagée. Un reformatage est peut-être nécessaire."</string>
<string name="ext_media_unmountable_notification_message" product="default" msgid="6902531775948238989">"La carte SD est endommagée. Vous devrez peut-être la reformater."</string>
- <string name="ext_media_badremoval_notification_title" product="nosdcard" msgid="1661683031330951073">"Mémoire de stockage USB retirée inopinément"</string>
+ <string name="ext_media_badremoval_notification_title" product="nosdcard" msgid="1661683031330951073">"Mémoire USB retirée inopinément"</string>
<string name="ext_media_badremoval_notification_title" product="default" msgid="6872152882604407837">"Carte SD retirée inopinément"</string>
<string name="ext_media_badremoval_notification_message" product="nosdcard" msgid="4329848819865594241">"Désinstaller la mémoire de stockage USB avant de la retirer pour éviter toute perte de données."</string>
<string name="ext_media_badremoval_notification_message" product="default" msgid="7260183293747448241">"Désinstaller la carte SD avant de la retirer pour éviter toute perte de données."</string>
diff --git a/core/res/res/values-nb/strings.xml b/core/res/res/values-nb/strings.xml
index b003c4a..3b15f88 100644
--- a/core/res/res/values-nb/strings.xml
+++ b/core/res/res/values-nb/strings.xml
@@ -919,11 +919,11 @@
<string name="ext_media_unmountable_notification_title" product="default" msgid="6410723906019100189">"Skadet minnekort"</string>
<string name="ext_media_unmountable_notification_message" product="nosdcard" msgid="529021299294450667">"USB-lagring er skadet. Det kan være nødvendig å formatere enheten på nytt."</string>
<string name="ext_media_unmountable_notification_message" product="default" msgid="6902531775948238989">"Minnekortet er skadet. Du må kanskje formatere det."</string>
- <string name="ext_media_badremoval_notification_title" product="nosdcard" msgid="1661683031330951073">"USB-lagring fjernet uventet"</string>
+ <string name="ext_media_badremoval_notification_title" product="nosdcard" msgid="1661683031330951073">"USB-enhet fjernet uventet"</string>
<string name="ext_media_badremoval_notification_title" product="default" msgid="6872152882604407837">"Minnekortet ble tatt ut uventet"</string>
<string name="ext_media_badremoval_notification_message" product="nosdcard" msgid="4329848819865594241">"Koble fra USB-enheten før du tar den ut for å unngå tap av data."</string>
<string name="ext_media_badremoval_notification_message" product="default" msgid="7260183293747448241">"Avmonter minnekortet før det tas ut, for å unngå datatap."</string>
- <string name="ext_media_safe_unmount_notification_title" product="nosdcard" msgid="3967973893270360230">"USB-lagring kan trygt fjernes"</string>
+ <string name="ext_media_safe_unmount_notification_title" product="nosdcard" msgid="3967973893270360230">"USB-enheten kan trygt fjernes"</string>
<string name="ext_media_safe_unmount_notification_title" product="default" msgid="6729801130790616200">"Trygt å ta ut minnekort"</string>
<string name="ext_media_safe_unmount_notification_message" product="nosdcard" msgid="6142195361606493530">"Det er trygt å ta ut enheten for USB-lagring."</string>
<string name="ext_media_safe_unmount_notification_message" product="default" msgid="568841278138377604">"Det er trygt å ta ut minnekortet."</string>
diff --git a/core/res/res/values-pl/strings.xml b/core/res/res/values-pl/strings.xml
index 0498d62..de44e72 100644
--- a/core/res/res/values-pl/strings.xml
+++ b/core/res/res/values-pl/strings.xml
@@ -464,7 +464,7 @@
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modyfikowanie/usuwanie zawartości karty SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6594393334785738252">"Umożliwia zapis na nośnik USB."</string>
<string name="permdesc_sdcardWrite" product="default" msgid="6643963204976471878">"Umożliwia aplikacji zapis na karcie SD."</string>
- <string name="permlab_mediaStorageWrite" product="default" msgid="6859839199706879015">"modyf./usuw. zawartości pam. wewn."</string>
+ <string name="permlab_mediaStorageWrite" product="default" msgid="6859839199706879015">"modyfikowanie/usuwanie zawartości pamięci wew."</string>
<string name="permdesc_mediaStorageWrite" product="default" msgid="8232008512478316233">"Zezwala aplikacji na modyfikowanie zawartości pamięci wewnętrznej."</string>
<string name="permlab_cache_filesystem" msgid="5656487264819669824">"dostęp do systemu plików pamięci podręcznej"</string>
<string name="permdesc_cache_filesystem" msgid="1624734528435659906">"Zezwala aplikacji na odczyt i zapis w systemie plików pamięci podręcznej."</string>
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java
index 138a455..b9f769f 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java
@@ -491,18 +491,11 @@
if (ResourceHelper.stringToFloat(s, mValue)) {
float f = mValue.getDimension(mBridgeResources.mMetrics);
- if (f < 0) {
- // negative values are not allowed in pixel dimensions
- Bridge.getLog().error(LayoutLog.TAG_BROKEN,
- "Negative pixel dimension: " + s,
- null, null /*data*/);
- return defValue;
- }
-
+ final int res = (int)(f+0.5f);
+ if (res != 0) return res;
if (f == 0) return 0;
- if (f < 1) return 1;
-
- return (int)(f+0.5f);
+ if (f > 0) return 1;
+ return defValue; // this is basically unreachable.
}
// looks like we were unable to resolve the dimension value