diff options
author | uabdullah <uabdullah@google.com> | 2017-06-22 18:54:58 -0700 |
---|---|---|
committer | Usman Abdullah <uabdullah@google.com> | 2017-06-23 13:22:34 -0700 |
commit | 8bcbd17f62d253490e479c342e51ff604480dbe3 (patch) | |
tree | d8287e7fd01bf1e070db50b95fd0c07682180441 /java | |
parent | 7038614cbe2dc19407bb0e573d3ca54c41fbd097 (diff) |
OMTP client type null improvement - cp aosp/319963 into Dialer
Replace the null "client type" value by a more detailed value in the MO SMS.
Create a client type value based on :
- Manufacturer name
- Model name
- Android os version
Test: OmtpConstantsTest.java
Original author:
http://aosp/319963 - Alexis MARCOU <alexis.marcou@orange.com>
PiperOrigin-RevId: 159906976
Change-Id: If759f7c96c9fb9a3895f8d944c842c350b8d2472
Diffstat (limited to 'java')
-rw-r--r-- | java/com/android/voicemail/impl/OmtpConstants.java | 37 | ||||
-rw-r--r-- | java/com/android/voicemail/impl/protocol/OmtpProtocol.java | 2 |
2 files changed, 36 insertions, 3 deletions
diff --git a/java/com/android/voicemail/impl/OmtpConstants.java b/java/com/android/voicemail/impl/OmtpConstants.java index 599d0d5f0..97da2a8e3 100644 --- a/java/com/android/voicemail/impl/OmtpConstants.java +++ b/java/com/android/voicemail/impl/OmtpConstants.java @@ -234,6 +234,39 @@ public class OmtpConstants { public static final int CHANGE_PIN_INVALID_CHARACTER = 5; public static final int CHANGE_PIN_SYSTEM_ERROR = 6; - /** Indicates the client is Google visual voicemail version 1.0. */ - public static final String CLIENT_TYPE_GOOGLE_10 = "google.vvm.10"; + public static String getClientType() { + String manufacturer = + truncate( + android.os.Build.MANUFACTURER + .replace('=', '_') + .replace(';', '_') + .replace('.', '_') + .replace(' ', '_'), + 12); + + String version = + truncate( + android.os.Build.VERSION + .RELEASE + .replace('=', '_') + .replace(';', '_') + .replace('.', '_') + .replace(' ', '_'), + 8); + + String model = + truncate( + android.os.Build.MODEL + .replace('=', '_') + .replace(';', '_') + .replace('.', '_') + .replace(' ', '_'), + 28 - manufacturer.length() - version.length()); + + return String.format("%s.%s.%s", manufacturer, model, version); + } + + private static final String truncate(String string, int length) { + return string.substring(0, Math.min(length, string.length())); + } } diff --git a/java/com/android/voicemail/impl/protocol/OmtpProtocol.java b/java/com/android/voicemail/impl/protocol/OmtpProtocol.java index 27aab8a7c..971edcf4f 100644 --- a/java/com/android/voicemail/impl/protocol/OmtpProtocol.java +++ b/java/com/android/voicemail/impl/protocol/OmtpProtocol.java @@ -35,7 +35,7 @@ public class OmtpProtocol extends VisualVoicemailProtocol { phoneAccountHandle, applicationPort, destinationNumber, - OmtpConstants.CLIENT_TYPE_GOOGLE_10, + OmtpConstants.getClientType(), OmtpConstants.PROTOCOL_VERSION1_1, null /*clientPrefix*/); } |