Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a212f33d authored by Jack Yu's avatar Jack Yu Committed by Gerrit Code Review
Browse files

Merge "Added a new system properties for IWLAN operation mode"

parents fc26318f 333186fd
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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;

@@ -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;
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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);
@@ -471,6 +473,11 @@ public class GsmCdmaPhone extends Phone {
        return mCT;
    }

    @Override
    public TransportManager getTransportManager() {
        return mTransportManager;
    }

    @Override
    public void updateVoiceMail() {
        if (isPhoneTypeGsm()) {
+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;
    }
}
+9 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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;
@@ -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
     */
+75 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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
@@ -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
@@ -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