From 5eb71eb4f470bac0cbae0e1be4db8c83bc16fcd9 Mon Sep 17 00:00:00 2001 From: "jiayl@webrtc.org" Date: Tue, 30 Dec 2014 22:44:11 +0000 Subject: [PATCH] Fix style issues from lint. BUG= R=glaznev@webrtc.org Review URL: https://webrtc-codereview.appspot.com/34629004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7984 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../appspot/apprtc/AppRTCAudioManager.java | 20 ++++++++----- .../src/org/appspot/apprtc/AppRTCClient.java | 3 ++ .../appspot/apprtc/AppRTCDemoActivity.java | 29 ++++++++++--------- .../org/appspot/apprtc/ConnectActivity.java | 24 +++++++-------- .../appspot/apprtc/PeerConnectionClient.java | 24 ++++++++------- .../org/appspot/apprtc/SettingsActivity.java | 15 ++++++---- .../org/appspot/apprtc/SettingsFragment.java | 3 ++ 7 files changed, 70 insertions(+), 48 deletions(-) diff --git a/talk/examples/android/src/org/appspot/apprtc/AppRTCAudioManager.java b/talk/examples/android/src/org/appspot/apprtc/AppRTCAudioManager.java index 04c853ef59..fe76197f41 100644 --- a/talk/examples/android/src/org/appspot/apprtc/AppRTCAudioManager.java +++ b/talk/examples/android/src/org/appspot/apprtc/AppRTCAudioManager.java @@ -34,10 +34,12 @@ import android.content.IntentFilter; import android.content.pm.PackageManager; import android.media.AudioManager; import android.util.Log; + +import org.appspot.apprtc.util.AppRTCUtils; + import java.util.Collections; import java.util.HashSet; import java.util.Set; -import org.appspot.apprtc.util.AppRTCUtils; /** * AppRTCAudioManager manages all audio related parts of the AppRTC demo. @@ -45,7 +47,10 @@ import org.appspot.apprtc.util.AppRTCUtils; public class AppRTCAudioManager { private static final String TAG = "AppRTCAudioManager"; - // Names of possible audio devices that we currently support. + /** + * AudioDevice is the names of possible audio devices that we currently + * support. + */ // TODO(henrika): add support for BLUETOOTH as well. public enum AudioDevice { SPEAKER_PHONE, @@ -88,9 +93,10 @@ public class AppRTCAudioManager { private void onProximitySensorChangedState() { // The proximity sensor should only be activated when there are exactly two // available audio devices. - if (audioDevices.size() == 2 && - audioDevices.contains(AppRTCAudioManager.AudioDevice.EARPIECE) && - audioDevices.contains(AppRTCAudioManager.AudioDevice.SPEAKER_PHONE)) { + if (audioDevices.size() == 2 + && audioDevices.contains(AppRTCAudioManager.AudioDevice.EARPIECE) + && audioDevices.contains( + AppRTCAudioManager.AudioDevice.SPEAKER_PHONE)) { if (proximitySensor.sensorReportsNearState()) { // Sensor reports that a "handset is being held up to a person's ear", // or "something is covering the light sensor". @@ -346,8 +352,8 @@ public class AppRTCAudioManager { // in the list. Given the current implementation, we know that the choice // will then be between EARPIECE and SPEAKER_PHONE. if (audioDevices.size() == 2) { - AppRTCUtils.assertIsTrue(audioDevices.contains(AudioDevice.EARPIECE) && - audioDevices.contains(AudioDevice.SPEAKER_PHONE)); + AppRTCUtils.assertIsTrue(audioDevices.contains(AudioDevice.EARPIECE) + && audioDevices.contains(AudioDevice.SPEAKER_PHONE)); // Start the proximity sensor. proximitySensor.start(); } else if (audioDevices.size() == 1) { diff --git a/talk/examples/android/src/org/appspot/apprtc/AppRTCClient.java b/talk/examples/android/src/org/appspot/apprtc/AppRTCClient.java index 021b939f5c..034ce5517a 100644 --- a/talk/examples/android/src/org/appspot/apprtc/AppRTCClient.java +++ b/talk/examples/android/src/org/appspot/apprtc/AppRTCClient.java @@ -33,6 +33,9 @@ import org.webrtc.SessionDescription; import java.util.List; +/** + * AppRTCClient is the interface representing an AppRTC client. + */ public interface AppRTCClient { /** * Asynchronously connect to an AppRTC room URL, e.g. diff --git a/talk/examples/android/src/org/appspot/apprtc/AppRTCDemoActivity.java b/talk/examples/android/src/org/appspot/apprtc/AppRTCDemoActivity.java index ca80cd3822..b63bf2e034 100644 --- a/talk/examples/android/src/org/appspot/apprtc/AppRTCDemoActivity.java +++ b/talk/examples/android/src/org/appspot/apprtc/AppRTCDemoActivity.java @@ -27,9 +27,6 @@ package org.appspot.apprtc; -import java.util.HashMap; -import java.util.Map; - import android.app.Activity; import android.app.AlertDialog; import android.app.Fragment; @@ -62,6 +59,9 @@ import org.webrtc.VideoRenderer; import org.webrtc.VideoRendererGui; import org.webrtc.VideoRendererGui.ScalingType; +import java.util.HashMap; +import java.util.Map; + /** * Activity of the AppRTCDemo Android app demonstrating interoperability * between the Android/Java implementation of PeerConnection and the @@ -107,9 +107,9 @@ public class AppRTCDemoActivity extends Activity getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); getWindow().getDecorView().setSystemUiVisibility( - View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | - View.SYSTEM_UI_FLAG_FULLSCREEN | - View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); + View.SYSTEM_UI_FLAG_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_FULLSCREEN + | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); setContentView(R.layout.activity_fullscreen); @@ -118,7 +118,7 @@ public class AppRTCDemoActivity extends Activity iceConnected = false; rootView = findViewById(android.R.id.content); - encoderStatView = (TextView)findViewById(R.id.encoder_stat); + encoderStatView = (TextView) findViewById(R.id.encoder_stat); menuBar = findViewById(R.id.menubar_fragment); roomNameView = (TextView) findViewById(R.id.room_name); videoView = (GLSurfaceView) findViewById(R.id.glview); @@ -254,6 +254,9 @@ public class AppRTCDemoActivity extends Activity } } + /** + * MenuBar fragment for AppRTC. + */ public static class MenuBarFragment extends Fragment { @Override public View onCreateView( @@ -429,12 +432,12 @@ public class AppRTCDemoActivity extends Activity String targetBitrate = null; String actualBitrate = null; for (StatsReport report : reports) { - if (report.type.equals("ssrc") && report.id.contains("ssrc") && - report.id.contains("send")) { + if (report.type.equals("ssrc") && report.id.contains("ssrc") + && report.id.contains("send")) { Map reportMap = getReportMap(report); String trackId = reportMap.get("googTrackId"); - if (trackId != null && - trackId.contains(PeerConnectionClient.VIDEO_TRACK_ID)) { + if (trackId != null + && trackId.contains(PeerConnectionClient.VIDEO_TRACK_ID)) { fps = reportMap.get("googFrameRateSent"); } } else if (report.id.equals("bweforvideo")) { @@ -486,8 +489,8 @@ public class AppRTCDemoActivity extends Activity return; } final Runnable runnableThis = this; - if (hudView.getVisibility() == View.INVISIBLE && - encoderStatView.getVisibility() == View.INVISIBLE) { + if (hudView.getVisibility() == View.INVISIBLE + && encoderStatView.getVisibility() == View.INVISIBLE) { videoView.postDelayed(runnableThis, 1000); return; } diff --git a/talk/examples/android/src/org/appspot/apprtc/ConnectActivity.java b/talk/examples/android/src/org/appspot/apprtc/ConnectActivity.java index 12e147c5b7..32c8ea9fb2 100644 --- a/talk/examples/android/src/org/appspot/apprtc/ConnectActivity.java +++ b/talk/examples/android/src/org/appspot/apprtc/ConnectActivity.java @@ -50,13 +50,12 @@ import android.widget.ImageButton; import android.widget.ListView; import android.widget.TextView; -import java.util.ArrayList; -import java.util.Random; - import org.json.JSONArray; import org.json.JSONException; import org.webrtc.MediaCodecVideoEncoder; +import java.util.ArrayList; +import java.util.Random; /** * Handles the initial setup where the user selects which room to join. @@ -69,8 +68,8 @@ public class ConnectActivity extends Activity { public static final String EXTRA_RUNTIME = "org.appspot.apprtc.RUNTIME"; public static final String EXTRA_BITRATE = "org.appspot.apprtc.BITRATE"; public static final String EXTRA_HWCODEC = "org.appspot.apprtc.HWCODEC"; - private static final String TAG = "ConnectRTCClient"; - private final int CONNECTION_REQUEST = 1; + private static final String TAG = "ConnectActivity"; + private static final int CONNECTION_REQUEST = 1; private static boolean commandLineRun = false; private ImageButton addRoomButton; @@ -141,8 +140,8 @@ public class ConnectActivity extends Activity { // If an implicit VIEW intent is launching the app, go directly to that URL. final Intent intent = getIntent(); - if ("android.intent.action.VIEW".equals(intent.getAction()) && - !commandLineRun) { + if ("android.intent.action.VIEW".equals(intent.getAction()) + && !commandLineRun) { commandLineRun = true; boolean loopback = intent.getBooleanExtra(EXTRA_LOOPBACK, false); int runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0); @@ -272,8 +271,8 @@ public class ConnectActivity extends Activity { int maxWidth = Integer.parseInt(dimensions[0]); int maxHeight = Integer.parseInt(dimensions[1]); if (maxWidth > 0 && maxHeight > 0) { - parametersResolution = "minHeight=" + maxHeight + ",maxHeight=" + - maxHeight + ",minWidth=" + maxWidth + ",maxWidth=" + maxWidth; + parametersResolution = "minHeight=" + maxHeight + ",maxHeight=" + + maxHeight + ",minWidth=" + maxWidth + ",maxWidth=" + maxWidth; } } catch (NumberFormatException e) { Log.e(TAG, "Wrong video resolution setting: " + resolution); @@ -288,8 +287,8 @@ public class ConnectActivity extends Activity { try { int cameraFps = Integer.parseInt(fpsValues[0]); if (cameraFps > 0) { - parametersFps = "minFrameRate=" + cameraFps + - ",maxFrameRate=" + cameraFps; + parametersFps = "minFrameRate=" + cameraFps + + ",maxFrameRate=" + cameraFps; } } catch (NumberFormatException e) { Log.e(TAG, "Wrong camera fps setting: " + fps); @@ -352,8 +351,9 @@ public class ConnectActivity extends Activity { } private boolean validateUrl(String url) { - if (URLUtil.isHttpsUrl(url) || URLUtil.isHttpUrl(url)) + if (URLUtil.isHttpsUrl(url) || URLUtil.isHttpUrl(url)) { return true; + } new AlertDialog.Builder(this) .setTitle(getText(R.string.invalid_url_title)) diff --git a/talk/examples/android/src/org/appspot/apprtc/PeerConnectionClient.java b/talk/examples/android/src/org/appspot/apprtc/PeerConnectionClient.java index ea15389f63..94160cf50b 100644 --- a/talk/examples/android/src/org/appspot/apprtc/PeerConnectionClient.java +++ b/talk/examples/android/src/org/appspot/apprtc/PeerConnectionClient.java @@ -35,10 +35,10 @@ import org.appspot.apprtc.AppRTCClient.SignalingParameters; import org.webrtc.DataChannel; import org.webrtc.IceCandidate; import org.webrtc.MediaConstraints; +import org.webrtc.MediaConstraints.KeyValuePair; import org.webrtc.MediaStream; import org.webrtc.MediaStreamTrack; import org.webrtc.PeerConnection; -import org.webrtc.MediaConstraints.KeyValuePair; import org.webrtc.PeerConnection.IceConnectionState; import org.webrtc.PeerConnectionFactory; import org.webrtc.SdpObserver; @@ -53,6 +53,9 @@ import java.util.LinkedList; import java.util.regex.Matcher; import java.util.regex.Pattern; +/** + * PeerConnection client for AppRTC. + */ public class PeerConnectionClient { private static final String TAG = "PCRTCClient"; public static final String VIDEO_TRACK_ID = "ARDAMSv0"; @@ -312,8 +315,8 @@ public class PeerConnectionClient { int[] cameraOrientation = { 0, 90, 180, 270 }; for (int index : cameraIndex) { for (int orientation : cameraOrientation) { - String name = "Camera " + index + ", Facing " + facing + - ", Orientation " + orientation; + String name = "Camera " + index + ", Facing " + facing + + ", Orientation " + orientation; VideoCapturer capturer = VideoCapturer.create(name); if (capturer != null) { Log.d(TAG, "Using camera: " + name); @@ -372,8 +375,8 @@ public class PeerConnectionClient { for (int i = 0; i < lines.length; i++) { newSdpDescription.append(lines[i]).append("\r\n"); if (i == lineIndex) { - String bitrateSet = "a=fmtp:" + vp8RtpMap + - " x-google-start-bitrate=" + bitrateKbps; + String bitrateSet = "a=fmtp:" + vp8RtpMap + + " x-google-start-bitrate=" + bitrateKbps; Log.d(TAG, "Add remote SDP line: " + bitrateSet); newSdpDescription.append(bitrateSet).append("\r\n"); } @@ -441,8 +444,9 @@ public class PeerConnectionClient { } public void switchCamera() { - if (videoConstraints == null) + if (videoConstraints == null) { return; // No video is sent. + } if (pc.signalingState() != PeerConnection.SignalingState.STABLE) { Log.e(TAG, "Switching camera during negotiation is not handled."); @@ -531,8 +535,8 @@ public class PeerConnectionClient { public void onAddStream(final MediaStream stream){ uiHandler.post(new Runnable() { public void run() { - abortUnless(stream.audioTracks.size() <= 1 && - stream.videoTracks.size() <= 1, + abortUnless(stream.audioTracks.size() <= 1 + && stream.videoTracks.size() <= 1, "Weird-looking stream: " + stream); if (stream.videoTracks.size() == 1) { stream.videoTracks.get(0).addRenderer( @@ -553,8 +557,8 @@ public class PeerConnectionClient { @Override public void onDataChannel(final DataChannel dc) { - reportError("AppRTC doesn't use data channels, but got: " + dc.label() + - " anyway!"); + reportError("AppRTC doesn't use data channels, but got: " + dc.label() + + " anyway!"); } @Override diff --git a/talk/examples/android/src/org/appspot/apprtc/SettingsActivity.java b/talk/examples/android/src/org/appspot/apprtc/SettingsActivity.java index 43d7620882..9e9989f35d 100644 --- a/talk/examples/android/src/org/appspot/apprtc/SettingsActivity.java +++ b/talk/examples/android/src/org/appspot/apprtc/SettingsActivity.java @@ -33,6 +33,9 @@ import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.os.Bundle; import android.preference.Preference; +/** + * Settings activity for AppRTC. + */ public class SettingsActivity extends Activity implements OnSharedPreferenceChangeListener{ private SettingsFragment settingsFragment; @@ -92,15 +95,15 @@ public class SettingsActivity extends Activity @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { - if (key.equals(keyprefResolution) || - key.equals(keyprefFps) || - key.equals(keyprefStartBitrateType) || - key.equals(keyPrefRoomServerUrl)) { + if (key.equals(keyprefResolution) + || key.equals(keyprefFps) + || key.equals(keyprefStartBitrateType) + || key.equals(keyPrefRoomServerUrl)) { updateSummary(sharedPreferences, key); } else if (key.equals(keyprefStartBitrateValue)) { updateSummaryBitrate(sharedPreferences, key); - } else if (key.equals(keyprefCpuUsageDetection) || - key.equals(keyprefHwCodec) || key.equals(keyprefSignaling)) { + } else if (key.equals(keyprefCpuUsageDetection) + || key.equals(keyprefHwCodec) || key.equals(keyprefSignaling)) { updateSummaryB(sharedPreferences, key); } if (key.equals(keyprefStartBitrateType)) { diff --git a/talk/examples/android/src/org/appspot/apprtc/SettingsFragment.java b/talk/examples/android/src/org/appspot/apprtc/SettingsFragment.java index ec4b70481c..02a055bbbb 100644 --- a/talk/examples/android/src/org/appspot/apprtc/SettingsFragment.java +++ b/talk/examples/android/src/org/appspot/apprtc/SettingsFragment.java @@ -30,6 +30,9 @@ package org.appspot.apprtc; import android.os.Bundle; import android.preference.PreferenceFragment; +/** + * Settings fragment for AppRTC. + */ public class SettingsFragment extends PreferenceFragment { @Override