Remove redundant initializers from WebRTC Java code.

Removes redundant field initializers such as null, 0 and false.

Bug: webrtc:9742
Change-Id: I1e54f6c6000885cf95f7af8e2701875a78445497
Reviewed-on: https://webrtc-review.googlesource.com/99481
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24676}
This commit is contained in:
Sami Kalliomäki
2018-09-11 11:11:47 +02:00
committed by Commit Bot
parent ef73f59de6
commit 3d50a31aad
35 changed files with 118 additions and 124 deletions

View File

@ -65,9 +65,9 @@ public class AppRTCAudioManager {
private AudioManagerEvents audioManagerEvents;
private AudioManagerState amState;
private int savedAudioMode = AudioManager.MODE_INVALID;
private boolean savedIsSpeakerPhoneOn = false;
private boolean savedIsMicrophoneMute = false;
private boolean hasWiredHeadset = false;
private boolean savedIsSpeakerPhoneOn;
private boolean savedIsMicrophoneMute;
private boolean hasWiredHeadset;
// Default audio device; speaker phone for video calls or earpiece for audio
// only calls.
@ -93,8 +93,7 @@ public class AppRTCAudioManager {
// relative to the view screen of a device and can therefore be used to
// assist device switching (close to ear <=> use headset earpiece if
// available, far from ear <=> use speaker phone).
@Nullable
private AppRTCProximitySensor proximitySensor = null;
@Nullable private AppRTCProximitySensor proximitySensor;
// Handles all tasks related to Bluetooth headset devices.
private final AppRTCBluetoothManager bluetoothManager;

View File

@ -16,8 +16,8 @@ import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Build;
import javax.annotation.Nullable;
import android.util.Log;
import javax.annotation.Nullable;
import org.appspot.apprtc.util.AppRTCUtils;
import org.webrtc.ThreadUtils;
@ -40,9 +40,8 @@ public class AppRTCProximitySensor implements SensorEventListener {
private final Runnable onSensorStateListener;
private final SensorManager sensorManager;
@Nullable
private Sensor proximitySensor = null;
private boolean lastStateReportIsNear = false;
@Nullable private Sensor proximitySensor;
private boolean lastStateReportIsNear;
/** Construction */
static AppRTCProximitySensor create(Context context, Runnable sensorStateListener) {

View File

@ -152,14 +152,12 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
private final ProxyVideoSink remoteProxyRenderer = new ProxyVideoSink();
private final ProxyVideoSink localProxyVideoSink = new ProxyVideoSink();
@Nullable
private PeerConnectionClient peerConnectionClient = null;
@Nullable private PeerConnectionClient peerConnectionClient;
@Nullable
private AppRTCClient appRtcClient;
@Nullable
private SignalingParameters signalingParameters;
@Nullable
private AppRTCAudioManager audioManager = null;
@Nullable private AppRTCAudioManager audioManager;
@Nullable
private SurfaceViewRenderer pipRenderer;
@Nullable
@ -176,9 +174,9 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
private boolean iceConnected;
private boolean isError;
private boolean callControlFragmentVisible = true;
private long callStartedTimeMs = 0;
private long callStartedTimeMs;
private boolean micEnabled = true;
private boolean screencaptureEnabled = false;
private boolean screencaptureEnabled;
private static Intent mediaProjectionPermissionResultData;
private static int mediaProjectionPermissionResultCode;
// True if local view is in the fullscreen renderer.

View File

@ -30,10 +30,10 @@ public class CaptureQualityController implements SeekBar.OnSeekBarChangeListener
private static final int FRAMERATE_THRESHOLD = 15;
private TextView captureFormatText;
private CallFragment.OnCallEvents callEvents;
private int width = 0;
private int height = 0;
private int framerate = 0;
private double targetBandwidth = 0;
private int width;
private int height;
private int framerate;
private double targetBandwidth;
public CaptureQualityController(
TextView captureFormatText, CallFragment.OnCallEvents callEvents) {

View File

@ -45,7 +45,7 @@ public class ConnectActivity extends Activity {
private static final String TAG = "ConnectActivity";
private static final int CONNECTION_REQUEST = 1;
private static final int REMOVE_FAVORITE_INDEX = 0;
private static boolean commandLineRun = false;
private static boolean commandLineRun;
private ImageButton addFavoriteButton;
private EditText roomEditText;

View File

@ -182,8 +182,7 @@ public class PeerConnectionClient {
private RtcEventLog rtcEventLog;
// Implements the WebRtcAudioRecordSamplesReadyCallback interface and writes
// recorded audio samples to an output file.
@Nullable
private RecordedAudioToFileController saveRecordedAudioToFile = null;
@Nullable private RecordedAudioToFileController saveRecordedAudioToFile;
/**
* Peer connection parameters.

View File

@ -12,14 +12,14 @@ package org.appspot.apprtc;
import android.media.AudioFormat;
import android.os.Environment;
import javax.annotation.Nullable;
import android.util.Log;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.concurrent.ExecutorService;
import javax.annotation.Nullable;
import org.webrtc.audio.JavaAudioDeviceModule;
import org.webrtc.audio.JavaAudioDeviceModule.SamplesReadyCallback;
import org.webrtc.voiceengine.WebRtcAudioRecord;
@ -36,10 +36,9 @@ public class RecordedAudioToFileController
private final Object lock = new Object();
private final ExecutorService executor;
@Nullable
private OutputStream rawAudioFileOutputStream = null;
@Nullable private OutputStream rawAudioFileOutputStream;
private boolean isRunning;
private long fileSizeInBytes = 0;
private long fileSizeInBytes;
public RecordedAudioToFileController(ExecutorService executor) {
Log.d(TAG, "ctor");