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) { public static Throwable getRootException(final Throwable exc) {
Throwable cause; Throwable cause;
for (cause = exc; cause != null; cause = cause.getCause()) {} for (cause = exc; cause != null; cause = cause.getCause()) {
}
return cause; return cause;
} }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -48,8 +48,7 @@ public class GeckoMediaDrmBridgeV23 extends GeckoMediaDrmBridgeV21 {
} }
@Override @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 // MediaDrm.KeyStatus information listener is supported on M+, there is no need to use
// dummy key id to report key status anymore. // dummy key id to report key status anymore.
} }

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

@ -64,7 +64,9 @@ final class JellyBeanAsyncCodec implements AsyncCodec {
switch (msg.what) { switch (msg.what) {
case MSG_CANCELLATION: case MSG_CANCELLATION:
// Just a marker. Nothing to do here. // 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; break;
default: default:
super.handleMessage(msg); super.handleMessage(msg);
@ -276,7 +278,9 @@ final class JellyBeanAsyncCodec implements AsyncCodec {
HandlerThread thread = new HandlerThread(name); HandlerThread thread = new HandlerThread(name);
thread.start(); thread.start();
mBufferPoller = new BufferPoller(thread.getLooper()); 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 @Override
@ -295,7 +299,9 @@ final class JellyBeanAsyncCodec implements AsyncCodec {
looper = mBufferPoller.getLooper(); looper = mBufferPoller.getLooper();
} }
mCallbackSender = new CallbackSender(looper, callbacks); mCallbackSender = new CallbackSender(looper, callbacks);
if (DEBUG) { Log.d(LOGTAG, "setCallbacks(): sender=" + mCallbackSender); } if (DEBUG) {
Log.d(LOGTAG, "setCallbacks(): sender=" + mCallbackSender);
}
} }
@Override @Override
@ -468,6 +474,8 @@ final class JellyBeanAsyncCodec implements AsyncCodec {
mBufferPoller.getLooper().quit(); mBufferPoller.getLooper().quit();
mBufferPoller = null; 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); wait(1000);
waitCount++; waitCount++;
} catch (InterruptedException e) { } catch (InterruptedException e) {
if (DEBUG) { e.printStackTrace(); } if (DEBUG) {
e.printStackTrace();
}
} }
} }
if (DEBUG) { if (DEBUG) {
@ -92,7 +94,9 @@ public final class RemoteManager implements IBinder.DeathRecipient {
try { try {
wait(1000); wait(1000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
if (DEBUG) { e.printStackTrace(); } if (DEBUG) {
e.printStackTrace();
}
} }
} }
} }

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

@ -51,10 +51,14 @@ public final class Sample implements Parcelable {
mArray = in.createByteArray(); mArray = in.createByteArray();
} }
private ArrayBuffer(final byte[] bytes) { mArray = bytes; } private ArrayBuffer(final byte[] bytes) {
mArray = bytes;
}
@Override @Override
public int describeContents() { return 0; } public int describeContents() {
return 0;
}
@Override @Override
public void writeToParcel(final Parcel dest, final int flags) { public void writeToParcel(final Parcel dest, final int flags) {
@ -93,7 +97,9 @@ public final class Sample implements Parcelable {
public BufferInfo info; public BufferInfo info;
public CryptoInfo cryptoInfo; 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, public static Sample create(final ByteBuffer src, final BufferInfo info,
final CryptoInfo cryptoInfo) { 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; package org.mozilla.gecko.mozglue;
// Class that all classes with native methods extend from. // 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. // Pointer to a WeakPtr object that refers to the native object.
private long mHandle; private long mHandle;

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

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

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

@ -122,9 +122,13 @@ public class SharedMemory implements Parcelable {
private native void unmap(long address, int size); 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() { private int getFD() {
return isValid() ? mDescriptor.getFd() : -1; return isValid() ? mDescriptor.getFd() : -1;

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

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

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

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

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

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

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

@ -497,14 +497,18 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
* *
* @return True if the pause is enabled. * @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. * Gets whether the compositor should use the maximum screen depth when rendering.
* *
* @return True if the maximum screen depth should be used. * @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. * Gets the display density override value.

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

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

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

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

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

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

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

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