Loading src/java/com/android/internal/telephony/CommandsInterface.java +6 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.telephony.TelephonyManager; import android.telephony.data.DataProfile; import com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo; import com.android.internal.telephony.dataconnection.TransportManager; import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo; import com.android.internal.telephony.uicc.IccCardStatus; Loading Loading @@ -2238,7 +2239,11 @@ public interface CommandsInterface { */ void stopNattKeepalive(int sessionHandle, Message result); default public List<ClientRequestStats> getClientRequestStats() { default List<ClientRequestStats> getClientRequestStats() { return null; } default int getIwlanOperationMode() { return TransportManager.IWLAN_OPERATION_MODE_DEFAULT; } } src/java/com/android/internal/telephony/GsmCdmaPhone.java +7 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.cdma.CdmaMmiCode; import com.android.internal.telephony.cdma.CdmaSubscriptionSourceManager; import com.android.internal.telephony.cdma.EriManager; import com.android.internal.telephony.dataconnection.TransportManager; import com.android.internal.telephony.gsm.GsmMmiCode; import com.android.internal.telephony.gsm.SuppServiceNotification; import com.android.internal.telephony.test.SimulatedRadioControl; Loading Loading @@ -223,6 +224,7 @@ public class GsmCdmaPhone extends Phone { // after CarrierActionAgent. mCarrierActionAgent = mTelephonyComponentFactory.makeCarrierActionAgent(this); mCarrierSignalAgent = mTelephonyComponentFactory.makeCarrierSignalAgent(this); mTransportManager = mTelephonyComponentFactory.makeTransportManager(this); mSST = mTelephonyComponentFactory.makeServiceStateTracker(this, this.mCi); // DcTracker uses SST so needs to be created after it is instantiated mDcTracker = mTelephonyComponentFactory.makeDcTracker(this); Loading Loading @@ -471,6 +473,11 @@ public class GsmCdmaPhone extends Phone { return mCT; } @Override public TransportManager getTransportManager() { return mTransportManager; } @Override public void updateVoiceMail() { if (isPhoneTypeGsm()) { Loading src/java/com/android/internal/telephony/HalVersion.java 0 → 100644 +95 −0 Original line number Diff line number Diff line /* * Copyright 2018 The Android Open Source 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 java.util.Objects; /** * Represent the version of underlying vendor HAL service. * @see <a href="https://source.android.com/devices/architecture/hidl/versioning"> * HIDL versioning</a>. */ public class HalVersion implements Comparable<HalVersion> { public final int major; public final int minor; public HalVersion(int major, int minor) { this.major = major; this.minor = minor; } @Override public int compareTo(HalVersion ver) { if (ver == null) { return 1; } if (this.major > ver.major) { return 1; } else if (this.major < ver.major) { return -1; } else if (this.minor > ver.minor) { return 1; } else if (this.minor < ver.minor) { return -1; } return 0; } @Override public int hashCode() { return Objects.hash(major, minor); } @Override public boolean equals(Object o) { return ((o instanceof HalVersion) && (o == this || compareTo((HalVersion) o) == 0)); } /** * @return True if the version is greater than the compared version. */ public boolean greater(HalVersion ver) { return compareTo(ver) > 0; } /** * @return True if the version is less than the compared version. */ public boolean less(HalVersion ver) { return compareTo(ver) < 0; } /** * @return True if the version is greater than or equal to the compared version. */ public boolean greaterOrEqual(HalVersion ver) { return greater(ver) || equals(ver); } /** * @return True if the version is less than or equal to the compared version. */ public boolean lessOrEqual(HalVersion ver) { return less(ver) || equals(ver); } @Override public String toString() { return major + "." + minor; } } src/java/com/android/internal/telephony/Phone.java +9 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ import com.android.internal.R; import com.android.internal.telephony.dataconnection.AccessNetworksManager; import com.android.internal.telephony.dataconnection.DataConnectionReasons; import com.android.internal.telephony.dataconnection.DcTracker; import com.android.internal.telephony.dataconnection.TransportManager; import com.android.internal.telephony.imsphone.ImsPhoneCall; import com.android.internal.telephony.test.SimulatedRadioControl; import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType; Loading Loading @@ -281,6 +282,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { private final String mActionDetached; private final String mActionAttached; protected DeviceStateMonitor mDeviceStateMonitor; protected TransportManager mTransportManager; protected AccessNetworksManager mAccessNetworksManager; protected int mPhoneId; Loading Loading @@ -1632,6 +1634,13 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { return null; } /** * @return The instance of transport manager */ public TransportManager getTransportManager() { return null; } /** * Update voice activation state */ Loading src/java/com/android/internal/telephony/RIL.java +75 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,8 @@ import com.android.internal.telephony.cat.ComprehensionTlv; import com.android.internal.telephony.cat.ComprehensionTlvTag; import com.android.internal.telephony.cdma.CdmaInformationRecords; import com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo; import com.android.internal.telephony.dataconnection.TransportManager; import com.android.internal.telephony.dataconnection.TransportManager.IwlanOperationMode; import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo; import com.android.internal.telephony.metrics.TelephonyMetrics; import com.android.internal.telephony.nano.TelephonyProto.SmsSession; Loading Loading @@ -153,6 +155,19 @@ public class RIL extends BaseCommands implements CommandsInterface { public static final int FOR_ACK_WAKELOCK = 1; private final ClientWakelockTracker mClientWakelockTracker = new ClientWakelockTracker(); private static final HalVersion RADIO_HAL_VERSION_UNKNOWN = new HalVersion(-1, -1); private static final HalVersion RADIO_HAL_VERSION_1_0 = new HalVersion(1, 0); private static final HalVersion RADIO_HAL_VERSION_1_1 = new HalVersion(1, 1); private static final HalVersion RADIO_HAL_VERSION_1_2 = new HalVersion(1, 2); private static final HalVersion RADIO_HAL_VERSION_1_3 = new HalVersion(1, 3); // IRadio version private final HalVersion mHalVersion; //***** Instance Variables final WakeLock mWakeLock; // Wake lock associated with request/response Loading Loading @@ -522,6 +537,11 @@ public class RIL extends BaseCommands implements CommandsInterface { // wakelock stuff is initialized above as callbacks are received on separate binder threads) getRadioProxy(null); getOemHookProxy(null); mHalVersion = getRadioHalVersion(); if (RILJ_LOGD) { riljLog("Radio HAL version: " + mHalVersion); } } @Override Loading Loading @@ -5742,4 +5762,59 @@ public class RIL extends BaseCommands implements CommandsInterface { signalStrength.wcdma.base.signalStrength, signalStrength.wcdma.rscp); } private HalVersion getRadioHalVersion() { if (mHalVersion != null) { return mHalVersion; } IRadio radioProxy10 = getRadioProxy(null); if (radioProxy10 != null) { android.hardware.radio.V1_3.IRadio radioProxy13 = android.hardware.radio.V1_3.IRadio.castFrom(radioProxy10); if (radioProxy13 != null) { return RADIO_HAL_VERSION_1_3; } android.hardware.radio.V1_2.IRadio radioProxy12 = android.hardware.radio.V1_2.IRadio.castFrom(radioProxy10); if (radioProxy12 != null) { return RADIO_HAL_VERSION_1_2; } android.hardware.radio.V1_1.IRadio radioProxy11 = android.hardware.radio.V1_1.IRadio.castFrom(radioProxy10); if (radioProxy11 != null) { return RADIO_HAL_VERSION_1_1; } return RADIO_HAL_VERSION_1_0; } return RADIO_HAL_VERSION_UNKNOWN; } /** * @return The {@link IwlanOperationMode IWLAN operation mode} */ public @IwlanOperationMode int getIwlanOperationMode() { // Get IWLAN operation mode from the system property. If the system property is missing, // use the default mode. int mode = SystemProperties.getInt(TransportManager.SYSTEM_PROPERTIES_IWLAN_OPERATION_MODE, TransportManager.IWLAN_OPERATION_MODE_DEFAULT); // If the operation mode is default, then we use the HAL version to determine it. // On 1.3 or later version of IRadio, it is expected the device to support // IWLAN AP-assisted mode. if (mode == TransportManager.IWLAN_OPERATION_MODE_DEFAULT) { if (getRadioHalVersion().greaterOrEqual(RADIO_HAL_VERSION_1_3)) { return TransportManager.IWLAN_OPERATION_MODE_AP_ASSISTED; } else { return TransportManager.IWLAN_OPERATION_MODE_LEGACY; } } return mode; } } Loading
src/java/com/android/internal/telephony/CommandsInterface.java +6 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.telephony.TelephonyManager; import android.telephony.data.DataProfile; import com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo; import com.android.internal.telephony.dataconnection.TransportManager; import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo; import com.android.internal.telephony.uicc.IccCardStatus; Loading Loading @@ -2238,7 +2239,11 @@ public interface CommandsInterface { */ void stopNattKeepalive(int sessionHandle, Message result); default public List<ClientRequestStats> getClientRequestStats() { default List<ClientRequestStats> getClientRequestStats() { return null; } default int getIwlanOperationMode() { return TransportManager.IWLAN_OPERATION_MODE_DEFAULT; } }
src/java/com/android/internal/telephony/GsmCdmaPhone.java +7 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.cdma.CdmaMmiCode; import com.android.internal.telephony.cdma.CdmaSubscriptionSourceManager; import com.android.internal.telephony.cdma.EriManager; import com.android.internal.telephony.dataconnection.TransportManager; import com.android.internal.telephony.gsm.GsmMmiCode; import com.android.internal.telephony.gsm.SuppServiceNotification; import com.android.internal.telephony.test.SimulatedRadioControl; Loading Loading @@ -223,6 +224,7 @@ public class GsmCdmaPhone extends Phone { // after CarrierActionAgent. mCarrierActionAgent = mTelephonyComponentFactory.makeCarrierActionAgent(this); mCarrierSignalAgent = mTelephonyComponentFactory.makeCarrierSignalAgent(this); mTransportManager = mTelephonyComponentFactory.makeTransportManager(this); mSST = mTelephonyComponentFactory.makeServiceStateTracker(this, this.mCi); // DcTracker uses SST so needs to be created after it is instantiated mDcTracker = mTelephonyComponentFactory.makeDcTracker(this); Loading Loading @@ -471,6 +473,11 @@ public class GsmCdmaPhone extends Phone { return mCT; } @Override public TransportManager getTransportManager() { return mTransportManager; } @Override public void updateVoiceMail() { if (isPhoneTypeGsm()) { Loading
src/java/com/android/internal/telephony/HalVersion.java 0 → 100644 +95 −0 Original line number Diff line number Diff line /* * Copyright 2018 The Android Open Source 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 java.util.Objects; /** * Represent the version of underlying vendor HAL service. * @see <a href="https://source.android.com/devices/architecture/hidl/versioning"> * HIDL versioning</a>. */ public class HalVersion implements Comparable<HalVersion> { public final int major; public final int minor; public HalVersion(int major, int minor) { this.major = major; this.minor = minor; } @Override public int compareTo(HalVersion ver) { if (ver == null) { return 1; } if (this.major > ver.major) { return 1; } else if (this.major < ver.major) { return -1; } else if (this.minor > ver.minor) { return 1; } else if (this.minor < ver.minor) { return -1; } return 0; } @Override public int hashCode() { return Objects.hash(major, minor); } @Override public boolean equals(Object o) { return ((o instanceof HalVersion) && (o == this || compareTo((HalVersion) o) == 0)); } /** * @return True if the version is greater than the compared version. */ public boolean greater(HalVersion ver) { return compareTo(ver) > 0; } /** * @return True if the version is less than the compared version. */ public boolean less(HalVersion ver) { return compareTo(ver) < 0; } /** * @return True if the version is greater than or equal to the compared version. */ public boolean greaterOrEqual(HalVersion ver) { return greater(ver) || equals(ver); } /** * @return True if the version is less than or equal to the compared version. */ public boolean lessOrEqual(HalVersion ver) { return less(ver) || equals(ver); } @Override public String toString() { return major + "." + minor; } }
src/java/com/android/internal/telephony/Phone.java +9 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ import com.android.internal.R; import com.android.internal.telephony.dataconnection.AccessNetworksManager; import com.android.internal.telephony.dataconnection.DataConnectionReasons; import com.android.internal.telephony.dataconnection.DcTracker; import com.android.internal.telephony.dataconnection.TransportManager; import com.android.internal.telephony.imsphone.ImsPhoneCall; import com.android.internal.telephony.test.SimulatedRadioControl; import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType; Loading Loading @@ -281,6 +282,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { private final String mActionDetached; private final String mActionAttached; protected DeviceStateMonitor mDeviceStateMonitor; protected TransportManager mTransportManager; protected AccessNetworksManager mAccessNetworksManager; protected int mPhoneId; Loading Loading @@ -1632,6 +1634,13 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { return null; } /** * @return The instance of transport manager */ public TransportManager getTransportManager() { return null; } /** * Update voice activation state */ Loading
src/java/com/android/internal/telephony/RIL.java +75 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,8 @@ import com.android.internal.telephony.cat.ComprehensionTlv; import com.android.internal.telephony.cat.ComprehensionTlvTag; import com.android.internal.telephony.cdma.CdmaInformationRecords; import com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo; import com.android.internal.telephony.dataconnection.TransportManager; import com.android.internal.telephony.dataconnection.TransportManager.IwlanOperationMode; import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo; import com.android.internal.telephony.metrics.TelephonyMetrics; import com.android.internal.telephony.nano.TelephonyProto.SmsSession; Loading Loading @@ -153,6 +155,19 @@ public class RIL extends BaseCommands implements CommandsInterface { public static final int FOR_ACK_WAKELOCK = 1; private final ClientWakelockTracker mClientWakelockTracker = new ClientWakelockTracker(); private static final HalVersion RADIO_HAL_VERSION_UNKNOWN = new HalVersion(-1, -1); private static final HalVersion RADIO_HAL_VERSION_1_0 = new HalVersion(1, 0); private static final HalVersion RADIO_HAL_VERSION_1_1 = new HalVersion(1, 1); private static final HalVersion RADIO_HAL_VERSION_1_2 = new HalVersion(1, 2); private static final HalVersion RADIO_HAL_VERSION_1_3 = new HalVersion(1, 3); // IRadio version private final HalVersion mHalVersion; //***** Instance Variables final WakeLock mWakeLock; // Wake lock associated with request/response Loading Loading @@ -522,6 +537,11 @@ public class RIL extends BaseCommands implements CommandsInterface { // wakelock stuff is initialized above as callbacks are received on separate binder threads) getRadioProxy(null); getOemHookProxy(null); mHalVersion = getRadioHalVersion(); if (RILJ_LOGD) { riljLog("Radio HAL version: " + mHalVersion); } } @Override Loading Loading @@ -5742,4 +5762,59 @@ public class RIL extends BaseCommands implements CommandsInterface { signalStrength.wcdma.base.signalStrength, signalStrength.wcdma.rscp); } private HalVersion getRadioHalVersion() { if (mHalVersion != null) { return mHalVersion; } IRadio radioProxy10 = getRadioProxy(null); if (radioProxy10 != null) { android.hardware.radio.V1_3.IRadio radioProxy13 = android.hardware.radio.V1_3.IRadio.castFrom(radioProxy10); if (radioProxy13 != null) { return RADIO_HAL_VERSION_1_3; } android.hardware.radio.V1_2.IRadio radioProxy12 = android.hardware.radio.V1_2.IRadio.castFrom(radioProxy10); if (radioProxy12 != null) { return RADIO_HAL_VERSION_1_2; } android.hardware.radio.V1_1.IRadio radioProxy11 = android.hardware.radio.V1_1.IRadio.castFrom(radioProxy10); if (radioProxy11 != null) { return RADIO_HAL_VERSION_1_1; } return RADIO_HAL_VERSION_1_0; } return RADIO_HAL_VERSION_UNKNOWN; } /** * @return The {@link IwlanOperationMode IWLAN operation mode} */ public @IwlanOperationMode int getIwlanOperationMode() { // Get IWLAN operation mode from the system property. If the system property is missing, // use the default mode. int mode = SystemProperties.getInt(TransportManager.SYSTEM_PROPERTIES_IWLAN_OPERATION_MODE, TransportManager.IWLAN_OPERATION_MODE_DEFAULT); // If the operation mode is default, then we use the HAL version to determine it. // On 1.3 or later version of IRadio, it is expected the device to support // IWLAN AP-assisted mode. if (mode == TransportManager.IWLAN_OPERATION_MODE_DEFAULT) { if (getRadioHalVersion().greaterOrEqual(RADIO_HAL_VERSION_1_3)) { return TransportManager.IWLAN_OPERATION_MODE_AP_ASSISTED; } else { return TransportManager.IWLAN_OPERATION_MODE_LEGACY; } } return mode; } }