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

Commit 50e88519 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add SatelliteModemEnableRequestAttributes" into main

parents 8c0b30e2 a03b0459
Loading
Loading
Loading
Loading
+132 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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.Objects;

/**
 * SatelliteModemEnableRequestAttributes is used to pack info needed by modem to allow carrier to
 * roam to satellite.
 *
 * @hide
 */
public final class SatelliteModemEnableRequestAttributes implements Parcelable {

    /** {@code true} to enable satellite and {@code false} to disable satellite */
    private final boolean mIsEnabled;
    /**
     * {@code true} to enable demo mode and {@code false} to disable. When disabling satellite,
     * {@code mIsDemoMode} is always considered as {@code false} by Telephony.
     */
    private final boolean mIsDemoMode;
    /**
     * {@code true} means satellite is enabled for emergency mode, {@code false} otherwise. When
     * disabling satellite, {@code isEmergencyMode} is always considered as {@code false} by
     * Telephony.
     */
    private final boolean mIsEmergencyMode;

    /** The subscription related info */
    @NonNull private final SatelliteSubscriptionInfo mSatelliteSubscriptionInfo;

    public SatelliteModemEnableRequestAttributes(boolean isEnabled, boolean isDemoMode,
            boolean isEmergencyMode, @NonNull SatelliteSubscriptionInfo satelliteSubscriptionInfo) {
        mIsEnabled = isEnabled;
        mIsDemoMode = isDemoMode;
        mIsEmergencyMode = isEmergencyMode;
        mSatelliteSubscriptionInfo = satelliteSubscriptionInfo;
    }

    private SatelliteModemEnableRequestAttributes(Parcel in) {
        mIsEnabled = in.readBoolean();
        mIsDemoMode = in.readBoolean();
        mIsEmergencyMode = in.readBoolean();
        mSatelliteSubscriptionInfo = in.readParcelable(
                SatelliteSubscriptionInfo.class.getClassLoader(), SatelliteSubscriptionInfo.class);
    }

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

    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeBoolean(mIsEnabled);
        dest.writeBoolean(mIsDemoMode);
        dest.writeBoolean(mIsEmergencyMode);
        mSatelliteSubscriptionInfo.writeToParcel(dest, flags);
    }

    public static final Creator<SatelliteModemEnableRequestAttributes> CREATOR = new Creator<>() {
        @Override
        public SatelliteModemEnableRequestAttributes createFromParcel(Parcel in) {
            return new SatelliteModemEnableRequestAttributes(in);
        }

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

    @Override
    public String toString() {
        return (new StringBuilder()).append("SatelliteModemEnableRequestAttributes{")
                .append(", mIsEnabled=").append(mIsEnabled)
                .append(", mIsDemoMode=").append(mIsDemoMode)
                .append(", mIsDemoMode=").append(mIsDemoMode)
                .append("mSatelliteSubscriptionInfo=").append(mSatelliteSubscriptionInfo)
                .append("}")
                .toString();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SatelliteModemEnableRequestAttributes that = (SatelliteModemEnableRequestAttributes) o;
        return mIsEnabled == that.mIsEnabled && mIsDemoMode == that.mIsDemoMode
                && mIsEmergencyMode == that.mIsEmergencyMode && mSatelliteSubscriptionInfo.equals(
                that.mSatelliteSubscriptionInfo);
    }

    @Override
    public int hashCode() {
        return Objects.hash(mIsEnabled, mIsDemoMode, mIsEmergencyMode, mSatelliteSubscriptionInfo);
    }

    public boolean isEnabled() {
        return mIsEnabled;
    }

    public boolean isDemoMode() {
        return mIsDemoMode;
    }

    public boolean isEmergencyMode() {
        return mIsEmergencyMode;
    }

    @NonNull public SatelliteSubscriptionInfo getSatelliteSubscriptionInfo() {
        return mSatelliteSubscriptionInfo;
    }
}
+106 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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.Objects;

/**
 * SatelliteSubscriptionInfo is used to pack subscription related info needed by modem to allow
 * carrier to roam to satellite.
 *
 * @hide
 */
public final class SatelliteSubscriptionInfo implements Parcelable {
    /**
     * The ICC ID used for satellite attachment.
     */
    @NonNull private final String mIccId;

    /**
     * The NIDD(Non IP Data) APN to be used for carrier roaming to satellite attachment.
     */
    @NonNull private final String mNiddApn;

    public SatelliteSubscriptionInfo(@NonNull String iccId, @NonNull String niddApn) {
        mIccId = iccId;
        mNiddApn = niddApn;
    }

    private SatelliteSubscriptionInfo(Parcel in) {
        mIccId = in.readString8();
        mNiddApn = in.readString8();
    }

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

    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeString8(mIccId);
        dest.writeString8(mNiddApn);
    }

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

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

    @Override
    @NonNull public String toString() {
        return (new StringBuilder()).append("SatelliteSubscriptionInfo{")
                .append("IccId=").append(mIccId)
                .append(", NiddApn=").append(mNiddApn)
                .append("}")
                .toString();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SatelliteSubscriptionInfo that = (SatelliteSubscriptionInfo) o;
        return mIccId.equals(that.getIccId()) && mNiddApn.equals(that.getNiddApn());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getIccId(), getNiddApn());
    }

    @NonNull
    public String getIccId() {
        return mIccId;
    }

    @NonNull
    public String getNiddApn() {
        return mNiddApn;
    }
}
+41 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.stub;

import android.telephony.satellite.stub.SatelliteSubscriptionInfo;

/**
 * {@hide}
 */
 parcelable SatelliteModemEnableRequestAttributes {
    /**
     * {@code true} to enable satellite and {@code false} to disable.
     */
    boolean isEnabled;
    /**
     * {@code true} to enable demo mode and {@code false} to disable.
     */
    boolean isDemoMode;
    /**
     * {@code true} to enable emergency modeand {@code false} to disable.
     */
    boolean isEmergencyMode;
    /**
     * The subscription related info.
     */
    SatelliteSubscriptionInfo satelliteSubscriptionInfo;
 }
 No newline at end of file
+31 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.stub;

/**
 * {@hide}
 */
 parcelable SatelliteSubscriptionInfo {
    /**
     * The ICC ID used for satellite attachment.
     */
    String iccId;
    /**
     * The NIDD(Non IP Data) APN to be used for carrier roaming to satellite attachment.
     */
    String niddApn;
 }
 No newline at end of file