diff options
Diffstat (limited to 'InCallUI')
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallServiceImpl.java | 2 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/TelecommAdapter.java | 29 |
2 files changed, 30 insertions, 1 deletions
diff --git a/InCallUI/src/com/android/incallui/InCallServiceImpl.java b/InCallUI/src/com/android/incallui/InCallServiceImpl.java index 1829e9306..f98d7f1df 100644 --- a/InCallUI/src/com/android/incallui/InCallServiceImpl.java +++ b/InCallUI/src/com/android/incallui/InCallServiceImpl.java @@ -42,6 +42,7 @@ public class InCallServiceImpl extends InCallService { InCallPresenter inCallPresenter = InCallPresenter.getInstance(); inCallPresenter.setUp( getApplicationContext(), CallList.getInstance(), AudioModeProvider.getInstance()); + TelecommAdapter.getInstance().setContext(this); } /** {@inheritDoc} */ @@ -49,6 +50,7 @@ public class InCallServiceImpl extends InCallService { Log.v(this, "onDestroy"); // Tear down the InCall system TelecommAdapter.getInstance().setAdapter(null); + TelecommAdapter.getInstance().setContext(null); CallList.getInstance().clearOnDisconnect(); InCallPresenter.getInstance().tearDown(); } diff --git a/InCallUI/src/com/android/incallui/TelecommAdapter.java b/InCallUI/src/com/android/incallui/TelecommAdapter.java index f1dd50b80..4b0aff3cb 100644 --- a/InCallUI/src/com/android/incallui/TelecommAdapter.java +++ b/InCallUI/src/com/android/incallui/TelecommAdapter.java @@ -16,6 +16,9 @@ package com.android.incallui; +import android.content.ActivityNotFoundException; +import android.content.Context; +import android.content.Intent; import android.os.Looper; import android.telecomm.InCallAdapter; @@ -23,7 +26,10 @@ import com.google.common.base.Preconditions; /** Wrapper around {@link InCallAdapter} that only forwards calls to the adapter when it's valid. */ final class TelecommAdapter { + private static final String ADD_CALL_MODE_KEY = "add_call_mode"; + private static TelecommAdapter sInstance; + private Context mContext; private InCallAdapter mAdapter; static TelecommAdapter getInstance() { @@ -37,6 +43,10 @@ final class TelecommAdapter { private TelecommAdapter() { } + void setContext(Context context) { + mContext = context; + } + void setAdapter(InCallAdapter adapter) { mAdapter = adapter; } @@ -119,7 +129,24 @@ final class TelecommAdapter { } void addCall() { - Log.wtf(this, "addCall not implemented"); + if (mContext != null) { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + + // when we request the dialer come up, we also want to inform + // it that we're going through the "add call" option from the + // InCallScreen / PhoneUtils. + intent.putExtra(ADD_CALL_MODE_KEY, true); + try { + Log.d(this, "Sending the add Call intent"); + mContext.startActivity(intent); + } catch (ActivityNotFoundException e) { + // This is rather rare but possible. + // Note: this method is used even when the phone is encrypted. At that moment + // the system may not find any Activity which can accept this Intent. + Log.e(this, "Activity for adding calls isn't found.", e); + } + } } void playDtmfTone(String callId, char digit) { |