From 988044789fb70eca91c6a6e1f2526131f376b751 Mon Sep 17 00:00:00 2001 From: erfanian Date: Wed, 24 Jan 2018 13:47:08 -0800 Subject: Link to the correct Assisted Dialing settings depending on platform version. Bug: 72162646 Test: unit tests PiperOrigin-RevId: 183134859 Change-Id: I73d3349f0ff33188cfe0a121b7737a57155683c7 --- java/com/android/dialer/calldetails/CallDetailsActivity.java | 12 ++++++++++-- .../dialer/compat/telephony/TelephonyManagerCompat.java | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/java/com/android/dialer/calldetails/CallDetailsActivity.java b/java/com/android/dialer/calldetails/CallDetailsActivity.java index b15dc456d..bf978ecf3 100644 --- a/java/com/android/dialer/calldetails/CallDetailsActivity.java +++ b/java/com/android/dialer/calldetails/CallDetailsActivity.java @@ -32,6 +32,7 @@ import android.provider.CallLog.Calls; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.RequiresPermission; +import android.support.v4.os.BuildCompat; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; @@ -52,6 +53,7 @@ import com.android.dialer.common.concurrent.DialerExecutor.FailureListener; import com.android.dialer.common.concurrent.DialerExecutor.SuccessListener; import com.android.dialer.common.concurrent.DialerExecutor.Worker; import com.android.dialer.common.concurrent.DialerExecutorComponent; +import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.constants.ActivityRequestCodes; import com.android.dialer.dialercontact.DialerContact; import com.android.dialer.duo.Duo; @@ -407,8 +409,14 @@ public class CallDetailsActivity extends AppCompatActivity { @Override public void openAssistedDialingSettings(View unused) { - Intent intent = new Intent(getActivity(), AssistedDialingSettingActivity.class); - getActivity().startActivity(intent); + if (BuildCompat.isAtLeastP()) { + Intent callSettingsIntent = + new Intent(TelephonyManagerCompat.ACTION_SHOW_ASSISTED_DIALING_SETTINGS); + getActivity().startActivity(callSettingsIntent); + } else { + Intent intent = new Intent(getActivity(), AssistedDialingSettingActivity.class); + getActivity().startActivity(intent); + } } @Override diff --git a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java index 86f344f4e..669cba7a9 100644 --- a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java +++ b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java @@ -80,6 +80,10 @@ public class TelephonyManagerCompat { */ public static final Integer FEATURES_ASSISTED_DIALING = 1 << 4; + /** The {@link android.content.Intent} action used to show the assisted dialing settings. */ + public static final String ACTION_SHOW_ASSISTED_DIALING_SETTINGS = + "android.telecom.action.SHOW_ASSISTED_DIALING_SETTINGS"; + /** * Returns the number of phones available. Returns 1 for Single standby mode (Single SIM * functionality) Returns 2 for Dual standby mode.(Dual SIM functionality) -- cgit v1.2.3