diff options
author | Evan Charlton <evanc@google.com> | 2014-09-11 17:44:24 -0700 |
---|---|---|
committer | Evan Charlton <evanc@google.com> | 2014-09-11 17:44:24 -0700 |
commit | f925b504266f80ec0b74212c403475f5cc790ab0 (patch) | |
tree | 78728f0ea484854c0d7b7b49ba04e84ba5a45a2d /InCallUI | |
parent | dbd311a0364490c2cd72bc9fde09196351749707 (diff) |
Send a broadcast on call state button touch
When the call state button is touched, send an OEM-provided Intent
so that OEMs can customize this behavior if they choose to.
Bug: 16988478
Change-Id: Icf5a53fd6a4ad1493cba707df4e8e2468bd7eb96
Diffstat (limited to 'InCallUI')
3 files changed, 27 insertions, 3 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index fc5c79bd6..b6ee22cec 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -70,6 +70,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr private TextView mPhoneNumber; private TextView mNumberLabel; private TextView mPrimaryName; + private View mCallStateButton; private ImageView mCallStateIcon; private ImageView mCallStateVideoCallIcon; private TextView mCallStateLabel; @@ -219,6 +220,14 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr } }); + mCallStateButton = view.findViewById(R.id.callStateButton); + mCallStateButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + getPresenter().onCallStateButtonTouched(); + } + }); + mManageConferenceCallButton = view.findViewById(R.id.manage_conference_call_button); mManageConferenceCallButton.setOnClickListener(new View.OnClickListener() { @Override diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java index 36a6b31d2..29ce8fc72 100644 --- a/InCallUI/src/com/android/incallui/CallCardPresenter.java +++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java @@ -16,7 +16,9 @@ package com.android.incallui; +import android.Manifest; import android.content.Context; +import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; @@ -42,6 +44,7 @@ import com.android.incallui.InCallPresenter.InCallEventListener; import com.android.incallui.InCallPresenter.InCallState; import com.android.incallui.InCallPresenter.InCallStateListener; import com.android.incallui.InCallPresenter.IncomingCallListener; +import com.android.incalluibind.ObjectFactory; import java.lang.ref.WeakReference; @@ -349,6 +352,14 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> } } + public void onCallStateButtonTouched() { + Intent broadcastIntent = ObjectFactory.getCallStateButtonBroadcastIntent(); + if (broadcastIntent != null) { + Log.d(this, "Sending call state button broadcast: ", broadcastIntent); + mContext.sendBroadcast(broadcastIntent, Manifest.permission.READ_PHONE_STATE); + } + } + private void maybeStartSearch(Call call, boolean isPrimary) { // no need to start search for conference calls which show generic info. if (call != null && !call.isConferenceCall()) { diff --git a/InCallUI/src/com/android/incalluibind/ObjectFactory.java b/InCallUI/src/com/android/incalluibind/ObjectFactory.java index 5813ce9e6..c64e98efb 100644 --- a/InCallUI/src/com/android/incalluibind/ObjectFactory.java +++ b/InCallUI/src/com/android/incalluibind/ObjectFactory.java @@ -21,7 +21,11 @@ import android.content.Intent; public class ObjectFactory { /** @return An {@link Intent} to be broadcast when the InCallUI is visible. */ - public static Intent getUiReadyBroadcastIntent() { - return null; - } + public static Intent getUiReadyBroadcastIntent() { return null; } + + /** + * @return An {@link Intent} to be broadcast when the call state button in the InCallUI is + * touched while in a call. + */ + public static Intent getCallStateButtonBroadcastIntent() { return null; } } |