diff options
author | erfanian <erfanian@google.com> | 2018-01-23 09:55:59 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-01-23 11:24:51 -0800 |
commit | f2556612e0b4cba2d536191ea8caf155cc434492 (patch) | |
tree | 0088f97503e6464555251a25cefa273397763f63 /java | |
parent | e336450bd3f9375fca3344ac3d5912689477ff85 (diff) |
Update Assisted Dialing references.
Test: existing unit tests
PiperOrigin-RevId: 182949031
Change-Id: I40955c6e5f4fe06687880d3e9ef4b91ef9c0b371
Diffstat (limited to 'java')
3 files changed, 25 insertions, 4 deletions
diff --git a/java/com/android/dialer/assisteddialing/ConcreteCreator.java b/java/com/android/dialer/assisteddialing/ConcreteCreator.java index a3c96dbdc..c1ffbd396 100644 --- a/java/com/android/dialer/assisteddialing/ConcreteCreator.java +++ b/java/com/android/dialer/assisteddialing/ConcreteCreator.java @@ -23,6 +23,7 @@ import android.os.Build.VERSION_CODES; import android.preference.PreferenceManager; import android.support.annotation.NonNull; import android.support.annotation.VisibleForTesting; +import android.support.v4.os.BuildCompat; import android.support.v4.os.UserManagerCompat; import android.telephony.TelephonyManager; import com.android.dialer.common.LogUtil; @@ -102,7 +103,8 @@ public final class ConcreteCreator { } return (Build.VERSION.SDK_INT >= BUILD_CODE_FLOOR - && Build.VERSION.SDK_INT <= BUILD_CODE_CEILING) + && Build.VERSION.SDK_INT <= BUILD_CODE_CEILING + && !BuildCompat.isAtLeastP()) && configProvider.getBoolean("assisted_dialing_enabled", false); } diff --git a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java index 92e256998..86f344f4e 100644 --- a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java +++ b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java @@ -65,8 +65,11 @@ public class TelephonyManagerCompat { public static final String ASSISTED_DIALING_EXTRAS = "android.telecom.extra.ASSISTED_DIALING_EXTRAS"; + public static final String EXTRA_ASSISTED_DIALING_TRANSFORMATION_INFO = + "android.telecom.extra.ASSISTED_DIALING_TRANSFORMATION_INFO"; + /** Indicates the Connection/Call used assisted dialing. */ - public static final int PROPERTY_ASSISTED_DIALING_USED = 0x00000200; + public static final int PROPERTY_ASSISTED_DIALING_USED = 1 << 9; public static final String EXTRA_IS_REFRESH = BuildCompat.isAtLeastOMR1() ? "android.telephony.extra.IS_REFRESH" : "is_refresh"; @@ -75,7 +78,7 @@ public class TelephonyManagerCompat { * Indicates the call underwent Assisted Dialing; typically set as a feature available from the * CallLog. */ - public static final Integer FEATURES_ASSISTED_DIALING = 0x10; + public static final Integer FEATURES_ASSISTED_DIALING = 1 << 4; /** * Returns the number of phones available. Returns 1 for Single standby mode (Single SIM diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java index 27243225b..a30367f7f 100644 --- a/java/com/android/incallui/call/DialerCall.java +++ b/java/com/android/incallui/call/DialerCall.java @@ -1114,7 +1114,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa // perform assisted dialing. PROPERTY_ASSISTED_DIALING_USED indicates assisted dialing took // place. if (hasProperty(TelephonyManagerCompat.PROPERTY_ASSISTED_DIALING_USED) - && Build.VERSION.SDK_INT > ConcreteCreator.BUILD_CODE_CEILING) { + && BuildCompat.isAtLeastP()) { return true; } return false; @@ -1126,10 +1126,26 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa return null; } + if (BuildCompat.isAtLeastP()) { + if (getExtras() == null) { + return null; + } + + if (getExtras() + .getParcelable(TelephonyManagerCompat.EXTRA_ASSISTED_DIALING_TRANSFORMATION_INFO) + == null) { + return null; + } + + // TODO(erfanian): Use the framework transformation info when we can link against it + return null; + } + if (getIntentExtras().getBundle(TelephonyManagerCompat.ASSISTED_DIALING_EXTRAS) == null) { return null; } + // Used in N-OMR1 return TransformationInfo.newInstanceFromBundle( getIntentExtras().getBundle(TelephonyManagerCompat.ASSISTED_DIALING_EXTRAS)); } |