VideoSize: replace with Size

Test: cts
Bug: 123661223
Change-Id: I31bfdf7a50a865854034e6c4fa0515e0c028f1a9
This commit is contained in:
Wei Jia
2019-01-30 17:12:13 -08:00
parent 28a7ebc77a
commit a3aac960ba
4 changed files with 7 additions and 102 deletions

View File

@@ -25483,7 +25483,7 @@ package android.media {
method @Nullable public android.media.MediaTimestamp getTimestamp();
method @NonNull public java.util.List<android.media.MediaPlayer2.TrackInfo> getTrackInfo();
method @NonNull public java.util.List<android.media.MediaPlayer2.TrackInfo> getTrackInfo(@NonNull android.media.DataSourceDesc);
method public android.media.VideoSize getVideoSize();
method public android.util.Size getVideoSize();
method public boolean isLooping();
method public Object loopCurrent(boolean);
method public Object notifyWhenCommandLabelReached(@NonNull Object);
@@ -25617,7 +25617,7 @@ package android.media {
method public void onMediaTimeDiscontinuity(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.media.MediaTimestamp);
method public void onSubtitleData(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.media.SubtitleData);
method public void onTimedMetaDataAvailable(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.media.TimedMetaData);
method public void onVideoSizeChanged(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.media.VideoSize);
method public void onVideoSizeChanged(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.util.Size);
}
public static final class MediaPlayer2.MetricsConstants {
@@ -26522,11 +26522,6 @@ package android.media {
method @NonNull public android.media.UriDataSourceDesc.Builder setDataSource(@NonNull android.content.Context, @NonNull android.net.Uri, @Nullable java.util.Map<java.lang.String,java.lang.String>, @Nullable java.util.List<java.net.HttpCookie>);
}
public final class VideoSize {
method public int getHeight();
method public int getWidth();
}
public interface VolumeAutomation {
method @NonNull public android.media.VolumeShaper createVolumeShaper(@NonNull android.media.VolumeShaper.Configuration);
}

View File

@@ -144,7 +144,6 @@ filegroup {
"apex/java/android/media/UriDataSourceDesc.java",
"apex/java/android/media/FileDataSourceDesc.java",
"apex/java/android/media/CallbackDataSourceDesc.java",
"apex/java/android/media/VideoSize.java",
"apex/java/android/media/Media2Utils.java",
"apex/java/android/media/MediaPlayer2Utils.java",
"apex/java/android/media/MediaPlayer2.java",

View File

@@ -40,6 +40,7 @@ import android.os.PersistableBundle;
import android.os.PowerManager;
import android.util.Log;
import android.util.Pair;
import android.util.Size;
import android.view.Surface;
import android.view.SurfaceHolder;
@@ -61,7 +62,6 @@ import java.net.URL;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
@@ -299,7 +299,7 @@ public class MediaPlayer2 implements AutoCloseable
private final AtomicLong mSrcIdGenerator = new AtomicLong(0);
private volatile float mVolume = 1.0f;
private VideoSize mVideoSize = new VideoSize(0, 0);
private Size mVideoSize = new Size(0, 0);
private static ExecutorService sDrmThreadPool = Executors.newCachedThreadPool();
@@ -1526,7 +1526,7 @@ public class MediaPlayer2 implements AutoCloseable
* notification {@code EventCallback.onVideoSizeChanged} when the size
* is available.
*/
public VideoSize getVideoSize() {
public Size getVideoSize() {
return mVideoSize;
}
@@ -2526,7 +2526,7 @@ public class MediaPlayer2 implements AutoCloseable
final int width = msg.arg1;
final int height = msg.arg2;
mVideoSize = new VideoSize(width, height);
mVideoSize = new Size(width, height);
sendEvent(new EventNotifier() {
@Override
public void notify(EventCallback callback) {
@@ -2765,7 +2765,7 @@ public class MediaPlayer2 implements AutoCloseable
* @param size the size of the video
*/
public void onVideoSizeChanged(
@NonNull MediaPlayer2 mp, @NonNull DataSourceDesc dsd, @NonNull VideoSize size) { }
@NonNull MediaPlayer2 mp, @NonNull DataSourceDesc dsd, @NonNull Size size) { }
/**
* Called to indicate an avaliable timed text

View File

@@ -1,89 +0,0 @@
/*
* Copyright 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media;
/**
* Immutable class for describing width and height dimensions.
*/
public final class VideoSize {
/**
* Create a new immutable VideoSize instance.
*
* @param width The width of the video size
* @param height The height of the video size
*/
VideoSize(int width, int height) {
mWidth = width;
mHeight = height;
}
/**
* Get the width of the video size
* @return width
*/
public int getWidth() {
return mWidth;
}
/**
* Get the height of the video size
* @return height
*/
public int getHeight() {
return mHeight;
}
/**
* Check if this video size is equal to another video size.
* <p>
* Two video sizes are equal if and only if both their widths and heights are
* equal.
* </p>
* <p>
* A video size object is never equal to any other type of object.
* </p>
*
* @return {@code true} if the objects were equal, {@code false} otherwise
*/
@Override
public boolean equals(final Object obj) {
if (obj == null) {
return false;
}
if (this == obj) {
return true;
}
if (obj instanceof VideoSize) {
VideoSize other = (VideoSize) obj;
return mWidth == other.mWidth && mHeight == other.mHeight;
}
return false;
}
/**
* Return the video size represented as a string with the format {@code "WxH"}
*
* @return string representation of the video size
*/
@Override
public String toString() {
return mWidth + "x" + mHeight;
}
private final int mWidth;
private final int mHeight;
}