diff options
Diffstat (limited to 'InCallUI/src/com/android')
4 files changed, 41 insertions, 4 deletions
diff --git a/InCallUI/src/com/android/incallui/BaseFragment.java b/InCallUI/src/com/android/incallui/BaseFragment.java index 6c2ba216c..1ef3b1513 100644 --- a/InCallUI/src/com/android/incallui/BaseFragment.java +++ b/InCallUI/src/com/android/incallui/BaseFragment.java @@ -50,8 +50,22 @@ public abstract class BaseFragment<T extends Presenter<U>, U extends Ui> extends } @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + if (savedInstanceState != null) { + mPresenter.onRestoreInstanceState(savedInstanceState); + } + } + + @Override public void onDestroyView() { super.onDestroyView(); mPresenter.onUiDestroy(getUi()); } + + @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + mPresenter.onSaveInstanceState(outState); + } } diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java index 2e83e321d..35410261d 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -17,10 +17,10 @@ package com.android.incallui; import android.content.Context; +import android.os.Bundle; import android.telecom.AudioState; import android.telecom.InCallService.VideoCall; import android.telecom.PhoneCapabilities; -import android.telecom.TelecomManager; import android.telecom.VideoProfile; import com.android.incallui.AudioModeProvider.AudioModeListener; @@ -30,8 +30,6 @@ import com.android.incallui.InCallPresenter.InCallStateListener; import com.android.incallui.InCallPresenter.IncomingCallListener; import com.android.incallui.InCallPresenter.InCallDetailsListener; -import android.telephony.PhoneNumberUtils; - import java.util.Objects; /** @@ -41,6 +39,9 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto implements InCallStateListener, AudioModeListener, IncomingCallListener, InCallDetailsListener, CanAddCallListener { + private static final String KEY_AUTOMATICALLY_MUTED = "incall_key_automatically_muted"; + private static final String KEY_PREVIOUS_MUTE_STATE = "incall_key_previous_mute_state"; + private Call mCall; private boolean mAutomaticallyMuted = false; private boolean mPreviousMuteState = false; @@ -232,7 +233,6 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto mPreviousMuteState = AudioModeProvider.getInstance().getMute(); // Simulate a click on the mute button muteClicked(true); - TelecomAdapter.getInstance().addCall(); } @@ -468,6 +468,22 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto mAutomaticallyMuted = false; } + @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + outState.putBoolean(KEY_AUTOMATICALLY_MUTED, mAutomaticallyMuted); + outState.putBoolean(KEY_PREVIOUS_MUTE_STATE, mPreviousMuteState); + } + + @Override + public void onRestoreInstanceState(Bundle savedInstanceState) { + mAutomaticallyMuted = + savedInstanceState.getBoolean(KEY_AUTOMATICALLY_MUTED, mAutomaticallyMuted); + mPreviousMuteState = + savedInstanceState.getBoolean(KEY_PREVIOUS_MUTE_STATE, mPreviousMuteState); + super.onRestoreInstanceState(savedInstanceState); + } + public interface CallButtonUi extends Ui { void setEnabled(boolean on); void setMute(boolean on); diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java index 930e069fd..3f9cd9827 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/src/com/android/incallui/InCallActivity.java @@ -182,6 +182,7 @@ public class InCallActivity extends Activity { if (mDialpadFragment != null) { out.putString(DIALPAD_TEXT_EXTRA, mDialpadFragment.getDtmfText()); } + super.onSaveInstanceState(out); } @Override diff --git a/InCallUI/src/com/android/incallui/Presenter.java b/InCallUI/src/com/android/incallui/Presenter.java index d2f2d36f8..4e1fa978d 100644 --- a/InCallUI/src/com/android/incallui/Presenter.java +++ b/InCallUI/src/com/android/incallui/Presenter.java @@ -16,6 +16,8 @@ package com.android.incallui; +import android.os.Bundle; + /** * Base class for Presenters. */ @@ -47,6 +49,10 @@ public abstract class Presenter<U extends Ui> { public void onUiUnready(U ui) { } + public void onSaveInstanceState(Bundle outState) {} + + public void onRestoreInstanceState(Bundle savedInstanceState) {} + public U getUi() { return mUi; } |