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

Commit 74743362 authored by Hui Wang's avatar Hui Wang Committed by Android (Google) Code Review
Browse files

Merge "Update Telephony APIs for Cell Broadcast"

parents 5193171c 473ed527
Loading
Loading
Loading
Loading
+21 −3
Original line number Diff line number Diff line
@@ -13109,6 +13109,17 @@ package android.telephony {
    method @NonNull public java.util.List<android.telephony.CbGeoUtils.LatLng> getVertices();
  }
  public final class CellBroadcastIdRange implements android.os.Parcelable {
    ctor public CellBroadcastIdRange(int, int, int, boolean) throws java.lang.IllegalArgumentException;
    method public int describeContents();
    method public int getEndId();
    method public int getStartId();
    method public int getType();
    method public boolean isEnabled();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellBroadcastIdRange> CREATOR;
  }
  public class CellBroadcastIntents {
    method public static void sendSmsCbReceivedBroadcast(@NonNull android.content.Context, @Nullable android.os.UserHandle, @NonNull android.telephony.SmsCbMessage, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, int, int);
    field public static final String ACTION_AREA_INFO_UPDATED = "android.telephony.action.AREA_INFO_UPDATED";
@@ -13668,10 +13679,10 @@ package android.telephony {
  }
  public final class SmsManager {
    method public boolean disableCellBroadcastRange(int, int, int);
    method public boolean enableCellBroadcastRange(int, int, int);
    method @Deprecated public boolean disableCellBroadcastRange(int, int, int);
    method @Deprecated public boolean enableCellBroadcastRange(int, int, int);
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getPremiumSmsConsent(@NonNull String);
    method @RequiresPermission(android.Manifest.permission.MODIFY_CELL_BROADCASTS) public void resetAllCellBroadcastRanges();
    method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_CELL_BROADCASTS) public void resetAllCellBroadcastRanges();
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void sendMultipartTextMessageWithoutPersisting(String, String, java.util.List<java.lang.String>, java.util.List<android.app.PendingIntent>, java.util.List<android.app.PendingIntent>);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setPremiumSmsConsent(@NonNull String, int);
    field public static final int PREMIUM_SMS_CONSENT_ALWAYS_ALLOW = 3; // 0x3
@@ -13876,6 +13887,7 @@ package android.telephony {
    method public String getCdmaPrlVersion();
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getCdmaRoamingMode();
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getCdmaSubscriptionMode();
    method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_CELL_BROADCASTS) public java.util.List<android.telephony.CellBroadcastIdRange> getCellBroadcastIdRanges();
    method public int getCurrentPhoneType();
    method public int getCurrentPhoneType(int);
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getDataActivationState();
@@ -13964,6 +13976,7 @@ package android.telephony {
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setCarrierRestrictionRules(@NonNull android.telephony.CarrierRestrictionRules);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCdmaRoamingMode(int);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCdmaSubscriptionMode(int);
    method @RequiresPermission(android.Manifest.permission.MODIFY_CELL_BROADCASTS) public void setCellBroadcastIdRanges(@NonNull java.util.List<android.telephony.CellBroadcastIdRange>, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataActivationState(int);
    method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(int, boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataRoamingEnabled(boolean);
@@ -14027,6 +14040,11 @@ package android.telephony {
    field public static final int CDMA_SUBSCRIPTION_NV = 1; // 0x1
    field public static final int CDMA_SUBSCRIPTION_RUIM_SIM = 0; // 0x0
    field public static final int CDMA_SUBSCRIPTION_UNKNOWN = -1; // 0xffffffff
    field public static final int CELLBROADCAST_RESULT_FAIL_ACTIVATION = 3; // 0x3
    field public static final int CELLBROADCAST_RESULT_FAIL_CONFIG = 2; // 0x2
    field public static final int CELLBROADCAST_RESULT_SUCCESS = 0; // 0x0
    field public static final int CELLBROADCAST_RESULT_UNKNOWN = -1; // 0xffffffff
    field public static final int CELLBROADCAST_RESULT_UNSUPPORTED = 1; // 0x1
    field public static final int ENABLE_NR_DUAL_CONNECTIVITY_INVALID_STATE = 4; // 0x4
    field public static final int ENABLE_NR_DUAL_CONNECTIVITY_NOT_SUPPORTED = 1; // 0x1
    field public static final int ENABLE_NR_DUAL_CONNECTIVITY_RADIO_ERROR = 3; // 0x3
+1 −0
Original line number Diff line number Diff line
@@ -501,6 +501,7 @@ applications that come with the platform
        <permission name="android.permission.CAPTURE_MEDIA_OUTPUT" />
        <permission name="android.permission.CAPTURE_TUNER_AUDIO_INPUT" />
        <permission name="android.permission.CAPTURE_VOICE_COMMUNICATION_OUTPUT" />
        <permission name="android.permission.MODIFY_CELL_BROADCASTS" />
    </privapp-permissions>

    <privapp-permissions package="com.android.statementservice">
+1 −0
Original line number Diff line number Diff line
@@ -701,6 +701,7 @@

    <!-- Permission required for CTS test - CtsTelephonyTestCases -->
    <uses-permission android:name="android.permission.BIND_TELECOM_CONNECTION_SERVICE" />
    <uses-permission android:name="android.permission.MODIFY_CELL_BROADCASTS" />

    <!-- Permission required for CTS test - CtsPersistentDataBlockManagerTestCases -->
    <uses-permission android:name="android.permission.ACCESS_PDB_STATE" />
+19 −0
Original line number 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;

parcelable CellBroadcastIdRange;
+159 −0
Original line number 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;

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

import java.util.Objects;

/**
 * Describes a particular cell broadcast message identifier range.
 * @hide
 */
@SystemApi
public final class CellBroadcastIdRange implements Parcelable {

    private int mStartId;
    private int mEndId;
    private int mType;
    private boolean mIsEnabled;

    /**
     * Create a new CellBroacastRange
     *
     * @param startId first message identifier as specified in TS 23.041 (3GPP)
     * or C.R1001-G (3GPP2)
     * @param endId last message identifier as specified in TS 23.041 (3GPP)
     * or C.R1001-G (3GPP2)
     * @param type the message format as defined in {@link SmsCbMessage}
     * @param isEnabled whether the range is enabled
     *
     * @throws IllegalArgumentException if endId < startId or invalid value
     */
    public CellBroadcastIdRange(int startId, int endId,
            @android.telephony.SmsCbMessage.MessageFormat int type, boolean isEnabled)
            throws IllegalArgumentException {
        if (startId < 0 || endId < 0) {
            throw new IllegalArgumentException("invalid id");
        }
        if (endId < startId) {
            throw new IllegalArgumentException("endId must be greater than or equal to startId");
        }
        mStartId = startId;
        mEndId = endId;
        mType = type;
        mIsEnabled = isEnabled;
    }

    /**
     * Return the first message identifier of this range as specified in TS 23.041 (3GPP)
     * or C.R1001-G (3GPP2)
     */
    public int getStartId() {
        return mStartId;
    }

    /**
     * Return the last message identifier of this range as specified in TS 23.041 (3GPP)
     * or C.R1001-G (3GPP2)
     */
    public int getEndId() {
        return mEndId;
    }

    /**
     * Return the message format of this range as defined in {@link SmsCbMessage}
     */
    public @android.telephony.SmsCbMessage.MessageFormat int getType() {
        return mType;
    }

    /**
     * Return whether the range is enabled
     */
    public boolean isEnabled() {
        return mIsEnabled;
    }

    /**
     * {@link Parcelable#writeToParcel}
     */
    @Override
    public void writeToParcel(@NonNull Parcel out, int flags) {
        out.writeInt(mStartId);
        out.writeInt(mEndId);
        out.writeInt(mType);
        out.writeBoolean(mIsEnabled);
    }

    /**
     * {@link Parcelable.Creator}
     *
     */
    public static final @NonNull Parcelable.Creator<CellBroadcastIdRange> CREATOR =
            new Creator<CellBroadcastIdRange>() {
                @NonNull
                @Override
                public CellBroadcastIdRange createFromParcel(Parcel in) {
                    int startId = in.readInt();
                    int endId = in.readInt();
                    int type = in.readInt();
                    boolean isEnabled = in.readBoolean();

                    return new CellBroadcastIdRange(startId, endId, type, isEnabled);
                }

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

    /**
     * {@link Parcelable#describeContents}
     */
    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public int hashCode() {
        return Objects.hash(mStartId, mEndId, mType, mIsEnabled);
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof CellBroadcastIdRange)) {
            return false;
        }

        CellBroadcastIdRange other = (CellBroadcastIdRange) obj;

        return mStartId == other.mStartId && mEndId == other.mEndId && mType == other.mType
                && mIsEnabled == other.mIsEnabled;
    }

    @Override
    public String toString() {
        return "CellBroadcastIdRange[" + mStartId + ", " + mEndId + ", " + mType + ", "
                + mIsEnabled + "]";
    }
}
Loading