Bug 1512274 - [geckoview] LeftCurly checkstyle fixes r=geckoview-reviewers,snorp

Differential Revision: https://phabricator.services.mozilla.com/D23688

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Agi Sferro 2019-03-15 21:21:24 +00:00
Родитель 5ab4f6d887
Коммит 2dd021c9ae
28 изменённых файлов: 288 добавлений и 168 удалений

Просмотреть файл

@ -58,7 +58,8 @@ public class CrashHandler implements Thread.UncaughtExceptionHandler {
*/
public static Throwable getRootException(final Throwable exc) {
Throwable cause;
for (cause = exc; cause != null; cause = cause.getCause()) {}
for (cause = exc; cause != null; cause = cause.getCause()) {
}
return cause;
}

Просмотреть файл

@ -87,8 +87,7 @@ import android.view.InputDevice;
import android.view.WindowManager;
import android.webkit.MimeTypeMap;
public class GeckoAppShell
{
public class GeckoAppShell {
private static final String LOGTAG = "GeckoAppShell";
// We have static members only.
@ -513,19 +512,13 @@ public class GeckoAppShell
}
@Override
public void onProviderDisabled(final String provider)
{
}
public void onProviderDisabled(final String provider) {}
@Override
public void onProviderEnabled(final String provider)
{
}
public void onProviderEnabled(final String provider) {}
@Override
public void onStatusChanged(final String provider, final int status, final Bundle extras)
{
}
public void onStatusChanged(final String provider, final int status, final Bundle extras) {}
@Override // NotificationListener
public void showNotification(final String name, final String cookie, final String host,
@ -1449,8 +1442,7 @@ public class GeckoAppShell
bitmap.copyPixelsToBuffer(buf);
return buf.array();
}
catch (Exception e) {
} catch (Exception e) {
Log.w(LOGTAG, "getIconForExtension failed.", e);
return null;
}
@ -1490,8 +1482,7 @@ public class GeckoAppShell
Settings.System.getInt(getApplicationContext().getContentResolver(),
Settings.System.TEXT_SHOW_PASSWORD, 1);
return (showPassword > 0);
}
catch (Exception e) {
} catch (Exception e) {
return true;
}
}

Просмотреть файл

