Commit e8f0303e authored by Henrique Nakashima's avatar Henrique Nakashima Committed by Commit Bot

Remove JellyBean workaround in TabState.

A bug in JellyBean with rewinding buffers required a workaround.
JellyBean has not been supported for a while, so this can be removed.

Change-Id: I99aa7ea55ded13e9748b34c3902ce085fade4c2d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2212448Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771153}
parent a0027c59
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package org.chromium.chrome.browser.tab; package org.chromium.chrome.browser.tab;
import android.graphics.Color; import android.graphics.Color;
import android.os.Build;
import android.util.Pair; import android.util.Pair;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
...@@ -301,15 +300,8 @@ public class TabState { ...@@ -301,15 +300,8 @@ public class TabState {
public static byte[] getContentStateByteArray(ByteBuffer buffer) { public static byte[] getContentStateByteArray(ByteBuffer buffer) {
byte[] contentsStateBytes = new byte[buffer.limit()]; byte[] contentsStateBytes = new byte[buffer.limit()];
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { buffer.rewind();
buffer.rewind(); buffer.get(contentsStateBytes);
buffer.get(contentsStateBytes);
} else {
// For JellyBean and below a bug in MappedByteBufferAdapter causes rewind to not be
// propagated to the underlying ByteBuffer, and results in an underflow exception. See:
// http://b.android.com/53637.
for (int i = 0; i < buffer.limit(); i++) contentsStateBytes[i] = buffer.get(i);
}
return contentsStateBytes; return contentsStateBytes;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment