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

Commit 0e4cf9e8 authored by Youngtae Cha's avatar Youngtae Cha Committed by Android (Google) Code Review
Browse files

Merge "Apply telephony_config_json_parser for satellite accesss control" into main

parents c1ab6920 1dfdc0a5
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -466,6 +466,11 @@
    <integer name="config_satellite_location_query_throttle_interval_minutes">10</integer>
    <java-symbol type="integer" name="config_satellite_location_query_throttle_interval_minutes" />

    <!-- The file contains satellite access configuration like supported frequencies, bands,
    satellite positions, and so on -->
    <string name="satellite_access_config_file" translatable="false"></string>
    <java-symbol type="string" name="satellite_access_config_file" />

    <!-- Boolean indicating whether to enable MT SMS polling for NB IOT NTN. -->
    <bool name="config_enabled_mt_sms_polling">true</bool>
    <java-symbol type="bool" name="config_enabled_mt_sms_polling" />
+19 −3
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ import android.os.Parcelable;

import com.android.internal.telephony.flags.Flags;

import java.util.Objects;

/**
 * EARFCN (E-UTRA Absolute Radio Frequency Channel Number):  A number that identifies a
 * specific frequency channel in LTE/5G NR, used to define the carrier frequency.
@@ -73,10 +75,10 @@ public final class EarfcnRange implements Parcelable {
     * @param startEarfcn The starting earfcn value.
     * @param endEarfcn   The ending earfcn value.
     */
    public EarfcnRange(@IntRange(from = 0, to = 65535) int endEarfcn,
            @IntRange(from = 0, to = 65535) int startEarfcn) {
        mEndEarfcn = endEarfcn;
    public EarfcnRange(@IntRange(from = 0, to = 65535) int startEarfcn,
            @IntRange(from = 0, to = 65535) int endEarfcn) {
        mStartEarfcn = startEarfcn;
        mEndEarfcn = endEarfcn;
    }

    @Override
@@ -85,6 +87,7 @@ public final class EarfcnRange implements Parcelable {
    }

    @Override
    @NonNull
    public String toString() {
        return "startEarfcn: " + mStartEarfcn + ", " + "endEarfcn: " + mEndEarfcn;
    }
@@ -121,4 +124,17 @@ public final class EarfcnRange implements Parcelable {
    public @IntRange(from = 0, to = 65535) int getEndEarfcn() {
        return mEndEarfcn;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof EarfcnRange that)) return false;

        return (that.mStartEarfcn == mStartEarfcn) && (that.mEndEarfcn == mEndEarfcn);
    }

    @Override
    public int hashCode() {
        return Objects.hash(mStartEarfcn, mEndEarfcn);
    }
}
+38 −14
Original line number Diff line number Diff line
@@ -24,7 +24,9 @@ import androidx.annotation.NonNull;

import com.android.internal.telephony.flags.Flags;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * SatelliteAccessConfiguration is used to store satellite access configuration
@@ -44,25 +46,25 @@ public final class SatelliteAccessConfiguration implements Parcelable {
     * The list of tag IDs associated with the current location
     */
    @NonNull
    private int[] mTagIds;
    private List<Integer> mTagIdList;

    /**
     * Constructor for {@link SatelliteAccessConfiguration}.
     *
     * @param satelliteInfos The list of {@link SatelliteInfo} objects representing the satellites
     *                       accessible with this configuration.
     * @param tagIds         The list of tag IDs associated with this configuration.
     * @param tagIdList      The list of tag IDs associated with this configuration.
     */
    public SatelliteAccessConfiguration(@NonNull List<SatelliteInfo> satelliteInfos,
            @NonNull int[] tagIds) {
            @NonNull List<Integer> tagIdList) {
        mSatelliteInfoList = satelliteInfos;
        mTagIds = tagIds;
        mTagIdList = tagIdList;
    }

    public SatelliteAccessConfiguration(Parcel in) {
        mSatelliteInfoList = in.createTypedArrayList(SatelliteInfo.CREATOR);
        mTagIds = new int[in.readInt()];
        in.readIntArray(mTagIds);
        mTagIdList = new ArrayList<>();
        in.readList(mTagIdList, Integer.class.getClassLoader(), Integer.class);
    }

    public static final Creator<SatelliteAccessConfiguration> CREATOR =
@@ -91,12 +93,7 @@ public final class SatelliteAccessConfiguration implements Parcelable {
    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeTypedList(mSatelliteInfoList);
        if (mTagIds != null && mTagIds.length > 0) {
            dest.writeInt(mTagIds.length);
            dest.writeIntArray(mTagIds);
        } else {
            dest.writeInt(0);
        }
        dest.writeList(mTagIdList);
    }

    /**
@@ -116,7 +113,34 @@ public final class SatelliteAccessConfiguration implements Parcelable {
     * @return The list of tag IDs.
     */
    @NonNull
    public int[] getTagIds() {
        return mTagIds;
    public List<Integer> getTagIds() {
        return mTagIdList;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof SatelliteAccessConfiguration that)) return false;

        return mSatelliteInfoList.equals(that.mSatelliteInfoList)
                && Objects.equals(mTagIdList, that.mTagIdList);
    }

    @Override
    public int hashCode() {
        int result = Objects.hash(mSatelliteInfoList);
        result = 31 * result + Objects.hashCode(mTagIdList);
        return result;
    }

    @Override
    @NonNull
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("SatelliteAccessConfiguration{");
        sb.append("mSatelliteInfoList=").append(mSatelliteInfoList);
        sb.append(", mTagIds=").append(mTagIdList);
        sb.append('}');
        return sb.toString();
    }
}
+50 −23
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.telephony.satellite;

