Fix NPE of extras in media metrics

Bug: 182186519
Bug: 182104911
Test: CTS
Change-Id: I114763499b62eb62aa9d770e6b1e1f98ce6a8eaf
This commit is contained in:
shubang
2021-03-09 15:56:00 -08:00
parent 3f4814f5dc
commit af960d008e
5 changed files with 10 additions and 9 deletions

View File

@@ -113,10 +113,11 @@ public final class NetworkEvent extends Event implements Parcelable {
*
* @hide
*/
public NetworkEvent(@NetworkType int type, long timeSinceCreatedMillis, Bundle extras) {
public NetworkEvent(@NetworkType int type, long timeSinceCreatedMillis,
@Nullable Bundle extras) {
this.mNetworkType = type;
this.mTimeSinceCreatedMillis = timeSinceCreatedMillis;
this.mExtras = extras.deepCopy();
this.mExtras = extras == null ? null : extras.deepCopy();
}
/**

View File

@@ -65,12 +65,12 @@ public final class PlaybackErrorEvent extends Event implements Parcelable {
int errorCode,
int subErrorCode,
long timeSinceCreatedMillis,
Bundle extras) {
@Nullable Bundle extras) {
this.mExceptionStack = exceptionStack;
this.mErrorCode = errorCode;
this.mSubErrorCode = subErrorCode;
this.mTimeSinceCreatedMillis = timeSinceCreatedMillis;
this.mExtras = extras.deepCopy();
this.mExtras = extras == null ? null : extras.deepCopy();
}
/** @hide */

View File

@@ -194,7 +194,7 @@ public final class PlaybackMetrics implements Parcelable {
long localBytesRead,
long networkTransferDurationMillis,
byte[] drmSessionId,
Bundle extras) {
@Nullable Bundle extras) {
this.mMediaDurationMillis = mediaDurationMillis;
this.mStreamSource = streamSource;
this.mStreamType = streamType;
@@ -212,7 +212,7 @@ public final class PlaybackMetrics implements Parcelable {
this.mLocalBytesRead = localBytesRead;
this.mNetworkTransferDurationMillis = networkTransferDurationMillis;
this.mDrmSessionId = drmSessionId;
this.mExtras = extras.deepCopy();
this.mExtras = extras == null ? null : extras.deepCopy();
}
/**

View File

@@ -138,10 +138,10 @@ public final class PlaybackStateEvent extends Event implements Parcelable {
public PlaybackStateEvent(
int state,
long timeSinceCreatedMillis,
Bundle extras) {
@Nullable Bundle extras) {
this.mTimeSinceCreatedMillis = timeSinceCreatedMillis;
this.mState = state;
this.mExtras = extras.deepCopy();
this.mExtras = extras == null ? null : extras.deepCopy();
}
/**

View File

@@ -167,7 +167,7 @@ public final class TrackChangeEvent extends Event implements Parcelable {
this.mWidth = width;
this.mHeight = height;
this.mVideoFrameRate = videoFrameRate;
this.mExtras = extras.deepCopy();
this.mExtras = extras == null ? null : extras.deepCopy();
}
/**