@ -5,8 +5,7 @@
package org.mozilla.gecko;
public class GeckoHalDefines
{
public class GeckoHalDefines {
/*
* Keep these values consistent with |SensorType| in HalSensor.h
*/

Просмотреть файл

@ -5,8 +5,7 @@
package org.mozilla.gecko;
public interface NotificationListener
{
public interface NotificationListener {
void showNotification(String name, String cookie, String title, String text,
String host, String imageUrl);

Просмотреть файл

@ -11,8 +11,7 @@ import org.mozilla.gecko.mozglue.JNIObject;
import android.graphics.SurfaceTexture;
/* package */ final class SurfaceTextureListener
extends JNIObject implements SurfaceTexture.OnFrameAvailableListener
{
extends JNIObject implements SurfaceTexture.OnFrameAvailableListener {
@WrapForJNI(calledFrom = "gecko")
private SurfaceTextureListener() {
}

Просмотреть файл

@ -136,7 +136,9 @@ import org.mozilla.gecko.gfx.GeckoSurface;
try {
return mCodec.getInputBuffer(index) != null;
} catch (IllegalStateException e) {
if (DEBUG) { Log.d(LOGTAG, "invalid input buffer#" + index, e); }
if (DEBUG) {
Log.d(LOGTAG, "invalid input buffer#" + index, e);
}
return false;
}
}
@ -267,7 +269,9 @@ import org.mozilla.gecko.gfx.GeckoSurface;
try {
return (mCodec.getOutputBuffer(index) != null) || mRenderToSurface;
} catch (IllegalStateException e) {
if (DEBUG) { Log.e(LOGTAG, "invalid buffer#" + index, e); }
if (DEBUG) {
Log.e(LOGTAG, "invalid buffer#" + index, e);
}
return false;
}
}
@ -302,7 +306,9 @@ import org.mozilla.gecko.gfx.GeckoSurface;
private synchronized void onRelease(final Sample sample, final boolean render) {
final Output output = mSentOutputs.poll();
if (output == null) {
if (DEBUG) { Log.d(LOGTAG, sample + " already released"); }
if (DEBUG) {
Log.d(LOGTAG, sample + " already released");
}
return;
}
mCodec.releaseOutputBuffer(output.index, render);
@ -381,11 +387,15 @@ import org.mozilla.gecko.gfx.GeckoSurface;
}
if (mCodec != null) {
if (DEBUG) { Log.d(LOGTAG, "release existing codec: " + mCodec); }
if (DEBUG) {
Log.d(LOGTAG, "release existing codec: " + mCodec);
}
mCodec.release();
}
if (DEBUG) { Log.d(LOGTAG, "configure " + this); }
if (DEBUG) {
Log.d(LOGTAG, "configure " + this);
}
final MediaFormat fmt = format.asFormat();
final String mime = fmt.getString(MediaFormat.KEY_MIME);
@ -410,7 +420,9 @@ import org.mozilla.gecko.gfx.GeckoSurface;
if (renderToSurface) {
mIsTunneledPlaybackSupported = mCodec.isTunneledPlaybackSupported(mime);
}
if (DEBUG) { Log.d(LOGTAG, codec.toString() + " created. Render to surface?" + renderToSurface); }
if (DEBUG) {
Log.d(LOGTAG, codec.toString() + " created. Render to surface?" + renderToSurface);
}
return true;
}
@ -468,7 +480,9 @@ import org.mozilla.gecko.gfx.GeckoSurface;
mIsAdaptivePlaybackSupported = codec.isAdaptivePlaybackSupported(
format.getString(MediaFormat.KEY_MIME));
if (mIsAdaptivePlaybackSupported) {
if (DEBUG) { Log.d(LOGTAG, "codec supports adaptive playback = " + mIsAdaptivePlaybackSupported); }
if (DEBUG) {
Log.d(LOGTAG, "codec supports adaptive playback = " + mIsAdaptivePlaybackSupported);
}
// TODO: may need to find a way to not use hard code to decide the max w/h.
format.setInteger(MediaFormat.KEY_MAX_WIDTH, 1920);
format.setInteger(MediaFormat.KEY_MAX_HEIGHT, 1080);
@ -492,7 +506,9 @@ import org.mozilla.gecko.gfx.GeckoSurface;
@Override
public synchronized void start() throws RemoteException {
if (DEBUG) { Log.d(LOGTAG, "start " + this); }
if (DEBUG) {
Log.d(LOGTAG, "start " + this);
}
mInputProcessor.start();
mOutputProcessor.start();
try {
@ -517,7 +533,9 @@ import org.mozilla.gecko.gfx.GeckoSurface;
@Override
public synchronized void stop() throws RemoteException {
if (DEBUG) { Log.d(LOGTAG, "stop " + this); }
if (DEBUG) {
Log.d(LOGTAG, "stop " + this);
}
try {
mInputProcessor.stop();
mOutputProcessor.stop();
@ -530,13 +548,17 @@ import org.mozilla.gecko.gfx.GeckoSurface;
@Override
public synchronized void flush() throws RemoteException {
if (DEBUG) { Log.d(LOGTAG, "flush " + this); }
if (DEBUG) {
Log.d(LOGTAG, "flush " + this);
}
try {
mInputProcessor.stop();
mOutputProcessor.stop();
mCodec.flush();
if (DEBUG) { Log.d(LOGTAG, "flushed " + this); }
if (DEBUG) {
Log.d(LOGTAG, "flushed " + this);
}
mInputProcessor.start();
mOutputProcessor.start();
mCodec.resumeReceivingInputs();
@ -584,7 +606,9 @@ import org.mozilla.gecko.gfx.GeckoSurface;
@Override
public synchronized void release() throws RemoteException {
if (DEBUG) { Log.d(LOGTAG, "release " + this); }
if (DEBUG) {
Log.d(LOGTAG, "release " + this);
}
try {
// In case Codec.stop() is not called yet.
mInputProcessor.stop();

Просмотреть файл

@ -171,8 +171,7 @@ public final class CodecProxy {
}
@WrapForJNI
public synchronized boolean isAdaptivePlaybackSupported()
{
public synchronized boolean isAdaptivePlaybackSupported() {
if (mRemote == null) {
Log.e(LOGTAG, "cannot check isAdaptivePlaybackSupported with an ended codec");
return false;
@ -186,8 +185,7 @@ public final class CodecProxy {
}
@WrapForJNI
public synchronized boolean isHardwareAccelerated()
{
public synchronized boolean isHardwareAccelerated() {
if (mRemote == null) {
Log.e(LOGTAG, "cannot check isHardwareAccelerated with an ended codec");
return false;
@ -201,8 +199,7 @@ public final class CodecProxy {
}
@WrapForJNI
public synchronized boolean isTunneledPlaybackSupported()
{
public synchronized boolean isTunneledPlaybackSupported() {
if (mRemote == null) {
Log.e(LOGTAG, "cannot check isTunneledPlaybackSupported with an ended codec");
return false;
@ -266,7 +263,9 @@ public final class CodecProxy {
return false;
}
try {
if (DEBUG) { Log.d(LOGTAG, "flush " + this); }
if (DEBUG) {
Log.d(LOGTAG, "flush " + this);
}
mRemote.flush();
mFlushed = true;
} catch (DeadObjectException e) {
@ -286,7 +285,9 @@ public final class CodecProxy {
Log.w(LOGTAG, "codec already ended");
return true;
}
if (DEBUG) { Log.d(LOGTAG, "release " + this); }
if (DEBUG) {
Log.d(LOGTAG, "release " + this);
}
if (!mSurfaceOutputs.isEmpty()) {
// Flushing output buffers to surface may cause some frames to be skipped and

Просмотреть файл

@ -152,7 +152,9 @@ public class GeckoHlsAudioRenderer extends GeckoHlsRendererBase {
@Override
protected boolean clearInputSamplesQueue() {
if (DEBUG) { Log.d(LOGTAG, "clearInputSamplesQueue"); }
if (DEBUG) {
Log.d(LOGTAG, "clearInputSamplesQueue");
}
mDemuxedInputSamples.clear();
return true;
}

Просмотреть файл

@ -100,8 +100,12 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
this.mEnableV = enableVideoRenderer;
this.mEnableA = enableAudioRenderer;
}
boolean isVideoRendererEnabled() { return mEnableV; }
boolean isAudioRendererEnabled() { return mEnableA; }
boolean isVideoRendererEnabled() {
return mEnableV;
}
boolean isAudioRendererEnabled() {
return mEnableA;
}
}
private RendererController mRendererController = new RendererController(true, true);
@ -122,14 +126,30 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
mVideoDataArrived = false;
mAudioDataArrived = false;
}
public void updateNumOfVideoTracks(final int numOfTracks) { mNumVideoTracks = numOfTracks; }
public void updateNumOfAudioTracks(final int numOfTracks) { mNumAudioTracks = numOfTracks; }
public boolean hasVideo() { return mNumVideoTracks > 0; }
public boolean hasAudio() { return mNumAudioTracks > 0; }
public int getNumOfVideoTracks() { return mNumVideoTracks; }
public int getNumOfAudioTracks() { return mNumAudioTracks; }
public void onVideoInfoUpdated() { mVideoInfoUpdated = true; }
public void onAudioInfoUpdated() { mAudioInfoUpdated = true; }
public void updateNumOfVideoTracks(final int numOfTracks) {
mNumVideoTracks = numOfTracks;
}
public void updateNumOfAudioTracks(final int numOfTracks) {
mNumAudioTracks = numOfTracks;
}
public boolean hasVideo() {
return mNumVideoTracks > 0;
}
public boolean hasAudio() {
return mNumAudioTracks > 0;
}
public int getNumOfVideoTracks() {
return mNumVideoTracks;
}
public int getNumOfAudioTracks() {
return mNumAudioTracks;
}
public void onVideoInfoUpdated() {
mVideoInfoUpdated = true;
}
public void onAudioInfoUpdated() {
mAudioInfoUpdated = true;
}
public void onDataArrived(final int trackType) {
if (trackType == C.TRACK_TYPE_VIDEO) {
mVideoDataArrived = true;
@ -231,7 +251,9 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
// Called on GeckoHlsPlayerThread
public void onDataArrived(final int trackType) {
synchronized (GeckoHlsPlayer.this) {
if (DEBUG) { Log.d(LOGTAG, "[CB][onDataArrived] id " + mPlayerId); }
if (DEBUG) {
Log.d(LOGTAG, "[CB][onDataArrived] id " + mPlayerId);
}
if (!mIsPlayerInitDone) {
return;
}
@ -296,7 +318,9 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
if (mPlayer != null && !isLiveStream()) {
duration = Math.max(0L, mPlayer.getDuration() * 1000L);
}
if (DEBUG) { Log.d(LOGTAG, "getDuration : " + duration + "(Us)"); }
if (DEBUG) {
Log.d(LOGTAG, "getDuration : " + duration + "(Us)");
}
return duration;
}
@ -304,7 +328,9 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
// created only from synchronized APIs in GeckoPlayerFactory.
public GeckoHlsPlayer() {
mPlayerId = sPlayerId.incrementAndGet();
if (DEBUG) { Log.d(LOGTAG, " construct player with id(" + mPlayerId + ")"); }
if (DEBUG) {
Log.d(LOGTAG, " construct player with id(" + mPlayerId + ")");
}
}
// Should be only called by GeckoPlayerFactory and GeckoHLSResourceWrapper.
@ -320,14 +346,18 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
@Override
public synchronized void addDemuxerWrapperCallbackListener(
final BaseHlsPlayer.DemuxerCallbacks callback) {
if (DEBUG) { Log.d(LOGTAG, " addDemuxerWrapperCallbackListener ..."); }
if (DEBUG) {
Log.d(LOGTAG, " addDemuxerWrapperCallbackListener ...");
}
mDemuxerCallbacks = callback;
}
// Called on GeckoHlsPlayerThread from ExoPlayer
@Override
public synchronized void onLoadingChanged(final boolean isLoading) {
if (DEBUG) { Log.d(LOGTAG, "loading [" + isLoading + "]"); }
if (DEBUG) {
Log.d(LOGTAG, "loading [" + isLoading + "]");
}
if (!isLoading) {
if (mMediaDecoderPlayState != MediaDecoderPlayState.PLAY_STATE_PLAYING) {
suspendExoplayer();
@ -340,7 +370,9 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
// Called on GeckoHlsPlayerThread from ExoPlayer
@Override
public synchronized void onPlayerStateChanged(final boolean playWhenReady, final int state) {
if (DEBUG) { Log.d(LOGTAG, "state [" + playWhenReady + ", " + getStateString(state) + "]"); }
if (DEBUG) {
Log.d(LOGTAG, "state [" + playWhenReady + ", " + getStateString(state) + "]");
}
if (state == ExoPlayer.STATE_READY &&
!mExoplayerSuspended &&
mMediaDecoderPlayState == MediaDecoderPlayState.PLAY_STATE_PLAYING) {
@ -351,7 +383,9 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
// Called on GeckoHlsPlayerThread from ExoPlayer
@Override
public void onPositionDiscontinuity() {
if (DEBUG) { Log.d(LOGTAG, "positionDiscontinuity"); }
if (DEBUG) {
Log.d(LOGTAG, "positionDiscontinuity");
}
}
// Called on GeckoHlsPlayerThread from ExoPlayer
@ -366,7 +400,9 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
// Called on GeckoHlsPlayerThread from ExoPlayer
@Override
public synchronized void onPlayerError(final ExoPlaybackException e) {
if (DEBUG) { Log.e(LOGTAG, "playerFailed" , e); }
if (DEBUG) {
Log.e(LOGTAG, "playerFailed" , e);
}
mIsPlayerInitDone = false;
if (mResourceCallbacks != null) {
mResourceCallbacks.onError(ResourceError.PLAYER.code());
@ -471,7 +507,9 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
int periodCount = timeline.getPeriodCount();
int windowCount = timeline.getWindowCount();
if (DEBUG) { Log.d(LOGTAG, "sourceInfo [periodCount=" + periodCount + ", windowCount=" + windowCount); }
if (DEBUG) {
Log.d(LOGTAG, "sourceInfo [periodCount=" + periodCount + ", windowCount=" + windowCount);
}
Timeline.Period period = new Timeline.Period();
for (int i = 0; i < Math.min(periodCount, MAX_TIMELINE_ITEM_LINES); i++) {
timeline.getPeriod(i, period);
@ -599,7 +637,9 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
@Override
public synchronized void init(final String url,
final BaseHlsPlayer.ResourceCallbacks callback) {
if (DEBUG) { Log.d(LOGTAG, " init"); }
if (DEBUG) {
Log.d(LOGTAG, " init");
}
assertTrue(callback != null);
assertTrue(!mIsPlayerInitDone);
@ -644,14 +684,18 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
public synchronized long getBufferedPosition() {
// Value returned by getBufferedPosition() is in milliseconds.
long bufferedPos = mPlayer == null ? 0L : Math.max(0L, mPlayer.getBufferedPosition() * 1000L);
if (DEBUG) { Log.d(LOGTAG, "getBufferedPosition : " + bufferedPos + "(Us)"); }
if (DEBUG) {
Log.d(LOGTAG, "getBufferedPosition : " + bufferedPos + "(Us)");
}
return bufferedPos;
}
// Called on MFR's TaskQueue
@Override
public synchronized int getNumberOfTracks(final TrackType trackType) {
if (DEBUG) { Log.d(LOGTAG, "getNumberOfTracks : type " + trackType); }
if (DEBUG) {
Log.d(LOGTAG, "getNumberOfTracks : type " + trackType);
}
if (trackType == TrackType.VIDEO) {
return mTracksInfo.getNumOfVideoTracks();
} else if (trackType == TrackType.AUDIO) {
@ -663,7 +707,9 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
// Called on MFR's TaskQueue
@Override
public synchronized GeckoVideoInfo getVideoInfo(final int index) {
if (DEBUG) { Log.d(LOGTAG, "getVideoInfo"); }
if (DEBUG) {
Log.d(LOGTAG, "getVideoInfo");
}
assertTrue(mVRenderer != null);
if (!mTracksInfo.hasVideo()) {
return null;
@ -683,7 +729,9 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
// Called on MFR's TaskQueue
@Override
public synchronized GeckoAudioInfo getAudioInfo(final int index) {
if (DEBUG) { Log.d(LOGTAG, "getAudioInfo"); }
if (DEBUG) {
Log.d(LOGTAG, "getAudioInfo");
}
assertTrue(mARenderer != null);
if (!mTracksInfo.hasAudio()) {
return null;
@ -796,7 +844,9 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
if (mMediaDecoderPlayState == MediaDecoderPlayState.PLAY_STATE_PLAYING) {
return;
}
if (DEBUG) { Log.d(LOGTAG, "MediaDecoder played."); }
if (DEBUG) {
Log.d(LOGTAG, "MediaDecoder played.");
}
mMediaDecoderPlayState = MediaDecoderPlayState.PLAY_STATE_PLAYING;
resumeExoplayer();
}
@ -807,7 +857,9 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
if (mMediaDecoderPlayState != MediaDecoderPlayState.PLAY_STATE_PLAYING) {
return;
}
if (DEBUG) { Log.d(LOGTAG, "MediaDecoder paused."); }
if (DEBUG) {
Log.d(LOGTAG, "MediaDecoder paused.");
}
mMediaDecoderPlayState = MediaDecoderPlayState.PLAY_STATE_PAUSED;
suspendExoplayer();
}
@ -815,7 +867,9 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
private synchronized void suspendExoplayer() {
if (mPlayer != null) {
mExoplayerSuspended = true;
if (DEBUG) { Log.d(LOGTAG, "suspend Exoplayer"); }
if (DEBUG) {
Log.d(LOGTAG, "suspend Exoplayer");
}
mPlayer.setPlayWhenReady(false);
}
}
@ -823,14 +877,18 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
private synchronized void resumeExoplayer() {
if (mPlayer != null) {
mExoplayerSuspended = false;
if (DEBUG) { Log.d(LOGTAG, "resume Exoplayer"); }
if (DEBUG) {
Log.d(LOGTAG, "resume Exoplayer");
}
mPlayer.setPlayWhenReady(true);
}
}
// Called on Gecko's main thread, when HLSDemuxer or HLSResource destructs.
@Override
public synchronized void release() {
if (DEBUG) { Log.d(LOGTAG, "releasing ... id : " + mPlayerId); }
if (DEBUG) {
Log.d(LOGTAG, "releasing ... id : " + mPlayerId);
}
if (mPlayer != null) {
mPlayer.removeListener(this);
mPlayer.stop();

Просмотреть файл

@ -89,11 +89,15 @@ public abstract class GeckoHlsRendererBase extends BaseRenderer {
public Format getFormat(final int index) {
assertTrue(index >= 0);
Format fmt = index < mFormats.size() ? mFormats.get(index) : null;
if (DEBUG) { Log.d(LOGTAG, "getFormat : index = " + index + ", format : " + fmt); }
if (DEBUG) {
Log.d(LOGTAG, "getFormat : index = " + index + ", format : " + fmt);
}
return fmt;
}
public synchronized long getFirstSamplePTS() { return mFirstSampleStartTime; }
public synchronized long getFirstSamplePTS() {
return mFirstSampleStartTime;
}
public synchronized ConcurrentLinkedQueue<GeckoHLSSample> getQueuedSamples(final int number) {
ConcurrentLinkedQueue<GeckoHLSSample> samples =
@ -111,11 +115,15 @@ public abstract class GeckoHlsRendererBase extends BaseRenderer {
sample = samples.isEmpty() ? null : samples.peek();
if (sample == null) {
if (DEBUG) { Log.d(LOGTAG, "getQueuedSamples isEmpty, mWaitingForData = true !"); }
if (DEBUG) {
Log.d(LOGTAG, "getQueuedSamples isEmpty, mWaitingForData = true !");
}
mWaitingForData = true;
} else if (mFirstSampleStartTime == Long.MIN_VALUE) {
mFirstSampleStartTime = sample.info.presentationTimeUs;
if (DEBUG) { Log.d(LOGTAG, "mFirstSampleStartTime = " + mFirstSampleStartTime); }
if (DEBUG) {
Log.d(LOGTAG, "mFirstSampleStartTime = " + mFirstSampleStartTime);
}
}
return samples;
}
@ -176,7 +184,9 @@ public abstract class GeckoHlsRendererBase extends BaseRenderer {
if (mInitialized || mFormats.size() == 0) {
return;
}
if (DEBUG) { Log.d(LOGTAG, "Initializing ... "); }
if (DEBUG) {
Log.d(LOGTAG, "Initializing ... ");
}
try {
createInputBuffer();
mInitialized = true;
@ -229,7 +239,9 @@ public abstract class GeckoHlsRendererBase extends BaseRenderer {
// We've read a buffer.
if (mBufferForRead.isEndOfStream()) {
if (DEBUG) { Log.d(LOGTAG, "Now we're at the End Of Stream."); }
if (DEBUG) {
Log.d(LOGTAG, "Now we're at the End Of Stream.");
}
handleEndOfStream(mBufferForRead);
return false;
}
@ -244,7 +256,9 @@ public abstract class GeckoHlsRendererBase extends BaseRenderer {
private void maybeNotifyDataArrived() {
if (mWaitingForData && isQueuedEnoughData()) {
if (DEBUG) { Log.d(LOGTAG, "onDataArrived"); }
if (DEBUG) {
Log.d(LOGTAG, "onDataArrived");
}
mPlayerEventDispatcher.onDataArrived(getTrackType());
mWaitingForData = false;
}
@ -281,7 +295,9 @@ public abstract class GeckoHlsRendererBase extends BaseRenderer {
@Override
protected synchronized void onPositionReset(final long positionUs, final boolean joining) {
if (DEBUG) { Log.d(LOGTAG, "onPositionReset : positionUs = " + positionUs); }
if (DEBUG) {
Log.d(LOGTAG, "onPositionReset : positionUs = " + positionUs);
}
mInputStreamEnded = false;
if (mInitialized) {
clearInputSamplesQueue();

Просмотреть файл

@ -155,7 +155,9 @@ public class GeckoHlsVideoRenderer extends GeckoHlsRendererBase {
@Override
protected void resetRenderer() {
if (DEBUG) { Log.d(LOGTAG, "[resetRenderer] mInitialized = " + mInitialized); }
if (DEBUG) {
Log.d(LOGTAG, "[resetRenderer] mInitialized = " + mInitialized);
}
if (mInitialized) {
mRendererReconfigured = false;
mRendererReconfigurationState = RECONFIGURATION_STATE.NONE;
@ -173,10 +175,14 @@ public class GeckoHlsVideoRenderer extends GeckoHlsRendererBase {
assertTrue(mFormats.size() > 0);
if (mRendererReconfigurationState == RECONFIGURATION_STATE.WRITE_PENDING) {
if (bufferForRead.data == null) {
if (DEBUG) { Log.d(LOGTAG, "[feedInput][WRITE_PENDING] bufferForRead.data is not initialized."); }
if (DEBUG) {
Log.d(LOGTAG, "[feedInput][WRITE_PENDING] bufferForRead.data is not initialized.");
}
return;
}
if (DEBUG) { Log.d(LOGTAG, "[feedInput][WRITE_PENDING] put initialization data"); }
if (DEBUG) {
Log.d(LOGTAG, "[feedInput][WRITE_PENDING] put initialization data");
}
Format currentFormat = mFormats.get(mFormats.size() - 1);
for (int i = 0; i < currentFormat.initializationData.size(); i++) {
byte[] data = currentFormat.initializationData.get(i);
@ -190,7 +196,9 @@ public class GeckoHlsVideoRenderer extends GeckoHlsRendererBase {
protected void handleFormatRead(final DecoderInputBuffer bufferForRead)
throws ExoPlaybackException {
if (mRendererReconfigurationState == RECONFIGURATION_STATE.QUEUE_PENDING) {
if (DEBUG) { Log.d(LOGTAG, "[feedInput][QUEUE_PENDING] 2 formats in a row."); }
if (DEBUG) {
Log.d(LOGTAG, "[feedInput][QUEUE_PENDING] 2 formats in a row.");
}
// We received two formats in a row. Clear the current buffer of any reconfiguration data
// associated with the first format.
bufferForRead.clear();
@ -202,7 +210,9 @@ public class GeckoHlsVideoRenderer extends GeckoHlsRendererBase {
@Override
protected void handleEndOfStream(final DecoderInputBuffer bufferForRead) {
if (mRendererReconfigurationState == RECONFIGURATION_STATE.QUEUE_PENDING) {
if (DEBUG) { Log.d(LOGTAG, "[feedInput][QUEUE_PENDING] isEndOfStream."); }
if (DEBUG) {
Log.d(LOGTAG, "[feedInput][QUEUE_PENDING] isEndOfStream.");
}
// We received a new format immediately before the end of the stream. We need to clear
// the corresponding reconfiguration data from the current buffer, but re-write it into
// a subsequent buffer if there are any (e.g. if the user seeks backwards).
@ -257,7 +267,9 @@ public class GeckoHlsVideoRenderer extends GeckoHlsRendererBase {
protected void onPositionReset(final long positionUs, final boolean joining) {
super.onPositionReset(positionUs, joining);
if (mInitialized && mRendererReconfigured && mFormats.size() != 0) {
if (DEBUG) { Log.d(LOGTAG, "[onPositionReset] WRITE_PENDING"); }
if (DEBUG) {
Log.d(LOGTAG, "[onPositionReset] WRITE_PENDING");
}
// Any reconfiguration data that we put shortly before the reset
// may be invalid. We avoid this issue by sending reconfiguration
// data following every position reset.
@ -267,7 +279,9 @@ public class GeckoHlsVideoRenderer extends GeckoHlsRendererBase {
@Override
protected boolean clearInputSamplesQueue() {
if (DEBUG) { Log.d(LOGTAG, "clearInputSamplesQueue"); }
if (DEBUG) {
Log.d(LOGTAG, "clearInputSamplesQueue");
}
mDemuxedInputSamples.clear();
mDemuxedNoDurationSamples.clear();
return true;
@ -278,13 +292,17 @@ public class GeckoHlsVideoRenderer extends GeckoHlsRendererBase {
boolean canReconfig = areAdaptationCompatible(oldFormat, newFormat)
&& newFormat.width <= mCodecMaxValues.width && newFormat.height <= mCodecMaxValues.height
&& newFormat.maxInputSize <= mCodecMaxValues.inputSize;
if (DEBUG) { Log.d(LOGTAG, "[canReconfigure] : " + canReconfig); }
if (DEBUG) {
Log.d(LOGTAG, "[canReconfigure] : " + canReconfig);
}
return canReconfig;
}
@Override
protected void prepareReconfiguration() {
if (DEBUG) { Log.d(LOGTAG, "[onInputFormatChanged] starting reconfiguration !"); }
if (DEBUG) {
Log.d(LOGTAG, "[onInputFormatChanged] starting reconfiguration !");
}
mRendererReconfigured = true;
mRendererReconfigurationState = RECONFIGURATION_STATE.WRITE_PENDING;
}
@ -302,7 +320,9 @@ public class GeckoHlsVideoRenderer extends GeckoHlsRendererBase {
System.arraycopy(data, 0, mCSDInfo, startPos, data.length);
startPos += data.length;
}
if (DEBUG) { Log.d(LOGTAG, "mCSDInfo [" + Utils.bytesToHex(mCSDInfo) + "]"); }
if (DEBUG) {
Log.d(LOGTAG, "mCSDInfo [" + Utils.bytesToHex(mCSDInfo) + "]");
}
}
@Override
@ -377,7 +397,9 @@ public class GeckoHlsVideoRenderer extends GeckoHlsRendererBase {
for (sample = mDemuxedNoDurationSamples.poll(); sample != null; sample = mDemuxedNoDurationSamples.poll()) {
if (sample.duration == Long.MAX_VALUE) {
sample.duration = prevDuration;
if (DEBUG) { Log.d(LOGTAG, "Adjust the PTS of the last sample to " + sample.duration + " (us)"); }
if (DEBUG) {
Log.d(LOGTAG, "Adjust the PTS of the last sample to " + sample.duration + " (us)");
}
}
prevDuration = sample.duration;
if (DEBUG) {

Просмотреть файл

@ -315,8 +315,7 @@ public class GeckoMediaDrmBridgeV21 implements GeckoMediaDrm {
return;
}
protected void HandleKeyStatusChangeByDummyKey(final String sessionId)
{
protected void HandleKeyStatusChangeByDummyKey(final String sessionId) {
SessionKeyInfo[] keyInfos = new SessionKeyInfo[1];
keyInfos[0] = new SessionKeyInfo(DUMMY_KEY_ID,
MediaDrm.KeyStatus.STATUS_USABLE);

Просмотреть файл

@ -48,8 +48,7 @@ public class GeckoMediaDrmBridgeV23 extends GeckoMediaDrmBridgeV21 {
}
@Override
protected void HandleKeyStatusChangeByDummyKey(final String sessionId)
{
protected void HandleKeyStatusChangeByDummyKey(final String sessionId) {
// MediaDrm.KeyStatus information listener is supported on M+, there is no need to use
// dummy key id to report key status anymore.
}

Просмотреть файл

@ -64,7 +64,9 @@ final class JellyBeanAsyncCodec implements AsyncCodec {
switch (msg.what) {
case MSG_CANCELLATION:
// Just a marker. Nothing to do here.
if (DEBUG) { Log.d(LOGTAG, "handler " + this + " done cancellation, codec=" + JellyBeanAsyncCodec.this); }
if (DEBUG) {
Log.d(LOGTAG, "handler " + this + " done cancellation, codec=" + JellyBeanAsyncCodec.this);
}
break;
default:
super.handleMessage(msg);
@ -276,7 +278,9 @@ final class JellyBeanAsyncCodec implements AsyncCodec {
HandlerThread thread = new HandlerThread(name);
thread.start();
mBufferPoller = new BufferPoller(thread.getLooper());
if (DEBUG) { Log.d(LOGTAG, "start poller for codec:" + this + ", thread=" + thread.getThreadId()); }
if (DEBUG) {
Log.d(LOGTAG, "start poller for codec:" + this + ", thread=" + thread.getThreadId());
}
}
@Override
@ -295,7 +299,9 @@ final class JellyBeanAsyncCodec implements AsyncCodec {
looper = mBufferPoller.getLooper();
}
mCallbackSender = new CallbackSender(looper, callbacks);
if (DEBUG) { Log.d(LOGTAG, "setCallbacks(): sender=" + mCallbackSender); }
if (DEBUG) {
Log.d(LOGTAG, "setCallbacks(): sender=" + mCallbackSender);
}
}
@Override
@ -468,6 +474,8 @@ final class JellyBeanAsyncCodec implements AsyncCodec {
mBufferPoller.getLooper().quit();
mBufferPoller = null;
if (DEBUG) { Log.d(LOGTAG, "stop poller " + this); }
if (DEBUG) {
Log.d(LOGTAG, "stop poller " + this);
}
}
}

Просмотреть файл

@ -79,7 +79,9 @@ public final class RemoteManager implements IBinder.DeathRecipient {
wait(1000);
waitCount++;
} catch (InterruptedException e) {
if (DEBUG) { e.printStackTrace(); }
if (DEBUG) {
e.printStackTrace();
}
}
}
if (DEBUG) {
@ -92,7 +94,9 @@ public final class RemoteManager implements IBinder.DeathRecipient {
try {
wait(1000);
} catch (InterruptedException e) {
if (DEBUG) { e.printStackTrace(); }
if (DEBUG) {
e.printStackTrace();
}
}
}
}

Просмотреть файл

@ -51,10 +51,14 @@ public final class Sample implements Parcelable {
mArray = in.createByteArray();
}
private ArrayBuffer(final byte[] bytes) { mArray = bytes; }
private ArrayBuffer(final byte[] bytes) {
mArray = bytes;
}
@Override
public int describeContents() { return 0; }
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(final Parcel dest, final int flags) {
@ -93,7 +97,9 @@ public final class Sample implements Parcelable {
public BufferInfo info;
public CryptoInfo cryptoInfo;
public static Sample create() { return create(null, new BufferInfo(), null); }
public static Sample create() {
return create(null, new BufferInfo(), null);
}
public static Sample create(final ByteBuffer src, final BufferInfo info,
final CryptoInfo cryptoInfo) {

Просмотреть файл

@ -88,5 +88,7 @@ public final class SharedMemBuffer implements Sample.Buffer {
}
}
@Override public String toString() { return "Buffer: " + mSharedMem; }
@Override public String toString() {
return "Buffer: " + mSharedMem;
}
}

Просмотреть файл

@ -1,8 +1,7 @@
package org.mozilla.gecko.mozglue;
// Class that all classes with native methods extend from.
public abstract class JNIObject
{
public abstract class JNIObject {
// Pointer to a WeakPtr object that refers to the native object.
private long mHandle;

Просмотреть файл

@ -5,8 +5,7 @@
package org.mozilla.gecko.mozglue;
public interface NativeReference
{
public interface NativeReference {
public void release();
public boolean isReleased();

Просмотреть файл

@ -122,9 +122,13 @@ public class SharedMemory implements Parcelable {
private native void unmap(long address, int size);
public boolean isValid() { return mDescriptor != null; }
public boolean isValid() {
return mDescriptor != null;
}
public int getSize() { return mSize; }
public int getSize() {
return mSize;
}
private int getFD() {
return isValid() ? mDescriptor.getFd() : -1;

Просмотреть файл

@ -65,9 +65,7 @@ public class ContentUriUtils {
}
return !TextUtils.isEmpty(rootPath) ?
rootPath + "/" + docPath : null;
}
// DownloadsProvider
else if (isDownloadsDocument(uri)) {
} else if (isDownloadsDocument(uri)) { // DownloadsProvider
final String id = DocumentsContract.getDocumentId(uri);
// workaround for issue (https://bugzilla.mozilla.org/show_bug.cgi?id=1502721) and
// as per https://github.com/Yalantis/uCrop/issues/318#issuecomment-333066640
@ -83,9 +81,7 @@ public class ContentUriUtils {
return null;
}
}
}
// MediaProvider
else if (isMediaDocument(uri)) {
} else if (isMediaDocument(uri)) { // MediaProvider
final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":");
final String type = split[0];
@ -106,18 +102,13 @@ public class ContentUriUtils {
return getDataColumn(context, contentUri, selection, selectionArgs);
}
}
// MediaStore (and general)
else if ("content".equalsIgnoreCase(uri.getScheme())) {
} else if ("content".equalsIgnoreCase(uri.getScheme())) { // MediaStore (and general)
// Return the remote address
if (isGooglePhotosUri(uri))
return uri.getLastPathSegment();
return getDataColumn(context, uri, null, null);
}
// File
else if ("file".equalsIgnoreCase(uri.getScheme())) {
} else if ("file".equalsIgnoreCase(uri.getScheme())) { // File
return uri.getPath();
}

Просмотреть файл

@ -17,8 +17,12 @@ public class INISection {
// default file to read and write to
private String mName;
public String getName() { return mName; }
public void setName(final String name) { mName = name; }
public String getName() {
return mName;
}
public void setName(final String name) {
mName = name;
}
// show or hide debug logging
private boolean mDebug;

Просмотреть файл

@ -267,8 +267,7 @@ import android.view.inputmethod.EditorInfo;
}
public void shadowReplace(final int start, final int end,
final CharSequence newText)
{
final CharSequence newText) {
if (DEBUG) {
assertOnIcThread();
}

Просмотреть файл

@ -497,14 +497,18 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
*
* @return True if the pause is enabled.
*/
public boolean getPauseForDebuggerEnabled() { return mDebugPause; }
public boolean getPauseForDebuggerEnabled() {
return mDebugPause;
}
/**
* Gets whether the compositor should use the maximum screen depth when rendering.
*
* @return True if the maximum screen depth should be used.
*/
public boolean getUseMaxScreenDepth() { return mUseMaxScreenDepth; }
public boolean getUseMaxScreenDepth() {
return mUseMaxScreenDepth;
}
/**
* Gets the display density override value.

Просмотреть файл

@ -100,7 +100,9 @@ public class GeckoSession implements Parcelable {
private SessionFinder mFinder;
private String mId = UUID.randomUUID().toString().replace("-", "");
/* package */ String getId() { return mId; }
/* package */ String getId() {
return mId;
}
private boolean mShouldPinOnScreen;
@ -1354,7 +1356,9 @@ public class GeckoSession implements Parcelable {
@UiThread
public @NonNull SessionAccessibility getAccessibility() {
ThreadUtils.assertOnUiThread();
if (mAccessibility != null) { return mAccessibility; }
if (mAccessibility != null) {
return mAccessibility;
}
mAccessibility = new SessionAccessibility(this);
if (mWindow != null) {
@ -3075,8 +3079,7 @@ public class GeckoSession implements Parcelable {
*/
@UiThread
default @Nullable GeckoResult<AllowOrDeny> onLoadRequest(@NonNull GeckoSession session,
@NonNull LoadRequest request)
{
@NonNull LoadRequest request) {
return null;
}
@ -3094,8 +3097,7 @@ public class GeckoSession implements Parcelable {
*/
@UiThread
default @Nullable GeckoResult<GeckoSession> onNewSession(@NonNull GeckoSession session,
@NonNull String uri)
{
@NonNull String uri) {
return null;
}
@ -3108,8 +3110,7 @@ public class GeckoSession implements Parcelable {
@UiThread
default @Nullable GeckoResult<String> onLoadError(@NonNull GeckoSession session,
@Nullable String uri,
@NonNull WebRequestError error)
{
@NonNull WebRequestError error) {
return null;
}
}
@ -3186,8 +3187,7 @@ public class GeckoSession implements Parcelable {
*/
@UiThread
default void onAlert(@NonNull GeckoSession session, @Nullable String title, @Nullable String msg,
@NonNull AlertCallback callback)
{
@NonNull AlertCallback callback) {
callback.dismiss();
}
@ -3225,8 +3225,7 @@ public class GeckoSession implements Parcelable {
@UiThread
default void onButtonPrompt(@NonNull GeckoSession session, @Nullable String title,
@Nullable String msg, @Nullable String[] btnMsg,
@NonNull ButtonCallback callback)
{
@NonNull ButtonCallback callback) {
callback.dismiss();
}
@ -3257,8 +3256,7 @@ public class GeckoSession implements Parcelable {
@UiThread
default void onTextPrompt(@NonNull GeckoSession session, @Nullable String title,
@Nullable String msg, @Nullable String value,
@NonNull TextCallback callback)
{
@NonNull TextCallback callback) {
callback.dismiss();
}
@ -3389,8 +3387,7 @@ public class GeckoSession implements Parcelable {
@UiThread
default void onAuthPrompt(final @NonNull GeckoSession session, final @Nullable String title,
final @Nullable String msg, final @NonNull AuthOptions options,
final @NonNull AuthCallback callback)
{
final @NonNull AuthCallback callback) {
callback.dismiss();
}
@ -3543,8 +3540,7 @@ public class GeckoSession implements Parcelable {
@UiThread
default void onChoicePrompt(@NonNull GeckoSession session, @Nullable String title,
@Nullable String msg, @Choice.ChoiceType int type,
@NonNull Choice[] choices, @NonNull ChoiceCallback callback)
{
@NonNull Choice[] choices, @NonNull ChoiceCallback callback) {
callback.dismiss();
}
@ -3559,8 +3555,7 @@ public class GeckoSession implements Parcelable {
*/
@UiThread
default void onColorPrompt(@NonNull GeckoSession session, @Nullable String title,
@Nullable String value, @NonNull TextCallback callback)
{
@Nullable String value, @NonNull TextCallback callback) {
callback.dismiss();
}
@ -3609,8 +3604,7 @@ public class GeckoSession implements Parcelable {
@UiThread
default void onDateTimePrompt(@NonNull GeckoSession session, @Nullable String title,
@DatetimeType int type, @Nullable String value, @Nullable String min,
@Nullable String max, @NonNull TextCallback callback)
{
@Nullable String max, @NonNull TextCallback callback) {
callback.dismiss();
}
@ -3658,9 +3652,9 @@ public class GeckoSession implements Parcelable {
* @param callback Callback interface.
*/
@UiThread
default void onFilePrompt(@NonNull GeckoSession session, @Nullable String title, @FileType int type,
@Nullable String[] mimeTypes, @NonNull FileCallback callback)
{
default void onFilePrompt(@NonNull GeckoSession session, @Nullable String title,
@FileType int type, @Nullable String[] mimeTypes,
@NonNull FileCallback callback) {
callback.dismiss();
}
@ -3676,8 +3670,7 @@ public class GeckoSession implements Parcelable {
*/
@UiThread
default @Nullable GeckoResult<AllowOrDeny> onPopupRequest(@NonNull GeckoSession session,
@Nullable String targetUri)
{
@Nullable String targetUri) {
return null;
}
}
@ -3920,8 +3913,7 @@ public class GeckoSession implements Parcelable {
@UiThread
default void onAndroidPermissionsRequest(@NonNull GeckoSession session,
@Nullable String[] permissions,
@NonNull Callback callback)
{
@NonNull Callback callback) {
callback.reject();
}
@ -3937,8 +3929,7 @@ public class GeckoSession implements Parcelable {
*/
@UiThread
default void onContentPermissionRequest(@NonNull GeckoSession session, @Nullable String uri,
@Permission int type, @NonNull Callback callback)
{
@Permission int type, @NonNull Callback callback) {
callback.reject();
}
@ -4145,8 +4136,7 @@ public class GeckoSession implements Parcelable {
@UiThread
default void onMediaPermissionRequest(@NonNull GeckoSession session, @NonNull String uri,
@Nullable MediaSource[] video, @Nullable MediaSource[] audio,
@NonNull MediaCallback callback)
{
@NonNull MediaCallback callback) {
callback.reject();
}
}

Просмотреть файл

@ -114,8 +114,7 @@ public class GeckoWebExecutor {
}
if (request.cacheMode < WebRequest.CACHE_MODE_FIRST ||
request.cacheMode > WebRequest.CACHE_MODE_LAST)
{
request.cacheMode > WebRequest.CACHE_MODE_LAST) {
throw new IllegalArgumentException("Unknown cache mode");
}

Просмотреть файл

@ -535,8 +535,7 @@ public class PanZoomController extends JNIObject {
if (eventType == MotionEvent.ACTION_POINTER_UP ||
eventType == MotionEvent.ACTION_UP ||
eventType == MotionEvent.ACTION_CANCEL ||
eventType == MotionEvent.ACTION_HOVER_MOVE)
{
eventType == MotionEvent.ACTION_HOVER_MOVE) {
mPointerState.pointers.remove(pointerIndex);
}
}

Просмотреть файл

@ -587,7 +587,9 @@ public class SessionAccessibility {
PrefsHelper.addObserver(new String[]{ FORCE_ACCESSIBILITY_PREF }, prefHandler);
}
public static boolean isPlatformEnabled() { return sEnabled; }
public static boolean isPlatformEnabled() {
return sEnabled;
}
public static boolean isEnabled() {
return sEnabled || sForceEnabled;