Remove precondition checks
Remove precondition checks when we can work around them.
Bug:16620302
Change-Id: Ideb70a35c08f2275361eebec2850f454cf0bec55
diff --git a/src/com/android/telecomm/DtmfLocalTonePlayer.java b/src/com/android/telecomm/DtmfLocalTonePlayer.java
index e18f59c..715b1e8 100644
--- a/src/com/android/telecomm/DtmfLocalTonePlayer.java
+++ b/src/com/android/telecomm/DtmfLocalTonePlayer.java
@@ -20,7 +20,6 @@
import android.media.ToneGenerator;
import android.provider.Settings;
-import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import java.util.Map;
@@ -57,13 +56,8 @@
/** {@inheritDoc} */
@Override
public void onForegroundCallChanged(Call oldForegroundCall, Call newForegroundCall) {
- if (oldForegroundCall != null) {
- endDtmfSession(oldForegroundCall);
- }
-
- if (newForegroundCall != null) {
- startDtmfSession(newForegroundCall);
- }
+ endDtmfSession(oldForegroundCall);
+ startDtmfSession(newForegroundCall);
}
/**
@@ -113,7 +107,9 @@
* @param call The call associated with this dtmf session.
*/
private void startDtmfSession(Call call) {
- Preconditions.checkNotNull(call);
+ if (call == null) {
+ return;
+ }
TelecommApp app = TelecommApp.getInstance();
final boolean areLocalTonesEnabled;
@@ -144,8 +140,7 @@
* @param call The call associated with the session to end.
*/
private void endDtmfSession(Call call) {
- Preconditions.checkNotNull(call);
- if (mCall == call) {
+ if (call != null && mCall == call) {
// Do a stopTone() in case the sessions ends before we are told to stop the tone.
stopTone(call);