diff options
Diffstat (limited to 'java/com')
3 files changed, 35 insertions, 10 deletions
diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java index e83fcd4c7..8b504737b 100644 --- a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java +++ b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java @@ -29,10 +29,10 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.android.dialer.app.R; -import com.android.dialer.app.list.ListsFragment; import com.android.dialer.app.voicemail.VoicemailAudioManager; import com.android.dialer.app.voicemail.VoicemailErrorManager; import com.android.dialer.app.voicemail.VoicemailPlaybackPresenter; +import com.android.dialer.common.FragmentUtils; import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.DialerExecutor; import com.android.dialer.common.concurrent.DialerExecutorComponent; @@ -151,7 +151,7 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment { @Override public void fetchCalls() { super.fetchCalls(); - ((ListsFragment) getParentFragment()).updateTabUnreadCounts(); + FragmentUtils.getParentUnsafe(this, CallLogFragmentListener.class).updateTabUnreadCounts(); } @Override diff --git a/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java b/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java index e9b64dfe3..3a7733436 100644 --- a/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java +++ b/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java @@ -57,6 +57,7 @@ import com.android.dialer.constants.Constants; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.phonenumbercache.CallLogQuery; +import com.android.dialer.strictmode.StrictModeUtils; import com.android.dialer.telecom.TelecomUtil; import com.android.dialer.util.PermissionsUtil; import com.google.common.io.ByteStreams; @@ -518,7 +519,10 @@ public class VoicemailPlaybackPresenter handleError(new IllegalStateException("Cannot play voicemail when call is in progress")); return; } + StrictModeUtils.bypass(this::prepareMediaPlayer); + } + private void prepareMediaPlayer() { try { mediaPlayer = new MediaPlayer(); mediaPlayer.setOnPreparedListener(this); diff --git a/java/com/android/dialer/main/impl/MainActivity.java b/java/com/android/dialer/main/impl/MainActivity.java index b94f07588..fd32aa2a1 100644 --- a/java/com/android/dialer/main/impl/MainActivity.java +++ b/java/com/android/dialer/main/impl/MainActivity.java @@ -38,6 +38,7 @@ import com.android.dialer.app.calllog.CallLogAdapter; import com.android.dialer.app.calllog.CallLogFragment; import com.android.dialer.app.calllog.CallLogFragment.CallLogFragmentListener; import com.android.dialer.app.calllog.CallLogNotificationsService; +import com.android.dialer.app.calllog.VisualVoicemailCallLogFragment; import com.android.dialer.app.list.DragDropController; import com.android.dialer.app.list.OldSpeedDialFragment; import com.android.dialer.app.list.OnDragDropListener; @@ -789,15 +790,30 @@ public final class MainActivity extends TransactionSafeActivity @Override public void onVoicemailSelected() { hideAllFragments(); - NewVoicemailFragment fragment = - (NewVoicemailFragment) supportFragmentManager.findFragmentByTag(VOICEMAIL_TAG); - if (fragment == null) { - supportFragmentManager - .beginTransaction() - .add(R.id.fragment_container, new NewVoicemailFragment(), VOICEMAIL_TAG) - .commit(); + if (ConfigProviderComponent.get(context) + .getConfigProvider() + .getBoolean("enable_new_voicemail_fragment", false)) { + NewVoicemailFragment fragment = + (NewVoicemailFragment) supportFragmentManager.findFragmentByTag(VOICEMAIL_TAG); + if (fragment == null) { + supportFragmentManager + .beginTransaction() + .add(R.id.fragment_container, new NewVoicemailFragment(), VOICEMAIL_TAG) + .commit(); + } else { + supportFragmentManager.beginTransaction().show(fragment).commit(); + } } else { - supportFragmentManager.beginTransaction().show(fragment).commit(); + VisualVoicemailCallLogFragment fragment = + (VisualVoicemailCallLogFragment) fragmentManager.findFragmentByTag(VOICEMAIL_TAG); + if (fragment == null) { + fragmentManager + .beginTransaction() + .add(R.id.fragment_container, new VisualVoicemailCallLogFragment(), VOICEMAIL_TAG) + .commit(); + } else { + fragmentManager.beginTransaction().show(fragment).commit(); + } } } @@ -808,6 +824,7 @@ public final class MainActivity extends TransactionSafeActivity supportTransaction.hide(supportFragmentManager.findFragmentByTag(CALL_LOG_TAG)); } if (supportFragmentManager.findFragmentByTag(VOICEMAIL_TAG) != null) { + // NewVoicemailFragment supportTransaction.hide(supportFragmentManager.findFragmentByTag(VOICEMAIL_TAG)); } supportTransaction.commit(); @@ -823,6 +840,10 @@ public final class MainActivity extends TransactionSafeActivity if (fragmentManager.findFragmentByTag(CONTACTS_TAG) != null) { transaction.hide(fragmentManager.findFragmentByTag(CONTACTS_TAG)); } + if (fragmentManager.findFragmentByTag(VOICEMAIL_TAG) != null) { + // Old VisualVoicemailFragment + transaction.hide(fragmentManager.findFragmentByTag(VOICEMAIL_TAG)); + } transaction.commit(); } } |