diff options
author | Steve Kondik <steve@cyngn.com> | 2015-03-24 23:42:47 -0700 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-03-25 03:23:25 -0700 |
commit | bce297e9385c691a257961538c00d02196910027 (patch) | |
tree | 63fc1e840c6f43aeb38363c86e7b23d9a9257df8 /src/com/android/incallui/InCallActivity.java | |
parent | 11f663cbbb40200d5171171e2c777a6a31859edc (diff) | |
parent | d27ad14ef320762f4303b0794d2ae0f339f76d2d (diff) | |
download | packages_apps_InCallUI-bce297e9385c691a257961538c00d02196910027.tar.gz packages_apps_InCallUI-bce297e9385c691a257961538c00d02196910027.tar.bz2 packages_apps_InCallUI-bce297e9385c691a257961538c00d02196910027.zip |
Merge branch 'lollipop-mr1-release' of https://android.googlesource.com/platform/packages/apps/InCallUI into cm-12.1staging/cm-12.1-test
Change-Id: I7d550c092380b050f7cbc714006bc4ed94b08a56
Diffstat (limited to 'src/com/android/incallui/InCallActivity.java')
-rw-r--r-- | src/com/android/incallui/InCallActivity.java | 107 |
1 files changed, 67 insertions, 40 deletions
diff --git a/src/com/android/incallui/InCallActivity.java b/src/com/android/incallui/InCallActivity.java index c37d8080..fc70f6c5 100644 --- a/src/com/android/incallui/InCallActivity.java +++ b/src/com/android/incallui/InCallActivity.java @@ -34,12 +34,13 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.res.Configuration; import android.content.res.TypedArray; +import android.content.res.Resources; import android.graphics.Point; import android.net.Uri; import android.os.Bundle; import android.telecom.DisconnectCause; -import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; +import android.telecom.TelecomManager; import android.telephony.PhoneNumberUtils; import android.telephony.TelephonyManager; import android.text.TextUtils; @@ -57,6 +58,10 @@ import android.widget.TextView; import com.android.phone.common.animation.AnimUtils; import com.android.phone.common.animation.AnimationListenerAdapter; import com.android.contacts.common.interactions.TouchPointManager; +import com.android.contacts.common.util.MaterialColorMapUtils; +import com.android.contacts.common.util.MaterialColorMapUtils.MaterialPalette; +import com.android.contacts.common.widget.SelectPhoneAccountDialogFragment; +import com.android.contacts.common.widget.SelectPhoneAccountDialogFragment.SelectPhoneAccountListener; import com.android.incallui.Call.State; import java.util.ArrayList; @@ -70,11 +75,12 @@ public class InCallActivity extends Activity { public static final String SHOW_DIALPAD_EXTRA = "InCallActivity.show_dialpad"; public static final String DIALPAD_TEXT_EXTRA = "InCallActivity.dialpad_text"; - public static final String NEW_OUTGOING_CALL = "InCallActivity.new_outgoing_call"; private static final String ACTION_SUPP_SERVICE_FAILURE = "org.codeaurora.ACTION_SUPP_SERVICE_FAILURE"; private static final String EXTRA_RESULT = "result"; + public static final String NEW_OUTGOING_CALL_EXTRA = "InCallActivity.new_outgoing_call"; + public static final String SHOW_CIRCULAR_REVEAL_EXTRA = "InCallActivity.show_circular_reveal"; private CallButtonFragment mCallButtonFragment; private CallCardFragment mCallCardFragment; @@ -110,6 +116,7 @@ public class InCallActivity extends Activity { private Tab[] mDsdaTab = new Tab[TAB_COUNT_TWO]; private boolean[] mDsdaTabAdd = {false, false}; + private boolean mDismissKeyguard = false; AnimationListenerAdapter mSlideOutListener = new AnimationListenerAdapter() { @Override @@ -216,6 +223,7 @@ public class InCallActivity extends Activity { if (mDialpadFragment != null) { out.putString(DIALPAD_TEXT_EXTRA, mDialpadFragment.getDtmfText()); } + super.onSaveInstanceState(out); } @Override @@ -238,6 +246,8 @@ public class InCallActivity extends Activity { super.onResume(); mIsForegroundActivity = true; + + InCallPresenter.getInstance().setThemeColors(); InCallPresenter.getInstance().onUiShowing(true); if (mShowDialpadRequested) { @@ -271,6 +281,9 @@ public class InCallActivity extends Activity { } InCallPresenter.getInstance().onUiShowing(false); + if (isFinishing()) { + InCallPresenter.getInstance().unsetActivity(this); + } } @Override @@ -285,10 +298,7 @@ public class InCallActivity extends Activity { @Override protected void onDestroy() { Log.d(this, "onDestroy()... this = " + this); - - InCallPresenter.getInstance().updateIsChangingConfigurations(); - InCallPresenter.getInstance().setActivity(null); - unregisterReceiver(mReceiver); + InCallPresenter.getInstance().unsetActivity(this); super.onDestroy(); } @@ -351,12 +361,12 @@ public class InCallActivity extends Activity { @Override public void onBackPressed() { - Log.d(this, "onBackPressed()..."); + Log.i(this, "onBackPressed"); // BACK is also used to exit out of any "special modes" of the // in-call UI: - if (!mCallCardFragment.isVisible()) { + if (!mConferenceManagerFragment.isVisible() && !mCallCardFragment.isVisible()) { return; } @@ -365,7 +375,7 @@ public class InCallActivity extends Activity { mCallButtonFragment.getPresenter().showDialpadClicked(false); return; } else if (mConferenceManagerFragment.isVisible()) { - mConferenceManagerFragment.setVisible(false); + showConferenceCallManager(false); return; } @@ -531,8 +541,8 @@ public class InCallActivity extends Activity { relaunchedFromDialer(showDialpad); } - if (intent.getBooleanExtra(NEW_OUTGOING_CALL, false)) { - intent.removeExtra(NEW_OUTGOING_CALL); + if (intent.getBooleanExtra(NEW_OUTGOING_CALL_EXTRA, false)) { + intent.removeExtra(NEW_OUTGOING_CALL_EXTRA); Call call = CallList.getInstance().getOutgoingCall(); if (call == null) { call = CallList.getInstance().getPendingOutgoingCall(); @@ -547,7 +557,6 @@ public class InCallActivity extends Activity { extras = new Bundle(); } - Point touchPoint = null; if (TouchPointManager.getInstance().hasValidPoint()) { // Use the most immediate touch point in the InCallUi if available @@ -558,23 +567,21 @@ public class InCallActivity extends Activity { touchPoint = (Point) extras.getParcelable(TouchPointManager.TOUCH_POINT); } } - mCallCardFragment.animateForNewOutgoingCall(touchPoint); - - /* - * If both a phone account handle and a list of phone accounts to choose from are - * missing, then disconnect the call because there is no way to place an outgoing - * call. - * The exception is emergency calls, which may be waiting for the ConnectionService - * to set the PhoneAccount during the PENDING_OUTGOING state. - */ - if (call != null && !isEmergencyCall(call)) { - final List<PhoneAccountHandle> phoneAccountHandles = extras - .getParcelableArrayList(android.telecom.Call.AVAILABLE_PHONE_ACCOUNTS); - if (call.getAccountHandle() == null && - (phoneAccountHandles == null || phoneAccountHandles.isEmpty())) { - TelecomAdapter.getInstance().disconnectCall(call.getId()); - } + + // This is only true in the case where an outgoing call is initiated by tapping + // on the "Select account dialog", in which case we skip the initial animation. In + // most other cases the circular reveal is done by OutgoingCallAnimationActivity. + final boolean showCircularReveal = + intent.getBooleanExtra(SHOW_CIRCULAR_REVEAL_EXTRA, false); + mCallCardFragment.animateForNewOutgoingCall(touchPoint, showCircularReveal); + + // InCallActivity is responsible for disconnecting a new outgoing call if there + // is no way of making it (i.e. no valid call capable accounts) + if (InCallPresenter.isCallWithNoValidAccounts(call)) { + TelecomAdapter.getInstance().disconnectCall(call.getId()); } + + dismissKeyguard(true); } Call pendingAccountSelectionCall = CallList.getInstance().getWaitingForAccountCall(); @@ -591,8 +598,22 @@ public class InCallActivity extends Activity { phoneAccountHandles = new ArrayList<>(); } + SelectPhoneAccountListener listener = new SelectPhoneAccountListener() { + @Override + public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle, + boolean setDefault) { + InCallPresenter.getInstance().handleAccountSelection(selectedAccountHandle, + setDefault); + } + @Override + public void onDialogDismissed() { + InCallPresenter.getInstance().cancelAccountSelection(); + } + }; + SelectPhoneAccountDialogFragment.showAccountDialog(getFragmentManager(), - phoneAccountHandles); + R.string.select_phone_account_for_calls, true, phoneAccountHandles, + listener); } else { mCallCardFragment.setVisible(true); } @@ -601,14 +622,6 @@ public class InCallActivity extends Activity { } } - private boolean isEmergencyCall(Call call) { - final Uri handle = call.getHandle(); - if (handle == null) { - return false; - } - return PhoneNumberUtils.isEmergencyNumber(handle.getSchemeSpecificPart()); - } - private void relaunchedFromDialer(boolean showDialpad) { mShowDialpadRequested = showDialpad; mAnimateDialpadOnShow = true; @@ -662,6 +675,10 @@ public class InCallActivity extends Activity { } public void dismissKeyguard(boolean dismiss) { + if (mDismissKeyguard == dismiss) { + return; + } + mDismissKeyguard = dismiss; if (dismiss) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); } else { @@ -716,8 +733,18 @@ public class InCallActivity extends Activity { return mDialpadFragment != null && mDialpadFragment.isVisible(); } - public void showConferenceCallManager() { - mConferenceManagerFragment.setVisible(true); + /** + * Hides or shows the conference manager fragment. + * + * @param show {@code true} if the conference manager should be shown, {@code false} if it + * should be hidden. + */ + public void showConferenceCallManager(boolean show) { + mConferenceManagerFragment.setVisible(show); + + // Need to hide the call card fragment to ensure that accessibility service does not try to + // give focus to the call card when the conference manager is visible. + mCallCardFragment.getView().setVisibility(show ? View.GONE : View.VISIBLE); } public void showPostCharWaitDialog(String callId, String chars) { @@ -838,7 +865,7 @@ public class InCallActivity extends Activity { mDialog = new AlertDialog.Builder(this) .setMessage(msg) - .setPositiveButton(R.string.ok, new OnClickListener() { + .setPositiveButton(android.R.string.ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { onDialogDismissed(); |