import android.annotation.FlaggedApi;
import android.annotation.Nullable;
import android.os.Parcel;
import android.os.ParcelUuid;
import android.os.Parcelable;
@@ -25,7 +26,9 @@ import androidx.annotation.NonNull;

import com.android.internal.telephony.flags.Flags;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.UUID;

/**
@@ -47,17 +50,18 @@ public class SatelliteInfo implements Parcelable {
     * Position information of a satellite.
     * This includes the longitude and altitude of the satellite.
     */
    @Nullable
    private SatellitePosition mPosition;

    /**
     * The frequency bands to scan. Bands and earfcns won't overlap.
     * The frequency band list to scan. Bands and earfcns won't overlap.
     * Bands will be filled only if the whole band is needed.
     * Maximum length of the vector is 8.
     */
    private int[] mBands;
    private List<Integer> mBandList;

    /**
     * EARFCN (E-UTRA Absolute Radio Frequency Channel Number) Ranges
     * EARFCN (E-UTRA Absolute Radio Frequency Channel Number) range list
     * The supported frequency range list.
     * Maximum length of the vector is 8.
     */
@@ -71,13 +75,8 @@ public class SatelliteInfo implements Parcelable {
        }
        mPosition = in.readParcelable(SatellitePosition.class.getClassLoader(),
                SatellitePosition.class);
        int numBands = in.readInt();
        mBands = new int[numBands];
        if (numBands > 0) {
            for (int i = 0; i < numBands; i++) {
                mBands[i] = in.readInt();
            }
        }
        mBandList = new ArrayList<>();
        in.readList(mBandList, Integer.class.getClassLoader(), Integer.class);
        mEarfcnRangeList = in.createTypedArrayList(EarfcnRange.CREATOR);
    }

@@ -86,15 +85,15 @@ public class SatelliteInfo implements Parcelable {
     *
     * @param satelliteId       The ID of the satellite.
     * @param satellitePosition The {@link SatellitePosition} of the satellite.
     * @param bands             The list of frequency bands supported by the satellite.
     * @param bandList          The list of frequency bandList supported by the satellite.
     * @param earfcnRanges      The list of {@link EarfcnRange} objects representing the EARFCN
     *                          ranges supported by the satellite.
     */
    public SatelliteInfo(@NonNull UUID satelliteId, @NonNull SatellitePosition satellitePosition,
            @NonNull int[] bands, @NonNull List<EarfcnRange> earfcnRanges) {
    public SatelliteInfo(@NonNull UUID satelliteId, @Nullable SatellitePosition satellitePosition,
            @NonNull List<Integer> bandList, @NonNull List<EarfcnRange> earfcnRanges) {
        mId = satelliteId;
        mPosition = satellitePosition;
        mBands = bands;
        mBandList = bandList;
        mEarfcnRangeList = earfcnRanges;
    }

@@ -119,12 +118,7 @@ public class SatelliteInfo implements Parcelable {
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeParcelable(new ParcelUuid(mId), flags);
        dest.writeParcelable(mPosition, flags);
        if (mBands != null && mBands.length > 0) {
            dest.writeInt(mBands.length);
            dest.writeIntArray(mBands);
        } else {
            dest.writeInt(0);
        }
        dest.writeList(mBandList);
        dest.writeTypedList(mEarfcnRangeList);
    }

@@ -141,8 +135,10 @@ public class SatelliteInfo implements Parcelable {
    /**
     * Returns the position of the satellite.
     *
     * @return The {@link SatellitePosition} of the satellite.
     * @return The {@link SatellitePosition} of the satellite, or {@code null} if the position is
     * not available.
     */
    @Nullable
    public SatellitePosition getSatellitePosition() {
        return mPosition;
    }
@@ -153,8 +149,8 @@ public class SatelliteInfo implements Parcelable {
     * @return The list of frequency bands.
     */
    @NonNull
    public int[] getBands() {
        return mBands;
    public List<Integer> getBands() {
        return mBandList;
    }

    /**
@@ -166,4 +162,35 @@ public class SatelliteInfo implements Parcelable {
    public List<EarfcnRange> getEarfcnRanges() {
        return mEarfcnRangeList;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof SatelliteInfo that)) return false;

        return mId.equals(that.mId)
                && Objects.equals(mPosition, that.mPosition)
                && Objects.equals(mBandList, that.mBandList)
                && mEarfcnRangeList.equals(that.mEarfcnRangeList);
    }

    @Override
    public int hashCode() {
        int result = Objects.hash(mId, mPosition, mEarfcnRangeList);
        result = 31 * result + Objects.hashCode(mBandList);
        return result;
    }

    @Override
    @NonNull
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("SatelliteInfo{");
        sb.append("mId=").append(mId);
        sb.append(", mPosition=").append(mPosition);
        sb.append(", mBandList=").append(mBandList);
        sb.append(", mEarfcnRangeList=").append(mEarfcnRangeList);
        sb.append('}');
        return sb.toString();
    }
}
+22 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import androidx.annotation.NonNull;

import com.android.internal.telephony.flags.Flags;

import java.util.Objects;

/**
 * The position of a satellite in Earth orbit.
 *
@@ -111,4 +113,24 @@ public class SatellitePosition implements Parcelable {
    public double getAltitudeKm() {
        return mAltitudeKm;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof SatellitePosition that)) return false;

        return Double.compare(that.mLongitudeDegree, mLongitudeDegree) == 0
                && Double.compare(that.mAltitudeKm, mAltitudeKm) == 0;
    }

    @Override
    public int hashCode() {
        return Objects.hash(mLongitudeDegree, mAltitudeKm);
    }

    @Override
    @NonNull
    public String toString() {
        return "mLongitudeDegree: " + mLongitudeDegree + ", " + "mAltitudeKm: " + mAltitudeKm;
    }
}