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

Commit 5e4d5598 authored by Thomas Nguyen's avatar Thomas Nguyen
Browse files

Add RIL requests and unsol for Satellite HAL

Bug: 260644201
Test: atest VtsHalRadioTargetTest
atest TelephonyManagerTestOnMockModem
MO/MT SMS, MMS, voice calls with live network

Change-Id: I27e1cfe9442786333b694190c123edf762d7db60
parent fc58e326
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -224,6 +224,7 @@ java_library {
        "android.hardware.radio.messaging-V2-java",
        "android.hardware.radio.messaging-V2-java",
        "android.hardware.radio.modem-V2-java",
        "android.hardware.radio.modem-V2-java",
        "android.hardware.radio.network-V2-java",
        "android.hardware.radio.network-V2-java",
        "android.hardware.radio.satellite-V1-java",
        "android.hardware.radio.sim-V2-java",
        "android.hardware.radio.sim-V2-java",
        "android.hardware.radio.voice-V2-java",
        "android.hardware.radio.voice-V2-java",
        "android.hardware.thermal-V1.0-java-constants",
        "android.hardware.thermal-V1.0-java-constants",
+1 −0
Original line number Original line Diff line number Diff line
@@ -2793,6 +2793,7 @@ package android.telephony {
    field public static final int HAL_SERVICE_MESSAGING = 2; // 0x2
    field public static final int HAL_SERVICE_MESSAGING = 2; // 0x2
    field public static final int HAL_SERVICE_MODEM = 3; // 0x3
    field public static final int HAL_SERVICE_MODEM = 3; // 0x3
    field public static final int HAL_SERVICE_NETWORK = 4; // 0x4
    field public static final int HAL_SERVICE_NETWORK = 4; // 0x4
    field public static final int HAL_SERVICE_SATELLITE = 8; // 0x8
    field public static final int HAL_SERVICE_SIM = 5; // 0x5
    field public static final int HAL_SERVICE_SIM = 5; // 0x5
    field public static final int HAL_SERVICE_VOICE = 6; // 0x6
    field public static final int HAL_SERVICE_VOICE = 6; // 0x6
    field public static final android.util.Pair HAL_VERSION_UNKNOWN;
    field public static final android.util.Pair HAL_VERSION_UNKNOWN;
+9 −0
Original line number Original line Diff line number Diff line
@@ -14977,6 +14977,14 @@ public class TelephonyManager {
    @TestApi
    @TestApi
    public static final int HAL_SERVICE_IMS = 7;
    public static final int HAL_SERVICE_IMS = 7;
    /**
     * HAL service type that supports the HAL APIs implementation of IRadioSatellite
     * {@link RadioSatelliteProxy}
     * @hide
     */
    @TestApi
    public static final int HAL_SERVICE_SATELLITE = 8;
    /** @hide */
    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(prefix = {"HAL_SERVICE_"},
    @IntDef(prefix = {"HAL_SERVICE_"},
@@ -14989,6 +14997,7 @@ public class TelephonyManager {
                    HAL_SERVICE_SIM,
                    HAL_SERVICE_SIM,
                    HAL_SERVICE_VOICE,
                    HAL_SERVICE_VOICE,
                    HAL_SERVICE_IMS,
                    HAL_SERVICE_IMS,
                    HAL_SERVICE_SATELLITE
            })
            })
    public @interface HalService {}
    public @interface HalService {}
+144 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2022 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 android.telephony.satellite;

import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;

/**
 * @hide
 */
public final class PointingInfo implements Parcelable {
    /** Satellite azimuth in degrees */
    private float mSatelliteAzimuthDegrees;

    /** Satellite elevation in degrees */
    private float mSatelliteElevationDegrees;

    /** Antenna azimuth in degrees */
    private float mAntennaAzimuthDegrees;

    /**
     * Angle of rotation about the x axis. This value represents the angle between a plane
     * parallel to the device's screen and a plane parallel to the ground.
     */
    private float mAntennaPitchDegrees;

    /**
     * Angle of rotation about the y axis. This value represents the angle between a plane
     * perpendicular to the device's screen and a plane parallel to the ground.
     */
    private float mAntennaRollDegrees;

    /**
     * @hide
     */
    public PointingInfo(float satelliteAzimuthDegress, float satelliteElevationDegress,
            float antennaAzimuthDegrees, float antennaPitchDegrees, float antennaRollDegrees) {
        mSatelliteAzimuthDegrees = satelliteAzimuthDegress;
        mSatelliteElevationDegrees = satelliteElevationDegress;
        mAntennaAzimuthDegrees = antennaAzimuthDegrees;
        mAntennaPitchDegrees = antennaPitchDegrees;
        mAntennaRollDegrees = antennaRollDegrees;
    }

    private PointingInfo(Parcel in) {
        readFromParcel(in);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(@NonNull Parcel out, int flags) {
        out.writeFloat(mSatelliteAzimuthDegrees);
        out.writeFloat(mSatelliteElevationDegrees);
        out.writeFloat(mAntennaAzimuthDegrees);
        out.writeFloat(mAntennaPitchDegrees);
        out.writeFloat(mAntennaRollDegrees);
    }

    public static final @android.annotation.NonNull Creator<PointingInfo> CREATOR =
            new Creator<PointingInfo>() {
                @Override
                public PointingInfo createFromParcel(Parcel in) {
                    return new PointingInfo(in);
                }

                @Override
                public PointingInfo[] newArray(int size) {
                    return new PointingInfo[size];
                }
            };

    @NonNull
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();

        sb.append("SatelliteAzimuthDegrees:");
        sb.append(mSatelliteAzimuthDegrees);
        sb.append(",");

        sb.append("SatelliteElevationDegrees:");
        sb.append(mSatelliteElevationDegrees);
        sb.append(",");

        sb.append("AntennaAzimuthDegrees:");
        sb.append(mAntennaAzimuthDegrees);
        sb.append(",");

        sb.append("AntennaPitchDegrees:");
        sb.append(mAntennaPitchDegrees);
        sb.append(",");

        sb.append("AntennaRollDegrees:");
        sb.append(mAntennaRollDegrees);
        return sb.toString();
    }

    public float getSatelliteAzimuthDegrees() {
        return mSatelliteAzimuthDegrees;
    }

    public float getSatelliteElevationDegrees() {
        return mSatelliteElevationDegrees;
    }

    public float getAntennaAzimuthDegrees() {
        return mAntennaAzimuthDegrees;
    }

    public float getAntennaPitchDegrees() {
        return mAntennaPitchDegrees;
    }

    public float getAntennaRollDegrees() {
        return mAntennaRollDegrees;
    }

    private void readFromParcel(Parcel in) {
        mSatelliteAzimuthDegrees = in.readFloat();
        mSatelliteElevationDegrees = in.readFloat();
        mAntennaAzimuthDegrees = in.readFloat();
        mAntennaPitchDegrees = in.readFloat();
        mAntennaRollDegrees = in.readFloat();
    }
}
+201 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2022 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 android.telephony.satellite;

import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;

import java.util.HashSet;
import java.util.Set;

/**
 * @hide
 */
public final class SatelliteCapabilities implements Parcelable {
    /**
     * List of technologies supported by the satellite modem.
     */
    private Set<Integer> mSupportedRadioTechnologies;

    /**
     * Whether satellite mode is always on (this to indicate power impact of keeping it on is
     * very minimal).
     */
    private boolean mIsAlwaysOn;

    /**
     * Whether UE needs to point to a satellite to send and receive data.
     */
    private boolean mNeedsPointingToSatellite;

    /**
     * List of features supported by the Satellite modem.
     */
    private Set<Integer> mSupportedFeatures;

    /**
     * Whether UE needs a separate SIM profile to communicate with the Satellite network.
     */
    private boolean mNeedsSeparateSimProfile;

    /**
     * @hide
     */
    public SatelliteCapabilities(Set<Integer> supportedRadioTechnologies, boolean isAlwaysOn,
            boolean needsPointingToSatellite, Set<Integer> supportedFeatures,
            boolean needsSeparateSimProfile) {
        mSupportedRadioTechnologies = supportedRadioTechnologies;
        mIsAlwaysOn = isAlwaysOn;
        mNeedsPointingToSatellite = needsPointingToSatellite;
        mSupportedFeatures = supportedFeatures;
        mNeedsSeparateSimProfile = needsSeparateSimProfile;
    }

    private SatelliteCapabilities(Parcel in) {
        readFromParcel(in);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(@NonNull Parcel out, int flags) {
        if (mSupportedRadioTechnologies != null && !mSupportedRadioTechnologies.isEmpty()) {
            out.writeInt(mSupportedRadioTechnologies.size());
            for (int technology : mSupportedRadioTechnologies) {
                out.writeInt(technology);
            }
        } else {
            out.writeInt(0);
        }

        out.writeBoolean(mIsAlwaysOn);
        out.writeBoolean(mNeedsPointingToSatellite);

        if (mSupportedFeatures != null && !mSupportedFeatures.isEmpty()) {
            out.writeInt(mSupportedFeatures.size());
            for (int feature : mSupportedFeatures) {
                out.writeInt(feature);
            }
        } else {
            out.writeInt(0);
        }

        out.writeBoolean(mNeedsSeparateSimProfile);
    }

    public static final @android.annotation.NonNull Creator<SatelliteCapabilities> CREATOR =
            new Creator<SatelliteCapabilities>() {
                @Override
                public SatelliteCapabilities createFromParcel(Parcel in) {
                    return new SatelliteCapabilities(in);
                }

                @Override
                public SatelliteCapabilities[] newArray(int size) {
                    return new SatelliteCapabilities[size];
                }
            };

    @NonNull
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();

        sb.append("SupportedRadioTechnology:");
        if (mSupportedRadioTechnologies != null && !mSupportedRadioTechnologies.isEmpty()) {
            for (int technology : mSupportedRadioTechnologies) {
                sb.append(technology);
                sb.append(",");
            }
        } else {
            sb.append("none,");
        }

        sb.append("SupportedFeatures:");
        if (mSupportedFeatures != null && !mSupportedFeatures.isEmpty()) {
            for (int feature : mSupportedFeatures) {
                sb.append(feature);
                sb.append(",");
            }
        } else {
            sb.append("none,");
        }

        sb.append("isAlwaysOn:");
        sb.append(mIsAlwaysOn);
        sb.append(",");

        sb.append("needsPointingToSatellite:");
        sb.append(mNeedsPointingToSatellite);
        sb.append(",");

        sb.append("needsSeparateSimProfile:");
        sb.append(mNeedsSeparateSimProfile);
        return sb.toString();
    }

    @NonNull
    public Set<Integer> getSupportedRadioTechnologies() {
        return mSupportedRadioTechnologies;
    }

    public boolean isAlwaysOn() {
        return mIsAlwaysOn;
    }

    /** Get function for mNeedsPointingToSatellite */
    public boolean needsPointingToSatellite() {
        return mNeedsPointingToSatellite;
    }

    @NonNull
    public Set<Integer> getSupportedFeatures() {
        return mSupportedFeatures;
    }

    /** Get function for mNeedsSeparateSimProfile */
    public boolean needsSeparateSimProfile() {
        return mNeedsSeparateSimProfile;
    }

    private void readFromParcel(Parcel in) {
        mSupportedRadioTechnologies = new HashSet<>();
        int numSupportedRadioTechnologies = in.readInt();
        if (numSupportedRadioTechnologies > 0) {
            for (int i = 0; i < numSupportedRadioTechnologies; i++) {
                mSupportedRadioTechnologies.add(in.readInt());
            }
        }

        mIsAlwaysOn = in.readBoolean();
        mNeedsPointingToSatellite = in.readBoolean();

        mSupportedFeatures = new HashSet<>();
        int numSupportedFeatures = in.readInt();
        if (numSupportedFeatures > 0) {
            for (int i = 0; i < numSupportedFeatures; i++) {
                mSupportedFeatures.add(in.readInt());
            }
        }

        mNeedsSeparateSimProfile = in.readBoolean();
    }
}
Loading