diff options
author | Stephen Bird <sbird@cyngn.com> | 2016-03-21 20:35:09 -0700 |
---|---|---|
committer | Richard MacGregor <rmacgregor@cyngn.com> | 2016-04-08 10:42:51 -0700 |
commit | b36eab16daecb79a083c0f8d821660766a2494ab (patch) | |
tree | d06434de0d5a3683fb4627bc446c0f8a53ed5d0c /src-ambient | |
parent | 7823a59c3ddae3b733512b564edeeee09b03ae37 (diff) | |
download | packages_apps_PhoneCommon-b36eab16daecb79a083c0f8d821660766a2494ab.tar.gz packages_apps_PhoneCommon-b36eab16daecb79a083c0f8d821660766a2494ab.tar.bz2 packages_apps_PhoneCommon-b36eab16daecb79a083c0f8d821660766a2494ab.zip |
Only clear dialpad on success
Change-Id: I5b3975ff6f6b2ea7194cbc415b3730f03ec7e796
Diffstat (limited to 'src-ambient')
-rw-r--r-- | src-ambient/incall/CallMethodHelper.java | 33 | ||||
-rw-r--r-- | src-ambient/incall/CallMethodInfo.java | 19 |
2 files changed, 39 insertions, 13 deletions
diff --git a/src-ambient/incall/CallMethodHelper.java b/src-ambient/incall/CallMethodHelper.java index 4889980..34ad825 100644 --- a/src-ambient/incall/CallMethodHelper.java +++ b/src-ambient/incall/CallMethodHelper.java @@ -83,8 +83,10 @@ import static com.cyanogen.ambient.incall.util.InCallHelper.NO_COLOR; */ public class CallMethodHelper { - protected static CallMethodHelper sInstance; + protected static final String TAG = CallMethodHelper.class.getSimpleName(); + protected static final boolean DEBUG = false; + protected static CallMethodHelper sInstance; protected AmbientApiClient mClient; protected Context mContext; protected InCallApi mInCallApi; @@ -98,8 +100,7 @@ public class CallMethodHelper { protected static HashMap<String, CallMethodReceiver> mRegisteredClients = new HashMap<>(); protected static boolean dataHasBeenBroadcastPreviously = false; // determine which info types to load - protected static final String TAG = CallMethodHelper.class.getSimpleName(); - protected static final boolean DEBUG = false; + public interface CallMethodReceiver { void onChanged(HashMap<ComponentName, CallMethodInfo> callMethodInfos); @@ -262,13 +263,22 @@ public class CallMethodHelper { return sInstance; } + public interface InCallCallListener { + void onResult(int resultCode); + } + /** * Generic CallResultReceiver with basic error handling * @param cmi * @return */ public static StartInCallCallReceiver getVoIPResultReceiver(final CallMethodInfo cmi, - final String originCode) { + final String originCode) { + return getVoIPResultReceiver(cmi, originCode, null); + } + + public static StartInCallCallReceiver getVoIPResultReceiver(final CallMethodInfo cmi, + final String originCode, final InCallCallListener listener) { StartInCallCallReceiver svcrr = new StartInCallCallReceiver(new Handler(Looper.getMainLooper())); @@ -284,22 +294,19 @@ public class CallMethodHelper { case StatusCodes.StartCall.CALL_FAILURE_TIMEOUT: case StatusCodes.StartCall.CALL_FAILURE_UNAUTHENTICATED: case StatusCodes.StartCall.CALL_FAILURE: - String text = getInstance().mContext.getResources() .getString(R.string.invalid_number_text); text = String.format(text, cmi.mName); Toast.makeText(getInstance().mContext, text, Toast.LENGTH_LONG).show(); break; - case StatusCodes.StartCall.CALL_CONNECTED: - break; - case StatusCodes.StartCall.HANDOVER_CONNECTED: - break; default: Log.i(TAG, "Nothing to do for this Start VoIP Call resultcode = " + resultCode); break; } - + if (listener != null) { + listener.onResult(resultCode); + } } }); @@ -697,6 +704,12 @@ public class CallMethodHelper { Log.d(TAG, "componentName: " + cn.toShortString()); Log.d(TAG, "Event: " + e.toString()); } + if (getInstance() == null || + getInstance().mInCallApi == null || + getInstance().mClient == null) { + // For testing purposes, this might be null + return; + } getInstance().mInCallApi.sendAnalyticsEventToPlugin(getInstance().mClient, cn, e) .setResultCallback(new ResultCallback<Result>() { @Override diff --git a/src-ambient/incall/CallMethodInfo.java b/src-ambient/incall/CallMethodInfo.java index 8c04b14..7d52426 100644 --- a/src-ambient/incall/CallMethodInfo.java +++ b/src-ambient/incall/CallMethodInfo.java @@ -29,6 +29,7 @@ import android.telephony.SubscriptionManager; import android.text.TextUtils; import android.util.Log; import com.android.phone.common.ambient.AmbientConnection; +import com.android.phone.common.incall.CallMethodHelper.InCallCallListener; import com.android.phone.common.R; import com.android.phone.common.util.StartInCallCallReceiver; import com.cyanogen.ambient.incall.InCallServices; @@ -201,17 +202,29 @@ public class CallMethodInfo { } public void placeCall(String origin, String number, Context c, boolean isVideoCall) { - placeCall(origin, number, c, isVideoCall, false, null); + placeCall(origin, number, c, isVideoCall, false, null, null); } public void placeCall(String origin, String number, Context c, boolean isVideoCall, boolean forcePSTN) { - placeCall(origin, number, c, isVideoCall, forcePSTN, null); + placeCall(origin, number, c, isVideoCall, forcePSTN, null, null); + } + + public void placeCall(String origin, String number, Context c, boolean isVideoCall, boolean + forcePSTN, InCallCallListener listener) { + placeCall(origin, number, c, isVideoCall, forcePSTN, null, listener); } public void placeCall(String origin, String number, Context c, boolean isVideoCall, boolean forcePSTN, String numberMimeType) { - StartInCallCallReceiver svcrr = CallMethodHelper.getVoIPResultReceiver(this, origin); + placeCall(origin, number, c, isVideoCall, forcePSTN, numberMimeType, null); + } + + public void placeCall(String origin, String number, Context c, boolean isVideoCall, + boolean forcePSTN, String numberMimeType, InCallCallListener listener) { + + StartInCallCallReceiver svcrr + = CallMethodHelper.getVoIPResultReceiver(this, origin, listener); StartCallRequest request = new StartCallRequest(number, origin, 0, svcrr); if (isVideoCall) { |