diff options
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; } } |