From 7d2bb077b3f8fbe26bfc623975e6bd6d2ce3188b Mon Sep 17 00:00:00 2001 From: Danny Baumann Date: Wed, 1 Feb 2012 09:54:43 +0100 Subject: Add Motorola Wrigley 3G RIL. The RIL of those devices signals incoming forwarded calls incorrectly. Instead of sending a supplementary service notification with type = MT and code2 = 0, it sends code2 = 10. This RIL class works around that. Change-Id: I8654663daab084c486fe787e50b9dde01e67895f --- .../internal/telephony/MotoWrigley3GRIL.java | 69 ++++++++++++++++++++++ .../android/internal/telephony/PhoneFactory.java | 3 + 2 files changed, 72 insertions(+) create mode 100644 telephony/java/com/android/internal/telephony/MotoWrigley3GRIL.java diff --git a/telephony/java/com/android/internal/telephony/MotoWrigley3GRIL.java b/telephony/java/com/android/internal/telephony/MotoWrigley3GRIL.java new file mode 100644 index 0000000..2bf724a --- /dev/null +++ b/telephony/java/com/android/internal/telephony/MotoWrigley3GRIL.java @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2012 The CyanogenMod Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.telephony; + +import android.content.Context; +import android.os.Parcel; +import android.util.Log; + +import com.android.internal.telephony.gsm.NetworkInfo; +import com.android.internal.telephony.gsm.SuppServiceNotification; + +import java.util.ArrayList; + +/** + * RIL class for Motorola Wrigley 3G RILs which need + * supplementary service notification post-processing + * + * {@hide} + */ +public class MotoWrigley3GRIL extends RIL { + public MotoWrigley3GRIL(Context context) { + super(context); + } + + public MotoWrigley3GRIL(Context context, int networkMode, int cdmaSubscription) { + super(context, networkMode, cdmaSubscription); + } + + @Override + protected Object + responseSuppServiceNotification(Parcel p) { + SuppServiceNotification notification = new SuppServiceNotification(); + + notification.notificationType = p.readInt(); + notification.code = p.readInt(); + notification.index = p.readInt(); + notification.type = p.readInt(); + notification.number = p.readString(); + + /** + * Moto's RIL seems to confuse code2 0 ('forwarded call') and + * 10 ('additional incoming call forwarded') and sends 10 when an + * incoming call is forwarded and _no_ call is currently active. + * It never sends 10 where it would be appropriate, so it's safe + * to just convert every occurence of 10 to 0. + */ + if (notification.notificationType == SuppServiceNotification.NOTIFICATION_TYPE_MT) { + if (notification.code == SuppServiceNotification.MT_CODE_ADDITIONAL_CALL_FORWARDED) { + notification.code = SuppServiceNotification.MT_CODE_FORWARDED_CALL; + } + } + + return notification; + } +} diff --git a/telephony/java/com/android/internal/telephony/PhoneFactory.java b/telephony/java/com/android/internal/telephony/PhoneFactory.java index 80e15d0..72c1aed 100644 --- a/telephony/java/com/android/internal/telephony/PhoneFactory.java +++ b/telephony/java/com/android/internal/telephony/PhoneFactory.java @@ -131,6 +131,9 @@ public class PhoneFactory { } else if ("mototegra".equals(sRILClassname)) { Log.i(LOG_TAG, "Using Motorola Tegra2 RIL"); sCommandsInterface = new MotoTegraRIL(context, networkMode, cdmaSubscription); + } else if ("motow3g".equals(sRILClassname)) { + Log.i(LOG_TAG, "Using Motorola Wrigley 3G RIL"); + sCommandsInterface = new MotoWrigley3GRIL(context, networkMode, cdmaSubscription); } else { sCommandsInterface = new RIL(context, networkMode, cdmaSubscription); } -- cgit v1.1