diff options
author | Shareef Ali <shareefalis@cyanogenmod.org> | 2013-06-13 08:56:00 -0500 |
---|---|---|
committer | Shareef Ali <shareefalis@cyanogenmod.org> | 2013-06-13 09:04:41 -0500 |
commit | 5d2cd80f220a8dd429c437e437978bf160c0a983 (patch) | |
tree | 3d6e396a29b0b350fc1f41390bf1107f0e9582d9 /src | |
parent | aee7b8203fae90edbc91ed879ffb6e53bb90b2d2 (diff) | |
download | frameworks_opt_telephony-5d2cd80f220a8dd429c437e437978bf160c0a983.zip frameworks_opt_telephony-5d2cd80f220a8dd429c437e437978bf160c0a983.tar.gz frameworks_opt_telephony-5d2cd80f220a8dd429c437e437978bf160c0a983.tar.bz2 |
SamsungQualcommRIL: support exynos RIL radio states.
* required for m3
* enable it with v3 feature: exynos4RadioState
* remove m3 class
Change-Id: Id34320c59a316e2b6747bd3a48077b863ab772d6
Diffstat (limited to 'src')
-rw-r--r-- | src/java/com/android/internal/telephony/SamsungQualcommM3RIL.java | 94 | ||||
-rw-r--r-- | src/java/com/android/internal/telephony/SamsungQualcommRIL.java | 35 |
2 files changed, 35 insertions, 94 deletions
diff --git a/src/java/com/android/internal/telephony/SamsungQualcommM3RIL.java b/src/java/com/android/internal/telephony/SamsungQualcommM3RIL.java deleted file mode 100644 index cc1483b..0000000 --- a/src/java/com/android/internal/telephony/SamsungQualcommM3RIL.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2013 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 static com.android.internal.telephony.RILConstants.*; - -import android.content.Context; -import android.os.Parcel; -import android.os.SystemProperties; -import android.util.Log; -import com.android.internal.telephony.RILConstants; -import java.util.Collections; -import android.telephony.PhoneNumberUtils; - -import java.util.ArrayList; - -/** - * Custom RIL to handle unique behavior of M3 radio - * - * {@hide} - */ -public class SamsungQualcommM3RIL extends SamsungQualcommRIL implements CommandsInterface { - - public SamsungQualcommM3RIL(Context context, int networkMode, int cdmaSubscription) { - super(context, networkMode, cdmaSubscription); - } - - @Override - protected void - processUnsolicited (Parcel p) { - Object ret; - int dataPosition = p.dataPosition(); - int response = p.readInt(); - - switch (response) { - case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: ret = responseVoid(p); break; - - default: - // Rewind the Parcel - p.setDataPosition(dataPosition); - - // Forward responses that we are not overriding to the super class - super.processUnsolicited(p); - return; - } - - switch (response) { - case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: - /* has bonus radio state int */ - int state = p.readInt(); - Log.d(LOG_TAG, "Radio state: " + state); - - switch (state) { - case 2: - // RADIO_UNAVAILABLE - state = 1; - break; - case 3: - // RADIO_ON - state = 10; - break; - case 4: - // RADIO_ON - state = 10; - // When SIM is PIN-unlocked, RIL doesn't respond with RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED. - // We notify the system here. - Log.d(LOG_TAG, "SIM is PIN-unlocked now"); - if (mIccStatusChangedRegistrants != null) { - mIccStatusChangedRegistrants.notifyRegistrants(); - } - break; - } - RadioState newState = getRadioStateFromInt(state); - Log.d(LOG_TAG, "New Radio state: " + state + " (" + newState.toString() + ")"); - switchToRadioState(newState); - break; - } - } - -} diff --git a/src/java/com/android/internal/telephony/SamsungQualcommRIL.java b/src/java/com/android/internal/telephony/SamsungQualcommRIL.java index ad6f90d..997cf01 100644 --- a/src/java/com/android/internal/telephony/SamsungQualcommRIL.java +++ b/src/java/com/android/internal/telephony/SamsungQualcommRIL.java @@ -62,6 +62,7 @@ public class SamsungQualcommRIL extends RIL implements CommandsInterface { public static final long SEND_SMS_TIMEOUT_IN_MS = 30000; private String homeOperator= SystemProperties.get("ro.cdma.home.operator.numeric"); private String operator= SystemProperties.get("ro.cdma.home.operator.alpha"); + private boolean oldRilState = needsOldRilFeature("exynos4RadioState"); public SamsungQualcommRIL(Context context, int networkMode, int cdmaSubscription) { super(context, networkMode, cdmaSubscription); @@ -185,6 +186,40 @@ public class SamsungQualcommRIL extends RIL implements CommandsInterface { } @Override + protected RadioState getRadioStateFromInt(int stateInt) { + if(!oldRilState) + super.getRadioStateFromInt(stateInt); + RadioState state; + + /* RIL_RadioState ril.h */ + switch(stateInt) { + case 0: state = RadioState.RADIO_OFF; break; + case 1: + case 2: state = RadioState.RADIO_UNAVAILABLE; break; + case 4: + // When SIM is PIN-unlocked, RIL doesn't respond with RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED. + // We notify the system here. + Log.d(LOG_TAG, "SIM is PIN-unlocked now"); + if (mIccStatusChangedRegistrants != null) { + mIccStatusChangedRegistrants.notifyRegistrants(); + } + case 3: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 13: state = RadioState.RADIO_ON; break; + + default: + throw new RuntimeException( + "Unrecognized RIL_RadioState: " + stateInt); + } + return state; + } + + @Override public void setPhoneType(int phoneType){ super.setPhoneType(phoneType); isGSM = (phoneType != RILConstants.CDMA_PHONE); |