From e332b103cacab1430bde7130dbfea1eebca30038 Mon Sep 17 00:00:00 2001 From: zachh Date: Fri, 8 Jun 2018 17:03:55 -0700 Subject: Removed cast to DialtactsActivity. DialtactsActivity should be dead code at this point so this code should be unreachable. Bug: 109931227 Test: none PiperOrigin-RevId: 199872804 Change-Id: I4f4f66f5c803662de238c42dc746423c8ab1f150 --- .../android/dialer/app/calllog/CallLogAdapter.java | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'java/com') diff --git a/java/com/android/dialer/app/calllog/CallLogAdapter.java b/java/com/android/dialer/app/calllog/CallLogAdapter.java index a4479da9e..d3fd36520 100644 --- a/java/com/android/dialer/app/calllog/CallLogAdapter.java +++ b/java/com/android/dialer/app/calllog/CallLogAdapter.java @@ -54,7 +54,6 @@ import android.view.View; import android.view.ViewGroup; import com.android.contacts.common.ContactsUtils; import com.android.contacts.common.preference.ContactsPreferences; -import com.android.dialer.app.DialtactsActivity; import com.android.dialer.app.R; import com.android.dialer.app.calllog.CallLogFragment.CallLogFragmentListener; import com.android.dialer.app.calllog.CallLogGroupBuilder.GroupCreator; @@ -395,16 +394,15 @@ public class CallLogAdapter extends GroupingListAdapter if (viewHolder.callType == CallLog.Calls.MISSED_TYPE) { CallLogAsyncTaskUtil.markCallAsRead(activity, viewHolder.callIds); if (activityType == ACTIVITY_TYPE_DIALTACTS) { - if (v.getContext() instanceof MainActivityPeer.PeerSupplier) { - // This is really bad, but we must do this to prevent a dependency cycle, enforce - // best practices in new code, and avoid refactoring DialtactsActivity. - ((FragmentUtilListener) - ((MainActivityPeer.PeerSupplier) v.getContext()).getPeer()) - .getImpl(CallLogFragmentListener.class) - .updateTabUnreadCounts(); - } else { - ((DialtactsActivity) v.getContext()).updateTabUnreadCounts(); - } + Assert.checkState( + v.getContext() instanceof MainActivityPeer.PeerSupplier, + "%s is not a PeerSupplier", + v.getContext().getClass()); + // This is really bad, but we must do this to prevent a dependency cycle, enforce + // best practices in new code, and avoid refactoring DialtactsActivity. + ((FragmentUtilListener) ((MainActivityPeer.PeerSupplier) v.getContext()).getPeer()) + .getImpl(CallLogFragmentListener.class) + .updateTabUnreadCounts(); } } expandViewHolderActions(viewHolder); -- cgit v1.2.3