diff options
Diffstat (limited to 'telephony')
130 files changed, 5060 insertions, 8054 deletions
diff --git a/telephony/OWNERS b/telephony/OWNERS index 58a7ea08da3f..628c48070314 100644 --- a/telephony/OWNERS +++ b/telephony/OWNERS @@ -1,18 +1,16 @@ set noparent -tgunn@google.com -breadley@google.com -hallliu@google.com -rgreenwalt@google.com -mpq@google.com amitmahajan@google.com +breadley@google.com fionaxu@google.com jackyu@google.com +hallliu@google.com +rgreenwalt@google.com +tgunn@google.com jminjie@google.com -satk@google.com shuoq@google.com refuhoo@google.com -paulye@google.com nazaninb@google.com sarahchin@google.com dbright@google.com +xiaotonj@google.com diff --git a/telephony/api/system-current.txt b/telephony/api/system-current.txt new file mode 100644 index 000000000000..efe586abcfe9 --- /dev/null +++ b/telephony/api/system-current.txt @@ -0,0 +1,2151 @@ +// Signature format: 2.0 +package android.telephony { + + public final class AccessNetworkConstants { + field public static final int TRANSPORT_TYPE_INVALID = -1; // 0xffffffff + } + + public static final class AccessNetworkConstants.NgranBands { + method public static int getFrequencyRangeGroup(int); + field public static final int FREQUENCY_RANGE_GROUP_1 = 1; // 0x1 + field public static final int FREQUENCY_RANGE_GROUP_2 = 2; // 0x2 + field public static final int FREQUENCY_RANGE_GROUP_UNKNOWN = 0; // 0x0 + } + + public final class BarringInfo implements android.os.Parcelable { + ctor public BarringInfo(); + method @NonNull public android.telephony.BarringInfo createLocationInfoSanitizedCopy(); + } + + public final class CallAttributes implements android.os.Parcelable { + ctor public CallAttributes(@NonNull android.telephony.PreciseCallState, int, @NonNull android.telephony.CallQuality); + method public int describeContents(); + method @NonNull public android.telephony.CallQuality getCallQuality(); + method public int getNetworkType(); + method @NonNull public android.telephony.PreciseCallState getPreciseCallState(); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CallAttributes> CREATOR; + } + + public final class CallQuality implements android.os.Parcelable { + ctor public CallQuality(int, int, int, int, int, int, int, int, int, int, int); + ctor public CallQuality(int, int, int, int, int, int, int, int, int, int, int, boolean, boolean, boolean); + method public int describeContents(); + method public int getAverageRelativeJitter(); + method public int getAverageRoundTripTime(); + method public int getCallDuration(); + method public int getCodecType(); + method public int getDownlinkCallQualityLevel(); + method public int getMaxRelativeJitter(); + method public int getNumRtpPacketsNotReceived(); + method public int getNumRtpPacketsReceived(); + method public int getNumRtpPacketsTransmitted(); + method public int getNumRtpPacketsTransmittedLost(); + method public int getUplinkCallQualityLevel(); + method public boolean isIncomingSilenceDetected(); + method public boolean isOutgoingSilenceDetected(); + method public boolean isRtpInactivityDetected(); + method public void writeToParcel(android.os.Parcel, int); + field public static final int CALL_QUALITY_BAD = 4; // 0x4 + field public static final int CALL_QUALITY_EXCELLENT = 0; // 0x0 + field public static final int CALL_QUALITY_FAIR = 2; // 0x2 + field public static final int CALL_QUALITY_GOOD = 1; // 0x1 + field public static final int CALL_QUALITY_NOT_AVAILABLE = 5; // 0x5 + field public static final int CALL_QUALITY_POOR = 3; // 0x3 + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CallQuality> CREATOR; + } + + public class CarrierConfigManager { + method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getDefaultCarrierServicePackageName(); + method @NonNull public static android.os.PersistableBundle getDefaultConfig(); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void overrideConfig(int, @Nullable android.os.PersistableBundle); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void updateConfigForPhoneId(int, String); + field public static final String KEY_CARRIER_SETUP_APP_STRING = "carrier_setup_app_string"; + field public static final String KEY_SUPPORT_CDMA_1X_VOICE_CALLS_BOOL = "support_cdma_1x_voice_calls_bool"; + } + + public static final class CarrierConfigManager.Wifi { + field public static final String KEY_HOTSPOT_MAX_CLIENT_COUNT = "wifi.hotspot_maximum_client_count"; + field public static final String KEY_PREFIX = "wifi."; + } + + public final class CarrierRestrictionRules implements android.os.Parcelable { + method @NonNull public java.util.List<java.lang.Boolean> areCarrierIdentifiersAllowed(@NonNull java.util.List<android.service.carrier.CarrierIdentifier>); + method public int describeContents(); + method @NonNull public java.util.List<android.service.carrier.CarrierIdentifier> getAllowedCarriers(); + method public int getDefaultCarrierRestriction(); + method @NonNull public java.util.List<android.service.carrier.CarrierIdentifier> getExcludedCarriers(); + method public int getMultiSimPolicy(); + method public boolean isAllCarriersAllowed(); + method public void writeToParcel(android.os.Parcel, int); + field public static final int CARRIER_RESTRICTION_DEFAULT_ALLOWED = 1; // 0x1 + field public static final int CARRIER_RESTRICTION_DEFAULT_NOT_ALLOWED = 0; // 0x0 + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CarrierRestrictionRules> CREATOR; + field public static final int MULTISIM_POLICY_NONE = 0; // 0x0 + field public static final int MULTISIM_POLICY_ONE_VALID_SIM_MUST_BE_PRESENT = 1; // 0x1 + } + + public static final class CarrierRestrictionRules.Builder { + ctor public CarrierRestrictionRules.Builder(); + method @NonNull public android.telephony.CarrierRestrictionRules build(); + method @NonNull public android.telephony.CarrierRestrictionRules.Builder setAllCarriersAllowed(); + method @NonNull public android.telephony.CarrierRestrictionRules.Builder setAllowedCarriers(@NonNull java.util.List<android.service.carrier.CarrierIdentifier>); + method @NonNull public android.telephony.CarrierRestrictionRules.Builder setDefaultCarrierRestriction(int); + method @NonNull public android.telephony.CarrierRestrictionRules.Builder setExcludedCarriers(@NonNull java.util.List<android.service.carrier.CarrierIdentifier>); + method @NonNull public android.telephony.CarrierRestrictionRules.Builder setMultiSimPolicy(int); + } + + public class CbGeoUtils { + } + + public static class CbGeoUtils.Circle implements android.telephony.CbGeoUtils.Geometry { + ctor public CbGeoUtils.Circle(@NonNull android.telephony.CbGeoUtils.LatLng, double); + method public boolean contains(@NonNull android.telephony.CbGeoUtils.LatLng); + method @NonNull public android.telephony.CbGeoUtils.LatLng getCenter(); + method public double getRadius(); + } + + public static interface CbGeoUtils.Geometry { + method public boolean contains(@NonNull android.telephony.CbGeoUtils.LatLng); + } + + public static class CbGeoUtils.LatLng { + ctor public CbGeoUtils.LatLng(double, double); + method public double distance(@NonNull android.telephony.CbGeoUtils.LatLng); + method @NonNull public android.telephony.CbGeoUtils.LatLng subtract(@NonNull android.telephony.CbGeoUtils.LatLng); + field public final double lat; + field public final double lng; + } + + public static class CbGeoUtils.Polygon implements android.telephony.CbGeoUtils.Geometry { + ctor public CbGeoUtils.Polygon(@NonNull java.util.List<android.telephony.CbGeoUtils.LatLng>); + method public boolean contains(@NonNull android.telephony.CbGeoUtils.LatLng); + method @NonNull public java.util.List<android.telephony.CbGeoUtils.LatLng> getVertices(); + } + + public abstract class CellBroadcastService extends android.app.Service { + ctor public CellBroadcastService(); + method @NonNull @WorkerThread public abstract CharSequence getCellBroadcastAreaInfo(int); + method public android.os.IBinder onBind(@Nullable android.content.Intent); + method public abstract void onCdmaCellBroadcastSms(int, @NonNull byte[], int); + method public abstract void onCdmaScpMessage(int, @NonNull java.util.List<android.telephony.cdma.CdmaSmsCbProgramData>, @NonNull String, @NonNull java.util.function.Consumer<android.os.Bundle>); + method public abstract void onGsmCellBroadcastSms(int, @NonNull byte[]); + field public static final String CELL_BROADCAST_SERVICE_INTERFACE = "android.telephony.CellBroadcastService"; + } + + public abstract class CellIdentity implements android.os.Parcelable { + method @NonNull public abstract android.telephony.CellLocation asCellLocation(); + method @NonNull public abstract android.telephony.CellIdentity sanitizeLocationInfo(); + } + + public final class CellIdentityCdma extends android.telephony.CellIdentity { + method @NonNull public android.telephony.cdma.CdmaCellLocation asCellLocation(); + method @NonNull public android.telephony.CellIdentityCdma sanitizeLocationInfo(); + } + + public final class CellIdentityGsm extends android.telephony.CellIdentity { + method @NonNull public android.telephony.gsm.GsmCellLocation asCellLocation(); + method @NonNull public android.telephony.CellIdentityGsm sanitizeLocationInfo(); + } + + public final class CellIdentityLte extends android.telephony.CellIdentity { + method @NonNull public android.telephony.gsm.GsmCellLocation asCellLocation(); + method @NonNull public android.telephony.CellIdentityLte sanitizeLocationInfo(); + } + + public final class CellIdentityNr extends android.telephony.CellIdentity { + method @NonNull public android.telephony.CellLocation asCellLocation(); + method @NonNull public android.telephony.CellIdentityNr sanitizeLocationInfo(); + } + + public final class CellIdentityTdscdma extends android.telephony.CellIdentity { + method @NonNull public android.telephony.gsm.GsmCellLocation asCellLocation(); + method @NonNull public android.telephony.CellIdentityTdscdma sanitizeLocationInfo(); + } + + public final class CellIdentityWcdma extends android.telephony.CellIdentity { + method @NonNull public android.telephony.gsm.GsmCellLocation asCellLocation(); + method @NonNull public android.telephony.CellIdentityWcdma sanitizeLocationInfo(); + } + + public final class DataFailCause { + field @Deprecated public static final int VSNCP_APN_UNATHORIZED = 2238; // 0x8be + } + + public final class DataSpecificRegistrationInfo implements android.os.Parcelable { + method public int describeContents(); + method @NonNull public android.telephony.LteVopsSupportInfo getLteVopsSupportInfo(); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.DataSpecificRegistrationInfo> CREATOR; + } + + public final class DisconnectCause { + field public static final int ALREADY_DIALING = 72; // 0x48 + field public static final int ANSWERED_ELSEWHERE = 52; // 0x34 + field public static final int BUSY = 4; // 0x4 + field public static final int CALLING_DISABLED = 74; // 0x4a + field public static final int CALL_BARRED = 20; // 0x14 + field public static final int CALL_PULLED = 51; // 0x33 + field public static final int CANT_CALL_WHILE_RINGING = 73; // 0x49 + field public static final int CDMA_ACCESS_BLOCKED = 35; // 0x23 + field public static final int CDMA_ACCESS_FAILURE = 32; // 0x20 + field public static final int CDMA_ALREADY_ACTIVATED = 49; // 0x31 + field public static final int CDMA_DROP = 27; // 0x1b + field public static final int CDMA_INTERCEPT = 28; // 0x1c + field public static final int CDMA_LOCKED_UNTIL_POWER_CYCLE = 26; // 0x1a + field public static final int CDMA_NOT_EMERGENCY = 34; // 0x22 + field public static final int CDMA_PREEMPTED = 33; // 0x21 + field public static final int CDMA_REORDER = 29; // 0x1d + field public static final int CDMA_RETRY_ORDER = 31; // 0x1f + field public static final int CDMA_SO_REJECT = 30; // 0x1e + field public static final int CONGESTION = 5; // 0x5 + field public static final int CS_RESTRICTED = 22; // 0x16 + field public static final int CS_RESTRICTED_EMERGENCY = 24; // 0x18 + field public static final int CS_RESTRICTED_NORMAL = 23; // 0x17 + field public static final int DATA_DISABLED = 54; // 0x36 + field public static final int DATA_LIMIT_REACHED = 55; // 0x37 + field public static final int DIALED_CALL_FORWARDING_WHILE_ROAMING = 57; // 0x39 + field public static final int DIALED_MMI = 39; // 0x27 + field public static final int DIAL_LOW_BATTERY = 62; // 0x3e + field public static final int DIAL_MODIFIED_TO_DIAL = 48; // 0x30 + field public static final int DIAL_MODIFIED_TO_DIAL_VIDEO = 66; // 0x42 + field public static final int DIAL_MODIFIED_TO_SS = 47; // 0x2f + field public static final int DIAL_MODIFIED_TO_USSD = 46; // 0x2e + field public static final int DIAL_VIDEO_MODIFIED_TO_DIAL = 69; // 0x45 + field public static final int DIAL_VIDEO_MODIFIED_TO_DIAL_VIDEO = 70; // 0x46 + field public static final int DIAL_VIDEO_MODIFIED_TO_SS = 67; // 0x43 + field public static final int DIAL_VIDEO_MODIFIED_TO_USSD = 68; // 0x44 + field public static final int EMERGENCY_PERM_FAILURE = 64; // 0x40 + field public static final int EMERGENCY_TEMP_FAILURE = 63; // 0x3f + field public static final int ERROR_UNSPECIFIED = 36; // 0x24 + field public static final int FDN_BLOCKED = 21; // 0x15 + field public static final int ICC_ERROR = 19; // 0x13 + field public static final int IMEI_NOT_ACCEPTED = 58; // 0x3a + field public static final int IMS_ACCESS_BLOCKED = 60; // 0x3c + field public static final int IMS_MERGED_SUCCESSFULLY = 45; // 0x2d + field public static final int IMS_SIP_ALTERNATE_EMERGENCY_CALL = 71; // 0x47 + field public static final int INCOMING_AUTO_REJECTED = 81; // 0x51 + field public static final int INCOMING_MISSED = 1; // 0x1 + field public static final int INCOMING_REJECTED = 16; // 0x10 + field public static final int INVALID_CREDENTIALS = 10; // 0xa + field public static final int INVALID_NUMBER = 7; // 0x7 + field public static final int LIMIT_EXCEEDED = 15; // 0xf + field public static final int LOCAL = 3; // 0x3 + field public static final int LOST_SIGNAL = 14; // 0xe + field public static final int LOW_BATTERY = 61; // 0x3d + field public static final int MAXIMUM_NUMBER_OF_CALLS_REACHED = 53; // 0x35 + field public static final int MMI = 6; // 0x6 + field public static final int NORMAL = 2; // 0x2 + field public static final int NORMAL_UNSPECIFIED = 65; // 0x41 + field public static final int NOT_DISCONNECTED = 0; // 0x0 + field public static final int NOT_VALID = -1; // 0xffffffff + field public static final int NO_PHONE_NUMBER_SUPPLIED = 38; // 0x26 + field public static final int NUMBER_UNREACHABLE = 8; // 0x8 + field public static final int OTASP_PROVISIONING_IN_PROCESS = 76; // 0x4c + field public static final int OUTGOING_CANCELED = 44; // 0x2c + field public static final int OUTGOING_EMERGENCY_CALL_PLACED = 80; // 0x50 + field public static final int OUTGOING_FAILURE = 43; // 0x2b + field public static final int OUT_OF_NETWORK = 11; // 0xb + field public static final int OUT_OF_SERVICE = 18; // 0x12 + field public static final int POWER_OFF = 17; // 0x11 + field public static final int SERVER_ERROR = 12; // 0xc + field public static final int SERVER_UNREACHABLE = 9; // 0x9 + field public static final int TIMED_OUT = 13; // 0xd + field public static final int TOO_MANY_ONGOING_CALLS = 75; // 0x4b + field public static final int UNOBTAINABLE_NUMBER = 25; // 0x19 + field public static final int VIDEO_CALL_NOT_ALLOWED_WHILE_TTY_ENABLED = 50; // 0x32 + field public static final int VOICEMAIL_NUMBER_MISSING = 40; // 0x28 + field public static final int WIFI_LOST = 59; // 0x3b + } + + public final class ImsiEncryptionInfo implements android.os.Parcelable { + method public int describeContents(); + method @Nullable public String getKeyIdentifier(); + method @Nullable public java.security.PublicKey getPublicKey(); + method public void writeToParcel(@NonNull android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ImsiEncryptionInfo> CREATOR; + } + + public final class LteVopsSupportInfo implements android.os.Parcelable { + ctor public LteVopsSupportInfo(int, int); + method public int describeContents(); + method public int getEmcBearerSupport(); + method public int getVopsSupport(); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.LteVopsSupportInfo> CREATOR; + field public static final int LTE_STATUS_NOT_AVAILABLE = 1; // 0x1 + field public static final int LTE_STATUS_NOT_SUPPORTED = 3; // 0x3 + field public static final int LTE_STATUS_SUPPORTED = 2; // 0x2 + } + + public class MbmsDownloadSession implements java.lang.AutoCloseable { + field public static final String MBMS_DOWNLOAD_SERVICE_ACTION = "android.telephony.action.EmbmsDownload"; + } + + public class MbmsGroupCallSession implements java.lang.AutoCloseable { + field public static final String MBMS_GROUP_CALL_SERVICE_ACTION = "android.telephony.action.EmbmsGroupCall"; + } + + public class MbmsStreamingSession implements java.lang.AutoCloseable { + field public static final String MBMS_STREAMING_SERVICE_ACTION = "android.telephony.action.EmbmsStreaming"; + } + + public final class ModemActivityInfo implements android.os.Parcelable { + ctor public ModemActivityInfo(long, int, int, @NonNull int[], int); + method public int describeContents(); + method public int getIdleTimeMillis(); + method public int getReceiveTimeMillis(); + method public int getSleepTimeMillis(); + method public long getTimestamp(); + method @NonNull public java.util.List<android.telephony.ModemActivityInfo.TransmitPower> getTransmitPowerInfo(); + method public boolean isValid(); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ModemActivityInfo> CREATOR; + field public static final int TX_POWER_LEVELS = 5; // 0x5 + field public static final int TX_POWER_LEVEL_0 = 0; // 0x0 + field public static final int TX_POWER_LEVEL_1 = 1; // 0x1 + field public static final int TX_POWER_LEVEL_2 = 2; // 0x2 + field public static final int TX_POWER_LEVEL_3 = 3; // 0x3 + field public static final int TX_POWER_LEVEL_4 = 4; // 0x4 + } + + public class ModemActivityInfo.TransmitPower { + method @NonNull public android.util.Range<java.lang.Integer> getPowerRangeInDbm(); + method public int getTimeInMillis(); + } + + public final class NetworkRegistrationInfo implements android.os.Parcelable { + method @Nullable public android.telephony.DataSpecificRegistrationInfo getDataSpecificInfo(); + method public int getRegistrationState(); + method public int getRejectCause(); + method public int getRoamingType(); + method public boolean isEmergencyEnabled(); + method public void writeToParcel(android.os.Parcel, int); + field public static final int REGISTRATION_STATE_DENIED = 3; // 0x3 + field public static final int REGISTRATION_STATE_HOME = 1; // 0x1 + field public static final int REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING = 0; // 0x0 + field public static final int REGISTRATION_STATE_NOT_REGISTERED_SEARCHING = 2; // 0x2 + field public static final int REGISTRATION_STATE_ROAMING = 5; // 0x5 + field public static final int REGISTRATION_STATE_UNKNOWN = 4; // 0x4 + } + + public static final class NetworkRegistrationInfo.Builder { + ctor public NetworkRegistrationInfo.Builder(); + method @NonNull public android.telephony.NetworkRegistrationInfo build(); + method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setAccessNetworkTechnology(int); + method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setAvailableServices(@NonNull java.util.List<java.lang.Integer>); + method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setCellIdentity(@Nullable android.telephony.CellIdentity); + method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setDomain(int); + method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setEmergencyOnly(boolean); + method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setRegisteredPlmn(@Nullable String); + method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setRegistrationState(int); + method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setRejectCause(int); + method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setTransportType(int); + } + + public abstract class NetworkService extends android.app.Service { + ctor public NetworkService(); + method public android.os.IBinder onBind(android.content.Intent); + method @Nullable public abstract android.telephony.NetworkService.NetworkServiceProvider onCreateNetworkServiceProvider(int); + field public static final String SERVICE_INTERFACE = "android.telephony.NetworkService"; + } + + public abstract class NetworkService.NetworkServiceProvider implements java.lang.AutoCloseable { + ctor public NetworkService.NetworkServiceProvider(int); + method public abstract void close(); + method public final int getSlotIndex(); + method public final void notifyNetworkRegistrationInfoChanged(); + method public void requestNetworkRegistrationInfo(int, @NonNull android.telephony.NetworkServiceCallback); + } + + public class NetworkServiceCallback { + method public void onRequestNetworkRegistrationInfoComplete(int, @Nullable android.telephony.NetworkRegistrationInfo); + field public static final int RESULT_ERROR_BUSY = 3; // 0x3 + field public static final int RESULT_ERROR_FAILED = 5; // 0x5 + field public static final int RESULT_ERROR_ILLEGAL_STATE = 4; // 0x4 + field public static final int RESULT_ERROR_INVALID_ARG = 2; // 0x2 + field public static final int RESULT_ERROR_UNSUPPORTED = 1; // 0x1 + field public static final int RESULT_SUCCESS = 0; // 0x0 + } + + public interface NumberVerificationCallback { + method public default void onCallReceived(@NonNull String); + method public default void onVerificationFailed(int); + field public static final int REASON_CONCURRENT_REQUESTS = 4; // 0x4 + field public static final int REASON_IN_ECBM = 5; // 0x5 + field public static final int REASON_IN_EMERGENCY_CALL = 6; // 0x6 + field public static final int REASON_NETWORK_NOT_AVAILABLE = 2; // 0x2 + field public static final int REASON_TIMED_OUT = 1; // 0x1 + field public static final int REASON_TOO_MANY_CALLS = 3; // 0x3 + field public static final int REASON_UNSPECIFIED = 0; // 0x0 + } + + public final class PhoneNumberRange implements android.os.Parcelable { + ctor public PhoneNumberRange(@NonNull String, @NonNull String, @NonNull String, @NonNull String); + method public int describeContents(); + method public boolean matches(@NonNull String); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.PhoneNumberRange> CREATOR; + } + + public class PhoneNumberUtils { + method @NonNull public static String getUsernameFromUriNumber(@NonNull String); + method public static boolean isUriNumber(@Nullable String); + method public static boolean isVoiceMailNumber(@NonNull android.content.Context, int, @Nullable String); + } + + public final class PreciseCallState implements android.os.Parcelable { + ctor public PreciseCallState(int, int, int, int, int); + method public int describeContents(); + method public int getBackgroundCallState(); + method public int getForegroundCallState(); + method public int getRingingCallState(); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.PreciseCallState> CREATOR; + field public static final int PRECISE_CALL_STATE_ACTIVE = 1; // 0x1 + field public static final int PRECISE_CALL_STATE_ALERTING = 4; // 0x4 + field public static final int PRECISE_CALL_STATE_DIALING = 3; // 0x3 + field public static final int PRECISE_CALL_STATE_DISCONNECTED = 7; // 0x7 + field public static final int PRECISE_CALL_STATE_DISCONNECTING = 8; // 0x8 + field public static final int PRECISE_CALL_STATE_HOLDING = 2; // 0x2 + field public static final int PRECISE_CALL_STATE_IDLE = 0; // 0x0 + field public static final int PRECISE_CALL_STATE_INCOMING = 5; // 0x5 + field public static final int PRECISE_CALL_STATE_NOT_VALID = -1; // 0xffffffff + field public static final int PRECISE_CALL_STATE_WAITING = 6; // 0x6 + } + + public final class PreciseDataConnectionState implements android.os.Parcelable { + method @Deprecated @NonNull public String getDataConnectionApn(); + method @Deprecated public int getDataConnectionApnTypeBitMask(); + method @Deprecated public int getDataConnectionFailCause(); + method @Deprecated @Nullable public android.net.LinkProperties getDataConnectionLinkProperties(); + method @Deprecated public int getDataConnectionNetworkType(); + method @Deprecated public int getDataConnectionState(); + } + + public final class PreciseDisconnectCause { + field public static final int ACCESS_CLASS_BLOCKED = 260; // 0x104 + field public static final int ACCESS_INFORMATION_DISCARDED = 43; // 0x2b + field public static final int ACM_LIMIT_EXCEEDED = 68; // 0x44 + field public static final int BEARER_CAPABILITY_NOT_AUTHORIZED = 57; // 0x39 + field public static final int BEARER_NOT_AVAIL = 58; // 0x3a + field public static final int BEARER_SERVICE_NOT_IMPLEMENTED = 65; // 0x41 + field public static final int BUSY = 17; // 0x11 + field public static final int CALL_BARRED = 240; // 0xf0 + field public static final int CALL_REJECTED = 21; // 0x15 + field public static final int CDMA_ACCESS_BLOCKED = 1009; // 0x3f1 + field public static final int CDMA_ACCESS_FAILURE = 1006; // 0x3ee + field public static final int CDMA_DROP = 1001; // 0x3e9 + field public static final int CDMA_INTERCEPT = 1002; // 0x3ea + field public static final int CDMA_LOCKED_UNTIL_POWER_CYCLE = 1000; // 0x3e8 + field public static final int CDMA_NOT_EMERGENCY = 1008; // 0x3f0 + field public static final int CDMA_PREEMPTED = 1007; // 0x3ef + field public static final int CDMA_REORDER = 1003; // 0x3eb + field public static final int CDMA_RETRY_ORDER = 1005; // 0x3ed + field public static final int CDMA_SO_REJECT = 1004; // 0x3ec + field public static final int CHANNEL_NOT_AVAIL = 44; // 0x2c + field public static final int CHANNEL_UNACCEPTABLE = 6; // 0x6 + field public static final int CONDITIONAL_IE_ERROR = 100; // 0x64 + field public static final int DESTINATION_OUT_OF_ORDER = 27; // 0x1b + field public static final int ERROR_UNSPECIFIED = 65535; // 0xffff + field public static final int FACILITY_REJECTED = 29; // 0x1d + field public static final int FDN_BLOCKED = 241; // 0xf1 + field public static final int IMEI_NOT_ACCEPTED = 243; // 0xf3 + field public static final int IMSI_UNKNOWN_IN_VLR = 242; // 0xf2 + field public static final int INCOMING_CALLS_BARRED_WITHIN_CUG = 55; // 0x37 + field public static final int INCOMPATIBLE_DESTINATION = 88; // 0x58 + field public static final int INFORMATION_ELEMENT_NON_EXISTENT = 99; // 0x63 + field public static final int INTERWORKING_UNSPECIFIED = 127; // 0x7f + field public static final int INVALID_MANDATORY_INFORMATION = 96; // 0x60 + field public static final int INVALID_NUMBER_FORMAT = 28; // 0x1c + field public static final int INVALID_TRANSACTION_IDENTIFIER = 81; // 0x51 + field public static final int MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 101; // 0x65 + field public static final int MESSAGE_TYPE_NON_IMPLEMENTED = 97; // 0x61 + field public static final int MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 98; // 0x62 + field public static final int NETWORK_DETACH = 261; // 0x105 + field public static final int NETWORK_OUT_OF_ORDER = 38; // 0x26 + field public static final int NETWORK_REJECT = 252; // 0xfc + field public static final int NETWORK_RESP_TIMEOUT = 251; // 0xfb + field public static final int NORMAL = 16; // 0x10 + field public static final int NORMAL_UNSPECIFIED = 31; // 0x1f + field public static final int NOT_VALID = -1; // 0xffffffff + field public static final int NO_ANSWER_FROM_USER = 19; // 0x13 + field public static final int NO_CIRCUIT_AVAIL = 34; // 0x22 + field public static final int NO_DISCONNECT_CAUSE_AVAILABLE = 0; // 0x0 + field public static final int NO_ROUTE_TO_DESTINATION = 3; // 0x3 + field public static final int NO_USER_RESPONDING = 18; // 0x12 + field public static final int NO_VALID_SIM = 249; // 0xf9 + field public static final int NUMBER_CHANGED = 22; // 0x16 + field public static final int OEM_CAUSE_1 = 61441; // 0xf001 + field public static final int OEM_CAUSE_10 = 61450; // 0xf00a + field public static final int OEM_CAUSE_11 = 61451; // 0xf00b + field public static final int OEM_CAUSE_12 = 61452; // 0xf00c + field public static final int OEM_CAUSE_13 = 61453; // 0xf00d + field public static final int OEM_CAUSE_14 = 61454; // 0xf00e + field public static final int OEM_CAUSE_15 = 61455; // 0xf00f + field public static final int OEM_CAUSE_2 = 61442; // 0xf002 + field public static final int OEM_CAUSE_3 = 61443; // 0xf003 + field public static final int OEM_CAUSE_4 = 61444; // 0xf004 + field public static final int OEM_CAUSE_5 = 61445; // 0xf005 + field public static final int OEM_CAUSE_6 = 61446; // 0xf006 + field public static final int OEM_CAUSE_7 = 61447; // 0xf007 + field public static final int OEM_CAUSE_8 = 61448; // 0xf008 + field public static final int OEM_CAUSE_9 = 61449; // 0xf009 + field public static final int ONLY_DIGITAL_INFORMATION_BEARER_AVAILABLE = 70; // 0x46 + field public static final int OPERATOR_DETERMINED_BARRING = 8; // 0x8 + field public static final int OUT_OF_SRV = 248; // 0xf8 + field public static final int PREEMPTION = 25; // 0x19 + field public static final int PROTOCOL_ERROR_UNSPECIFIED = 111; // 0x6f + field public static final int QOS_NOT_AVAIL = 49; // 0x31 + field public static final int RADIO_ACCESS_FAILURE = 253; // 0xfd + field public static final int RADIO_INTERNAL_ERROR = 250; // 0xfa + field public static final int RADIO_LINK_FAILURE = 254; // 0xfe + field public static final int RADIO_LINK_LOST = 255; // 0xff + field public static final int RADIO_OFF = 247; // 0xf7 + field public static final int RADIO_RELEASE_ABNORMAL = 259; // 0x103 + field public static final int RADIO_RELEASE_NORMAL = 258; // 0x102 + field public static final int RADIO_SETUP_FAILURE = 257; // 0x101 + field public static final int RADIO_UPLINK_FAILURE = 256; // 0x100 + field public static final int RECOVERY_ON_TIMER_EXPIRED = 102; // 0x66 + field public static final int REQUESTED_FACILITY_NOT_IMPLEMENTED = 69; // 0x45 + field public static final int REQUESTED_FACILITY_NOT_SUBSCRIBED = 50; // 0x32 + field public static final int RESOURCES_UNAVAILABLE_OR_UNSPECIFIED = 47; // 0x2f + field public static final int SEMANTICALLY_INCORRECT_MESSAGE = 95; // 0x5f + field public static final int SERVICE_OPTION_NOT_AVAILABLE = 63; // 0x3f + field public static final int SERVICE_OR_OPTION_NOT_IMPLEMENTED = 79; // 0x4f + field public static final int STATUS_ENQUIRY = 30; // 0x1e + field public static final int SWITCHING_CONGESTION = 42; // 0x2a + field public static final int TEMPORARY_FAILURE = 41; // 0x29 + field public static final int UNOBTAINABLE_NUMBER = 1; // 0x1 + field public static final int USER_NOT_MEMBER_OF_CUG = 87; // 0x57 + } + + public class ServiceState implements android.os.Parcelable { + method public void fillInNotifierBundle(@NonNull android.os.Bundle); + method @Nullable public android.telephony.NetworkRegistrationInfo getNetworkRegistrationInfo(int, int); + method @NonNull public java.util.List<android.telephony.NetworkRegistrationInfo> getNetworkRegistrationInfoListForDomain(int); + method @NonNull public java.util.List<android.telephony.NetworkRegistrationInfo> getNetworkRegistrationInfoListForTransportType(int); + method @NonNull public static android.telephony.ServiceState newFromBundle(@NonNull android.os.Bundle); + field public static final int ROAMING_TYPE_DOMESTIC = 2; // 0x2 + field public static final int ROAMING_TYPE_INTERNATIONAL = 3; // 0x3 + field public static final int ROAMING_TYPE_NOT_ROAMING = 0; // 0x0 + field public static final int ROAMING_TYPE_UNKNOWN = 1; // 0x1 + } + + public class SignalStrength implements android.os.Parcelable { + ctor public SignalStrength(@NonNull android.telephony.SignalStrength); + } + + public final class SmsCbCmasInfo implements android.os.Parcelable { + ctor public SmsCbCmasInfo(int, int, int, int, int, int); + method public int describeContents(); + method public int getCategory(); + method public int getCertainty(); + method public int getMessageClass(); + method public int getResponseType(); + method public int getSeverity(); + method public int getUrgency(); + method public void writeToParcel(android.os.Parcel, int); + field public static final int CMAS_CATEGORY_CBRNE = 10; // 0xa + field public static final int CMAS_CATEGORY_ENV = 7; // 0x7 + field public static final int CMAS_CATEGORY_FIRE = 5; // 0x5 + field public static final int CMAS_CATEGORY_GEO = 0; // 0x0 + field public static final int CMAS_CATEGORY_HEALTH = 6; // 0x6 + field public static final int CMAS_CATEGORY_INFRA = 9; // 0x9 + field public static final int CMAS_CATEGORY_MET = 1; // 0x1 + field public static final int CMAS_CATEGORY_OTHER = 11; // 0xb + field public static final int CMAS_CATEGORY_RESCUE = 4; // 0x4 + field public static final int CMAS_CATEGORY_SAFETY = 2; // 0x2 + field public static final int CMAS_CATEGORY_SECURITY = 3; // 0x3 + field public static final int CMAS_CATEGORY_TRANSPORT = 8; // 0x8 + field public static final int CMAS_CATEGORY_UNKNOWN = -1; // 0xffffffff + field public static final int CMAS_CERTAINTY_LIKELY = 1; // 0x1 + field public static final int CMAS_CERTAINTY_OBSERVED = 0; // 0x0 + field public static final int CMAS_CERTAINTY_UNKNOWN = -1; // 0xffffffff + field public static final int CMAS_CLASS_CHILD_ABDUCTION_EMERGENCY = 3; // 0x3 + field public static final int CMAS_CLASS_CMAS_EXERCISE = 5; // 0x5 + field public static final int CMAS_CLASS_EXTREME_THREAT = 1; // 0x1 + field public static final int CMAS_CLASS_OPERATOR_DEFINED_USE = 6; // 0x6 + field public static final int CMAS_CLASS_PRESIDENTIAL_LEVEL_ALERT = 0; // 0x0 + field public static final int CMAS_CLASS_REQUIRED_MONTHLY_TEST = 4; // 0x4 + field public static final int CMAS_CLASS_SEVERE_THREAT = 2; // 0x2 + field public static final int CMAS_CLASS_UNKNOWN = -1; // 0xffffffff + field public static final int CMAS_RESPONSE_TYPE_ASSESS = 6; // 0x6 + field public static final int CMAS_RESPONSE_TYPE_AVOID = 5; // 0x5 + field public static final int CMAS_RESPONSE_TYPE_EVACUATE = 1; // 0x1 + field public static final int CMAS_RESPONSE_TYPE_EXECUTE = 3; // 0x3 + field public static final int CMAS_RESPONSE_TYPE_MONITOR = 4; // 0x4 + field public static final int CMAS_RESPONSE_TYPE_NONE = 7; // 0x7 + field public static final int CMAS_RESPONSE_TYPE_PREPARE = 2; // 0x2 + field public static final int CMAS_RESPONSE_TYPE_SHELTER = 0; // 0x0 + field public static final int CMAS_RESPONSE_TYPE_UNKNOWN = -1; // 0xffffffff + field public static final int CMAS_SEVERITY_EXTREME = 0; // 0x0 + field public static final int CMAS_SEVERITY_SEVERE = 1; // 0x1 + field public static final int CMAS_SEVERITY_UNKNOWN = -1; // 0xffffffff + field public static final int CMAS_URGENCY_EXPECTED = 1; // 0x1 + field public static final int CMAS_URGENCY_IMMEDIATE = 0; // 0x0 + field public static final int CMAS_URGENCY_UNKNOWN = -1; // 0xffffffff + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.SmsCbCmasInfo> CREATOR; + } + + public final class SmsCbEtwsInfo implements android.os.Parcelable { + ctor public SmsCbEtwsInfo(int, boolean, boolean, boolean, @Nullable byte[]); + method public int describeContents(); + method @Nullable public byte[] getPrimaryNotificationSignature(); + method public long getPrimaryNotificationTimestamp(); + method public int getWarningType(); + method public boolean isEmergencyUserAlert(); + method public boolean isPopupAlert(); + method public boolean isPrimary(); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.SmsCbEtwsInfo> CREATOR; + field public static final int ETWS_WARNING_TYPE_EARTHQUAKE = 0; // 0x0 + field public static final int ETWS_WARNING_TYPE_EARTHQUAKE_AND_TSUNAMI = 2; // 0x2 + field public static final int ETWS_WARNING_TYPE_OTHER_EMERGENCY = 4; // 0x4 + field public static final int ETWS_WARNING_TYPE_TEST_MESSAGE = 3; // 0x3 + field public static final int ETWS_WARNING_TYPE_TSUNAMI = 1; // 0x1 + field public static final int ETWS_WARNING_TYPE_UNKNOWN = -1; // 0xffffffff + } + + public final class SmsCbLocation implements android.os.Parcelable { + ctor public SmsCbLocation(@NonNull String, int, int); + method public int describeContents(); + method public int getCid(); + method public int getLac(); + method @NonNull public String getPlmn(); + method public boolean isInLocationArea(@NonNull android.telephony.SmsCbLocation); + method public boolean isInLocationArea(@Nullable String, int, int); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.SmsCbLocation> CREATOR; + } + + public final class SmsCbMessage implements android.os.Parcelable { + ctor public SmsCbMessage(int, int, int, @NonNull android.telephony.SmsCbLocation, int, @Nullable String, int, @Nullable String, int, @Nullable android.telephony.SmsCbEtwsInfo, @Nullable android.telephony.SmsCbCmasInfo, int, @Nullable java.util.List<android.telephony.CbGeoUtils.Geometry>, long, int, int); + method @NonNull public static android.telephony.SmsCbMessage createFromCursor(@NonNull android.database.Cursor); + method public int describeContents(); + method @Nullable public android.telephony.SmsCbCmasInfo getCmasWarningInfo(); + method @NonNull public android.content.ContentValues getContentValues(); + method public int getDataCodingScheme(); + method @Nullable public android.telephony.SmsCbEtwsInfo getEtwsWarningInfo(); + method public int getGeographicalScope(); + method @NonNull public java.util.List<android.telephony.CbGeoUtils.Geometry> getGeometries(); + method @Nullable public String getLanguageCode(); + method @NonNull public android.telephony.SmsCbLocation getLocation(); + method public int getMaximumWaitingDuration(); + method @Nullable public String getMessageBody(); + method public int getMessageFormat(); + method public int getMessagePriority(); + method public long getReceivedTime(); + method public int getSerialNumber(); + method public int getServiceCategory(); + method public int getSlotIndex(); + method public int getSubscriptionId(); + method public boolean isCmasMessage(); + method public boolean isEmergencyMessage(); + method public boolean isEtwsMessage(); + method public boolean needGeoFencingCheck(); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.SmsCbMessage> CREATOR; + field public static final int GEOGRAPHICAL_SCOPE_CELL_WIDE = 3; // 0x3 + field public static final int GEOGRAPHICAL_SCOPE_CELL_WIDE_IMMEDIATE = 0; // 0x0 + field public static final int GEOGRAPHICAL_SCOPE_LOCATION_AREA_WIDE = 2; // 0x2 + field public static final int GEOGRAPHICAL_SCOPE_PLMN_WIDE = 1; // 0x1 + field public static final int MAXIMUM_WAIT_TIME_NOT_SET = 255; // 0xff + field public static final int MESSAGE_FORMAT_3GPP = 1; // 0x1 + field public static final int MESSAGE_FORMAT_3GPP2 = 2; // 0x2 + field public static final int MESSAGE_PRIORITY_EMERGENCY = 3; // 0x3 + field public static final int MESSAGE_PRIORITY_INTERACTIVE = 1; // 0x1 + field public static final int MESSAGE_PRIORITY_NORMAL = 0; // 0x0 + field public static final int MESSAGE_PRIORITY_URGENT = 2; // 0x2 + } + + public final class SmsManager { + method @RequiresPermission(android.Manifest.permission.ACCESS_MESSAGES_ON_ICC) public boolean copyMessageToIcc(@Nullable byte[], @NonNull byte[], int); + method @RequiresPermission(android.Manifest.permission.ACCESS_MESSAGES_ON_ICC) public boolean deleteMessageFromIcc(int); + method public boolean disableCellBroadcastRange(int, int, int); + method public boolean enableCellBroadcastRange(int, int, int); + method @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_MESSAGES_ON_ICC) public java.util.List<android.telephony.SmsMessage> getMessagesFromIcc(); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getPremiumSmsConsent(@NonNull String); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getSmsCapacityOnIcc(); + 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 + field public static final int PREMIUM_SMS_CONSENT_ASK_USER = 1; // 0x1 + field public static final int PREMIUM_SMS_CONSENT_NEVER_ALLOW = 2; // 0x2 + field public static final int PREMIUM_SMS_CONSENT_UNKNOWN = 0; // 0x0 + } + + public class SmsMessage { + method @Nullable public static android.telephony.SmsMessage createFromNativeSmsSubmitPdu(@NonNull byte[], boolean); + method @Nullable public static android.telephony.SmsMessage.SubmitPdu getSmsPdu(int, int, @Nullable String, @NonNull String, @NonNull String, long); + method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public static byte[] getSubmitPduEncodedMessage(boolean, @NonNull String, @NonNull String, int, @IntRange(from=0) int, @IntRange(from=0) int, @IntRange(from=0, to=255) int, @IntRange(from=1, to=255) int, @IntRange(from=1, to=255) int); + } + + public class SubscriptionInfo implements android.os.Parcelable { + method public boolean areUiccApplicationsEnabled(); + method @Nullable public java.util.List<android.telephony.UiccAccessRule> getAccessRules(); + method public int getProfileClass(); + method public boolean isGroupDisabled(); + } + + public class SubscriptionManager { + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean canDisablePhysicalSubscription(); + method public boolean canManageSubscription(@NonNull android.telephony.SubscriptionInfo, @NonNull String); + method @NonNull public int[] getActiveAndHiddenSubscriptionIdList(); + method @NonNull public int[] getActiveSubscriptionIdList(); + method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.SubscriptionInfo getActiveSubscriptionInfoForIcc(@NonNull String); + method public java.util.List<android.telephony.SubscriptionInfo> getAvailableSubscriptionInfoList(); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getEnabledSubscriptionId(int); + method @NonNull public static android.content.res.Resources getResourcesForSubId(@NonNull android.content.Context, int); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isSubscriptionEnabled(int); + method public void requestEmbeddedSubscriptionInfoListRefresh(); + method public void requestEmbeddedSubscriptionInfoListRefresh(int); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDefaultDataSubId(int); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDefaultSmsSubId(int); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDefaultVoiceSubscriptionId(int); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setDisplayName(@Nullable String, int, int); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setIconTint(int, int); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setPreferredDataSubscriptionId(int, boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setSubscriptionEnabled(int, boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUiccApplicationsEnabled(int, boolean); + field @RequiresPermission(android.Manifest.permission.MANAGE_SUBSCRIPTION_PLANS) public static final String ACTION_SUBSCRIPTION_PLANS_CHANGED = "android.telephony.action.SUBSCRIPTION_PLANS_CHANGED"; + field @NonNull public static final android.net.Uri ADVANCED_CALLING_ENABLED_CONTENT_URI; + field @Deprecated public static final int PROFILE_CLASS_DEFAULT; + field public static final int PROFILE_CLASS_OPERATIONAL; + field public static final int PROFILE_CLASS_PROVISIONING; + field public static final int PROFILE_CLASS_TESTING; + field public static final int PROFILE_CLASS_UNSET; + field @NonNull public static final android.net.Uri VT_ENABLED_CONTENT_URI; + field @NonNull public static final android.net.Uri WFC_ENABLED_CONTENT_URI; + field @NonNull public static final android.net.Uri WFC_MODE_CONTENT_URI; + field @NonNull public static final android.net.Uri WFC_ROAMING_ENABLED_CONTENT_URI; + field @NonNull public static final android.net.Uri WFC_ROAMING_MODE_CONTENT_URI; + } + + public class TelephonyFrameworkInitializer { + method public static void registerServiceWrappers(); + method public static void setTelephonyServiceManager(@NonNull android.os.TelephonyServiceManager); + } + + public final class TelephonyHistogram implements android.os.Parcelable { + ctor public TelephonyHistogram(int, int, int); + ctor public TelephonyHistogram(android.telephony.TelephonyHistogram); + ctor public TelephonyHistogram(android.os.Parcel); + method public void addTimeTaken(int); + method public int describeContents(); + method public int getAverageTime(); + method public int getBucketCount(); + method public int[] getBucketCounters(); + method public int[] getBucketEndPoints(); + method public int getCategory(); + method public int getId(); + method public int getMaxTime(); + method public int getMinTime(); + method public int getSampleCount(); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.TelephonyHistogram> CREATOR; + field public static final int TELEPHONY_CATEGORY_RIL = 1; // 0x1 + } + + public class TelephonyManager { + method @Deprecated @RequiresPermission(android.Manifest.permission.CALL_PHONE) public void call(String, String); + method public int checkCarrierPrivilegesForPackage(String); + method public int checkCarrierPrivilegesForPackageAnyPhone(String); + method public void dial(String); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean disableDataConnectivity(); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean enableDataConnectivity(); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean enableModemForSlot(int, boolean); + method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void enableVideoCalling(boolean); + method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getAidForAppType(int); + method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List<android.service.carrier.CarrierIdentifier> getAllowedCarriers(int); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getAllowedNetworkTypes(); + method @Nullable @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public android.content.ComponentName getAndUpdateDefaultRespondViaMessageApplication(); + method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.ImsiEncryptionInfo getCarrierInfoForImsiEncryption(int); + method public java.util.List<java.lang.String> getCarrierPackageNamesForIntent(android.content.Intent); + method public java.util.List<java.lang.String> getCarrierPackageNamesForIntentAndPhone(android.content.Intent, int); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getCarrierPrivilegeStatus(int); + method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List<java.lang.String> getCarrierPrivilegedPackagesForAllActiveSubscriptions(); + method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.CarrierRestrictionRules getCarrierRestrictionRules(); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String getCdmaMdn(); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String getCdmaMdn(int); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String getCdmaMin(); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String getCdmaMin(int); + method public String getCdmaPrlVersion(); + method public int getCurrentPhoneType(); + method public int getCurrentPhoneType(int); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getDataActivationState(); + method @Deprecated public boolean getDataEnabled(); + method @Deprecated public boolean getDataEnabled(int); + method @Nullable @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public android.content.ComponentName getDefaultRespondViaMessageApplication(); + method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getDeviceSoftwareVersion(int); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean getEmergencyCallbackMode(); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getEmergencyNumberDbVersion(); + method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimDomain(); + method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimIst(); + method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.Map<java.lang.Integer,java.lang.Integer> getLogicalToPhysicalSlotMapping(); + method public int getMaxNumberOfSimultaneouslyActiveSims(); + method public static long getMaxNumberVerificationTimeoutMillis(); + method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String[] getMergedImsisFromGroup(); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getPreferredNetworkTypeBitmask(); + method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public int getRadioPowerState(); + method public int getSimApplicationState(); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getSimApplicationState(int); + method public int getSimCardState(); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getSimCardState(int); + method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.Locale getSimLocale(); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getSupportedRadioAccessFamily(); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public java.util.List<android.telephony.TelephonyHistogram> getTelephonyHistograms(); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.UiccSlotInfo[] getUiccSlotsInfo(); + method @Nullable public android.os.Bundle getVisualVoicemailSettings(); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getVoiceActivationState(); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handlePinMmi(String); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handlePinMmiForSubscriber(int, String); + method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean iccCloseLogicalChannelBySlot(int, int); + method @Nullable @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public android.telephony.IccOpenLogicalChannelResponse iccOpenLogicalChannelBySlot(int, @Nullable String, int); + method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String iccTransmitApduBasicChannelBySlot(int, int, int, int, int, int, @Nullable String); + method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String iccTransmitApduLogicalChannelBySlot(int, int, int, int, int, int, int, @Nullable String); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isAnyRadioPoweredOn(); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isApnMetered(int); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isApplicationOnUicc(int); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isDataConnectionAllowed(); + method public boolean isDataConnectivityPossible(); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isDataEnabledForApn(int); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isEmergencyAssistanceEnabled(); + method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isIdle(); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isInEmergencySmsMode(); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isLteCdmaEvdoGsmWcdmaEnabled(); + method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isOffhook(); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isOpportunisticNetworkEnabled(); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isPotentialEmergencyNumber(@NonNull String); + method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRadioOn(); + method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRinging(); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean isTetheringApnRequired(); + method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isVideoCallingEnabled(); + method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isVisualVoicemailEnabled(android.telecom.PhoneAccountHandle); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean matchesCurrentSimOperator(@NonNull String, int, @Nullable String); + method public boolean needsOtaServiceProvisioning(); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void notifyOtaEmergencyNumberDbInstalled(); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void notifyUserActivity(); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean rebootRadio(); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void reportDefaultNetworkStatus(boolean); + method @RequiresPermission(allOf={android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.MODIFY_PHONE_STATE}) public void requestCellInfoUpdate(@NonNull android.os.WorkSource, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyManager.CellInfoCallback); + method public void requestModemActivityInfo(@NonNull android.os.ResultReceiver); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void requestNumberVerification(@NonNull android.telephony.PhoneNumberRange, long, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.NumberVerificationCallback); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void resetAllCarrierActions(); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void resetCarrierKeysForImsiEncryption(); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public void resetIms(int); + method @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) public void resetOtaEmergencyNumberDbFilePath(); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean resetRadioConfig(); + method @RequiresPermission(android.Manifest.permission.CONNECTIVITY_INTERNAL) public void resetSettings(); + method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setAllowedNetworkTypes(long); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setAlwaysAllowMmsData(boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCarrierDataEnabled(boolean); + 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 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); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setMultiSimCarrierRestriction(boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setOpportunisticNetworkState(boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setPreferredNetworkTypeBitmask(long); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadio(boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setRadioEnabled(boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadioPower(boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setSimPowerState(int); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setSimPowerStateForSlot(int, int); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setSystemSelectionChannels(@NonNull java.util.List<android.telephony.RadioAccessSpecifier>, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setSystemSelectionChannels(@NonNull java.util.List<android.telephony.RadioAccessSpecifier>); + method @Deprecated public void setVisualVoicemailEnabled(android.telecom.PhoneAccountHandle, boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoiceActivationState(int); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void shutdownAllRadios(); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean supplyPin(String); + method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int[] supplyPinReportResult(String); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean supplyPuk(String, String); + method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int[] supplyPukReportResult(String, String); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean switchSlots(int[]); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void toggleRadioOnOff(); + method @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) public void updateOtaEmergencyNumberDbFilePath(@NonNull android.os.ParcelFileDescriptor); + method public void updateServiceLocation(); + field @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final String ACTION_ANOMALY_REPORTED = "android.telephony.action.ANOMALY_REPORTED"; + field public static final String ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE = "com.android.internal.telephony.CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE"; + field public static final String ACTION_CARRIER_SIGNAL_PCO_VALUE = "com.android.internal.telephony.CARRIER_SIGNAL_PCO_VALUE"; + field public static final String ACTION_CARRIER_SIGNAL_REDIRECTED = "com.android.internal.telephony.CARRIER_SIGNAL_REDIRECTED"; + field public static final String ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED = "com.android.internal.telephony.CARRIER_SIGNAL_REQUEST_NETWORK_FAILED"; + field public static final String ACTION_CARRIER_SIGNAL_RESET = "com.android.internal.telephony.CARRIER_SIGNAL_RESET"; + field public static final String ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED = "android.intent.action.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED"; + field public static final String ACTION_DEFAULT_VOICE_SUBSCRIPTION_CHANGED = "android.intent.action.ACTION_DEFAULT_VOICE_SUBSCRIPTION_CHANGED"; + field public static final String ACTION_EMERGENCY_ASSISTANCE = "android.telephony.action.EMERGENCY_ASSISTANCE"; + field public static final String ACTION_EMERGENCY_CALLBACK_MODE_CHANGED = "android.intent.action.EMERGENCY_CALLBACK_MODE_CHANGED"; + field public static final String ACTION_EMERGENCY_CALL_STATE_CHANGED = "android.intent.action.EMERGENCY_CALL_STATE_CHANGED"; + field public static final String ACTION_REQUEST_OMADM_CONFIGURATION_UPDATE = "com.android.omadm.service.CONFIGURATION_UPDATE"; + field public static final String ACTION_SERVICE_PROVIDERS_UPDATED = "android.telephony.action.SERVICE_PROVIDERS_UPDATED"; + field public static final String ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS = "android.telephony.action.SHOW_NOTICE_ECM_BLOCK_OTHERS"; + field public static final String ACTION_SIM_APPLICATION_STATE_CHANGED = "android.telephony.action.SIM_APPLICATION_STATE_CHANGED"; + field public static final String ACTION_SIM_CARD_STATE_CHANGED = "android.telephony.action.SIM_CARD_STATE_CHANGED"; + field public static final String ACTION_SIM_SLOT_STATUS_CHANGED = "android.telephony.action.SIM_SLOT_STATUS_CHANGED"; + field public static final int CARD_POWER_DOWN = 0; // 0x0 + field public static final int CARD_POWER_UP = 1; // 0x1 + field public static final int CARD_POWER_UP_PASS_THROUGH = 2; // 0x2 + field public static final int CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES = -2; // 0xfffffffe + field public static final int CARRIER_PRIVILEGE_STATUS_HAS_ACCESS = 1; // 0x1 + field public static final int CARRIER_PRIVILEGE_STATUS_NO_ACCESS = 0; // 0x0 + field public static final int CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED = -1; // 0xffffffff + field public static final String EXTRA_ANOMALY_DESCRIPTION = "android.telephony.extra.ANOMALY_DESCRIPTION"; + field public static final String EXTRA_ANOMALY_ID = "android.telephony.extra.ANOMALY_ID"; + field @Deprecated public static final String EXTRA_APN_PROTOCOL = "apnProto"; + field public static final String EXTRA_APN_PROTOCOL_INT = "apnProtoInt"; + field @Deprecated public static final String EXTRA_APN_TYPE = "apnType"; + field public static final String EXTRA_APN_TYPE_INT = "apnTypeInt"; + field public static final String EXTRA_DATA_SPN = "android.telephony.extra.DATA_SPN"; + field public static final String EXTRA_DEFAULT_NETWORK_AVAILABLE = "defaultNetworkAvailable"; + field public static final String EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE = "android.telephony.extra.DEFAULT_SUBSCRIPTION_SELECT_TYPE"; + field public static final int EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_ALL = 4; // 0x4 + field public static final int EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_DATA = 1; // 0x1 + field public static final int EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_NONE = 0; // 0x0 + field public static final int EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_SMS = 3; // 0x3 + field public static final int EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_VOICE = 2; // 0x2 + field public static final String EXTRA_ERROR_CODE = "errorCode"; + field public static final String EXTRA_PCO_ID = "pcoId"; + field public static final String EXTRA_PCO_VALUE = "pcoValue"; + field public static final String EXTRA_PHONE_IN_ECM_STATE = "android.telephony.extra.PHONE_IN_ECM_STATE"; + field public static final String EXTRA_PHONE_IN_EMERGENCY_CALL = "android.telephony.extra.PHONE_IN_EMERGENCY_CALL"; + field public static final String EXTRA_PLMN = "android.telephony.extra.PLMN"; + field public static final String EXTRA_REDIRECTION_URL = "redirectionUrl"; + field public static final String EXTRA_SHOW_PLMN = "android.telephony.extra.SHOW_PLMN"; + field public static final String EXTRA_SHOW_SPN = "android.telephony.extra.SHOW_SPN"; + field public static final String EXTRA_SIM_COMBINATION_NAMES = "android.telephony.extra.SIM_COMBINATION_NAMES"; + field public static final String EXTRA_SIM_COMBINATION_WARNING_TYPE = "android.telephony.extra.SIM_COMBINATION_WARNING_TYPE"; + field public static final int EXTRA_SIM_COMBINATION_WARNING_TYPE_DUAL_CDMA = 1; // 0x1 + field public static final int EXTRA_SIM_COMBINATION_WARNING_TYPE_NONE = 0; // 0x0 + field public static final String EXTRA_SIM_STATE = "android.telephony.extra.SIM_STATE"; + field public static final String EXTRA_SPN = "android.telephony.extra.SPN"; + field public static final String EXTRA_VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL = "android.telephony.extra.VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL"; + field public static final String EXTRA_VOICEMAIL_SCRAMBLED_PIN_STRING = "android.telephony.extra.VOICEMAIL_SCRAMBLED_PIN_STRING"; + field public static final int INVALID_EMERGENCY_NUMBER_DB_VERSION = -1; // 0xffffffff + field public static final int KEY_TYPE_EPDG = 1; // 0x1 + field public static final int KEY_TYPE_WLAN = 2; // 0x2 + field public static final String MODEM_ACTIVITY_RESULT_KEY = "controller_activity"; + field public static final long NETWORK_TYPE_BITMASK_1xRTT = 64L; // 0x40L + field public static final long NETWORK_TYPE_BITMASK_CDMA = 8L; // 0x8L + field public static final long NETWORK_TYPE_BITMASK_EDGE = 2L; // 0x2L + field public static final long NETWORK_TYPE_BITMASK_EHRPD = 8192L; // 0x2000L + field public static final long NETWORK_TYPE_BITMASK_EVDO_0 = 16L; // 0x10L + field public static final long NETWORK_TYPE_BITMASK_EVDO_A = 32L; // 0x20L + field public static final long NETWORK_TYPE_BITMASK_EVDO_B = 2048L; // 0x800L + field public static final long NETWORK_TYPE_BITMASK_GPRS = 1L; // 0x1L + field public static final long NETWORK_TYPE_BITMASK_GSM = 32768L; // 0x8000L + field public static final long NETWORK_TYPE_BITMASK_HSDPA = 128L; // 0x80L + field public static final long NETWORK_TYPE_BITMASK_HSPA = 512L; // 0x200L + field public static final long NETWORK_TYPE_BITMASK_HSPAP = 16384L; // 0x4000L + field public static final long NETWORK_TYPE_BITMASK_HSUPA = 256L; // 0x100L + field public static final long NETWORK_TYPE_BITMASK_IWLAN = 131072L; // 0x20000L + field public static final long NETWORK_TYPE_BITMASK_LTE = 4096L; // 0x1000L + field public static final long NETWORK_TYPE_BITMASK_LTE_CA = 262144L; // 0x40000L + field public static final long NETWORK_TYPE_BITMASK_NR = 524288L; // 0x80000L + field public static final long NETWORK_TYPE_BITMASK_TD_SCDMA = 65536L; // 0x10000L + field public static final long NETWORK_TYPE_BITMASK_UMTS = 4L; // 0x4L + field public static final long NETWORK_TYPE_BITMASK_UNKNOWN = 0L; // 0x0L + field public static final int RADIO_POWER_OFF = 0; // 0x0 + field public static final int RADIO_POWER_ON = 1; // 0x1 + field public static final int RADIO_POWER_UNAVAILABLE = 2; // 0x2 + field public static final int SET_CARRIER_RESTRICTION_ERROR = 2; // 0x2 + field public static final int SET_CARRIER_RESTRICTION_NOT_SUPPORTED = 1; // 0x1 + field public static final int SET_CARRIER_RESTRICTION_SUCCESS = 0; // 0x0 + field public static final int SIM_ACTIVATION_STATE_ACTIVATED = 2; // 0x2 + field public static final int SIM_ACTIVATION_STATE_ACTIVATING = 1; // 0x1 + field public static final int SIM_ACTIVATION_STATE_DEACTIVATED = 3; // 0x3 + field public static final int SIM_ACTIVATION_STATE_RESTRICTED = 4; // 0x4 + field public static final int SIM_ACTIVATION_STATE_UNKNOWN = 0; // 0x0 + field public static final int SIM_STATE_LOADED = 10; // 0xa + field public static final int SIM_STATE_PRESENT = 11; // 0xb + field public static final int SRVCC_STATE_HANDOVER_CANCELED = 3; // 0x3 + field public static final int SRVCC_STATE_HANDOVER_COMPLETED = 1; // 0x1 + field public static final int SRVCC_STATE_HANDOVER_FAILED = 2; // 0x2 + field public static final int SRVCC_STATE_HANDOVER_NONE = -1; // 0xffffffff + field public static final int SRVCC_STATE_HANDOVER_STARTED = 0; // 0x0 + } + + public final class UiccAccessRule implements android.os.Parcelable { + ctor public UiccAccessRule(byte[], @Nullable String, long); + method public int describeContents(); + method public int getCarrierPrivilegeStatus(android.content.pm.PackageInfo); + method public int getCarrierPrivilegeStatus(android.content.pm.Signature, String); + method public String getCertificateHexString(); + method @Nullable public String getPackageName(); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.UiccAccessRule> CREATOR; + } + + public class UiccSlotInfo implements android.os.Parcelable { + ctor @Deprecated public UiccSlotInfo(boolean, boolean, String, int, int, boolean); + method public int describeContents(); + method public String getCardId(); + method public int getCardStateInfo(); + method public boolean getIsActive(); + method public boolean getIsEuicc(); + method public boolean getIsExtendedApduSupported(); + method public int getLogicalSlotIdx(); + method public boolean isRemovable(); + method public void writeToParcel(android.os.Parcel, int); + field public static final int CARD_STATE_INFO_ABSENT = 1; // 0x1 + field public static final int CARD_STATE_INFO_ERROR = 3; // 0x3 + field public static final int CARD_STATE_INFO_PRESENT = 2; // 0x2 + field public static final int CARD_STATE_INFO_RESTRICTED = 4; // 0x4 + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.UiccSlotInfo> CREATOR; + } + + public abstract class VisualVoicemailService extends android.app.Service { + method public static final void sendVisualVoicemailSms(android.content.Context, android.telecom.PhoneAccountHandle, String, short, String, android.app.PendingIntent); + method public static final void setSmsFilterSettings(android.content.Context, android.telecom.PhoneAccountHandle, android.telephony.VisualVoicemailSmsFilterSettings); + } + +} + +package android.telephony.cdma { + + public final class CdmaSmsCbProgramData implements android.os.Parcelable { + method public int describeContents(); + method public int getCategory(); + method public int getOperation(); + method public void writeToParcel(android.os.Parcel, int); + field public static final int CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY = 4099; // 0x1003 + field public static final int CATEGORY_CMAS_EXTREME_THREAT = 4097; // 0x1001 + field public static final int CATEGORY_CMAS_LAST_RESERVED_VALUE = 4351; // 0x10ff + field public static final int CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT = 4096; // 0x1000 + field public static final int CATEGORY_CMAS_SEVERE_THREAT = 4098; // 0x1002 + field public static final int CATEGORY_CMAS_TEST_MESSAGE = 4100; // 0x1004 + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.cdma.CdmaSmsCbProgramData> CREATOR; + field public static final int OPERATION_ADD_CATEGORY = 1; // 0x1 + field public static final int OPERATION_CLEAR_CATEGORIES = 2; // 0x2 + field public static final int OPERATION_DELETE_CATEGORY = 0; // 0x0 + } + +} + +package android.telephony.data { + + public final class DataCallResponse implements android.os.Parcelable { + method public int describeContents(); + method @NonNull public java.util.List<android.net.LinkAddress> getAddresses(); + method public int getCause(); + method @NonNull public java.util.List<java.net.InetAddress> getDnsAddresses(); + method @NonNull public java.util.List<java.net.InetAddress> getGatewayAddresses(); + method public int getId(); + method @NonNull public String getInterfaceName(); + method public int getLinkStatus(); + method @Deprecated public int getMtu(); + method public int getMtuV4(); + method public int getMtuV6(); + method @NonNull public java.util.List<java.net.InetAddress> getPcscfAddresses(); + method public int getProtocolType(); + method public int getSuggestedRetryTime(); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.DataCallResponse> CREATOR; + field public static final int LINK_STATUS_ACTIVE = 2; // 0x2 + field public static final int LINK_STATUS_DORMANT = 1; // 0x1 + field public static final int LINK_STATUS_INACTIVE = 0; // 0x0 + field public static final int LINK_STATUS_UNKNOWN = -1; // 0xffffffff + } + + public static final class DataCallResponse.Builder { + ctor public DataCallResponse.Builder(); + method @NonNull public android.telephony.data.DataCallResponse build(); + method @NonNull public android.telephony.data.DataCallResponse.Builder setAddresses(@NonNull java.util.List<android.net.LinkAddress>); + method @NonNull public android.telephony.data.DataCallResponse.Builder setCause(int); + method @NonNull public android.telephony.data.DataCallResponse.Builder setDnsAddresses(@NonNull java.util.List<java.net.InetAddress>); + method @NonNull public android.telephony.data.DataCallResponse.Builder setGatewayAddresses(@NonNull java.util.List<java.net.InetAddress>); + method @NonNull public android.telephony.data.DataCallResponse.Builder setId(int); + method @NonNull public android.telephony.data.DataCallResponse.Builder setInterfaceName(@NonNull String); + method @NonNull public android.telephony.data.DataCallResponse.Builder setLinkStatus(int); + method @Deprecated @NonNull public android.telephony.data.DataCallResponse.Builder setMtu(int); + method @NonNull public android.telephony.data.DataCallResponse.Builder setMtuV4(int); + method @NonNull public android.telephony.data.DataCallResponse.Builder setMtuV6(int); + method @NonNull public android.telephony.data.DataCallResponse.Builder setPcscfAddresses(@NonNull java.util.List<java.net.InetAddress>); + method @NonNull public android.telephony.data.DataCallResponse.Builder setProtocolType(int); + method @NonNull public android.telephony.data.DataCallResponse.Builder setSuggestedRetryTime(int); + } + + public final class DataProfile implements android.os.Parcelable { + method public int describeContents(); + method @NonNull public String getApn(); + method public int getAuthType(); + method public int getBearerBitmask(); + method @Deprecated public int getMtu(); + method public int getMtuV4(); + method public int getMtuV6(); + method @Nullable public String getPassword(); + method public int getProfileId(); + method public int getProtocolType(); + method public int getRoamingProtocolType(); + method public int getSupportedApnTypesBitmask(); + method public int getType(); + method @Nullable public String getUserName(); + method public boolean isEnabled(); + method public boolean isPersistent(); + method public boolean isPreferred(); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.DataProfile> CREATOR; + field public static final int TYPE_3GPP = 1; // 0x1 + field public static final int TYPE_3GPP2 = 2; // 0x2 + field public static final int TYPE_COMMON = 0; // 0x0 + } + + public static final class DataProfile.Builder { + ctor public DataProfile.Builder(); + method @NonNull public android.telephony.data.DataProfile build(); + method @NonNull public android.telephony.data.DataProfile.Builder enable(boolean); + method @NonNull public android.telephony.data.DataProfile.Builder setApn(@NonNull String); + method @NonNull public android.telephony.data.DataProfile.Builder setAuthType(int); + method @NonNull public android.telephony.data.DataProfile.Builder setBearerBitmask(int); + method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setMtu(int); + method @NonNull public android.telephony.data.DataProfile.Builder setMtuV4(int); + method @NonNull public android.telephony.data.DataProfile.Builder setMtuV6(int); + method @NonNull public android.telephony.data.DataProfile.Builder setPassword(@NonNull String); + method @NonNull public android.telephony.data.DataProfile.Builder setPersistent(boolean); + method @NonNull public android.telephony.data.DataProfile.Builder setPreferred(boolean); + method @NonNull public android.telephony.data.DataProfile.Builder setProfileId(int); + method @NonNull public android.telephony.data.DataProfile.Builder setProtocolType(int); + method @NonNull public android.telephony.data.DataProfile.Builder setRoamingProtocolType(int); + method @NonNull public android.telephony.data.DataProfile.Builder setSupportedApnTypesBitmask(int); + method @NonNull public android.telephony.data.DataProfile.Builder setType(int); + method @NonNull public android.telephony.data.DataProfile.Builder setUserName(@NonNull String); + } + + public abstract class DataService extends android.app.Service { + ctor public DataService(); + method public android.os.IBinder onBind(android.content.Intent); + method @Nullable public abstract android.telephony.data.DataService.DataServiceProvider onCreateDataServiceProvider(int); + field public static final int REQUEST_REASON_HANDOVER = 3; // 0x3 + field public static final int REQUEST_REASON_NORMAL = 1; // 0x1 + field public static final int REQUEST_REASON_SHUTDOWN = 2; // 0x2 + field public static final int REQUEST_REASON_UNKNOWN = 0; // 0x0 + field public static final String SERVICE_INTERFACE = "android.telephony.data.DataService"; + } + + public abstract class DataService.DataServiceProvider implements java.lang.AutoCloseable { + ctor public DataService.DataServiceProvider(int); + method public abstract void close(); + method public void deactivateDataCall(int, int, @Nullable android.telephony.data.DataServiceCallback); + method public final int getSlotIndex(); + method public final void notifyDataCallListChanged(java.util.List<android.telephony.data.DataCallResponse>); + method public void requestDataCallList(@NonNull android.telephony.data.DataServiceCallback); + method public void setDataProfile(@NonNull java.util.List<android.telephony.data.DataProfile>, boolean, @NonNull android.telephony.data.DataServiceCallback); + method public void setInitialAttachApn(@NonNull android.telephony.data.DataProfile, boolean, @NonNull android.telephony.data.DataServiceCallback); + method public void setupDataCall(int, @NonNull android.telephony.data.DataProfile, boolean, boolean, int, @Nullable android.net.LinkProperties, @NonNull android.telephony.data.DataServiceCallback); + } + + public class DataServiceCallback { + method public void onDataCallListChanged(@NonNull java.util.List<android.telephony.data.DataCallResponse>); + method public void onDeactivateDataCallComplete(int); + method public void onRequestDataCallListComplete(int, @NonNull java.util.List<android.telephony.data.DataCallResponse>); + method public void onSetDataProfileComplete(int); + method public void onSetInitialAttachApnComplete(int); + method public void onSetupDataCallComplete(int, @Nullable android.telephony.data.DataCallResponse); + field public static final int RESULT_ERROR_BUSY = 3; // 0x3 + field public static final int RESULT_ERROR_ILLEGAL_STATE = 4; // 0x4 + field public static final int RESULT_ERROR_INVALID_ARG = 2; // 0x2 + field public static final int RESULT_ERROR_UNSUPPORTED = 1; // 0x1 + field public static final int RESULT_SUCCESS = 0; // 0x0 + } + + public abstract class QualifiedNetworksService extends android.app.Service { + ctor public QualifiedNetworksService(); + method @NonNull public abstract android.telephony.data.QualifiedNetworksService.NetworkAvailabilityProvider onCreateNetworkAvailabilityProvider(int); + field public static final String QUALIFIED_NETWORKS_SERVICE_INTERFACE = "android.telephony.data.QualifiedNetworksService"; + } + + public abstract class QualifiedNetworksService.NetworkAvailabilityProvider implements java.lang.AutoCloseable { + ctor public QualifiedNetworksService.NetworkAvailabilityProvider(int); + method public abstract void close(); + method public final int getSlotIndex(); + method public final void updateQualifiedNetworkTypes(int, @NonNull java.util.List<java.lang.Integer>); + } + +} + +package android.telephony.euicc { + + public final class DownloadableSubscription implements android.os.Parcelable { + method public java.util.List<android.telephony.UiccAccessRule> getAccessRules(); + method @Nullable public String getCarrierName(); + } + + public static final class DownloadableSubscription.Builder { + ctor public DownloadableSubscription.Builder(); + ctor public DownloadableSubscription.Builder(android.telephony.euicc.DownloadableSubscription); + method public android.telephony.euicc.DownloadableSubscription build(); + method public android.telephony.euicc.DownloadableSubscription.Builder setAccessRules(java.util.List<android.telephony.UiccAccessRule>); + method public android.telephony.euicc.DownloadableSubscription.Builder setCarrierName(String); + method public android.telephony.euicc.DownloadableSubscription.Builder setConfirmationCode(String); + method public android.telephony.euicc.DownloadableSubscription.Builder setEncodedActivationCode(String); + } + + public class EuiccCardManager { + method public void authenticateServer(String, String, byte[], byte[], byte[], byte[], java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>); + method public void cancelSession(String, byte[], @android.telephony.euicc.EuiccCardManager.CancelReason int, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>); + method public void deleteProfile(String, String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.Void>); + method public void disableProfile(String, String, boolean, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.Void>); + method public void listNotifications(String, @android.telephony.euicc.EuiccNotification.Event int, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.telephony.euicc.EuiccNotification[]>); + method public void loadBoundProfilePackage(String, byte[], java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>); + method public void prepareDownload(String, @Nullable byte[], byte[], byte[], byte[], java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>); + method public void removeNotificationFromList(String, int, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.Void>); + method public void requestAllProfiles(String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.service.euicc.EuiccProfileInfo[]>); + method public void requestDefaultSmdpAddress(String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.String>); + method public void requestEuiccChallenge(String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>); + method public void requestEuiccInfo1(String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>); + method public void requestEuiccInfo2(String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>); + method public void requestProfile(String, String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.service.euicc.EuiccProfileInfo>); + method public void requestRulesAuthTable(String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.telephony.euicc.EuiccRulesAuthTable>); + method public void requestSmdsAddress(String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.String>); + method public void resetMemory(String, @android.telephony.euicc.EuiccCardManager.ResetOption int, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.Void>); + method public void retrieveNotification(String, int, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.telephony.euicc.EuiccNotification>); + method public void retrieveNotificationList(String, @android.telephony.euicc.EuiccNotification.Event int, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.telephony.euicc.EuiccNotification[]>); + method public void setDefaultSmdpAddress(String, String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.Void>); + method public void setNickname(String, String, String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.Void>); + method public void switchToProfile(String, String, boolean, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.service.euicc.EuiccProfileInfo>); + field public static final int CANCEL_REASON_END_USER_REJECTED = 0; // 0x0 + field public static final int CANCEL_REASON_POSTPONED = 1; // 0x1 + field public static final int CANCEL_REASON_PPR_NOT_ALLOWED = 3; // 0x3 + field public static final int CANCEL_REASON_TIMEOUT = 2; // 0x2 + field public static final int RESET_OPTION_DELETE_FIELD_LOADED_TEST_PROFILES = 2; // 0x2 + field public static final int RESET_OPTION_DELETE_OPERATIONAL_PROFILES = 1; // 0x1 + field public static final int RESET_OPTION_RESET_DEFAULT_SMDP_ADDRESS = 4; // 0x4 + field public static final int RESULT_CALLER_NOT_ALLOWED = -3; // 0xfffffffd + field public static final int RESULT_EUICC_NOT_FOUND = -2; // 0xfffffffe + field public static final int RESULT_OK = 0; // 0x0 + field public static final int RESULT_UNKNOWN_ERROR = -1; // 0xffffffff + } + + @IntDef(prefix={"CANCEL_REASON_"}, value={android.telephony.euicc.EuiccCardManager.CANCEL_REASON_END_USER_REJECTED, android.telephony.euicc.EuiccCardManager.CANCEL_REASON_POSTPONED, android.telephony.euicc.EuiccCardManager.CANCEL_REASON_TIMEOUT, android.telephony.euicc.EuiccCardManager.CANCEL_REASON_PPR_NOT_ALLOWED}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface EuiccCardManager.CancelReason { + } + + @IntDef(flag=true, prefix={"RESET_OPTION_"}, value={android.telephony.euicc.EuiccCardManager.RESET_OPTION_DELETE_OPERATIONAL_PROFILES, android.telephony.euicc.EuiccCardManager.RESET_OPTION_DELETE_FIELD_LOADED_TEST_PROFILES, android.telephony.euicc.EuiccCardManager.RESET_OPTION_RESET_DEFAULT_SMDP_ADDRESS}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface EuiccCardManager.ResetOption { + } + + public static interface EuiccCardManager.ResultCallback<T> { + method public void onComplete(int, T); + } + + public class EuiccManager { + method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void continueOperation(android.content.Intent, android.os.Bundle); + method @Deprecated @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void eraseSubscriptions(@NonNull android.app.PendingIntent); + method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void eraseSubscriptions(@android.telephony.euicc.EuiccCardManager.ResetOption int, @NonNull android.app.PendingIntent); + method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void getDefaultDownloadableSubscriptionList(android.app.PendingIntent); + method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void getDownloadableSubscriptionMetadata(android.telephony.euicc.DownloadableSubscription, android.app.PendingIntent); + method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public int getOtaStatus(); + method @NonNull @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public java.util.List<java.lang.String> getSupportedCountries(); + method @NonNull @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public java.util.List<java.lang.String> getUnsupportedCountries(); + method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public boolean isSupportedCountry(@NonNull String); + method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void setSupportedCountries(@NonNull java.util.List<java.lang.String>); + method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void setUnsupportedCountries(@NonNull java.util.List<java.lang.String>); + field public static final String ACTION_DELETE_SUBSCRIPTION_PRIVILEGED = "android.telephony.euicc.action.DELETE_SUBSCRIPTION_PRIVILEGED"; + field @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public static final String ACTION_OTA_STATUS_CHANGED = "android.telephony.euicc.action.OTA_STATUS_CHANGED"; + field public static final String ACTION_PROVISION_EMBEDDED_SUBSCRIPTION = "android.telephony.euicc.action.PROVISION_EMBEDDED_SUBSCRIPTION"; + field public static final String ACTION_RENAME_SUBSCRIPTION_PRIVILEGED = "android.telephony.euicc.action.RENAME_SUBSCRIPTION_PRIVILEGED"; + field public static final String ACTION_TOGGLE_SUBSCRIPTION_PRIVILEGED = "android.telephony.euicc.action.TOGGLE_SUBSCRIPTION_PRIVILEGED"; + field public static final int EUICC_ACTIVATION_TYPE_ACCOUNT_REQUIRED = 4; // 0x4 + field public static final int EUICC_ACTIVATION_TYPE_BACKUP = 2; // 0x2 + field public static final int EUICC_ACTIVATION_TYPE_DEFAULT = 1; // 0x1 + field public static final int EUICC_ACTIVATION_TYPE_TRANSFER = 3; // 0x3 + field public static final int EUICC_OTA_FAILED = 2; // 0x2 + field public static final int EUICC_OTA_IN_PROGRESS = 1; // 0x1 + field public static final int EUICC_OTA_NOT_NEEDED = 4; // 0x4 + field public static final int EUICC_OTA_STATUS_UNAVAILABLE = 5; // 0x5 + field public static final int EUICC_OTA_SUCCEEDED = 3; // 0x3 + field public static final String EXTRA_ACTIVATION_TYPE = "android.telephony.euicc.extra.ACTIVATION_TYPE"; + field public static final String EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTIONS = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTIONS"; + field public static final String EXTRA_ENABLE_SUBSCRIPTION = "android.telephony.euicc.extra.ENABLE_SUBSCRIPTION"; + field public static final String EXTRA_FORCE_PROVISION = "android.telephony.euicc.extra.FORCE_PROVISION"; + field public static final String EXTRA_FROM_SUBSCRIPTION_ID = "android.telephony.euicc.extra.FROM_SUBSCRIPTION_ID"; + field public static final String EXTRA_PHYSICAL_SLOT_ID = "android.telephony.euicc.extra.PHYSICAL_SLOT_ID"; + field public static final String EXTRA_SUBSCRIPTION_ID = "android.telephony.euicc.extra.SUBSCRIPTION_ID"; + field public static final String EXTRA_SUBSCRIPTION_NICKNAME = "android.telephony.euicc.extra.SUBSCRIPTION_NICKNAME"; + } + + @IntDef(prefix={"EUICC_OTA_"}, value={android.telephony.euicc.EuiccManager.EUICC_OTA_IN_PROGRESS, android.telephony.euicc.EuiccManager.EUICC_OTA_FAILED, android.telephony.euicc.EuiccManager.EUICC_OTA_SUCCEEDED, android.telephony.euicc.EuiccManager.EUICC_OTA_NOT_NEEDED, android.telephony.euicc.EuiccManager.EUICC_OTA_STATUS_UNAVAILABLE}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface EuiccManager.OtaStatus { + } + + public final class EuiccNotification implements android.os.Parcelable { + ctor public EuiccNotification(int, String, @android.telephony.euicc.EuiccNotification.Event int, @Nullable byte[]); + method public int describeContents(); + method @Nullable public byte[] getData(); + method @android.telephony.euicc.EuiccNotification.Event public int getEvent(); + method public int getSeq(); + method public String getTargetAddr(); + method public void writeToParcel(android.os.Parcel, int); + field @android.telephony.euicc.EuiccNotification.Event public static final int ALL_EVENTS = 15; // 0xf + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.euicc.EuiccNotification> CREATOR; + field public static final int EVENT_DELETE = 8; // 0x8 + field public static final int EVENT_DISABLE = 4; // 0x4 + field public static final int EVENT_ENABLE = 2; // 0x2 + field public static final int EVENT_INSTALL = 1; // 0x1 + } + + @IntDef(flag=true, prefix={"EVENT_"}, value={android.telephony.euicc.EuiccNotification.EVENT_INSTALL, android.telephony.euicc.EuiccNotification.EVENT_ENABLE, android.telephony.euicc.EuiccNotification.EVENT_DISABLE, android.telephony.euicc.EuiccNotification.EVENT_DELETE}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface EuiccNotification.Event { + } + + public final class EuiccRulesAuthTable implements android.os.Parcelable { + method public int describeContents(); + method public int findIndex(@android.service.euicc.EuiccProfileInfo.PolicyRule int, android.service.carrier.CarrierIdentifier); + method public boolean hasPolicyRuleFlag(int, @android.telephony.euicc.EuiccRulesAuthTable.PolicyRuleFlag int); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.euicc.EuiccRulesAuthTable> CREATOR; + field public static final int POLICY_RULE_FLAG_CONSENT_REQUIRED = 1; // 0x1 + } + + public static final class EuiccRulesAuthTable.Builder { + ctor public EuiccRulesAuthTable.Builder(int); + method public android.telephony.euicc.EuiccRulesAuthTable.Builder add(int, java.util.List<android.service.carrier.CarrierIdentifier>, int); + method public android.telephony.euicc.EuiccRulesAuthTable build(); + } + + @IntDef(flag=true, prefix={"POLICY_RULE_FLAG_"}, value={android.telephony.euicc.EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface EuiccRulesAuthTable.PolicyRuleFlag { + } + +} + +package android.telephony.ims { + + public final class ImsCallForwardInfo implements android.os.Parcelable { + ctor public ImsCallForwardInfo(int, int, int, int, @NonNull String, int); + method public int describeContents(); + method public int getCondition(); + method public String getNumber(); + method public int getServiceClass(); + method public int getStatus(); + method public int getTimeSeconds(); + method public int getToA(); + method public void writeToParcel(android.os.Parcel, int); + field public static final int CDIV_CF_REASON_ALL = 4; // 0x4 + field public static final int CDIV_CF_REASON_ALL_CONDITIONAL = 5; // 0x5 + field public static final int CDIV_CF_REASON_BUSY = 1; // 0x1 + field public static final int CDIV_CF_REASON_NOT_LOGGED_IN = 6; // 0x6 + field public static final int CDIV_CF_REASON_NOT_REACHABLE = 3; // 0x3 + field public static final int CDIV_CF_REASON_NO_REPLY = 2; // 0x2 + field public static final int CDIV_CF_REASON_UNCONDITIONAL = 0; // 0x0 + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsCallForwardInfo> CREATOR; + field public static final int STATUS_ACTIVE = 1; // 0x1 + field public static final int STATUS_NOT_ACTIVE = 0; // 0x0 + field public static final int TYPE_OF_ADDRESS_INTERNATIONAL = 145; // 0x91 + field public static final int TYPE_OF_ADDRESS_UNKNOWN = 129; // 0x81 + } + + public final class ImsCallProfile implements android.os.Parcelable { + ctor public ImsCallProfile(); + ctor public ImsCallProfile(int, int); + ctor public ImsCallProfile(int, int, android.os.Bundle, android.telephony.ims.ImsStreamMediaProfile); + method public int describeContents(); + method public String getCallExtra(String); + method public String getCallExtra(String, String); + method public boolean getCallExtraBoolean(String); + method public boolean getCallExtraBoolean(String, boolean); + method public int getCallExtraInt(String); + method public int getCallExtraInt(String, int); + method public android.os.Bundle getCallExtras(); + method public int getCallType(); + method public static int getCallTypeFromVideoState(int); + method public int getCallerNumberVerificationStatus(); + method public int getEmergencyCallRouting(); + method public int getEmergencyServiceCategories(); + method @NonNull public java.util.List<java.lang.String> getEmergencyUrns(); + method public android.telephony.ims.ImsStreamMediaProfile getMediaProfile(); + method @NonNull public android.os.Bundle getProprietaryCallExtras(); + method public int getRestrictCause(); + method public int getServiceType(); + method public static int getVideoStateFromCallType(int); + method public static int getVideoStateFromImsCallProfile(android.telephony.ims.ImsCallProfile); + method public boolean hasKnownUserIntentEmergency(); + method public boolean isEmergencyCallTesting(); + method public boolean isVideoCall(); + method public boolean isVideoPaused(); + method public static int presentationToOir(int); + method public void setCallExtra(String, String); + method public void setCallExtraBoolean(String, boolean); + method public void setCallExtraInt(String, int); + method public void setCallRestrictCause(int); + method public void setCallerNumberVerificationStatus(int); + method public void setEmergencyCallRouting(int); + method public void setEmergencyCallTesting(boolean); + method public void setEmergencyServiceCategories(int); + method public void setEmergencyUrns(@NonNull java.util.List<java.lang.String>); + method public void setHasKnownUserIntentEmergency(boolean); + method public void updateCallExtras(android.telephony.ims.ImsCallProfile); + method public void updateCallType(android.telephony.ims.ImsCallProfile); + method public void updateMediaProfile(android.telephony.ims.ImsCallProfile); + method public void writeToParcel(android.os.Parcel, int); + field public static final int CALL_RESTRICT_CAUSE_DISABLED = 2; // 0x2 + field public static final int CALL_RESTRICT_CAUSE_HD = 3; // 0x3 + field public static final int CALL_RESTRICT_CAUSE_NONE = 0; // 0x0 + field public static final int CALL_RESTRICT_CAUSE_RAT = 1; // 0x1 + field public static final int CALL_TYPE_VIDEO_N_VOICE = 3; // 0x3 + field public static final int CALL_TYPE_VOICE = 2; // 0x2 + field public static final int CALL_TYPE_VOICE_N_VIDEO = 1; // 0x1 + field public static final int CALL_TYPE_VS = 8; // 0x8 + field public static final int CALL_TYPE_VS_RX = 10; // 0xa + field public static final int CALL_TYPE_VS_TX = 9; // 0x9 + field public static final int CALL_TYPE_VT = 4; // 0x4 + field public static final int CALL_TYPE_VT_NODIR = 7; // 0x7 + field public static final int CALL_TYPE_VT_RX = 6; // 0x6 + field public static final int CALL_TYPE_VT_TX = 5; // 0x5 + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsCallProfile> CREATOR; + field public static final int DIALSTRING_NORMAL = 0; // 0x0 + field public static final int DIALSTRING_SS_CONF = 1; // 0x1 + field public static final int DIALSTRING_USSD = 2; // 0x2 + field public static final String EXTRA_ADDITIONAL_CALL_INFO = "AdditionalCallInfo"; + field public static final String EXTRA_ADDITIONAL_SIP_INVITE_FIELDS = "android.telephony.ims.extra.ADDITIONAL_SIP_INVITE_FIELDS"; + field public static final String EXTRA_CALL_DISCONNECT_CAUSE = "android.telephony.ims.extra.CALL_DISCONNECT_CAUSE"; + field public static final String EXTRA_CALL_NETWORK_TYPE = "android.telephony.ims.extra.CALL_NETWORK_TYPE"; + field @Deprecated public static final String EXTRA_CALL_RAT_TYPE = "CallRadioTech"; + field public static final String EXTRA_CHILD_NUMBER = "ChildNum"; + field public static final String EXTRA_CNA = "cna"; + field public static final String EXTRA_CNAP = "cnap"; + field public static final String EXTRA_CODEC = "Codec"; + field public static final String EXTRA_DIALSTRING = "dialstring"; + field public static final String EXTRA_DISPLAY_TEXT = "DisplayText"; + field public static final String EXTRA_EMERGENCY_CALL = "e_call"; + field public static final String EXTRA_FORWARDED_NUMBER = "android.telephony.ims.extra.FORWARDED_NUMBER"; + field public static final String EXTRA_IS_CALL_PULL = "CallPull"; + field public static final String EXTRA_OI = "oi"; + field public static final String EXTRA_OIR = "oir"; + field public static final String EXTRA_REMOTE_URI = "remote_uri"; + field public static final String EXTRA_USSD = "ussd"; + field public static final int OIR_DEFAULT = 0; // 0x0 + field public static final int OIR_PRESENTATION_NOT_RESTRICTED = 2; // 0x2 + field public static final int OIR_PRESENTATION_PAYPHONE = 4; // 0x4 + field public static final int OIR_PRESENTATION_RESTRICTED = 1; // 0x1 + field public static final int OIR_PRESENTATION_UNKNOWN = 3; // 0x3 + field public static final int SERVICE_TYPE_EMERGENCY = 2; // 0x2 + field public static final int SERVICE_TYPE_NONE = 0; // 0x0 + field public static final int SERVICE_TYPE_NORMAL = 1; // 0x1 + field public static final int VERIFICATION_STATUS_FAILED = 2; // 0x2 + field public static final int VERIFICATION_STATUS_NOT_VERIFIED = 0; // 0x0 + field public static final int VERIFICATION_STATUS_PASSED = 1; // 0x1 + } + + public class ImsCallSessionListener { + method public void callQualityChanged(@NonNull android.telephony.CallQuality); + method public void callSessionConferenceExtendFailed(android.telephony.ims.ImsReasonInfo); + method public void callSessionConferenceExtendReceived(android.telephony.ims.stub.ImsCallSessionImplBase, android.telephony.ims.ImsCallProfile); + method public void callSessionConferenceExtended(android.telephony.ims.stub.ImsCallSessionImplBase, android.telephony.ims.ImsCallProfile); + method public void callSessionConferenceStateUpdated(android.telephony.ims.ImsConferenceState); + method @Deprecated public void callSessionHandover(int, int, android.telephony.ims.ImsReasonInfo); + method @Deprecated public void callSessionHandoverFailed(int, int, android.telephony.ims.ImsReasonInfo); + method public void callSessionHeld(android.telephony.ims.ImsCallProfile); + method public void callSessionHoldFailed(android.telephony.ims.ImsReasonInfo); + method public void callSessionHoldReceived(android.telephony.ims.ImsCallProfile); + method public void callSessionInitiated(android.telephony.ims.ImsCallProfile); + method public void callSessionInitiatedFailed(android.telephony.ims.ImsReasonInfo); + method public void callSessionInviteParticipantsRequestDelivered(); + method public void callSessionInviteParticipantsRequestFailed(android.telephony.ims.ImsReasonInfo); + method @Deprecated public void callSessionMayHandover(int, int); + method public void callSessionMergeComplete(android.telephony.ims.stub.ImsCallSessionImplBase); + method public void callSessionMergeFailed(android.telephony.ims.ImsReasonInfo); + method public void callSessionMergeStarted(android.telephony.ims.stub.ImsCallSessionImplBase, android.telephony.ims.ImsCallProfile); + method public void callSessionMultipartyStateChanged(boolean); + method public void callSessionProgressing(android.telephony.ims.ImsStreamMediaProfile); + method public void callSessionRemoveParticipantsRequestDelivered(); + method public void callSessionRemoveParticipantsRequestFailed(android.telephony.ims.ImsReasonInfo); + method public void callSessionResumeFailed(android.telephony.ims.ImsReasonInfo); + method public void callSessionResumeReceived(android.telephony.ims.ImsCallProfile); + method public void callSessionResumed(android.telephony.ims.ImsCallProfile); + method public void callSessionRttAudioIndicatorChanged(@NonNull android.telephony.ims.ImsStreamMediaProfile); + method public void callSessionRttMessageReceived(String); + method public void callSessionRttModifyRequestReceived(android.telephony.ims.ImsCallProfile); + method public void callSessionRttModifyResponseReceived(int); + method public void callSessionSuppServiceReceived(android.telephony.ims.ImsSuppServiceNotification); + method public void callSessionTerminated(android.telephony.ims.ImsReasonInfo); + method public void callSessionTtyModeReceived(int); + method public void callSessionUpdateFailed(android.telephony.ims.ImsReasonInfo); + method public void callSessionUpdateReceived(android.telephony.ims.ImsCallProfile); + method public void callSessionUpdated(android.telephony.ims.ImsCallProfile); + method public void callSessionUssdMessageReceived(int, String); + method public void onHandover(int, int, @Nullable android.telephony.ims.ImsReasonInfo); + method public void onHandoverFailed(int, int, @NonNull android.telephony.ims.ImsReasonInfo); + method public void onMayHandover(int, int); + } + + public final class ImsConferenceState implements android.os.Parcelable { + method public int describeContents(); + method public static int getConnectionStateForStatus(String); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsConferenceState> CREATOR; + field public static final String DISPLAY_TEXT = "display-text"; + field public static final String ENDPOINT = "endpoint"; + field public static final String SIP_STATUS_CODE = "sipstatuscode"; + field public static final String STATUS = "status"; + field public static final String STATUS_ALERTING = "alerting"; + field public static final String STATUS_CONNECTED = "connected"; + field public static final String STATUS_CONNECT_FAIL = "connect-fail"; + field public static final String STATUS_DIALING_IN = "dialing-in"; + field public static final String STATUS_DIALING_OUT = "dialing-out"; + field public static final String STATUS_DISCONNECTED = "disconnected"; + field public static final String STATUS_DISCONNECTING = "disconnecting"; + field public static final String STATUS_MUTED_VIA_FOCUS = "muted-via-focus"; + field public static final String STATUS_ON_HOLD = "on-hold"; + field public static final String STATUS_PENDING = "pending"; + field public static final String STATUS_SEND_ONLY = "sendonly"; + field public static final String STATUS_SEND_RECV = "sendrecv"; + field public static final String USER = "user"; + field public final java.util.HashMap<java.lang.String,android.os.Bundle> mParticipants; + } + + public final class ImsException extends java.lang.Exception { + ctor public ImsException(@Nullable String); + ctor public ImsException(@Nullable String, int); + ctor public ImsException(@Nullable String, int, @Nullable Throwable); + } + + public final class ImsExternalCallState implements android.os.Parcelable { + ctor public ImsExternalCallState(@NonNull String, @NonNull android.net.Uri, @Nullable android.net.Uri, boolean, int, int, boolean); + method public int describeContents(); + method @NonNull public android.net.Uri getAddress(); + method public int getCallId(); + method public int getCallState(); + method public int getCallType(); + method @Nullable public android.net.Uri getLocalAddress(); + method public boolean isCallHeld(); + method public boolean isCallPullable(); + method public void writeToParcel(android.os.Parcel, int); + field public static final int CALL_STATE_CONFIRMED = 1; // 0x1 + field public static final int CALL_STATE_TERMINATED = 2; // 0x2 + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsExternalCallState> CREATOR; + } + + public class ImsMmTelManager implements android.telephony.ims.RegistrationManager { + method @Deprecated @NonNull @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public static android.telephony.ims.ImsMmTelManager createForSubscriptionId(int); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void getFeatureState(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>) throws android.telephony.ims.ImsException; + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void getRegistrationState(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getVoWiFiRoamingModeSetting(); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isAvailable(int, int); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isCapable(int, int); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void isSupported(int, int, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>) throws android.telephony.ims.ImsException; + method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void registerImsRegistrationCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ImsMmTelManager.RegistrationCallback) throws android.telephony.ims.ImsException; + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setAdvancedCallingSettingEnabled(boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setRttCapabilitySetting(boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiModeSetting(int); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiNonPersistent(boolean, int); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiRoamingModeSetting(int); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiRoamingSettingEnabled(boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiSettingEnabled(boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVtSettingEnabled(boolean); + method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void unregisterImsRegistrationCallback(@NonNull android.telephony.ims.ImsMmTelManager.RegistrationCallback); + } + + @Deprecated public static class ImsMmTelManager.RegistrationCallback extends android.telephony.ims.RegistrationManager.RegistrationCallback { + ctor @Deprecated public ImsMmTelManager.RegistrationCallback(); + } + + public final class ImsReasonInfo implements android.os.Parcelable { + field public static final String EXTRA_MSG_SERVICE_NOT_AUTHORIZED = "Forbidden. Not Authorized for Service"; + } + + public class ImsService extends android.app.Service { + ctor public ImsService(); + method public android.telephony.ims.feature.MmTelFeature createMmTelFeature(int); + method public android.telephony.ims.feature.RcsFeature createRcsFeature(int); + method public void disableIms(int); + method public void enableIms(int); + method public android.telephony.ims.stub.ImsConfigImplBase getConfig(int); + method public android.telephony.ims.stub.ImsRegistrationImplBase getRegistration(int); + method public final void onUpdateSupportedImsFeatures(android.telephony.ims.stub.ImsFeatureConfiguration) throws android.os.RemoteException; + method public android.telephony.ims.stub.ImsFeatureConfiguration querySupportedImsFeatures(); + method public void readyForFeatureCreation(); + } + + public final class ImsSsData implements android.os.Parcelable { + ctor public ImsSsData(int, int, int, int, int); + method public int describeContents(); + method @Nullable public java.util.List<android.telephony.ims.ImsCallForwardInfo> getCallForwardInfo(); + method public int getRequestType(); + method public int getResult(); + method public int getServiceClass(); + method public int getServiceType(); + method @NonNull public java.util.List<android.telephony.ims.ImsSsInfo> getSuppServiceInfo(); + method public int getTeleserviceType(); + method public boolean isTypeBarring(); + method public boolean isTypeCf(); + method public boolean isTypeClip(); + method public boolean isTypeClir(); + method public boolean isTypeColp(); + method public boolean isTypeColr(); + method public boolean isTypeCw(); + method public boolean isTypeIcb(); + method public boolean isTypeInterrogation(); + method public boolean isTypeUnConditional(); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsSsData> CREATOR; + field public static final int RESULT_SUCCESS = 0; // 0x0 + field public static final int SERVICE_CLASS_DATA = 2; // 0x2 + field public static final int SERVICE_CLASS_DATA_CIRCUIT_ASYNC = 32; // 0x20 + field public static final int SERVICE_CLASS_DATA_CIRCUIT_SYNC = 16; // 0x10 + field public static final int SERVICE_CLASS_DATA_PACKET_ACCESS = 64; // 0x40 + field public static final int SERVICE_CLASS_DATA_PAD = 128; // 0x80 + field public static final int SERVICE_CLASS_FAX = 4; // 0x4 + field public static final int SERVICE_CLASS_NONE = 0; // 0x0 + field public static final int SERVICE_CLASS_SMS = 8; // 0x8 + field public static final int SERVICE_CLASS_VOICE = 1; // 0x1 + field public static final int SS_ACTIVATION = 0; // 0x0 + field public static final int SS_ALL_BARRING = 18; // 0x12 + field public static final int SS_ALL_DATA_TELESERVICES = 3; // 0x3 + field public static final int SS_ALL_TELESERVICES_EXCEPT_SMS = 5; // 0x5 + field public static final int SS_ALL_TELESEVICES = 1; // 0x1 + field public static final int SS_ALL_TELE_AND_BEARER_SERVICES = 0; // 0x0 + field public static final int SS_BAIC = 16; // 0x10 + field public static final int SS_BAIC_ROAMING = 17; // 0x11 + field public static final int SS_BAOC = 13; // 0xd + field public static final int SS_BAOIC = 14; // 0xe + field public static final int SS_BAOIC_EXC_HOME = 15; // 0xf + field public static final int SS_CFU = 0; // 0x0 + field public static final int SS_CFUT = 6; // 0x6 + field public static final int SS_CF_ALL = 4; // 0x4 + field public static final int SS_CF_ALL_CONDITIONAL = 5; // 0x5 + field public static final int SS_CF_BUSY = 1; // 0x1 + field public static final int SS_CF_NOT_REACHABLE = 3; // 0x3 + field public static final int SS_CF_NO_REPLY = 2; // 0x2 + field public static final int SS_CLIP = 7; // 0x7 + field public static final int SS_CLIR = 8; // 0x8 + field public static final int SS_CNAP = 11; // 0xb + field public static final int SS_COLP = 9; // 0x9 + field public static final int SS_COLR = 10; // 0xa + field public static final int SS_DEACTIVATION = 1; // 0x1 + field public static final int SS_ERASURE = 4; // 0x4 + field public static final int SS_INCOMING_BARRING = 20; // 0x14 + field public static final int SS_INCOMING_BARRING_ANONYMOUS = 22; // 0x16 + field public static final int SS_INCOMING_BARRING_DN = 21; // 0x15 + field public static final int SS_INTERROGATION = 2; // 0x2 + field public static final int SS_OUTGOING_BARRING = 19; // 0x13 + field public static final int SS_REGISTRATION = 3; // 0x3 + field public static final int SS_SMS_SERVICES = 4; // 0x4 + field public static final int SS_TELEPHONY = 2; // 0x2 + field public static final int SS_WAIT = 12; // 0xc + } + + public static final class ImsSsData.Builder { + ctor public ImsSsData.Builder(int, int, int, int, int); + method @NonNull public android.telephony.ims.ImsSsData build(); + method @NonNull public android.telephony.ims.ImsSsData.Builder setCallForwardingInfo(@NonNull java.util.List<android.telephony.ims.ImsCallForwardInfo>); + method @NonNull public android.telephony.ims.ImsSsData.Builder setSuppServiceInfo(@NonNull java.util.List<android.telephony.ims.ImsSsInfo>); + } + + public final class ImsSsInfo implements android.os.Parcelable { + ctor @Deprecated public ImsSsInfo(int, @Nullable String); + method public int describeContents(); + method public int getClirInterrogationStatus(); + method public int getClirOutgoingState(); + method @Deprecated public String getIcbNum(); + method @Nullable public String getIncomingCommunicationBarringNumber(); + method public int getProvisionStatus(); + method public int getStatus(); + method public void writeToParcel(android.os.Parcel, int); + field public static final int CLIR_OUTGOING_DEFAULT = 0; // 0x0 + field public static final int CLIR_OUTGOING_INVOCATION = 1; // 0x1 + field public static final int CLIR_OUTGOING_SUPPRESSION = 2; // 0x2 + field public static final int CLIR_STATUS_NOT_PROVISIONED = 0; // 0x0 + field public static final int CLIR_STATUS_PROVISIONED_PERMANENT = 1; // 0x1 + field public static final int CLIR_STATUS_TEMPORARILY_ALLOWED = 4; // 0x4 + field public static final int CLIR_STATUS_TEMPORARILY_RESTRICTED = 3; // 0x3 + field public static final int CLIR_STATUS_UNKNOWN = 2; // 0x2 + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsSsInfo> CREATOR; + field public static final int DISABLED = 0; // 0x0 + field public static final int ENABLED = 1; // 0x1 + field public static final int NOT_REGISTERED = -1; // 0xffffffff + field public static final int SERVICE_NOT_PROVISIONED = 0; // 0x0 + field public static final int SERVICE_PROVISIONED = 1; // 0x1 + field public static final int SERVICE_PROVISIONING_UNKNOWN = -1; // 0xffffffff + } + + public static final class ImsSsInfo.Builder { + ctor public ImsSsInfo.Builder(int); + method @NonNull public android.telephony.ims.ImsSsInfo build(); + method @NonNull public android.telephony.ims.ImsSsInfo.Builder setClirInterrogationStatus(int); + method @NonNull public android.telephony.ims.ImsSsInfo.Builder setClirOutgoingState(int); + method @NonNull public android.telephony.ims.ImsSsInfo.Builder setIncomingCommunicationBarringNumber(@NonNull String); + method @NonNull public android.telephony.ims.ImsSsInfo.Builder setProvisionStatus(int); + } + + public final class ImsStreamMediaProfile implements android.os.Parcelable { + ctor public ImsStreamMediaProfile(int, int, int, int, int); + method public void copyFrom(android.telephony.ims.ImsStreamMediaProfile); + method public int describeContents(); + method public int getAudioDirection(); + method public int getAudioQuality(); + method public int getRttMode(); + method public int getVideoDirection(); + method public int getVideoQuality(); + method public boolean isReceivingRttAudio(); + method public boolean isRttCall(); + method public void setReceivingRttAudio(boolean); + method public void setRttMode(int); + method public void writeToParcel(android.os.Parcel, int); + field public static final int AUDIO_QUALITY_AMR = 1; // 0x1 + field public static final int AUDIO_QUALITY_AMR_WB = 2; // 0x2 + field public static final int AUDIO_QUALITY_EVRC = 4; // 0x4 + field public static final int AUDIO_QUALITY_EVRC_B = 5; // 0x5 + field public static final int AUDIO_QUALITY_EVRC_NW = 7; // 0x7 + field public static final int AUDIO_QUALITY_EVRC_WB = 6; // 0x6 + field public static final int AUDIO_QUALITY_EVS_FB = 20; // 0x14 + field public static final int AUDIO_QUALITY_EVS_NB = 17; // 0x11 + field public static final int AUDIO_QUALITY_EVS_SWB = 19; // 0x13 + field public static final int AUDIO_QUALITY_EVS_WB = 18; // 0x12 + field public static final int AUDIO_QUALITY_G711A = 13; // 0xd + field public static final int AUDIO_QUALITY_G711AB = 15; // 0xf + field public static final int AUDIO_QUALITY_G711U = 11; // 0xb + field public static final int AUDIO_QUALITY_G722 = 14; // 0xe + field public static final int AUDIO_QUALITY_G723 = 12; // 0xc + field public static final int AUDIO_QUALITY_G729 = 16; // 0x10 + field public static final int AUDIO_QUALITY_GSM_EFR = 8; // 0x8 + field public static final int AUDIO_QUALITY_GSM_FR = 9; // 0x9 + field public static final int AUDIO_QUALITY_GSM_HR = 10; // 0xa + field public static final int AUDIO_QUALITY_NONE = 0; // 0x0 + field public static final int AUDIO_QUALITY_QCELP13K = 3; // 0x3 + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsStreamMediaProfile> CREATOR; + field public static final int DIRECTION_INACTIVE = 0; // 0x0 + field public static final int DIRECTION_INVALID = -1; // 0xffffffff + field public static final int DIRECTION_RECEIVE = 1; // 0x1 + field public static final int DIRECTION_SEND = 2; // 0x2 + field public static final int DIRECTION_SEND_RECEIVE = 3; // 0x3 + field public static final int RTT_MODE_DISABLED = 0; // 0x0 + field public static final int RTT_MODE_FULL = 1; // 0x1 + field public static final int VIDEO_QUALITY_NONE = 0; // 0x0 + field public static final int VIDEO_QUALITY_QCIF = 1; // 0x1 + field public static final int VIDEO_QUALITY_QVGA_LANDSCAPE = 2; // 0x2 + field public static final int VIDEO_QUALITY_QVGA_PORTRAIT = 4; // 0x4 + field public static final int VIDEO_QUALITY_VGA_LANDSCAPE = 8; // 0x8 + field public static final int VIDEO_QUALITY_VGA_PORTRAIT = 16; // 0x10 + } + + public final class ImsSuppServiceNotification implements android.os.Parcelable { + ctor public ImsSuppServiceNotification(int, int, int, int, String, String[]); + method public int describeContents(); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsSuppServiceNotification> CREATOR; + field public final int code; + field public final String[] history; + field public final int index; + field public final int notificationType; + field public final String number; + field public final int type; + } + + public class ImsUtListener { + method public void onLineIdentificationSupplementaryServiceResponse(int, @NonNull android.telephony.ims.ImsSsInfo); + method public void onSupplementaryServiceIndication(android.telephony.ims.ImsSsData); + method public void onUtConfigurationCallBarringQueried(int, android.telephony.ims.ImsSsInfo[]); + method public void onUtConfigurationCallForwardQueried(int, android.telephony.ims.ImsCallForwardInfo[]); + method public void onUtConfigurationCallWaitingQueried(int, android.telephony.ims.ImsSsInfo[]); + method @Deprecated public void onUtConfigurationQueried(int, android.os.Bundle); + method public void onUtConfigurationQueryFailed(int, android.telephony.ims.ImsReasonInfo); + method public void onUtConfigurationUpdateFailed(int, android.telephony.ims.ImsReasonInfo); + method public void onUtConfigurationUpdated(int); + field @Deprecated public static final String BUNDLE_KEY_CLIR = "queryClir"; + field @Deprecated public static final String BUNDLE_KEY_SSINFO = "imsSsInfo"; + } + + public abstract class ImsVideoCallProvider { + ctor public ImsVideoCallProvider(); + method public void changeCallDataUsage(long); + method public void changeCameraCapabilities(android.telecom.VideoProfile.CameraCapabilities); + method public void changePeerDimensions(int, int); + method public void changeVideoQuality(int); + method public void handleCallSessionEvent(int); + method public abstract void onRequestCallDataUsage(); + method public abstract void onRequestCameraCapabilities(); + method public abstract void onSendSessionModifyRequest(android.telecom.VideoProfile, android.telecom.VideoProfile); + method public abstract void onSendSessionModifyResponse(android.telecom.VideoProfile); + method public abstract void onSetCamera(String); + method public void onSetCamera(String, int); + method public abstract void onSetDeviceOrientation(int); + method public abstract void onSetDisplaySurface(android.view.Surface); + method public abstract void onSetPauseImage(android.net.Uri); + method public abstract void onSetPreviewSurface(android.view.Surface); + method public abstract void onSetZoom(float); + method public void receiveSessionModifyRequest(android.telecom.VideoProfile); + method public void receiveSessionModifyResponse(int, android.telecom.VideoProfile, android.telecom.VideoProfile); + } + + public class ProvisioningManager { + method @NonNull public static android.telephony.ims.ProvisioningManager createForSubscriptionId(int); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @WorkerThread public int getProvisioningIntValue(int); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @WorkerThread public boolean getProvisioningStatusForCapability(int, int); + method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @WorkerThread public String getProvisioningStringValue(int); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @WorkerThread public boolean getRcsProvisioningStatusForCapability(int); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void notifyRcsAutoConfigurationReceived(@NonNull byte[], boolean); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void registerProvisioningChangedCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ProvisioningManager.Callback) throws android.telephony.ims.ImsException; + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public int setProvisioningIntValue(int, int); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public void setProvisioningStatusForCapability(int, int, boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public int setProvisioningStringValue(int, @NonNull String); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public void setRcsProvisioningStatusForCapability(int, boolean); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void unregisterProvisioningChangedCallback(@NonNull android.telephony.ims.ProvisioningManager.Callback); + field public static final int KEY_VOICE_OVER_WIFI_MODE_OVERRIDE = 27; // 0x1b + field public static final int KEY_VOICE_OVER_WIFI_ROAMING_ENABLED_OVERRIDE = 26; // 0x1a + field public static final int PROVISIONING_VALUE_DISABLED = 0; // 0x0 + field public static final int PROVISIONING_VALUE_ENABLED = 1; // 0x1 + field public static final String STRING_QUERY_RESULT_ERROR_GENERIC = "STRING_QUERY_RESULT_ERROR_GENERIC"; + field public static final String STRING_QUERY_RESULT_ERROR_NOT_READY = "STRING_QUERY_RESULT_ERROR_NOT_READY"; + } + + public static class ProvisioningManager.Callback { + ctor public ProvisioningManager.Callback(); + method public void onProvisioningIntChanged(int, int); + method public void onProvisioningStringChanged(int, @NonNull String); + } + + public class RcsUceAdapter { + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUceSettingEnabled(boolean) throws android.telephony.ims.ImsException; + } + +} + +package android.telephony.ims.feature { + + public final class CapabilityChangeRequest implements android.os.Parcelable { + method public void addCapabilitiesToDisableForTech(int, int); + method public void addCapabilitiesToEnableForTech(int, int); + method public int describeContents(); + method public java.util.List<android.telephony.ims.feature.CapabilityChangeRequest.CapabilityPair> getCapabilitiesToDisable(); + method public java.util.List<android.telephony.ims.feature.CapabilityChangeRequest.CapabilityPair> getCapabilitiesToEnable(); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.feature.CapabilityChangeRequest> CREATOR; + } + + public static class CapabilityChangeRequest.CapabilityPair { + ctor public CapabilityChangeRequest.CapabilityPair(int, int); + method public int getCapability(); + method public int getRadioTech(); + } + + public abstract class ImsFeature { + ctor public ImsFeature(); + method public abstract void changeEnabledCapabilities(android.telephony.ims.feature.CapabilityChangeRequest, android.telephony.ims.feature.ImsFeature.CapabilityCallbackProxy); + method public int getFeatureState(); + method public final int getSlotIndex(); + method public abstract void onFeatureReady(); + method public abstract void onFeatureRemoved(); + method public final void setFeatureState(int); + field public static final int CAPABILITY_ERROR_GENERIC = -1; // 0xffffffff + field public static final int CAPABILITY_SUCCESS = 0; // 0x0 + field public static final int FEATURE_EMERGENCY_MMTEL = 0; // 0x0 + field public static final int FEATURE_MMTEL = 1; // 0x1 + field public static final int FEATURE_RCS = 2; // 0x2 + field public static final int STATE_INITIALIZING = 1; // 0x1 + field public static final int STATE_READY = 2; // 0x2 + field public static final int STATE_UNAVAILABLE = 0; // 0x0 + } + + @Deprecated public static class ImsFeature.Capabilities { + field @Deprecated protected int mCapabilities; + } + + protected static class ImsFeature.CapabilityCallbackProxy { + method public void onChangeCapabilityConfigurationError(int, int, int); + } + + public class MmTelFeature extends android.telephony.ims.feature.ImsFeature { + ctor public MmTelFeature(); + method public void changeEnabledCapabilities(@NonNull android.telephony.ims.feature.CapabilityChangeRequest, @NonNull android.telephony.ims.feature.ImsFeature.CapabilityCallbackProxy); + method @Nullable public android.telephony.ims.ImsCallProfile createCallProfile(int, int); + method @Nullable public android.telephony.ims.stub.ImsCallSessionImplBase createCallSession(@NonNull android.telephony.ims.ImsCallProfile); + method @NonNull public android.telephony.ims.stub.ImsEcbmImplBase getEcbm(); + method @NonNull public android.telephony.ims.stub.ImsMultiEndpointImplBase getMultiEndpoint(); + method @NonNull public android.telephony.ims.stub.ImsSmsImplBase getSmsImplementation(); + method @NonNull public android.telephony.ims.stub.ImsUtImplBase getUt(); + method public final void notifyCapabilitiesStatusChanged(@NonNull android.telephony.ims.feature.MmTelFeature.MmTelCapabilities); + method public final void notifyIncomingCall(@NonNull android.telephony.ims.stub.ImsCallSessionImplBase, @NonNull android.os.Bundle); + method public final void notifyRejectedCall(@NonNull android.telephony.ims.ImsCallProfile, @NonNull android.telephony.ims.ImsReasonInfo); + method public final void notifyVoiceMessageCountUpdate(int); + method public void onFeatureReady(); + method public void onFeatureRemoved(); + method public boolean queryCapabilityConfiguration(int, int); + method @NonNull public final android.telephony.ims.feature.MmTelFeature.MmTelCapabilities queryCapabilityStatus(); + method public void setUiTtyMode(int, @Nullable android.os.Message); + method public int shouldProcessCall(@NonNull String[]); + field public static final String EXTRA_IS_UNKNOWN_CALL = "android.telephony.ims.feature.extra.IS_UNKNOWN_CALL"; + field public static final String EXTRA_IS_USSD = "android.telephony.ims.feature.extra.IS_USSD"; + field public static final int PROCESS_CALL_CSFB = 1; // 0x1 + field public static final int PROCESS_CALL_IMS = 0; // 0x0 + } + + public static class MmTelFeature.MmTelCapabilities extends android.telephony.ims.feature.ImsFeature.Capabilities { + ctor public MmTelFeature.MmTelCapabilities(); + ctor @Deprecated public MmTelFeature.MmTelCapabilities(android.telephony.ims.feature.ImsFeature.Capabilities); + ctor public MmTelFeature.MmTelCapabilities(int); + method public final void addCapabilities(int); + method public final boolean isCapable(int); + method public final void removeCapabilities(int); + } + + public class RcsFeature extends android.telephony.ims.feature.ImsFeature { + ctor public RcsFeature(); + method public void changeEnabledCapabilities(@NonNull android.telephony.ims.feature.CapabilityChangeRequest, @NonNull android.telephony.ims.feature.ImsFeature.CapabilityCallbackProxy); + method public void onFeatureReady(); + method public void onFeatureRemoved(); + } + +} + +package android.telephony.ims.stub { + + public class ImsCallSessionImplBase implements java.lang.AutoCloseable { + ctor public ImsCallSessionImplBase(); + method public void accept(int, android.telephony.ims.ImsStreamMediaProfile); + method public void close(); + method public void deflect(String); + method public void extendToConference(String[]); + method public String getCallId(); + method public android.telephony.ims.ImsCallProfile getCallProfile(); + method public android.telephony.ims.ImsVideoCallProvider getImsVideoCallProvider(); + method public android.telephony.ims.ImsCallProfile getLocalCallProfile(); + method public String getProperty(String); + method public android.telephony.ims.ImsCallProfile getRemoteCallProfile(); + method public int getState(); + method public void hold(android.telephony.ims.ImsStreamMediaProfile); + method public void inviteParticipants(String[]); + method public boolean isInCall(); + method public boolean isMultiparty(); + method public void merge(); + method public void reject(int); + method public void removeParticipants(String[]); + method public void resume(android.telephony.ims.ImsStreamMediaProfile); + method public void sendDtmf(char, android.os.Message); + method public void sendRttMessage(String); + method public void sendRttModifyRequest(android.telephony.ims.ImsCallProfile); + method public void sendRttModifyResponse(boolean); + method public void sendUssd(String); + method public void setListener(android.telephony.ims.ImsCallSessionListener); + method public void setMute(boolean); + method public void start(String, android.telephony.ims.ImsCallProfile); + method public void startConference(String[], android.telephony.ims.ImsCallProfile); + method public void startDtmf(char); + method public void stopDtmf(); + method public void terminate(int); + method public void update(int, android.telephony.ims.ImsStreamMediaProfile); + field public static final int USSD_MODE_NOTIFY = 0; // 0x0 + field public static final int USSD_MODE_REQUEST = 1; // 0x1 + } + + public static class ImsCallSessionImplBase.State { + method public static String toString(int); + field public static final int ESTABLISHED = 4; // 0x4 + field public static final int ESTABLISHING = 3; // 0x3 + field public static final int IDLE = 0; // 0x0 + field public static final int INITIATED = 1; // 0x1 + field public static final int INVALID = -1; // 0xffffffff + field public static final int NEGOTIATING = 2; // 0x2 + field public static final int REESTABLISHING = 6; // 0x6 + field public static final int RENEGOTIATING = 5; // 0x5 + field public static final int TERMINATED = 8; // 0x8 + field public static final int TERMINATING = 7; // 0x7 + } + + public class ImsConfigImplBase { + ctor public ImsConfigImplBase(); + method public int getConfigInt(int); + method public String getConfigString(int); + method public final void notifyProvisionedValueChanged(int, int); + method public final void notifyProvisionedValueChanged(int, String); + method public void notifyRcsAutoConfigurationReceived(@NonNull byte[], boolean); + method public int setConfig(int, int); + method public int setConfig(int, String); + field public static final int CONFIG_RESULT_FAILED = 1; // 0x1 + field public static final int CONFIG_RESULT_SUCCESS = 0; // 0x0 + field public static final int CONFIG_RESULT_UNKNOWN = -1; // 0xffffffff + } + + public class ImsEcbmImplBase { + ctor public ImsEcbmImplBase(); + method public final void enteredEcbm(); + method public void exitEmergencyCallbackMode(); + method public final void exitedEcbm(); + } + + public final class ImsFeatureConfiguration implements android.os.Parcelable { + method public int describeContents(); + method public java.util.Set<android.telephony.ims.stub.ImsFeatureConfiguration.FeatureSlotPair> getServiceFeatures(); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.stub.ImsFeatureConfiguration> CREATOR; + } + + public static class ImsFeatureConfiguration.Builder { + ctor public ImsFeatureConfiguration.Builder(); + method public android.telephony.ims.stub.ImsFeatureConfiguration.Builder addFeature(int, int); + method public android.telephony.ims.stub.ImsFeatureConfiguration build(); + } + + public static final class ImsFeatureConfiguration.FeatureSlotPair { + ctor public ImsFeatureConfiguration.FeatureSlotPair(int, int); + field public final int featureType; + field public final int slotId; + } + + public class ImsMultiEndpointImplBase { + ctor public ImsMultiEndpointImplBase(); + method public final void onImsExternalCallStateUpdate(java.util.List<android.telephony.ims.ImsExternalCallState>); + method public void requestImsExternalCallStateInfo(); + } + + public class ImsRegistrationImplBase { + ctor public ImsRegistrationImplBase(); + method public final void onDeregistered(android.telephony.ims.ImsReasonInfo); + method public final void onRegistered(int); + method public final void onRegistering(int); + method public final void onSubscriberAssociatedUriChanged(android.net.Uri[]); + method public final void onTechnologyChangeFailed(int, android.telephony.ims.ImsReasonInfo); + field public static final int REGISTRATION_TECH_IWLAN = 1; // 0x1 + field public static final int REGISTRATION_TECH_LTE = 0; // 0x0 + field public static final int REGISTRATION_TECH_NONE = -1; // 0xffffffff + } + + public class ImsSmsImplBase { + ctor public ImsSmsImplBase(); + method public void acknowledgeSms(int, @IntRange(from=0, to=65535) int, int); + method public void acknowledgeSmsReport(int, @IntRange(from=0, to=65535) int, int); + method public String getSmsFormat(); + method public void onReady(); + method @Deprecated public final void onSendSmsResult(int, @IntRange(from=0, to=65535) int, int, int) throws java.lang.RuntimeException; + method public final void onSendSmsResultError(int, @IntRange(from=0, to=65535) int, int, int, int) throws java.lang.RuntimeException; + method public final void onSendSmsResultSuccess(int, @IntRange(from=0, to=65535) int) throws java.lang.RuntimeException; + method public final void onSmsReceived(int, String, byte[]) throws java.lang.RuntimeException; + method @Deprecated public final void onSmsStatusReportReceived(int, @IntRange(from=0, to=65535) int, String, byte[]) throws java.lang.RuntimeException; + method public final void onSmsStatusReportReceived(int, String, byte[]) throws java.lang.RuntimeException; + method public void sendSms(int, @IntRange(from=0, to=65535) int, String, String, boolean, byte[]); + field public static final int DELIVER_STATUS_ERROR_GENERIC = 2; // 0x2 + field public static final int DELIVER_STATUS_ERROR_NO_MEMORY = 3; // 0x3 + field public static final int DELIVER_STATUS_ERROR_REQUEST_NOT_SUPPORTED = 4; // 0x4 + field public static final int DELIVER_STATUS_OK = 1; // 0x1 + field public static final int RESULT_NO_NETWORK_ERROR = -1; // 0xffffffff + field public static final int SEND_STATUS_ERROR = 2; // 0x2 + field public static final int SEND_STATUS_ERROR_FALLBACK = 4; // 0x4 + field public static final int SEND_STATUS_ERROR_RETRY = 3; // 0x3 + field public static final int SEND_STATUS_OK = 1; // 0x1 + field public static final int STATUS_REPORT_STATUS_ERROR = 2; // 0x2 + field public static final int STATUS_REPORT_STATUS_OK = 1; // 0x1 + } + + public class ImsUtImplBase { + ctor public ImsUtImplBase(); + method public void close(); + method public int queryCallBarring(int); + method public int queryCallBarringForServiceClass(int, int); + method public int queryCallForward(int, String); + method public int queryCallWaiting(); + method public int queryClip(); + method public int queryClir(); + method public int queryColp(); + method public int queryColr(); + method public void setListener(android.telephony.ims.ImsUtListener); + method public int transact(android.os.Bundle); + method public int updateCallBarring(int, int, String[]); + method public int updateCallBarringForServiceClass(int, int, String[], int); + method public int updateCallForward(int, int, String, int, int); + method public int updateCallWaiting(boolean, int); + method public int updateClip(boolean); + method public int updateClir(int); + method public int updateColp(boolean); + method public int updateColr(int); + } + +} + +package android.telephony.mbms { + + public static class DownloadRequest.Builder { + method public android.telephony.mbms.DownloadRequest.Builder setServiceId(String); + } + + public final class FileInfo implements android.os.Parcelable { + ctor public FileInfo(android.net.Uri, String); + } + + public final class FileServiceInfo extends android.telephony.mbms.ServiceInfo implements android.os.Parcelable { + ctor public FileServiceInfo(java.util.Map<java.util.Locale,java.lang.String>, String, java.util.List<java.util.Locale>, String, java.util.Date, java.util.Date, java.util.List<android.telephony.mbms.FileInfo>); + } + + public class MbmsDownloadReceiver extends android.content.BroadcastReceiver { + field public static final int RESULT_APP_NOTIFICATION_ERROR = 6; // 0x6 + field public static final int RESULT_BAD_TEMP_FILE_ROOT = 3; // 0x3 + field public static final int RESULT_DOWNLOAD_FINALIZATION_ERROR = 4; // 0x4 + field public static final int RESULT_INVALID_ACTION = 1; // 0x1 + field public static final int RESULT_MALFORMED_INTENT = 2; // 0x2 + field public static final int RESULT_OK = 0; // 0x0 + field public static final int RESULT_TEMP_FILE_GENERATION_ERROR = 5; // 0x5 + } + + public final class StreamingServiceInfo extends android.telephony.mbms.ServiceInfo implements android.os.Parcelable { + ctor public StreamingServiceInfo(java.util.Map<java.util.Locale,java.lang.String>, String, java.util.List<java.util.Locale>, String, java.util.Date, java.util.Date); + } + + public final class UriPathPair implements android.os.Parcelable { + method public int describeContents(); + method public android.net.Uri getContentUri(); + method public android.net.Uri getFilePathUri(); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.mbms.UriPathPair> CREATOR; + } + +} + +package android.telephony.mbms.vendor { + + public class MbmsDownloadServiceBase extends android.os.Binder implements android.os.IInterface { + ctor public MbmsDownloadServiceBase(); + method public int addProgressListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadProgressListener) throws android.os.RemoteException; + method public int addStatusListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStatusListener) throws android.os.RemoteException; + method public android.os.IBinder asBinder(); + method public int cancelDownload(android.telephony.mbms.DownloadRequest) throws android.os.RemoteException; + method public void dispose(int) throws android.os.RemoteException; + method public int download(android.telephony.mbms.DownloadRequest) throws android.os.RemoteException; + method public int initialize(int, android.telephony.mbms.MbmsDownloadSessionCallback) throws android.os.RemoteException; + method @NonNull public java.util.List<android.telephony.mbms.DownloadRequest> listPendingDownloads(int) throws android.os.RemoteException; + method public void onAppCallbackDied(int, int); + method public boolean onTransact(int, android.os.Parcel, android.os.Parcel, int) throws android.os.RemoteException; + method public int removeProgressListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadProgressListener) throws android.os.RemoteException; + method public int removeStatusListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStatusListener) throws android.os.RemoteException; + method public int requestDownloadState(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo) throws android.os.RemoteException; + method public int requestUpdateFileServices(int, java.util.List<java.lang.String>) throws android.os.RemoteException; + method public int resetDownloadKnowledge(android.telephony.mbms.DownloadRequest) throws android.os.RemoteException; + method public int setTempFileRootDirectory(int, String) throws android.os.RemoteException; + } + + public class MbmsGroupCallServiceBase extends android.app.Service { + ctor public MbmsGroupCallServiceBase(); + method public void dispose(int) throws android.os.RemoteException; + method public int initialize(@NonNull android.telephony.mbms.MbmsGroupCallSessionCallback, int) throws android.os.RemoteException; + method public void onAppCallbackDied(int, int); + method public android.os.IBinder onBind(android.content.Intent); + method public int startGroupCall(int, long, @NonNull java.util.List<java.lang.Integer>, @NonNull java.util.List<java.lang.Integer>, @NonNull android.telephony.mbms.GroupCallCallback); + method public void stopGroupCall(int, long); + method public void updateGroupCall(int, long, @NonNull java.util.List<java.lang.Integer>, @NonNull java.util.List<java.lang.Integer>); + } + + public class MbmsStreamingServiceBase extends android.os.Binder implements android.os.IInterface { + ctor public MbmsStreamingServiceBase(); + method public android.os.IBinder asBinder(); + method public void dispose(int) throws android.os.RemoteException; + method @Nullable public android.net.Uri getPlaybackUri(int, String) throws android.os.RemoteException; + method public int initialize(android.telephony.mbms.MbmsStreamingSessionCallback, int) throws android.os.RemoteException; + method public void onAppCallbackDied(int, int); + method public boolean onTransact(int, android.os.Parcel, android.os.Parcel, int) throws android.os.RemoteException; + method public int requestUpdateStreamingServices(int, java.util.List<java.lang.String>) throws android.os.RemoteException; + method public int startStreaming(int, String, android.telephony.mbms.StreamingServiceCallback) throws android.os.RemoteException; + method public void stopStreaming(int, String) throws android.os.RemoteException; + } + + public class VendorUtils { + ctor public VendorUtils(); + method public static android.content.ComponentName getAppReceiverFromPackageName(android.content.Context, String); + field public static final String ACTION_CLEANUP = "android.telephony.mbms.action.CLEANUP"; + field public static final String ACTION_DOWNLOAD_RESULT_INTERNAL = "android.telephony.mbms.action.DOWNLOAD_RESULT_INTERNAL"; + field public static final String ACTION_FILE_DESCRIPTOR_REQUEST = "android.telephony.mbms.action.FILE_DESCRIPTOR_REQUEST"; + field public static final String EXTRA_FD_COUNT = "android.telephony.mbms.extra.FD_COUNT"; + field public static final String EXTRA_FINAL_URI = "android.telephony.mbms.extra.FINAL_URI"; + field public static final String EXTRA_FREE_URI_LIST = "android.telephony.mbms.extra.FREE_URI_LIST"; + field public static final String EXTRA_PAUSED_LIST = "android.telephony.mbms.extra.PAUSED_LIST"; + field public static final String EXTRA_PAUSED_URI_LIST = "android.telephony.mbms.extra.PAUSED_URI_LIST"; + field public static final String EXTRA_SERVICE_ID = "android.telephony.mbms.extra.SERVICE_ID"; + field public static final String EXTRA_TEMP_FILES_IN_USE = "android.telephony.mbms.extra.TEMP_FILES_IN_USE"; + field public static final String EXTRA_TEMP_FILE_ROOT = "android.telephony.mbms.extra.TEMP_FILE_ROOT"; + field public static final String EXTRA_TEMP_LIST = "android.telephony.mbms.extra.TEMP_LIST"; + } + +} + diff --git a/telephony/common/com/google/android/mms/pdu/PduComposer.java b/telephony/common/com/google/android/mms/pdu/PduComposer.java index b8b212c493aa..5e1f556f4c4a 100644 --- a/telephony/common/com/google/android/mms/pdu/PduComposer.java +++ b/telephony/common/com/google/android/mms/pdu/PduComposer.java @@ -745,7 +745,9 @@ public class PduComposer { return PDU_COMPOSE_CONTENT_ERROR; } - // X-Mms-Report-Allowed Optional (not support) + // X-Mms-Report-Allowed Optional + appendHeader(PduHeaders.REPORT_ALLOWED); + return PDU_COMPOSE_SUCCESS; } diff --git a/telephony/common/com/google/android/mms/util/DrmConvertSession.java b/telephony/common/com/google/android/mms/util/DrmConvertSession.java index 156c7ad8baac..17ab15470670 100644 --- a/telephony/common/com/google/android/mms/util/DrmConvertSession.java +++ b/telephony/common/com/google/android/mms/util/DrmConvertSession.java @@ -20,7 +20,6 @@ import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.drm.DrmConvertedStatus; import android.drm.DrmManagerClient; -import android.provider.Downloads; import android.util.Log; import java.io.FileNotFoundException; @@ -33,6 +32,13 @@ public class DrmConvertSession { private int mConvertSessionId; private static final String TAG = "DrmConvertSession"; + // These values are copied from Downloads.Impl.* for backward compatibility since + // {@link #close()} that uses it is marked @UnsupportedAppUsage. + public static final int STATUS_SUCCESS = 200; + public static final int STATUS_NOT_ACCEPTABLE = 406; + public static final int STATUS_UNKNOWN_ERROR = 491; + public static final int STATUS_FILE_ERROR = 492; + private DrmConvertSession(DrmManagerClient drmClient, int convertSessionId) { mDrmClient = drmClient; mConvertSessionId = convertSessionId; @@ -118,38 +124,38 @@ public class DrmConvertSession { * Ends a conversion session of a file. * * @param fileName The filename of the converted file. - * @return Downloads.Impl.STATUS_SUCCESS if execution is ok. - * Downloads.Impl.STATUS_FILE_ERROR in case converted file can not - * be accessed. Downloads.Impl.STATUS_NOT_ACCEPTABLE if a problem + * @return STATUS_SUCCESS if execution is ok. + * STATUS_FILE_ERROR in case converted file can not + * be accessed. STATUS_NOT_ACCEPTABLE if a problem * occurs when accessing drm framework. - * Downloads.Impl.STATUS_UNKNOWN_ERROR if a general error occurred. + * STATUS_UNKNOWN_ERROR if a general error occurred. */ @UnsupportedAppUsage public int close(String filename) { DrmConvertedStatus convertedStatus = null; - int result = Downloads.Impl.STATUS_UNKNOWN_ERROR; + int result = STATUS_UNKNOWN_ERROR; if (mDrmClient != null && mConvertSessionId >= 0) { try { convertedStatus = mDrmClient.closeConvertSession(mConvertSessionId); if (convertedStatus == null || convertedStatus.statusCode != DrmConvertedStatus.STATUS_OK || convertedStatus.convertedData == null) { - result = Downloads.Impl.STATUS_NOT_ACCEPTABLE; + result = STATUS_NOT_ACCEPTABLE; } else { RandomAccessFile rndAccessFile = null; try { rndAccessFile = new RandomAccessFile(filename, "rw"); rndAccessFile.seek(convertedStatus.offset); rndAccessFile.write(convertedStatus.convertedData); - result = Downloads.Impl.STATUS_SUCCESS; + result = STATUS_SUCCESS; } catch (FileNotFoundException e) { - result = Downloads.Impl.STATUS_FILE_ERROR; + result = STATUS_FILE_ERROR; Log.w(TAG, "File: " + filename + " could not be found.", e); } catch (IOException e) { - result = Downloads.Impl.STATUS_FILE_ERROR; + result = STATUS_FILE_ERROR; Log.w(TAG, "Could not access File: " + filename + " .", e); } catch (IllegalArgumentException e) { - result = Downloads.Impl.STATUS_FILE_ERROR; + result = STATUS_FILE_ERROR; Log.w(TAG, "Could not open file in mode: rw", e); } catch (SecurityException e) { Log.w(TAG, "Access to File: " + filename + @@ -159,7 +165,7 @@ public class DrmConvertSession { try { rndAccessFile.close(); } catch (IOException e) { - result = Downloads.Impl.STATUS_FILE_ERROR; + result = STATUS_FILE_ERROR; Log.w(TAG, "Failed to close File:" + filename + ".", e); } diff --git a/telephony/java/android/service/carrier/CarrierService.java b/telephony/java/android/service/carrier/CarrierService.java index eefc1b70bac9..d06ec11f3e61 100644 --- a/telephony/java/android/service/carrier/CarrierService.java +++ b/telephony/java/android/service/carrier/CarrierService.java @@ -25,6 +25,9 @@ import android.os.ResultReceiver; import android.telephony.TelephonyRegistryManager; import android.util.Log; +import java.io.FileDescriptor; +import java.io.PrintWriter; + /** * A service that exposes carrier-specific functionality to the system. * <p> @@ -156,5 +159,10 @@ public abstract class CarrierService extends Service { result.send(RESULT_ERROR, null); } } + + @Override + protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { + CarrierService.this.dump(fd, pw, args); + } } } diff --git a/telephony/java/android/service/euicc/EuiccService.java b/telephony/java/android/service/euicc/EuiccService.java index ef11f469d9a0..ae2652e6c229 100644 --- a/telephony/java/android/service/euicc/EuiccService.java +++ b/telephony/java/android/service/euicc/EuiccService.java @@ -31,7 +31,9 @@ import android.os.RemoteException; import android.telephony.TelephonyManager; import android.telephony.euicc.DownloadableSubscription; import android.telephony.euicc.EuiccInfo; +import android.telephony.euicc.EuiccManager; import android.telephony.euicc.EuiccManager.OtaStatus; +import android.text.TextUtils; import android.util.Log; import java.io.PrintWriter; @@ -311,6 +313,64 @@ public abstract class EuiccService extends Service { mStubWrapper = new IEuiccServiceWrapper(); } + /** + * Given a SubjectCode[5.2.6.1] and ReasonCode[5.2.6.2] from GSMA (SGP.22 v2.2), encode it to + * the format described in + * {@link android.telephony.euicc.EuiccManager#OPERATION_SMDX_SUBJECT_REASON_CODE} + * + * @param subjectCode SubjectCode[5.2.6.1] from GSMA (SGP.22 v2.2) + * @param reasonCode ReasonCode[5.2.6.2] from GSMA (SGP.22 v2.2) + * @return encoded error code described in + * {@link android.telephony.euicc.EuiccManager#OPERATION_SMDX_SUBJECT_REASON_CODE} + * @throws NumberFormatException when the Subject/Reason code contains non digits + * @throws IllegalArgumentException when Subject/Reason code is null/empty + * @throws UnsupportedOperationException when sections has more than four layers (e.g 5.8.1.2) + * or when an number is bigger than 15 + */ + public int encodeSmdxSubjectAndReasonCode(@NonNull String subjectCode, + @NonNull String reasonCode) { + final int maxSupportedSection = 3; + final int maxSupportedDigit = 15; + final int bitsPerSection = 4; + + if (TextUtils.isEmpty(subjectCode) || TextUtils.isEmpty(reasonCode)) { + throw new IllegalArgumentException("SubjectCode/ReasonCode is empty"); + } + + final String[] subjectCodeToken = subjectCode.split("\\."); + final String[] reasonCodeToken = reasonCode.split("\\."); + + if (subjectCodeToken.length > maxSupportedSection + || reasonCodeToken.length > maxSupportedSection) { + throw new UnsupportedOperationException("Only three nested layer is supported."); + } + + int result = EuiccManager.OPERATION_SMDX_SUBJECT_REASON_CODE; + + // Pad the 0s needed for subject code + result = result << (maxSupportedSection - subjectCodeToken.length) * bitsPerSection; + + for (String digitString : subjectCodeToken) { + int num = Integer.parseInt(digitString); + if (num > maxSupportedDigit) { + throw new UnsupportedOperationException("SubjectCode exceeds " + maxSupportedDigit); + } + result = (result << bitsPerSection) + num; + } + + // Pad the 0s needed for reason code + result = result << (maxSupportedSection - reasonCodeToken.length) * bitsPerSection; + for (String digitString : reasonCodeToken) { + int num = Integer.parseInt(digitString); + if (num > maxSupportedDigit) { + throw new UnsupportedOperationException("ReasonCode exceeds " + maxSupportedDigit); + } + result = (result << bitsPerSection) + num; + } + + return result; + } + @Override @CallSuper public void onCreate() { diff --git a/telephony/java/android/telephony/ims/RcsEventQueryParams.aidl b/telephony/java/android/service/euicc/IEuiccServiceDumpResultCallback.aidl index f18c4dfd2dcd..ea55ebbadd88 100644 --- a/telephony/java/android/telephony/ims/RcsEventQueryParams.aidl +++ b/telephony/java/android/service/euicc/IEuiccServiceDumpResultCallback.aidl @@ -1,12 +1,11 @@ /* - * - * Copyright 2019, The Android Open Source Project + * Copyright (C) 2017 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 + * 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, @@ -15,6 +14,9 @@ * limitations under the License. */ -package android.telephony.ims; +package android.service.euicc; -parcelable RcsEventQueryParams; +/** @hide */ +oneway interface IEuiccServiceDumpResultCallback { + void onComplete(in String logs); +}
\ No newline at end of file diff --git a/telephony/java/android/telephony/AccessNetworkConstants.java b/telephony/java/android/telephony/AccessNetworkConstants.java index 01abb2661f39..558f4cd24471 100644 --- a/telephony/java/android/telephony/AccessNetworkConstants.java +++ b/telephony/java/android/telephony/AccessNetworkConstants.java @@ -19,6 +19,10 @@ package android.telephony; import android.annotation.IntDef; import android.annotation.SystemApi; import android.annotation.TestApi; +import android.hardware.radio.V1_1.EutranBands; +import android.hardware.radio.V1_1.GeranBands; +import android.hardware.radio.V1_5.AccessNetwork; +import android.hardware.radio.V1_5.UtranBands; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -84,13 +88,13 @@ public final class AccessNetworkConstants { public @interface RadioAccessNetworkType {} public static final class AccessNetworkType { - public static final int UNKNOWN = 0; - public static final int GERAN = 1; - public static final int UTRAN = 2; - public static final int EUTRAN = 3; - public static final int CDMA2000 = 4; - public static final int IWLAN = 5; - public static final int NGRAN = 6; + public static final int UNKNOWN = AccessNetwork.UNKNOWN; + public static final int GERAN = AccessNetwork.GERAN; + public static final int UTRAN = AccessNetwork.UTRAN; + public static final int EUTRAN = AccessNetwork.EUTRAN; + public static final int CDMA2000 = AccessNetwork.CDMA2000; + public static final int IWLAN = AccessNetwork.IWLAN; + public static final int NGRAN = AccessNetwork.NGRAN; /** @hide */ private AccessNetworkType() {} @@ -115,20 +119,20 @@ public final class AccessNetworkConstants { * http://www.etsi.org/deliver/etsi_ts/145000_145099/145005/14.00.00_60/ts_145005v140000p.pdf */ public static final class GeranBand { - public static final int BAND_T380 = 1; - public static final int BAND_T410 = 2; - public static final int BAND_450 = 3; - public static final int BAND_480 = 4; - public static final int BAND_710 = 5; - public static final int BAND_750 = 6; - public static final int BAND_T810 = 7; - public static final int BAND_850 = 8; - public static final int BAND_P900 = 9; - public static final int BAND_E900 = 10; - public static final int BAND_R900 = 11; - public static final int BAND_DCS1800 = 12; - public static final int BAND_PCS1900 = 13; - public static final int BAND_ER900 = 14; + public static final int BAND_T380 = GeranBands.BAND_T380; + public static final int BAND_T410 = GeranBands.BAND_T410; + public static final int BAND_450 = GeranBands.BAND_450; + public static final int BAND_480 = GeranBands.BAND_480; + public static final int BAND_710 = GeranBands.BAND_710; + public static final int BAND_750 = GeranBands.BAND_750; + public static final int BAND_T810 = GeranBands.BAND_T810; + public static final int BAND_850 = GeranBands.BAND_850; + public static final int BAND_P900 = GeranBands.BAND_P900; + public static final int BAND_E900 = GeranBands.BAND_E900; + public static final int BAND_R900 = GeranBands.BAND_R900; + public static final int BAND_DCS1800 = GeranBands.BAND_DCS1800; + public static final int BAND_PCS1900 = GeranBands.BAND_PCS1900; + public static final int BAND_ER900 = GeranBands.BAND_ER900; /** @hide */ private GeranBand() {} @@ -139,28 +143,28 @@ public final class AccessNetworkConstants { * http://www.etsi.org/deliver/etsi_ts/125100_125199/125104/13.03.00_60/ts_125104v130p.pdf */ public static final class UtranBand { - public static final int BAND_1 = 1; - public static final int BAND_2 = 2; - public static final int BAND_3 = 3; - public static final int BAND_4 = 4; - public static final int BAND_5 = 5; - public static final int BAND_6 = 6; - public static final int BAND_7 = 7; - public static final int BAND_8 = 8; - public static final int BAND_9 = 9; - public static final int BAND_10 = 10; - public static final int BAND_11 = 11; - public static final int BAND_12 = 12; - public static final int BAND_13 = 13; - public static final int BAND_14 = 14; + public static final int BAND_1 = UtranBands.BAND_1; + public static final int BAND_2 = UtranBands.BAND_2; + public static final int BAND_3 = UtranBands.BAND_3; + public static final int BAND_4 = UtranBands.BAND_4; + public static final int BAND_5 = UtranBands.BAND_5; + public static final int BAND_6 = UtranBands.BAND_6; + public static final int BAND_7 = UtranBands.BAND_7; + public static final int BAND_8 = UtranBands.BAND_8; + public static final int BAND_9 = UtranBands.BAND_9; + public static final int BAND_10 = UtranBands.BAND_10; + public static final int BAND_11 = UtranBands.BAND_11; + public static final int BAND_12 = UtranBands.BAND_12; + public static final int BAND_13 = UtranBands.BAND_13; + public static final int BAND_14 = UtranBands.BAND_14; // band 15, 16, 17, 18 are reserved - public static final int BAND_19 = 19; - public static final int BAND_20 = 20; - public static final int BAND_21 = 21; - public static final int BAND_22 = 22; + public static final int BAND_19 = UtranBands.BAND_19; + public static final int BAND_20 = UtranBands.BAND_20; + public static final int BAND_21 = UtranBands.BAND_21; + public static final int BAND_22 = UtranBands.BAND_22; // band 23, 24 are reserved - public static final int BAND_25 = 25; - public static final int BAND_26 = 26; + public static final int BAND_25 = UtranBands.BAND_25; + public static final int BAND_26 = UtranBands.BAND_26; // Frequency bands for TD-SCDMA. Defined in 3GPP TS 25.102, Table 5.2. @@ -169,38 +173,38 @@ public final class AccessNetworkConstants { * 1900 - 1920 MHz: Uplink and downlink transmission * 2010 - 2025 MHz: Uplink and downlink transmission */ - public static final int BAND_A = 101; + public static final int BAND_A = UtranBands.BAND_A; /** * Band B * 1850 - 1910 MHz: Uplink and downlink transmission * 1930 - 1990 MHz: Uplink and downlink transmission */ - public static final int BAND_B = 102; + public static final int BAND_B = UtranBands.BAND_B; /** * Band C * 1910 - 1930 MHz: Uplink and downlink transmission */ - public static final int BAND_C = 103; + public static final int BAND_C = UtranBands.BAND_C; /** * Band D * 2570 - 2620 MHz: Uplink and downlink transmission */ - public static final int BAND_D = 104; + public static final int BAND_D = UtranBands.BAND_D; /** * Band E * 2300—2400 MHz: Uplink and downlink transmission */ - public static final int BAND_E = 105; + public static final int BAND_E = UtranBands.BAND_E; /** * Band F * 1880 - 1920 MHz: Uplink and downlink transmission */ - public static final int BAND_F = 106; + public static final int BAND_F = UtranBands.BAND_F; /** @hide */ private UtranBand() {} @@ -211,54 +215,54 @@ public final class AccessNetworkConstants { * http://www.etsi.org/deliver/etsi_ts/136100_136199/136101/14.03.00_60/ts_136101v140p.pdf */ public static final class EutranBand { - public static final int BAND_1 = 1; - public static final int BAND_2 = 2; - public static final int BAND_3 = 3; - public static final int BAND_4 = 4; - public static final int BAND_5 = 5; - public static final int BAND_6 = 6; - public static final int BAND_7 = 7; - public static final int BAND_8 = 8; - public static final int BAND_9 = 9; - public static final int BAND_10 = 10; - public static final int BAND_11 = 11; - public static final int BAND_12 = 12; - public static final int BAND_13 = 13; - public static final int BAND_14 = 14; - public static final int BAND_17 = 17; - public static final int BAND_18 = 18; - public static final int BAND_19 = 19; - public static final int BAND_20 = 20; - public static final int BAND_21 = 21; - public static final int BAND_22 = 22; - public static final int BAND_23 = 23; - public static final int BAND_24 = 24; - public static final int BAND_25 = 25; - public static final int BAND_26 = 26; - public static final int BAND_27 = 27; - public static final int BAND_28 = 28; - public static final int BAND_30 = 30; - public static final int BAND_31 = 31; - public static final int BAND_33 = 33; - public static final int BAND_34 = 34; - public static final int BAND_35 = 35; - public static final int BAND_36 = 36; - public static final int BAND_37 = 37; - public static final int BAND_38 = 38; - public static final int BAND_39 = 39; - public static final int BAND_40 = 40; - public static final int BAND_41 = 41; - public static final int BAND_42 = 42; - public static final int BAND_43 = 43; - public static final int BAND_44 = 44; - public static final int BAND_45 = 45; - public static final int BAND_46 = 46; - public static final int BAND_47 = 47; - public static final int BAND_48 = 48; - public static final int BAND_65 = 65; - public static final int BAND_66 = 66; - public static final int BAND_68 = 68; - public static final int BAND_70 = 70; + public static final int BAND_1 = EutranBands.BAND_1; + public static final int BAND_2 = EutranBands.BAND_2; + public static final int BAND_3 = EutranBands.BAND_3; + public static final int BAND_4 = EutranBands.BAND_4; + public static final int BAND_5 = EutranBands.BAND_5; + public static final int BAND_6 = EutranBands.BAND_6; + public static final int BAND_7 = EutranBands.BAND_7; + public static final int BAND_8 = EutranBands.BAND_8; + public static final int BAND_9 = EutranBands.BAND_9; + public static final int BAND_10 = EutranBands.BAND_10; + public static final int BAND_11 = EutranBands.BAND_11; + public static final int BAND_12 = EutranBands.BAND_12; + public static final int BAND_13 = EutranBands.BAND_13; + public static final int BAND_14 = EutranBands.BAND_14; + public static final int BAND_17 = EutranBands.BAND_17; + public static final int BAND_18 = EutranBands.BAND_18; + public static final int BAND_19 = EutranBands.BAND_19; + public static final int BAND_20 = EutranBands.BAND_20; + public static final int BAND_21 = EutranBands.BAND_21; + public static final int BAND_22 = EutranBands.BAND_22; + public static final int BAND_23 = EutranBands.BAND_23; + public static final int BAND_24 = EutranBands.BAND_24; + public static final int BAND_25 = EutranBands.BAND_25; + public static final int BAND_26 = EutranBands.BAND_26; + public static final int BAND_27 = EutranBands.BAND_27; + public static final int BAND_28 = EutranBands.BAND_28; + public static final int BAND_30 = EutranBands.BAND_30; + public static final int BAND_31 = EutranBands.BAND_31; + public static final int BAND_33 = EutranBands.BAND_33; + public static final int BAND_34 = EutranBands.BAND_34; + public static final int BAND_35 = EutranBands.BAND_35; + public static final int BAND_36 = EutranBands.BAND_36; + public static final int BAND_37 = EutranBands.BAND_37; + public static final int BAND_38 = EutranBands.BAND_38; + public static final int BAND_39 = EutranBands.BAND_39; + public static final int BAND_40 = EutranBands.BAND_40; + public static final int BAND_41 = EutranBands.BAND_41; + public static final int BAND_42 = EutranBands.BAND_42; + public static final int BAND_43 = EutranBands.BAND_43; + public static final int BAND_44 = EutranBands.BAND_44; + public static final int BAND_45 = EutranBands.BAND_45; + public static final int BAND_46 = EutranBands.BAND_46; + public static final int BAND_47 = EutranBands.BAND_47; + public static final int BAND_48 = EutranBands.BAND_48; + public static final int BAND_65 = EutranBands.BAND_65; + public static final int BAND_66 = EutranBands.BAND_66; + public static final int BAND_68 = EutranBands.BAND_68; + public static final int BAND_70 = EutranBands.BAND_70; /** @hide */ private EutranBand() {}; @@ -304,51 +308,51 @@ public final class AccessNetworkConstants { */ public static final class NgranBands { /** FR1 bands */ - public static final int BAND_1 = 1; - public static final int BAND_2 = 2; - public static final int BAND_3 = 3; - public static final int BAND_5 = 5; - public static final int BAND_7 = 7; - public static final int BAND_8 = 8; - public static final int BAND_12 = 12; - public static final int BAND_14 = 14; - public static final int BAND_18 = 18; - public static final int BAND_20 = 20; - public static final int BAND_25 = 25; - public static final int BAND_28 = 28; - public static final int BAND_29 = 29; - public static final int BAND_30 = 30; - public static final int BAND_34 = 34; - public static final int BAND_38 = 38; - public static final int BAND_39 = 39; - public static final int BAND_40 = 40; - public static final int BAND_41 = 41; - public static final int BAND_48 = 48; - public static final int BAND_50 = 50; - public static final int BAND_51 = 51; - public static final int BAND_65 = 65; - public static final int BAND_66 = 66; - public static final int BAND_70 = 70; - public static final int BAND_71 = 71; - public static final int BAND_74 = 74; - public static final int BAND_75 = 75; - public static final int BAND_76 = 76; - public static final int BAND_77 = 77; - public static final int BAND_78 = 78; - public static final int BAND_79 = 79; - public static final int BAND_80 = 80; - public static final int BAND_81 = 81; - public static final int BAND_82 = 82; - public static final int BAND_83 = 83; - public static final int BAND_84 = 84; - public static final int BAND_86 = 86; - public static final int BAND_90 = 90; + public static final int BAND_1 = android.hardware.radio.V1_5.NgranBands.BAND_1; + public static final int BAND_2 = android.hardware.radio.V1_5.NgranBands.BAND_2; + public static final int BAND_3 = android.hardware.radio.V1_5.NgranBands.BAND_3; + public static final int BAND_5 = android.hardware.radio.V1_5.NgranBands.BAND_5; + public static final int BAND_7 = android.hardware.radio.V1_5.NgranBands.BAND_7; + public static final int BAND_8 = android.hardware.radio.V1_5.NgranBands.BAND_8; + public static final int BAND_12 = android.hardware.radio.V1_5.NgranBands.BAND_12; + public static final int BAND_14 = android.hardware.radio.V1_5.NgranBands.BAND_14; + public static final int BAND_18 = android.hardware.radio.V1_5.NgranBands.BAND_18; + public static final int BAND_20 = android.hardware.radio.V1_5.NgranBands.BAND_20; + public static final int BAND_25 = android.hardware.radio.V1_5.NgranBands.BAND_25; + public static final int BAND_28 = android.hardware.radio.V1_5.NgranBands.BAND_28; + public static final int BAND_29 = android.hardware.radio.V1_5.NgranBands.BAND_29; + public static final int BAND_30 = android.hardware.radio.V1_5.NgranBands.BAND_30; + public static final int BAND_34 = android.hardware.radio.V1_5.NgranBands.BAND_34; + public static final int BAND_38 = android.hardware.radio.V1_5.NgranBands.BAND_38; + public static final int BAND_39 = android.hardware.radio.V1_5.NgranBands.BAND_39; + public static final int BAND_40 = android.hardware.radio.V1_5.NgranBands.BAND_40; + public static final int BAND_41 = android.hardware.radio.V1_5.NgranBands.BAND_41; + public static final int BAND_48 = android.hardware.radio.V1_5.NgranBands.BAND_48; + public static final int BAND_50 = android.hardware.radio.V1_5.NgranBands.BAND_50; + public static final int BAND_51 = android.hardware.radio.V1_5.NgranBands.BAND_51; + public static final int BAND_65 = android.hardware.radio.V1_5.NgranBands.BAND_65; + public static final int BAND_66 = android.hardware.radio.V1_5.NgranBands.BAND_66; + public static final int BAND_70 = android.hardware.radio.V1_5.NgranBands.BAND_70; + public static final int BAND_71 = android.hardware.radio.V1_5.NgranBands.BAND_71; + public static final int BAND_74 = android.hardware.radio.V1_5.NgranBands.BAND_74; + public static final int BAND_75 = android.hardware.radio.V1_5.NgranBands.BAND_75; + public static final int BAND_76 = android.hardware.radio.V1_5.NgranBands.BAND_76; + public static final int BAND_77 = android.hardware.radio.V1_5.NgranBands.BAND_77; + public static final int BAND_78 = android.hardware.radio.V1_5.NgranBands.BAND_78; + public static final int BAND_79 = android.hardware.radio.V1_5.NgranBands.BAND_79; + public static final int BAND_80 = android.hardware.radio.V1_5.NgranBands.BAND_80; + public static final int BAND_81 = android.hardware.radio.V1_5.NgranBands.BAND_81; + public static final int BAND_82 = android.hardware.radio.V1_5.NgranBands.BAND_82; + public static final int BAND_83 = android.hardware.radio.V1_5.NgranBands.BAND_83; + public static final int BAND_84 = android.hardware.radio.V1_5.NgranBands.BAND_84; + public static final int BAND_86 = android.hardware.radio.V1_5.NgranBands.BAND_86; + public static final int BAND_90 = android.hardware.radio.V1_5.NgranBands.BAND_90; /** FR2 bands */ - public static final int BAND_257 = 257; - public static final int BAND_258 = 258; - public static final int BAND_260 = 260; - public static final int BAND_261 = 261; + public static final int BAND_257 = android.hardware.radio.V1_5.NgranBands.BAND_257; + public static final int BAND_258 = android.hardware.radio.V1_5.NgranBands.BAND_258; + public static final int BAND_260 = android.hardware.radio.V1_5.NgranBands.BAND_260; + public static final int BAND_261 = android.hardware.radio.V1_5.NgranBands.BAND_261; /** * NR Bands diff --git a/telephony/java/android/telephony/Annotation.java b/telephony/java/android/telephony/Annotation.java index db17a9505a27..ccda88f717c3 100644 --- a/telephony/java/android/telephony/Annotation.java +++ b/telephony/java/android/telephony/Annotation.java @@ -571,6 +571,19 @@ public class Annotation { public @interface PreciseDisconnectCauses { } + /** + * Carrier Privilege Status. + */ + @IntDef(prefix = { "CARRIER_PRIVILEGE_STATUS_" }, value = { + TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS, + TelephonyManager.CARRIER_PRIVILEGE_STATUS_NO_ACCESS, + TelephonyManager.CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED, + TelephonyManager.CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface CarrierPrivilegeStatus { + } + @IntDef({ Connection.AUDIO_CODEC_NONE, Connection.AUDIO_CODEC_AMR, @@ -598,48 +611,6 @@ public class Annotation { } /** - * Call forwarding function status - */ - @IntDef(prefix = { "STATUS_" }, value = { - CallForwardingInfo.STATUS_ACTIVE, - CallForwardingInfo.STATUS_INACTIVE, - CallForwardingInfo.STATUS_UNKNOWN_ERROR, - CallForwardingInfo.STATUS_NOT_SUPPORTED, - CallForwardingInfo.STATUS_FDN_CHECK_FAILURE - }) - @Retention(RetentionPolicy.SOURCE) - public @interface CallForwardingStatus { - } - - /** - * Call forwarding reason types - */ - @IntDef(flag = true, prefix = { "REASON_" }, value = { - CallForwardingInfo.REASON_UNCONDITIONAL, - CallForwardingInfo.REASON_BUSY, - CallForwardingInfo.REASON_NO_REPLY, - CallForwardingInfo.REASON_NOT_REACHABLE, - CallForwardingInfo.REASON_ALL, - CallForwardingInfo.REASON_ALL_CONDITIONAL - }) - @Retention(RetentionPolicy.SOURCE) - public @interface CallForwardingReason { - } - - /** - * Call waiting function status - */ - @IntDef(prefix = { "CALL_WAITING_STATUS_" }, value = { - TelephonyManager.CALL_WAITING_STATUS_ACTIVE, - TelephonyManager.CALL_WAITING_STATUS_INACTIVE, - TelephonyManager.CALL_WAITING_STATUS_NOT_SUPPORTED, - TelephonyManager.CALL_WAITING_STATUS_UNKNOWN_ERROR - }) - @Retention(RetentionPolicy.SOURCE) - public @interface CallWaitingStatus { - } - - /** * UICC SIM Application Types */ @IntDef(prefix = { "APPTYPE_" }, value = { @@ -651,4 +622,16 @@ public class Annotation { }) @Retention(RetentionPolicy.SOURCE) public @interface UiccAppType{} + + /** + * Override network type + */ + @Retention(RetentionPolicy.SOURCE) + @IntDef(prefix = "OVERRIDE_NETWORK_TYPE_", value = { + DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, + DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA, + DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO, + DisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA, + DisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE}) + public @interface OverrideNetworkType {} } diff --git a/telephony/java/android/telephony/ims/RcsMessageSnippet.aidl b/telephony/java/android/telephony/BarringInfo.aidl index 99b8eb704e00..50ddf6b31919 100644 --- a/telephony/java/android/telephony/ims/RcsMessageSnippet.aidl +++ b/telephony/java/android/telephony/BarringInfo.aidl @@ -1,12 +1,11 @@ /* - * - * Copyright 2019, The Android Open Source Project + * Copyright 2019 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 + * 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, @@ -15,6 +14,7 @@ * limitations under the License. */ -package android.telephony.ims; +/** @hide */ +package android.telephony; -parcelable RcsMessageSnippet; +parcelable BarringInfo; diff --git a/telephony/java/android/telephony/BarringInfo.java b/telephony/java/android/telephony/BarringInfo.java new file mode 100644 index 000000000000..92423a2f2218 --- /dev/null +++ b/telephony/java/android/telephony/BarringInfo.java @@ -0,0 +1,398 @@ +/* + * Copyright 2019 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.IntDef; +import android.annotation.NonNull; +import android.annotation.Nullable; +import android.annotation.SuppressLint; +import android.annotation.SystemApi; +import android.annotation.TestApi; +import android.os.Parcel; +import android.os.Parcelable; +import android.util.SparseArray; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.util.List; +import java.util.Objects; + +/** + * Provides the barring configuration for a particular service type. + * + * Provides indication about the barring of a particular service for use. Certain barring types + * are only valid for certain technology families. Any service that does not have a barring + * configuration is unbarred by default. + */ +public final class BarringInfo implements Parcelable { + + /** + * Barring Service Type + * + * @hide + */ + @Retention(RetentionPolicy.SOURCE) + @IntDef(prefix = "BARRING_SERVICE_TYPE_", value = { + BARRING_SERVICE_TYPE_CS_SERVICE, + BARRING_SERVICE_TYPE_PS_SERVICE, + BARRING_SERVICE_TYPE_CS_VOICE, + BARRING_SERVICE_TYPE_MO_SIGNALLING, + BARRING_SERVICE_TYPE_MO_DATA, + BARRING_SERVICE_TYPE_CS_FALLBACK, + BARRING_SERVICE_TYPE_MMTEL_VOICE, + BARRING_SERVICE_TYPE_MMTEL_VIDEO, + BARRING_SERVICE_TYPE_EMERGENCY, + BARRING_SERVICE_TYPE_SMS}) + public @interface BarringServiceType {} + + /* Applicabe to UTRAN */ + /** Barring indicator for circuit-switched service; applicable to UTRAN */ + public static final int BARRING_SERVICE_TYPE_CS_SERVICE = + android.hardware.radio.V1_5.BarringInfo.ServiceType.CS_SERVICE; + /** Barring indicator for packet-switched service; applicable to UTRAN */ + public static final int BARRING_SERVICE_TYPE_PS_SERVICE = + android.hardware.radio.V1_5.BarringInfo.ServiceType.PS_SERVICE; + /** Barring indicator for circuit-switched voice service; applicable to UTRAN */ + public static final int BARRING_SERVICE_TYPE_CS_VOICE = + android.hardware.radio.V1_5.BarringInfo.ServiceType.CS_VOICE; + + /* Applicable to EUTRAN, NGRAN */ + /** Barring indicator for mobile-originated signalling; applicable to EUTRAN and NGRAN */ + public static final int BARRING_SERVICE_TYPE_MO_SIGNALLING = + android.hardware.radio.V1_5.BarringInfo.ServiceType.MO_SIGNALLING; + /** Barring indicator for mobile-originated data traffic; applicable to EUTRAN and NGRAN */ + public static final int BARRING_SERVICE_TYPE_MO_DATA = + android.hardware.radio.V1_5.BarringInfo.ServiceType.MO_DATA; + /** Barring indicator for circuit-switched fallback for voice; applicable to EUTRAN and NGRAN */ + public static final int BARRING_SERVICE_TYPE_CS_FALLBACK = + android.hardware.radio.V1_5.BarringInfo.ServiceType.CS_FALLBACK; + /** Barring indicator for MMTEL (IMS) voice; applicable to EUTRAN and NGRAN */ + public static final int BARRING_SERVICE_TYPE_MMTEL_VOICE = + android.hardware.radio.V1_5.BarringInfo.ServiceType.MMTEL_VOICE; + /** Barring indicator for MMTEL (IMS) video; applicable to EUTRAN and NGRAN */ + public static final int BARRING_SERVICE_TYPE_MMTEL_VIDEO = + android.hardware.radio.V1_5.BarringInfo.ServiceType.MMTEL_VIDEO; + + /* Applicable to UTRAN, EUTRAN, NGRAN */ + /** Barring indicator for emergency services; applicable to UTRAN, EUTRAN, and NGRAN */ + public static final int BARRING_SERVICE_TYPE_EMERGENCY = + android.hardware.radio.V1_5.BarringInfo.ServiceType.EMERGENCY; + /** Barring indicator for SMS sending; applicable to UTRAN, EUTRAN, and NGRAN */ + public static final int BARRING_SERVICE_TYPE_SMS = + android.hardware.radio.V1_5.BarringInfo.ServiceType.SMS; + + //TODO: add barring constants for Operator-Specific barring codes + + /** Describe the current barring configuration of a cell */ + public static final class BarringServiceInfo implements Parcelable { + /** + * Barring Type + * @hide + */ + @Retention(RetentionPolicy.SOURCE) + @IntDef(prefix = "BARRING_TYPE_", value = + {BARRING_TYPE_NONE, + BARRING_TYPE_UNCONDITIONAL, + BARRING_TYPE_CONDITIONAL, + BARRING_TYPE_UNKNOWN}) + public @interface BarringType {} + + /** Barring is inactive */ + public static final int BARRING_TYPE_NONE = + android.hardware.radio.V1_5.BarringInfo.BarringType.NONE; + /** The service is barred */ + public static final int BARRING_TYPE_UNCONDITIONAL = + android.hardware.radio.V1_5.BarringInfo.BarringType.UNCONDITIONAL; + /** The service may be barred based on additional factors */ + public static final int BARRING_TYPE_CONDITIONAL = + android.hardware.radio.V1_5.BarringInfo.BarringType.CONDITIONAL; + + /** If a modem does not report barring info, then the barring type will be UNKNOWN */ + public static final int BARRING_TYPE_UNKNOWN = -1; + + private final @BarringType int mBarringType; + + private final boolean mIsConditionallyBarred; + private final int mConditionalBarringFactor; + private final int mConditionalBarringTimeSeconds; + + /** @hide */ + public BarringServiceInfo(@BarringType int type) { + this(type, false, 0, 0); + } + + /** @hide */ + @TestApi + public BarringServiceInfo(@BarringType int barringType, boolean isConditionallyBarred, + int conditionalBarringFactor, int conditionalBarringTimeSeconds) { + mBarringType = barringType; + mIsConditionallyBarred = isConditionallyBarred; + mConditionalBarringFactor = conditionalBarringFactor; + mConditionalBarringTimeSeconds = conditionalBarringTimeSeconds; + } + + public @BarringType int getBarringType() { + return mBarringType; + } + + /** + * @return true if the conditional barring parameters have resulted in the service being + * barred; false if the service has either not been evaluated for conditional + * barring or has been evaluated and isn't barred. + */ + public boolean isConditionallyBarred() { + return mIsConditionallyBarred; + } + + /** + * @return the conditional barring factor as a percentage 0-100, which is the probability of + * a random device being barred for the service type. + */ + public int getConditionalBarringFactor() { + return mConditionalBarringFactor; + } + + /** + * @return the conditional barring time seconds, which is the interval between successive + * evaluations for conditional barring based on the barring factor. + */ + @SuppressLint("MethodNameUnits") + public int getConditionalBarringTimeSeconds() { + return mConditionalBarringTimeSeconds; + } + + /** + * Return whether a service is currently barred based on the BarringInfo + * + * @return true if the service is currently being barred, otherwise false + */ + public boolean isBarred() { + return mBarringType == BarringServiceInfo.BARRING_TYPE_UNCONDITIONAL + || (mBarringType == BarringServiceInfo.BARRING_TYPE_CONDITIONAL + && mIsConditionallyBarred); + } + + @Override + public int hashCode() { + return Objects.hash(mBarringType, mIsConditionallyBarred, + mConditionalBarringFactor, mConditionalBarringTimeSeconds); + } + + @Override + public boolean equals(Object rhs) { + if (!(rhs instanceof BarringServiceInfo)) return false; + + BarringServiceInfo other = (BarringServiceInfo) rhs; + return mBarringType == other.mBarringType + && mIsConditionallyBarred == other.mIsConditionallyBarred + && mConditionalBarringFactor == other.mConditionalBarringFactor + && mConditionalBarringTimeSeconds == other.mConditionalBarringTimeSeconds; + } + + /** @hide */ + public BarringServiceInfo(Parcel p) { + mBarringType = p.readInt(); + mIsConditionallyBarred = p.readBoolean(); + mConditionalBarringFactor = p.readInt(); + mConditionalBarringTimeSeconds = p.readInt(); + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + dest.writeInt(mBarringType); + dest.writeBoolean(mIsConditionallyBarred); + dest.writeInt(mConditionalBarringFactor); + dest.writeInt(mConditionalBarringTimeSeconds); + } + + /* @inheritDoc */ + public static final @NonNull Parcelable.Creator<BarringServiceInfo> CREATOR = + new Parcelable.Creator<BarringServiceInfo>() { + @Override + public BarringServiceInfo createFromParcel(Parcel source) { + return new BarringServiceInfo(source); + } + + @Override + public BarringServiceInfo[] newArray(int size) { + return new BarringServiceInfo[size]; + } + }; + + @Override + public int describeContents() { + return 0; + } + } + + private static final BarringServiceInfo BARRING_SERVICE_INFO_UNKNOWN = + new BarringServiceInfo(BarringServiceInfo.BARRING_TYPE_UNKNOWN); + + private static final BarringServiceInfo BARRING_SERVICE_INFO_UNBARRED = + new BarringServiceInfo(BarringServiceInfo.BARRING_TYPE_NONE); + + private CellIdentity mCellIdentity; + + // A SparseArray potentially mapping each BarringService type to a BarringServiceInfo config + // that describes the current barring status of that particular service. + private SparseArray<BarringServiceInfo> mBarringServiceInfos; + + /** @hide */ + @TestApi + @SystemApi + public BarringInfo() { + mBarringServiceInfos = new SparseArray<>(); + } + + /** + * Constructor for new BarringInfo instances. + * + * @hide + */ + @TestApi + public BarringInfo(@Nullable CellIdentity barringCellId, + @NonNull SparseArray<BarringServiceInfo> barringServiceInfos) { + mCellIdentity = barringCellId; + mBarringServiceInfos = barringServiceInfos; + } + + /** @hide */ + public static BarringInfo create( + @NonNull android.hardware.radio.V1_5.CellIdentity halBarringCellId, + @NonNull List<android.hardware.radio.V1_5.BarringInfo> halBarringInfos) { + CellIdentity ci = CellIdentity.create(halBarringCellId); + SparseArray<BarringServiceInfo> serviceInfos = new SparseArray<>(); + + for (android.hardware.radio.V1_5.BarringInfo halBarringInfo : halBarringInfos) { + if (halBarringInfo.barringType + == android.hardware.radio.V1_5.BarringInfo.BarringType.CONDITIONAL) { + if (halBarringInfo.barringTypeSpecificInfo.getDiscriminator() + != android.hardware.radio.V1_5.BarringInfo.BarringTypeSpecificInfo + .hidl_discriminator.conditional) { + // this is an error case where the barring info is conditional but the + // conditional barring fields weren't included + continue; + } + android.hardware.radio.V1_5.BarringInfo.BarringTypeSpecificInfo + .Conditional conditionalInfo = + halBarringInfo.barringTypeSpecificInfo.conditional(); + serviceInfos.put( + halBarringInfo.serviceType, new BarringServiceInfo( + halBarringInfo.barringType, // will always be CONDITIONAL here + conditionalInfo.isBarred, + conditionalInfo.factor, + conditionalInfo.timeSeconds)); + } else { + // Barring type is either NONE or UNCONDITIONAL + serviceInfos.put( + halBarringInfo.serviceType, new BarringServiceInfo( + halBarringInfo.barringType, false, 0, 0)); + } + } + return new BarringInfo(ci, serviceInfos); + } + + /** + * Get the BarringServiceInfo for a specified service. + * + * @return a BarringServiceInfo struct describing the current barring status for a service + */ + public @NonNull BarringServiceInfo getBarringServiceInfo(@BarringServiceType int service) { + BarringServiceInfo bsi = mBarringServiceInfos.get(service); + // If barring is reported but not for a particular service, then we report the barring + // type as UNKNOWN; if the modem reports barring info but doesn't report for a particular + // service then we can safely assume that the service isn't barred (for instance because + // that particular service isn't applicable to the current RAN). + return (bsi != null) ? bsi : mBarringServiceInfos.size() > 0 + ? BARRING_SERVICE_INFO_UNBARRED : BARRING_SERVICE_INFO_UNKNOWN; + } + + /** @hide */ + @SystemApi + public @NonNull BarringInfo createLocationInfoSanitizedCopy() { + // The only thing that would need sanitizing is the CellIdentity + if (mCellIdentity == null) return this; + + return new BarringInfo(mCellIdentity.sanitizeLocationInfo(), mBarringServiceInfos); + } + + /** @hide */ + public BarringInfo(Parcel p) { + mCellIdentity = p.readParcelable(CellIdentity.class.getClassLoader()); + mBarringServiceInfos = p.readSparseArray(BarringServiceInfo.class.getClassLoader()); + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + dest.writeParcelable(mCellIdentity, flags); + dest.writeSparseArray(mBarringServiceInfos); + } + + public static final @NonNull Parcelable.Creator<BarringInfo> CREATOR = + new Parcelable.Creator<BarringInfo>() { + @Override + public BarringInfo createFromParcel(Parcel source) { + return new BarringInfo(source); + } + + @Override + public BarringInfo[] newArray(int size) { + return new BarringInfo[size]; + } + }; + + @Override + public int describeContents() { + return 0; + } + + @Override + public int hashCode() { + int hash = mCellIdentity != null ? mCellIdentity.hashCode() : 7; + for (int i = 0; i < mBarringServiceInfos.size(); i++) { + hash = hash + 15 * mBarringServiceInfos.keyAt(i); + hash = hash + 31 * mBarringServiceInfos.valueAt(i).hashCode(); + } + return hash; + } + + @Override + public boolean equals(Object rhs) { + if (!(rhs instanceof BarringInfo)) return false; + + BarringInfo bi = (BarringInfo) rhs; + + if (hashCode() != bi.hashCode()) return false; + + if (mBarringServiceInfos.size() != bi.mBarringServiceInfos.size()) return false; + + for (int i = 0; i < mBarringServiceInfos.size(); i++) { + if (mBarringServiceInfos.keyAt(i) != bi.mBarringServiceInfos.keyAt(i)) return false; + if (!Objects.equals(mBarringServiceInfos.valueAt(i), + bi.mBarringServiceInfos.valueAt(i))) { + return false; + } + } + return true; + } + + @Override + public String toString() { + return "BarringInfo {mCellIdentity=" + mCellIdentity + + ", mBarringServiceInfos=" + mBarringServiceInfos + "}"; + } +} diff --git a/telephony/java/android/telephony/CallForwardingInfo.java b/telephony/java/android/telephony/CallForwardingInfo.java index 1dd7539420ac..7e777fae46eb 100644 --- a/telephony/java/android/telephony/CallForwardingInfo.java +++ b/telephony/java/android/telephony/CallForwardingInfo.java @@ -15,24 +15,24 @@ */ package android.telephony; + +import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SuppressLint; -import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; -import android.telephony.Annotation.CallForwardingReason; -import android.telephony.Annotation.CallForwardingStatus; import com.android.telephony.Rlog; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.Objects; /** * Defines the call forwarding information. * @hide */ -@SystemApi public final class CallForwardingInfo implements Parcelable { private static final String TAG = "CallForwardingInfo"; @@ -41,7 +41,6 @@ public final class CallForwardingInfo implements Parcelable { * * @hide */ - @SystemApi public static final int STATUS_INACTIVE = 0; /** @@ -49,7 +48,6 @@ public final class CallForwardingInfo implements Parcelable { * * @hide */ - @SystemApi public static final int STATUS_ACTIVE = 1; /** @@ -58,7 +56,6 @@ public final class CallForwardingInfo implements Parcelable { * * @hide */ - @SystemApi public static final int STATUS_FDN_CHECK_FAILURE = 2; /** @@ -66,7 +63,6 @@ public final class CallForwardingInfo implements Parcelable { * * @hide */ - @SystemApi public static final int STATUS_UNKNOWN_ERROR = 3; /** @@ -74,7 +70,6 @@ public final class CallForwardingInfo implements Parcelable { * * @hide */ - @SystemApi public static final int STATUS_NOT_SUPPORTED = 4; /** @@ -83,7 +78,6 @@ public final class CallForwardingInfo implements Parcelable { * and conditions +CCFC * @hide */ - @SystemApi public static final int REASON_UNCONDITIONAL = 0; /** @@ -92,7 +86,6 @@ public final class CallForwardingInfo implements Parcelable { * and conditions +CCFC * @hide */ - @SystemApi public static final int REASON_BUSY = 1; /** @@ -101,7 +94,6 @@ public final class CallForwardingInfo implements Parcelable { * and conditions +CCFC * @hide */ - @SystemApi public static final int REASON_NO_REPLY = 2; /** @@ -110,7 +102,6 @@ public final class CallForwardingInfo implements Parcelable { * and conditions +CCFC * @hide */ - @SystemApi public static final int REASON_NOT_REACHABLE = 3; /** @@ -120,7 +111,6 @@ public final class CallForwardingInfo implements Parcelable { * and conditions +CCFC * @hide */ - @SystemApi public static final int REASON_ALL = 4; /** @@ -130,20 +120,48 @@ public final class CallForwardingInfo implements Parcelable { * and conditions +CCFC * @hide */ - @SystemApi public static final int REASON_ALL_CONDITIONAL = 5; /** + * Call forwarding function status + */ + @IntDef(prefix = { "STATUS_" }, value = { + STATUS_ACTIVE, + STATUS_INACTIVE, + STATUS_UNKNOWN_ERROR, + STATUS_NOT_SUPPORTED, + STATUS_FDN_CHECK_FAILURE + }) + @Retention(RetentionPolicy.SOURCE) + public @interface CallForwardingStatus { + } + + /** + * Call forwarding reason types + */ + @IntDef(flag = true, prefix = { "REASON_" }, value = { + REASON_UNCONDITIONAL, + REASON_BUSY, + REASON_NO_REPLY, + REASON_NOT_REACHABLE, + REASON_ALL, + REASON_ALL_CONDITIONAL + }) + @Retention(RetentionPolicy.SOURCE) + public @interface CallForwardingReason { + } + + /** * The call forwarding status. */ - private @CallForwardingStatus int mStatus; + private int mStatus; /** * The call forwarding reason indicates the condition under which calls will be forwarded. * Reference: 3GPP TS 27.007 version 10.3.0 Release 10 - 7.11 Call forwarding number * and conditions +CCFC */ - private @CallForwardingReason int mReason; + private int mReason; /** * The phone number to which calls will be forwarded. @@ -166,7 +184,6 @@ public final class CallForwardingInfo implements Parcelable { * @param timeSeconds the timeout (in seconds) before the forwarding is attempted * @hide */ - @SystemApi public CallForwardingInfo(@CallForwardingStatus int status, @CallForwardingReason int reason, @Nullable String number, int timeSeconds) { mStatus = status; @@ -182,7 +199,6 @@ public final class CallForwardingInfo implements Parcelable { * * @hide */ - @SystemApi public @CallForwardingStatus int getStatus() { return mStatus; } @@ -196,7 +212,6 @@ public final class CallForwardingInfo implements Parcelable { * * @hide */ - @SystemApi public @CallForwardingReason int getReason() { return mReason; } @@ -209,7 +224,6 @@ public final class CallForwardingInfo implements Parcelable { * * @hide */ - @SystemApi @Nullable public String getNumber() { return mNumber; @@ -227,7 +241,6 @@ public final class CallForwardingInfo implements Parcelable { * * @hide */ - @SystemApi @SuppressLint("MethodNameUnits") public int getTimeoutSeconds() { return mTimeSeconds; diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index bca09e5a3c0e..8cbeba14405b 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -37,6 +37,8 @@ import android.telephony.ims.ImsReasonInfo; import com.android.internal.telephony.ICarrierConfigLoader; import com.android.telephony.Rlog; +import java.util.concurrent.TimeUnit; + /** * Provides access to telephony configuration values that are carrier-specific. */ @@ -319,6 +321,34 @@ public class CarrierConfigManager { "only_auto_select_in_home_network"; /** + * Flag indicating whether to show single operator row in the choose network setting. + * + * The device configuration value {@code config_enableNewAutoSelectNetworkUI} ultimately + * controls whether this carrier configuration option is used. Where + * {@code config_enableNewAutoSelectNetworkUI} is false, the value of the + * {@link #KEY_SHOW_SINGLE_OPERATOR_ROW_IN_CHOOSE_NETWORK_SETTING_BOOL} carrier configuration + * option is ignored. + * + * If {@code true}, default value, merge the duplicate networks which with the same plmn, keep + * the one that with the higher signal strength level. + * If {@code false}, show all operators without merging. + * @hide + */ + public static final String KEY_SHOW_SINGLE_OPERATOR_ROW_IN_CHOOSE_NETWORK_SETTING_BOOL = + "show_single_operator_row_in_choose_network_setting_bool"; + + /** + * Flag indicating whether to display SPN as network name for home network in choose + * network setting. + * + * If {@code true}, display SPN as network name in choose network setting. + * If {@code false}, display PLMN in choose network setting. + * @hide + */ + public static final String KEY_SHOW_SPN_FOR_HOME_IN_CHOOSE_NETWORK_SETTING_BOOL = + "show_spn_for_home_in_choose_network_setting_bool"; + + /** * Control whether users receive a simplified network settings UI and improved network * selection. */ @@ -1523,6 +1553,7 @@ public class CarrierConfigManager { /** * The string is used to compare with operator name. * If it matches the pattern then show specific data icon. + * @hide */ public static final String KEY_SHOW_CARRIER_DATA_ICON_PATTERN_STRING = "show_carrier_data_icon_pattern_string"; @@ -2334,17 +2365,16 @@ public class CarrierConfigManager { * <p> If a measure is not set, signal criteria reporting from modem will not be triggered and * not be used for calculating signal level. If multiple measures are set bit, the parameter * whose value is smallest is used to indicate the signal level. + * <UL> + * <LI>RSRP = 1 << 0</LI> + * <LI>RSRQ = 1 << 1</LI> + * <LI>RSSNR = 1 << 2</LI> + * </UL> + * <p> The value of this key must be bitwise OR of {@link CellSignalStrengthLte#USE_RSRP}, + * {@link CellSignalStrengthLte#USE_RSRQ}, {@link CellSignalStrengthLte#USE_RSSNR}. * - * RSRP = 1 << 0, - * RSRQ = 1 << 1, - * RSSNR = 1 << 2, - * - * The value of this key must be bitwise OR of {@link CellSignalStrengthLte#USE_RSRP}, - * {@link CellSignalStrengthLte#USE_RSRQ}, {@link CellSignalStrengthLte#USE_RSSNR}. - * - * For example, if both RSRP and RSRQ are used, the value of key is 3 (1 << 0 | 1 << 1). - * If the key is invalid or not configured, a default value (RSRP = 1 << 0) - * will apply. + * <p> For example, if both RSRP and RSRQ are used, the value of key is 3 (1 << 0 | 1 << 1). + * If the key is invalid or not configured, a default value (RSRP = 1 << 0) will apply. * * @hide */ @@ -2353,16 +2383,18 @@ public class CarrierConfigManager { /** * List of 4 customized 5G SS reference signal received power (SSRSRP) thresholds. - * + * <p> * Reference: 3GPP TS 38.215 - * + * <p> * 4 threshold integers must be within the boundaries [-140 dB, -44 dB], and the levels are: - * "NONE: [-140, threshold1]" - * "POOR: (threshold1, threshold2]" - * "MODERATE: (threshold2, threshold3]" - * "GOOD: (threshold3, threshold4]" - * "EXCELLENT: (threshold4, -44]" - * + * <UL> + * <LI>"NONE: [-140, threshold1]"</LI> + * <LI>"POOR: (threshold1, threshold2]"</LI> + * <LI>"MODERATE: (threshold2, threshold3]"</LI> + * <LI>"GOOD: (threshold3, threshold4]"</LI> + * <LI>"EXCELLENT: (threshold4, -44]"</LI> + * </UL> + * <p> * This key is considered invalid if the format is violated. If the key is invalid or * not configured, a default value set will apply. */ @@ -2371,16 +2403,18 @@ public class CarrierConfigManager { /** * List of 4 customized 5G SS reference signal received quality (SSRSRQ) thresholds. - * + * <p> * Reference: 3GPP TS 38.215 - * + * <p> * 4 threshold integers must be within the boundaries [-20 dB, -3 dB], and the levels are: - * "NONE: [-20, threshold1]" - * "POOR: (threshold1, threshold2]" - * "MODERATE: (threshold2, threshold3]" - * "GOOD: (threshold3, threshold4]" - * "EXCELLENT: (threshold4, -3]" - * + * <UL> + * <LI>"NONE: [-20, threshold1]"</LI> + * <LI>"POOR: (threshold1, threshold2]"</LI> + * <LI>"MODERATE: (threshold2, threshold3]"</LI> + * <LI>"GOOD: (threshold3, threshold4]"</LI> + * <LI>"EXCELLENT: (threshold4, -3]"</LI> + * </UL> + * <p> * This key is considered invalid if the format is violated. If the key is invalid or * not configured, a default value set will apply. */ @@ -2389,17 +2423,19 @@ public class CarrierConfigManager { /** * List of 4 customized 5G SS signal-to-noise and interference ratio (SSSINR) thresholds. - * + * <p> * Reference: 3GPP TS 38.215, * 3GPP TS 38.133 10.1.16.1 - * + * <p> * 4 threshold integers must be within the boundaries [-23 dB, 40 dB], and the levels are: - * "NONE: [-23, threshold1]" - * "POOR: (threshold1, threshold2]" - * "MODERATE: (threshold2, threshold3]" - * "GOOD: (threshold3, threshold4]" - * "EXCELLENT: (threshold4, 40]" - * + * <UL> + * <LI>"NONE: [-23, threshold1]"</LI> + * <LI>"POOR: (threshold1, threshold2]"</LI> + * <LI>"MODERATE: (threshold2, threshold3]"</LI> + * <LI>"GOOD: (threshold3, threshold4]"</LI> + * <LI>"EXCELLENT: (threshold4, 40]"</LI> + * </UL> + * <p> * This key is considered invalid if the format is violated. If the key is invalid or * not configured, a default value set will apply. */ @@ -2414,19 +2450,19 @@ public class CarrierConfigManager { * <p> If a measure is not set, signal criteria reporting from modem will not be triggered and * not be used for calculating signal level. If multiple measures are set bit, the parameter * whose value is smallest is used to indicate the signal level. - * - * SSRSRP = 1 << 0, - * SSRSRQ = 1 << 1, - * SSSINR = 1 << 2, - * + * <UL> + * <LI>SSRSRP = 1 << 0</LI> + * <LI>SSRSRQ = 1 << 1</LI> + * <LI>SSSINR = 1 << 2</LI> + * </UL> * The value of this key must be bitwise OR of {@link CellSignalStrengthNr#USE_SSRSRP}, * {@link CellSignalStrengthNr#USE_SSRSRQ}, {@link CellSignalStrengthNr#USE_SSSINR}. * - * For example, if both SSRSRP and SSSINR are used, the value of key is 5 (1 << 0 | 1 << 2). + * <p> For example, if both SSRSRP and SSSINR are used, the value of key is 5 (1 << 0 | 1 << 2). * If the key is invalid or not configured, a default value (SSRSRP = 1 << 0) will apply. * - * Reference: 3GPP TS 38.215, - * 3GPP TS 38.133 10.1.16.1 + * <p> Reference: 3GPP TS 38.215, + * 3GPP TS 38.133 10.1.16.1 * * @hide */ @@ -2434,6 +2470,21 @@ public class CarrierConfigManager { "parameters_use_for_5g_nr_signal_bar_int"; /** + * String array of default bandwidth values per network type. + * The entries should be of form "network_name:downstream,upstream", with values in Kbps. + * @hide + */ + public static final String KEY_BANDWIDTH_STRING_ARRAY = "bandwidth_string_array"; + + /** + * For NR (non-standalone), whether to use the LTE value instead of NR value as the default for + * upstream bandwidth. Downstream bandwidth will still use the NR value as the default. + * @hide + */ + public static final String KEY_BANDWIDTH_NR_NSA_USE_LTE_VALUE_FOR_UPSTREAM_BOOL = + "bandwidth_nr_nsa_use_lte_value_for_upstream_bool"; + + /** * Key identifying if voice call barring notification is required to be shown to the user. * @hide */ @@ -2917,9 +2968,9 @@ public class CarrierConfigManager { * UE wants to display 5G_Plus icon for scenario#1, and 5G icon for scenario#2; otherwise not * define. * The configuration is: "connected_mmwave:5G_Plus,connected:5G" + * @hide */ - public static final String KEY_5G_ICON_CONFIGURATION_STRING = - "5g_icon_configuration_string"; + public static final String KEY_5G_ICON_CONFIGURATION_STRING = "5g_icon_configuration_string"; /** * Timeout in seconds for displaying 5G icon, default value is 0 which means the timer is @@ -2931,11 +2982,40 @@ public class CarrierConfigManager { * * If 5G is reacquired during this timer, the timer is canceled and restarted when 5G is next * lost. Allows us to momentarily lose 5G without blinking the icon. + * @hide */ public static final String KEY_5G_ICON_DISPLAY_GRACE_PERIOD_SEC_INT = "5g_icon_display_grace_period_sec_int"; /** + * Controls time in milliseconds until DcTracker reevaluates 5G connection state. + * @hide + */ + public static final String KEY_5G_WATCHDOG_TIME_MS_LONG = "5g_watchdog_time_long"; + + /** + * Whether NR (non-standalone) should be unmetered for all frequencies. + * If either {@link #KEY_UNMETERED_NR_NSA_MMWAVE_BOOL} or + * {@link #KEY_UNMETERED_NR_NSA_SUB6_BOOL} are true, then this value will be ignored. + * @hide + */ + public static final String KEY_UNMETERED_NR_NSA_BOOL = "unmetered_nr_nsa_bool"; + + /** + * Whether NR (non-standalone) frequencies above 6GHz (millimeter wave) should be unmetered. + * If this is true, then the value for {@link #KEY_UNMETERED_NR_NSA_BOOL} will be ignored. + * @hide + */ + public static final String KEY_UNMETERED_NR_NSA_MMWAVE_BOOL = "unmetered_nr_nsa_mmwave_bool"; + + /** + * Whether NR (non-standalone) frequencies below 6GHz (sub6) should be unmetered. + * If this is true, then the value for {@link #KEY_UNMETERED_NR_NSA_BOOL} will be ignored. + * @hide + */ + public static final String KEY_UNMETERED_NR_NSA_SUB6_BOOL = "unmetered_nr_nsa_sub6_bool"; + + /** * Support ASCII 7-BIT encoding for long SMS. This carrier config is used to enable * this feature. * @hide @@ -2944,6 +3024,13 @@ public class CarrierConfigManager { "ascii_7_bit_support_for_long_message_bool"; /** + * Controls whether to show wifi calling icon in statusbar when wifi calling is available. + * @hide + */ + public static final String KEY_SHOW_WIFI_CALLING_ICON_IN_STATUS_BAR_BOOL = + "show_wifi_calling_icon_in_status_bar_bool"; + + /** * Controls RSRP threshold at which OpportunisticNetworkService will decide whether * the opportunistic network is good enough for internet data. */ @@ -3007,11 +3094,6 @@ public class CarrierConfigManager { "ping_test_before_data_switch_bool"; /** - * Controls time in milliseconds until DcTracker reevaluates 5G connection state. - */ - public static final String KEY_5G_WATCHDOG_TIME_MS_LONG = - "5g_watchdog_time_long"; - /** * Controls whether to switch data to primary from opportunistic subscription * if primary is out of service. This control only affects system or 1st party app * initiated data switch, but will not override data switch initiated by privileged carrier apps @@ -3430,6 +3512,15 @@ public class CarrierConfigManager { "carrier_certificate_string_array"; /** + * Flag specifying whether the incoming call number should be formatted to national number + * for Japan. @return {@code true} convert to the national format, {@code false} otherwise. + * e.g. "+819012345678" -> "09012345678" + * @hide + */ + public static final String KEY_FORMAT_INCOMING_NUMBER_TO_NATIONAL_FOR_JP_BOOL = + "format_incoming_number_to_national_for_jp_bool"; + + /** * DisconnectCause array to play busy tone. Value should be array of * {@link android.telephony.DisconnectCause}. */ @@ -3444,6 +3535,30 @@ public class CarrierConfigManager { public static final String KEY_PREVENT_CLIR_ACTIVATION_AND_DEACTIVATION_CODE_BOOL = "prevent_clir_activation_and_deactivation_code_bool"; + /** + * The list of originating address of missed incoming call SMS. If the SMS has originator + * matched, the SMS will be treated as special SMS for notifying missed incoming call to the + * user. + * + * @hide + */ + public static final String KEY_MISSED_INCOMING_CALL_SMS_ORIGINATOR_STRING_ARRAY = + "missed_incoming_call_sms_originator_string_array"; + + /** + * The patterns of missed incoming call sms. This is the regular expression used for + * matching the missed incoming call's date, time, and caller id. The pattern should match + * fields for at least month, day, hour, and minute. Year is optional although it is encouraged. + * + * An usable pattern should look like this: + * ^(?<month>0[1-9]|1[012])\/(?<day>0[1-9]|1[0-9]|2[0-9]|3[0-1]) (?<hour>[0-1][0-9]|2[0-3]): + * (?<minute>[0-5][0-9])\s*(?<callerId>[0-9]+)\s*$ + * + * @hide + */ + public static final String KEY_MISSED_INCOMING_CALL_SMS_PATTERN_STRING_ARRAY = + "missed_incoming_call_sms_pattern_string_array"; + /** The default value for every variable. */ private final static PersistableBundle sDefaults; @@ -3508,6 +3623,8 @@ public class CarrierConfigManager { sDefaults.putBoolean(KEY_HAS_IN_CALL_NOISE_SUPPRESSION_BOOL, false); sDefaults.putBoolean(KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL, false); sDefaults.putBoolean(KEY_ONLY_AUTO_SELECT_IN_HOME_NETWORK_BOOL, false); + sDefaults.putBoolean(KEY_SHOW_SINGLE_OPERATOR_ROW_IN_CHOOSE_NETWORK_SETTING_BOOL, true); + sDefaults.putBoolean(KEY_SHOW_SPN_FOR_HOME_IN_CHOOSE_NETWORK_SETTING_BOOL, false); sDefaults.putBoolean(KEY_SIMPLIFIED_NETWORK_SETTINGS_BOOL, false); sDefaults.putBoolean(KEY_HIDE_SIM_LOCK_SETTINGS_BOOL, false); @@ -3609,7 +3726,7 @@ public class CarrierConfigManager { sDefaults.putInt(KEY_IMS_DTMF_TONE_DELAY_INT, 0); sDefaults.putInt(KEY_CDMA_DTMF_TONE_DELAY_INT, 100); sDefaults.putBoolean(KEY_CALL_FORWARDING_MAP_NON_NUMBER_TO_VOICEMAIL_BOOL, false); - sDefaults.putBoolean(KEY_IGNORE_RTT_MODE_SETTING_BOOL, false); + sDefaults.putBoolean(KEY_IGNORE_RTT_MODE_SETTING_BOOL, true); sDefaults.putInt(KEY_CDMA_3WAYCALL_FLASH_DELAY_INT , 0); sDefaults.putBoolean(KEY_SUPPORT_ADHOC_CONFERENCE_CALLS_BOOL, false); sDefaults.putBoolean(KEY_SUPPORT_ADD_CONFERENCE_PARTICIPANTS_BOOL, false); @@ -3863,6 +3980,13 @@ public class CarrierConfigManager { }); sDefaults.putInt(KEY_PARAMETERS_USE_FOR_5G_NR_SIGNAL_BAR_INT, CellSignalStrengthNr.USE_SSRSRP); + sDefaults.putStringArray(KEY_BANDWIDTH_STRING_ARRAY, new String[]{ + "GPRS:24,24", "EDGE:70,18", "UMTS:115,115", "CDMA-IS95A:14,14", "CDMA-IS95B:14,14", + "1xRTT:30,30", "EvDo-rev.0:750,48", "EvDo-rev.A:950,550", "HSDPA:4300,620", + "HSUPA:4300,1800", "HSPA:4300,1800", "EvDo-rev.B:1500,550:", "eHRPD:750,48", + "HSPAP:13000,3400", "TD-SCDMA:115,115", "LTE:30000,15000", "NR_NSA:47000,15000", + "NR_NSA_MMWAVE:145000,15000", "NR_SA:145000,15000"}); + sDefaults.putBoolean(KEY_BANDWIDTH_NR_NSA_USE_LTE_VALUE_FOR_UPSTREAM_BOOL, false); sDefaults.putString(KEY_WCDMA_DEFAULT_SIGNAL_STRENGTH_MEASUREMENT_STRING, "rssi"); sDefaults.putBoolean(KEY_CONFIG_SHOW_ORIG_DIAL_STRING_FOR_CDMA_BOOL, false); sDefaults.putBoolean(KEY_SHOW_CALL_BLOCKING_DISABLED_NOTIFICATION_ALWAYS_BOOL, false); @@ -3876,9 +4000,16 @@ public class CarrierConfigManager { sDefaults.putBoolean(KEY_USE_CALLER_ID_USSD_BOOL, false); sDefaults.putInt(KEY_CALL_WAITING_SERVICE_CLASS_INT, 1 /* SERVICE_CLASS_VOICE */); sDefaults.putString(KEY_5G_ICON_CONFIGURATION_STRING, - "connected_mmwave:5G,connected:5G"); + "connected_mmwave:5G,connected:5G,not_restricted_rrc_idle:5G," + + "not_restricted_rrc_con:5G"); sDefaults.putInt(KEY_5G_ICON_DISPLAY_GRACE_PERIOD_SEC_INT, 0); + /* Default value is 1 hour. */ + sDefaults.putLong(KEY_5G_WATCHDOG_TIME_MS_LONG, 3600000); + sDefaults.putBoolean(KEY_UNMETERED_NR_NSA_BOOL, false); + sDefaults.putBoolean(KEY_UNMETERED_NR_NSA_MMWAVE_BOOL, false); + sDefaults.putBoolean(KEY_UNMETERED_NR_NSA_SUB6_BOOL, false); sDefaults.putBoolean(KEY_ASCII_7_BIT_SUPPORT_FOR_LONG_MESSAGE_BOOL, false); + sDefaults.putBoolean(KEY_SHOW_WIFI_CALLING_ICON_IN_STATUS_BAR_BOOL, false); /* Default value is minimum RSRP level needed for SIGNAL_STRENGTH_GOOD */ sDefaults.putInt(KEY_OPPORTUNISTIC_NETWORK_ENTRY_THRESHOLD_RSRP_INT, -108); /* Default value is minimum RSRP level needed for SIGNAL_STRENGTH_MODERATE */ @@ -3896,8 +4027,6 @@ public class CarrierConfigManager { /* Default value is 3 seconds. */ sDefaults.putLong(KEY_OPPORTUNISTIC_NETWORK_DATA_SWITCH_EXIT_HYSTERESIS_TIME_LONG, 3000); sDefaults.putBoolean(KEY_PING_TEST_BEFORE_DATA_SWITCH_BOOL, true); - /* Default value is 1 hour. */ - sDefaults.putLong(KEY_5G_WATCHDOG_TIME_MS_LONG, 3600000); sDefaults.putBoolean(KEY_SWITCH_DATA_TO_PRIMARY_IF_PRIMARY_IS_OOS_BOOL, true); /* Default value is 60 seconds. */ sDefaults.putLong(KEY_OPPORTUNISTIC_NETWORK_PING_PONG_TIME_LONG, 60000); @@ -3929,13 +4058,17 @@ public class CarrierConfigManager { sDefaults.putBoolean(KEY_SUPPORT_WPS_OVER_IMS_BOOL, true); sDefaults.putAll(Ims.getDefaults()); sDefaults.putStringArray(KEY_CARRIER_CERTIFICATE_STRING_ARRAY, null); + sDefaults.putBoolean(KEY_FORMAT_INCOMING_NUMBER_TO_NATIONAL_FOR_JP_BOOL, false); sDefaults.putIntArray(KEY_DISCONNECT_CAUSE_PLAY_BUSYTONE_INT_ARRAY, new int[] {4 /* BUSY */}); sDefaults.putBoolean(KEY_PREVENT_CLIR_ACTIVATION_AND_DEACTIVATION_CODE_BOOL, false); sDefaults.putLong(KEY_DATA_SWITCH_VALIDATION_TIMEOUT_LONG, 2000); sDefaults.putInt(KEY_PARAMETERS_USED_FOR_LTE_SIGNAL_BAR_INT, CellSignalStrengthLte.USE_RSRP); - sDefaults.putLong(KEY_DATA_SWITCH_VALIDATION_MIN_GAP_LONG, 0); + sDefaults.putLong(KEY_DATA_SWITCH_VALIDATION_MIN_GAP_LONG, TimeUnit.DAYS.toMillis(1)); + sDefaults.putStringArray(KEY_MISSED_INCOMING_CALL_SMS_ORIGINATOR_STRING_ARRAY, + new String[0]); + sDefaults.putStringArray(KEY_MISSED_INCOMING_CALL_SMS_PATTERN_STRING_ARRAY, new String[0]); } /** @@ -4154,6 +4287,7 @@ public class CarrierConfigManager { } catch (RemoteException ex) { Rlog.e(TAG, "getDefaultCarrierServicePackageName ICarrierConfigLoader is null" + ex.toString()); + ex.rethrowAsRuntimeException(); } return ""; } diff --git a/telephony/java/android/telephony/CellIdentityGsm.java b/telephony/java/android/telephony/CellIdentityGsm.java index 9f2537c7ed10..203047fb111d 100644 --- a/telephony/java/android/telephony/CellIdentityGsm.java +++ b/telephony/java/android/telephony/CellIdentityGsm.java @@ -22,11 +22,12 @@ import android.compat.annotation.UnsupportedAppUsage; import android.os.Parcel; import android.telephony.gsm.GsmCellLocation; import android.text.TextUtils; +import android.util.ArraySet; -import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; -import java.util.List; import java.util.Objects; +import java.util.Set; /** * CellIdentity to represent a unique GSM cell @@ -50,7 +51,7 @@ public final class CellIdentityGsm extends CellIdentity { private final int mBsic; // a list of additional PLMN-IDs reported for this cell - private final List<String> mAdditionalPlmns; + private final ArraySet<String> mAdditionalPlmns; /** * @hide @@ -62,7 +63,7 @@ public final class CellIdentityGsm extends CellIdentity { mCid = CellInfo.UNAVAILABLE; mArfcn = CellInfo.UNAVAILABLE; mBsic = CellInfo.UNAVAILABLE; - mAdditionalPlmns = Collections.emptyList(); + mAdditionalPlmns = new ArraySet<>(); } /** @@ -81,13 +82,13 @@ public final class CellIdentityGsm extends CellIdentity { */ public CellIdentityGsm(int lac, int cid, int arfcn, int bsic, @Nullable String mccStr, @Nullable String mncStr, @Nullable String alphal, @Nullable String alphas, - @NonNull List<String> additionalPlmns) { + @NonNull Collection<String> additionalPlmns) { super(TAG, CellInfo.TYPE_GSM, mccStr, mncStr, alphal, alphas); mLac = inRangeOrUnavailable(lac, 0, MAX_LAC); mCid = inRangeOrUnavailable(cid, 0, MAX_CID); mArfcn = inRangeOrUnavailable(arfcn, 0, MAX_ARFCN); mBsic = inRangeOrUnavailable(bsic, 0, MAX_BSIC); - mAdditionalPlmns = new ArrayList<>(additionalPlmns.size()); + mAdditionalPlmns = new ArraySet<>(additionalPlmns.size()); for (String plmn : additionalPlmns) { if (isValidPlmn(plmn)) { mAdditionalPlmns.add(plmn); @@ -99,7 +100,7 @@ public final class CellIdentityGsm extends CellIdentity { public CellIdentityGsm(@NonNull android.hardware.radio.V1_0.CellIdentityGsm cid) { this(cid.lac, cid.cid, cid.arfcn, cid.bsic == (byte) 0xFF ? CellInfo.UNAVAILABLE : cid.bsic, - cid.mcc, cid.mnc, "", "", Collections.emptyList()); + cid.mcc, cid.mnc, "", "", new ArraySet<>()); } /** @hide */ @@ -107,7 +108,7 @@ public final class CellIdentityGsm extends CellIdentity { this(cid.base.lac, cid.base.cid, cid.base.arfcn, cid.base.bsic == (byte) 0xFF ? CellInfo.UNAVAILABLE : cid.base.bsic, cid.base.mcc, cid.base.mnc, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort, - Collections.emptyList()); + new ArraySet<>()); } /** @hide */ @@ -221,8 +222,8 @@ public final class CellIdentityGsm extends CellIdentity { * @return a list of additional PLMN IDs supported by this cell. */ @NonNull - public List<String> getAdditionalPlmns() { - return mAdditionalPlmns; + public Set<String> getAdditionalPlmns() { + return Collections.unmodifiableSet(mAdditionalPlmns); } /** @@ -296,7 +297,7 @@ public final class CellIdentityGsm extends CellIdentity { dest.writeInt(mCid); dest.writeInt(mArfcn); dest.writeInt(mBsic); - dest.writeList(mAdditionalPlmns); + dest.writeArraySet(mAdditionalPlmns); } /** Construct from Parcel, type has already been processed */ @@ -306,7 +307,7 @@ public final class CellIdentityGsm extends CellIdentity { mCid = in.readInt(); mArfcn = in.readInt(); mBsic = in.readInt(); - mAdditionalPlmns = in.readArrayList(null); + mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null); if (DBG) log(toString()); } diff --git a/telephony/java/android/telephony/CellIdentityLte.java b/telephony/java/android/telephony/CellIdentityLte.java index a194ae35216c..b4ce162274fb 100644 --- a/telephony/java/android/telephony/CellIdentityLte.java +++ b/telephony/java/android/telephony/CellIdentityLte.java @@ -23,11 +23,13 @@ import android.os.Build; import android.os.Parcel; import android.telephony.gsm.GsmCellLocation; import android.text.TextUtils; +import android.util.ArraySet; -import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; import java.util.Collections; -import java.util.List; import java.util.Objects; +import java.util.Set; /** * CellIdentity is to represent a unique LTE cell @@ -52,9 +54,11 @@ public final class CellIdentityLte extends CellIdentity { private final int mEarfcn; // cell bandwidth, in kHz private final int mBandwidth; + // cell bands + private final int[] mBands; // a list of additional PLMN-IDs reported for this cell - private final List<String> mAdditionalPlmns; + private final ArraySet<String> mAdditionalPlmns; private ClosedSubscriberGroupInfo mCsgInfo; @@ -68,8 +72,9 @@ public final class CellIdentityLte extends CellIdentity { mPci = CellInfo.UNAVAILABLE; mTac = CellInfo.UNAVAILABLE; mEarfcn = CellInfo.UNAVAILABLE; + mBands = new int[] {}; mBandwidth = CellInfo.UNAVAILABLE; - mAdditionalPlmns = Collections.emptyList(); + mAdditionalPlmns = new ArraySet<>(); mCsgInfo = null; } @@ -85,8 +90,9 @@ public final class CellIdentityLte extends CellIdentity { */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) public CellIdentityLte(int mcc, int mnc, int ci, int pci, int tac) { - this(ci, pci, tac, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, String.valueOf(mcc), - String.valueOf(mnc), null, null, Collections.emptyList(), null); + this(ci, pci, tac, CellInfo.UNAVAILABLE, new int[] {}, CellInfo.UNAVAILABLE, + String.valueOf(mcc), String.valueOf(mnc), null, null, new ArraySet<>(), + null); } /** @@ -105,17 +111,19 @@ public final class CellIdentityLte extends CellIdentity { * * @hide */ - public CellIdentityLte(int ci, int pci, int tac, int earfcn, int bandwidth, - @Nullable String mccStr, @Nullable String mncStr, @Nullable String alphal, - @Nullable String alphas, @NonNull List<String> additionalPlmns, + public CellIdentityLte(int ci, int pci, int tac, int earfcn, @NonNull int[] bands, + int bandwidth, @Nullable String mccStr, @Nullable String mncStr, + @Nullable String alphal, @Nullable String alphas, + @NonNull Collection<String> additionalPlmns, @Nullable ClosedSubscriberGroupInfo csgInfo) { super(TAG, CellInfo.TYPE_LTE, mccStr, mncStr, alphal, alphas); mCi = inRangeOrUnavailable(ci, 0, MAX_CI); mPci = inRangeOrUnavailable(pci, 0, MAX_PCI); mTac = inRangeOrUnavailable(tac, 0, MAX_TAC); mEarfcn = inRangeOrUnavailable(earfcn, 0, MAX_EARFCN); + mBands = bands; mBandwidth = inRangeOrUnavailable(bandwidth, 0, MAX_BANDWIDTH); - mAdditionalPlmns = new ArrayList<>(additionalPlmns.size()); + mAdditionalPlmns = new ArraySet<>(additionalPlmns.size()); for (String plmn : additionalPlmns) { if (isValidPlmn(plmn)) { mAdditionalPlmns.add(plmn); @@ -126,28 +134,29 @@ public final class CellIdentityLte extends CellIdentity { /** @hide */ public CellIdentityLte(@NonNull android.hardware.radio.V1_0.CellIdentityLte cid) { - this(cid.ci, cid.pci, cid.tac, cid.earfcn, - CellInfo.UNAVAILABLE, cid.mcc, cid.mnc, "", "", Collections.emptyList(), null); + this(cid.ci, cid.pci, cid.tac, cid.earfcn, new int[] {}, + CellInfo.UNAVAILABLE, cid.mcc, cid.mnc, "", "", new ArraySet<>(), null); } /** @hide */ public CellIdentityLte(@NonNull android.hardware.radio.V1_2.CellIdentityLte cid) { - this(cid.base.ci, cid.base.pci, cid.base.tac, cid.base.earfcn, cid.bandwidth, - cid.base.mcc, cid.base.mnc, cid.operatorNames.alphaLong, - cid.operatorNames.alphaShort, Collections.emptyList(), null); + this(cid.base.ci, cid.base.pci, cid.base.tac, cid.base.earfcn, new int[] {}, + cid.bandwidth, cid.base.mcc, cid.base.mnc, cid.operatorNames.alphaLong, + cid.operatorNames.alphaShort, new ArraySet<>(), null); } /** @hide */ public CellIdentityLte(@NonNull android.hardware.radio.V1_5.CellIdentityLte cid) { this(cid.base.base.ci, cid.base.base.pci, cid.base.base.tac, cid.base.base.earfcn, - cid.base.bandwidth, cid.base.base.mcc, cid.base.base.mnc, - cid.base.operatorNames.alphaLong, cid.base.operatorNames.alphaShort, - cid.additionalPlmns, cid.optionalCsgInfo.csgInfo() != null + cid.bands.stream().mapToInt(Integer::intValue).toArray(), cid.base.bandwidth, + cid.base.base.mcc, cid.base.base.mnc, cid.base.operatorNames.alphaLong, + cid.base.operatorNames.alphaShort, cid.additionalPlmns, + cid.optionalCsgInfo.csgInfo() != null ? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo()) : null); } private CellIdentityLte(@NonNull CellIdentityLte cid) { - this(cid.mCi, cid.mPci, cid.mTac, cid.mEarfcn, cid.mBandwidth, cid.mMccStr, + this(cid.mCi, cid.mPci, cid.mTac, cid.mEarfcn, cid.mBands, cid.mBandwidth, cid.mMccStr, cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort, cid.mAdditionalPlmns, cid.mCsgInfo); } @@ -155,7 +164,7 @@ public final class CellIdentityLte extends CellIdentity { @Override public @NonNull CellIdentityLte sanitizeLocationInfo() { return new CellIdentityLte(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, - CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, + CellInfo.UNAVAILABLE, mBands, CellInfo.UNAVAILABLE, mMccStr, mMncStr, mAlphaLong, mAlphaShort, mAdditionalPlmns, null); } @@ -220,12 +229,11 @@ public final class CellIdentityLte extends CellIdentity { * * Reference: 3GPP TS 36.101 section 5.5 * - * @return List of band number or empty list if not available. + * @return Array of band number or empty array if not available. */ @NonNull - public List<Integer> getBands() { - // Todo: Add actual support - return Collections.emptyList(); + public int[] getBands() { + return Arrays.copyOf(mBands, mBands.length); } /** @@ -270,8 +278,8 @@ public final class CellIdentityLte extends CellIdentity { * @return a list of additional PLMN IDs supported by this cell. */ @NonNull - public List<String> getAdditionalPlmns() { - return mAdditionalPlmns; + public Set<String> getAdditionalPlmns() { + return Collections.unmodifiableSet(mAdditionalPlmns); } /** @@ -307,8 +315,8 @@ public final class CellIdentityLte extends CellIdentity { @Override public int hashCode() { - return Objects.hash(mCi, mPci, mTac, - mAdditionalPlmns.hashCode(), mCsgInfo, super.hashCode()); + return Objects.hash(mCi, mPci, mTac, mEarfcn, Arrays.hashCode(mBands), + mBandwidth, mAdditionalPlmns.hashCode(), mCsgInfo, super.hashCode()); } @Override @@ -326,6 +334,7 @@ public final class CellIdentityLte extends CellIdentity { && mPci == o.mPci && mTac == o.mTac && mEarfcn == o.mEarfcn + && Arrays.equals(mBands, o.mBands) && mBandwidth == o.mBandwidth && TextUtils.equals(mMccStr, o.mMccStr) && TextUtils.equals(mMncStr, o.mMncStr) @@ -341,6 +350,7 @@ public final class CellIdentityLte extends CellIdentity { .append(" mPci=").append(mPci) .append(" mTac=").append(mTac) .append(" mEarfcn=").append(mEarfcn) + .append(" mBands=").append(mBands) .append(" mBandwidth=").append(mBandwidth) .append(" mMcc=").append(mMccStr) .append(" mMnc=").append(mMncStr) @@ -360,8 +370,9 @@ public final class CellIdentityLte extends CellIdentity { dest.writeInt(mPci); dest.writeInt(mTac); dest.writeInt(mEarfcn); + dest.writeIntArray(mBands); dest.writeInt(mBandwidth); - dest.writeList(mAdditionalPlmns); + dest.writeArraySet(mAdditionalPlmns); dest.writeParcelable(mCsgInfo, flags); } @@ -372,8 +383,9 @@ public final class CellIdentityLte extends CellIdentity { mPci = in.readInt(); mTac = in.readInt(); mEarfcn = in.readInt(); + mBands = in.createIntArray(); mBandwidth = in.readInt(); - mAdditionalPlmns = in.readArrayList(null); + mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null); mCsgInfo = in.readParcelable(null); if (DBG) log(toString()); } diff --git a/telephony/java/android/telephony/CellIdentityNr.java b/telephony/java/android/telephony/CellIdentityNr.java index a0ef5aa2feae..69cf7e7d4814 100644 --- a/telephony/java/android/telephony/CellIdentityNr.java +++ b/telephony/java/android/telephony/CellIdentityNr.java @@ -22,11 +22,13 @@ import android.annotation.Nullable; import android.os.Parcel; import android.telephony.AccessNetworkConstants.NgranBands.NgranBand; import android.telephony.gsm.GsmCellLocation; +import android.util.ArraySet; -import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; import java.util.Collections; -import java.util.List; import java.util.Objects; +import java.util.Set; /** * Information to represent a unique NR(New Radio 5G) cell. @@ -43,10 +45,10 @@ public final class CellIdentityNr extends CellIdentity { private final int mPci; private final int mTac; private final long mNci; - private final List<Integer> mBands; + private final int[] mBands; // a list of additional PLMN-IDs reported for this cell - private final List<String> mAdditionalPlmns; + private final ArraySet<String> mAdditionalPlmns; /** * @@ -63,17 +65,18 @@ public final class CellIdentityNr extends CellIdentity { * * @hide */ - public CellIdentityNr(int pci, int tac, int nrArfcn, @NgranBand List<Integer> bands, + public CellIdentityNr(int pci, int tac, int nrArfcn, @NonNull @NgranBand int[] bands, @Nullable String mccStr, @Nullable String mncStr, long nci, @Nullable String alphal, @Nullable String alphas, - @NonNull List<String> additionalPlmns) { + @NonNull Collection<String> additionalPlmns) { super(TAG, CellInfo.TYPE_NR, mccStr, mncStr, alphal, alphas); mPci = inRangeOrUnavailable(pci, 0, MAX_PCI); mTac = inRangeOrUnavailable(tac, 0, MAX_TAC); mNrArfcn = inRangeOrUnavailable(nrArfcn, 0, MAX_NRARFCN); - mBands = new ArrayList<>(bands); + // TODO: input validation for bands + mBands = bands; mNci = inRangeOrUnavailable(nci, 0, MAX_NCI); - mAdditionalPlmns = new ArrayList<>(additionalPlmns.size()); + mAdditionalPlmns = new ArraySet<>(additionalPlmns.size()); for (String plmn : additionalPlmns) { if (isValidPlmn(plmn)) { mAdditionalPlmns.add(plmn); @@ -83,15 +86,16 @@ public final class CellIdentityNr extends CellIdentity { /** @hide */ public CellIdentityNr(@NonNull android.hardware.radio.V1_4.CellIdentityNr cid) { - this(cid.pci, cid.tac, cid.nrarfcn, Collections.emptyList(), cid.mcc, cid.mnc, cid.nci, + this(cid.pci, cid.tac, cid.nrarfcn, new int[] {}, cid.mcc, cid.mnc, cid.nci, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort, - Collections.emptyList()); + new ArraySet<>()); } /** @hide */ public CellIdentityNr(@NonNull android.hardware.radio.V1_5.CellIdentityNr cid) { - this(cid.base.pci, cid.base.tac, cid.base.nrarfcn, cid.bands, cid.base.mcc, cid.base.mnc, - cid.base.nci, cid.base.operatorNames.alphaLong, + this(cid.base.pci, cid.base.tac, cid.base.nrarfcn, + cid.bands.stream().mapToInt(Integer::intValue).toArray(), cid.base.mcc, + cid.base.mnc, cid.base.nci, cid.base.operatorNames.alphaLong, cid.base.operatorNames.alphaShort, cid.additionalPlmns); } @@ -116,18 +120,22 @@ public final class CellIdentityNr extends CellIdentity { @Override public int hashCode() { return Objects.hash(super.hashCode(), mPci, mTac, - mNrArfcn, mBands.hashCode(), mNci, mAdditionalPlmns.hashCode()); + mNrArfcn, Arrays.hashCode(mBands), mNci, mAdditionalPlmns.hashCode()); } @Override public boolean equals(Object other) { + if (this == other) { + return true; + } + if (!(other instanceof CellIdentityNr)) { return false; } CellIdentityNr o = (CellIdentityNr) other; return super.equals(o) && mPci == o.mPci && mTac == o.mTac && mNrArfcn == o.mNrArfcn - && mBands.equals(o.mBands) && mNci == o.mNci + && Arrays.equals(mBands, o.mBands) && mNci == o.mNci && mAdditionalPlmns.equals(o.mAdditionalPlmns); } @@ -160,12 +168,12 @@ public final class CellIdentityNr extends CellIdentity { * Reference: TS 38.101-1 table 5.2-1 * Reference: TS 38.101-2 table 5.2-1 * - * @return List of band number or empty list if not available. + * @return Array of band number or empty array if not available. */ @NgranBand @NonNull - public List<Integer> getBands() { - return Collections.unmodifiableList(mBands); + public int[] getBands() { + return Arrays.copyOf(mBands, mBands.length); } /** @@ -212,8 +220,8 @@ public final class CellIdentityNr extends CellIdentity { * @return a list of additional PLMN IDs supported by this cell. */ @NonNull - public List<String> getAdditionalPlmns() { - return Collections.unmodifiableList(mAdditionalPlmns); + public Set<String> getAdditionalPlmns() { + return Collections.unmodifiableSet(mAdditionalPlmns); } @Override @@ -239,9 +247,9 @@ public final class CellIdentityNr extends CellIdentity { dest.writeInt(mPci); dest.writeInt(mTac); dest.writeInt(mNrArfcn); - dest.writeList(mBands); + dest.writeIntArray(mBands); dest.writeLong(mNci); - dest.writeList(mAdditionalPlmns); + dest.writeArraySet(mAdditionalPlmns); } /** Construct from Parcel, type has already been processed */ @@ -250,9 +258,9 @@ public final class CellIdentityNr extends CellIdentity { mPci = in.readInt(); mTac = in.readInt(); mNrArfcn = in.readInt(); - mBands = in.readArrayList(null); + mBands = in.createIntArray(); mNci = in.readLong(); - mAdditionalPlmns = in.readArrayList(null); + mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null); } /** Implement the Parcelable interface */ diff --git a/telephony/java/android/telephony/CellIdentityTdscdma.java b/telephony/java/android/telephony/CellIdentityTdscdma.java index 531487a313d9..30f98bc57458 100644 --- a/telephony/java/android/telephony/CellIdentityTdscdma.java +++ b/telephony/java/android/telephony/CellIdentityTdscdma.java @@ -20,11 +20,12 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Parcel; import android.telephony.gsm.GsmCellLocation; +import android.util.ArraySet; -import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; -import java.util.List; import java.util.Objects; +import java.util.Set; /** * CellIdentity is to represent a unique TD-SCDMA cell @@ -50,7 +51,7 @@ public final class CellIdentityTdscdma extends CellIdentity { private final int mUarfcn; // a list of additional PLMN-IDs reported for this cell - private final List<String> mAdditionalPlmns; + private final ArraySet<String> mAdditionalPlmns; private ClosedSubscriberGroupInfo mCsgInfo; @@ -63,7 +64,7 @@ public final class CellIdentityTdscdma extends CellIdentity { mCid = CellInfo.UNAVAILABLE; mCpid = CellInfo.UNAVAILABLE; mUarfcn = CellInfo.UNAVAILABLE; - mAdditionalPlmns = Collections.emptyList(); + mAdditionalPlmns = new ArraySet<>(); mCsgInfo = null; } @@ -85,13 +86,14 @@ public final class CellIdentityTdscdma extends CellIdentity { */ public CellIdentityTdscdma(@Nullable String mcc, @Nullable String mnc, int lac, int cid, int cpid, int uarfcn, @Nullable String alphal, @Nullable String alphas, - @NonNull List<String> additionalPlmns, @Nullable ClosedSubscriberGroupInfo csgInfo) { + @NonNull Collection<String> additionalPlmns, + @Nullable ClosedSubscriberGroupInfo csgInfo) { super(TAG, CellInfo.TYPE_TDSCDMA, mcc, mnc, alphal, alphas); mLac = inRangeOrUnavailable(lac, 0, MAX_LAC); mCid = inRangeOrUnavailable(cid, 0, MAX_CID); mCpid = inRangeOrUnavailable(cpid, 0, MAX_CPID); mUarfcn = inRangeOrUnavailable(uarfcn, 0, MAX_UARFCN); - mAdditionalPlmns = new ArrayList<>(additionalPlmns.size()); + mAdditionalPlmns = new ArraySet<>(additionalPlmns.size()); for (String plmn : additionalPlmns) { if (isValidPlmn(plmn)) { mAdditionalPlmns.add(plmn); @@ -208,8 +210,8 @@ public final class CellIdentityTdscdma extends CellIdentity { * @return a list of additional PLMN IDs supported by this cell. */ @NonNull - public List<String> getAdditionalPlmns() { - return mAdditionalPlmns; + public Set<String> getAdditionalPlmns() { + return Collections.unmodifiableSet(mAdditionalPlmns); } /** @@ -289,7 +291,7 @@ public final class CellIdentityTdscdma extends CellIdentity { dest.writeInt(mCid); dest.writeInt(mCpid); dest.writeInt(mUarfcn); - dest.writeList(mAdditionalPlmns); + dest.writeArraySet(mAdditionalPlmns); dest.writeParcelable(mCsgInfo, flags); } @@ -300,7 +302,7 @@ public final class CellIdentityTdscdma extends CellIdentity { mCid = in.readInt(); mCpid = in.readInt(); mUarfcn = in.readInt(); - mAdditionalPlmns = in.readArrayList(null); + mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null); mCsgInfo = in.readParcelable(null); if (DBG) log(toString()); } diff --git a/telephony/java/android/telephony/CellIdentityWcdma.java b/telephony/java/android/telephony/CellIdentityWcdma.java index 15e491b66575..9d2cb74bac23 100644 --- a/telephony/java/android/telephony/CellIdentityWcdma.java +++ b/telephony/java/android/telephony/CellIdentityWcdma.java @@ -22,11 +22,12 @@ import android.compat.annotation.UnsupportedAppUsage; import android.os.Parcel; import android.telephony.gsm.GsmCellLocation; import android.text.TextUtils; +import android.util.ArraySet; -import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; -import java.util.List; import java.util.Objects; +import java.util.Set; /** * CellIdentity to represent a unique UMTS cell @@ -51,7 +52,7 @@ public final class CellIdentityWcdma extends CellIdentity { private final int mUarfcn; // a list of additional PLMN-IDs reported for this cell - private final List<String> mAdditionalPlmns; + private final ArraySet<String> mAdditionalPlmns; @Nullable private final ClosedSubscriberGroupInfo mCsgInfo; @@ -65,7 +66,7 @@ public final class CellIdentityWcdma extends CellIdentity { mCid = CellInfo.UNAVAILABLE; mPsc = CellInfo.UNAVAILABLE; mUarfcn = CellInfo.UNAVAILABLE; - mAdditionalPlmns = Collections.emptyList(); + mAdditionalPlmns = new ArraySet<>(); mCsgInfo = null; } @@ -86,13 +87,14 @@ public final class CellIdentityWcdma extends CellIdentity { */ public CellIdentityWcdma(int lac, int cid, int psc, int uarfcn, @Nullable String mccStr, @Nullable String mncStr, @Nullable String alphal, @Nullable String alphas, - @NonNull List<String> additionalPlmns, @Nullable ClosedSubscriberGroupInfo csgInfo) { + @NonNull Collection<String> additionalPlmns, + @Nullable ClosedSubscriberGroupInfo csgInfo) { super(TAG, CellInfo.TYPE_WCDMA, mccStr, mncStr, alphal, alphas); mLac = inRangeOrUnavailable(lac, 0, MAX_LAC); mCid = inRangeOrUnavailable(cid, 0, MAX_CID); mPsc = inRangeOrUnavailable(psc, 0, MAX_PSC); mUarfcn = inRangeOrUnavailable(uarfcn, 0, MAX_UARFCN); - mAdditionalPlmns = new ArrayList<>(additionalPlmns.size()); + mAdditionalPlmns = new ArraySet<>(additionalPlmns.size()); for (String plmn : additionalPlmns) { if (isValidPlmn(plmn)) { mAdditionalPlmns.add(plmn); @@ -104,14 +106,14 @@ public final class CellIdentityWcdma extends CellIdentity { /** @hide */ public CellIdentityWcdma(@NonNull android.hardware.radio.V1_0.CellIdentityWcdma cid) { this(cid.lac, cid.cid, cid.psc, cid.uarfcn, cid.mcc, cid.mnc, "", "", - Collections.emptyList(), null); + new ArraySet<>(), null); } /** @hide */ public CellIdentityWcdma(@NonNull android.hardware.radio.V1_2.CellIdentityWcdma cid) { this(cid.base.lac, cid.base.cid, cid.base.psc, cid.base.uarfcn, cid.base.mcc, cid.base.mnc, cid.operatorNames.alphaLong, - cid.operatorNames.alphaShort, Collections.emptyList(), null); + cid.operatorNames.alphaShort, new ArraySet<>(), null); } /** @hide */ @@ -232,8 +234,8 @@ public final class CellIdentityWcdma extends CellIdentity { * @return a list of additional PLMN IDs supported by this cell. */ @NonNull - public List<String> getAdditionalPlmns() { - return mAdditionalPlmns; + public Set<String> getAdditionalPlmns() { + return Collections.unmodifiableSet(mAdditionalPlmns); } /** @@ -305,7 +307,7 @@ public final class CellIdentityWcdma extends CellIdentity { dest.writeInt(mCid); dest.writeInt(mPsc); dest.writeInt(mUarfcn); - dest.writeList(mAdditionalPlmns); + dest.writeArraySet(mAdditionalPlmns); dest.writeParcelable(mCsgInfo, flags); } @@ -316,7 +318,7 @@ public final class CellIdentityWcdma extends CellIdentity { mCid = in.readInt(); mPsc = in.readInt(); mUarfcn = in.readInt(); - mAdditionalPlmns = in.readArrayList(null); + mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null); mCsgInfo = in.readParcelable(null); if (DBG) log(toString()); } diff --git a/telephony/java/android/telephony/CellInfo.java b/telephony/java/android/telephony/CellInfo.java index bfa209bd31f5..b381ccecde47 100644 --- a/telephony/java/android/telephony/CellInfo.java +++ b/telephony/java/android/telephony/CellInfo.java @@ -21,6 +21,7 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.compat.annotation.UnsupportedAppUsage; import android.hardware.radio.V1_4.CellInfo.Info; +import android.hardware.radio.V1_5.CellInfo.CellInfoRatSpecificInfo; import android.os.Parcel; import android.os.Parcelable; @@ -28,6 +29,7 @@ import com.android.internal.annotations.VisibleForTesting; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.util.Objects; /** * Immutable cell information from a point in time. @@ -152,7 +154,7 @@ public abstract class CellInfo implements Parcelable { protected CellInfo() { this.mRegistered = false; this.mTimeStamp = Long.MAX_VALUE; - mCellConnectionStatus = CONNECTION_NONE; + this.mCellConnectionStatus = CONNECTION_NONE; } /** @hide */ @@ -240,27 +242,17 @@ public abstract class CellInfo implements Parcelable { @Override public int hashCode() { - int primeNum = 31; - return ((mRegistered ? 0 : 1) * primeNum) + ((int)(mTimeStamp / 1000) * primeNum) - + (mCellConnectionStatus * primeNum); + return Objects.hash(mCellConnectionStatus, mRegistered, mTimeStamp); } @Override - public boolean equals(Object other) { - if (other == null) { - return false; - } - if (this == other) { - return true; - } - try { - CellInfo o = (CellInfo) other; - return mRegistered == o.mRegistered - && mTimeStamp == o.mTimeStamp - && mCellConnectionStatus == o.mCellConnectionStatus; - } catch (ClassCastException e) { - return false; - } + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof CellInfo)) return false; + CellInfo cellInfo = (CellInfo) o; + return mCellConnectionStatus == cellInfo.mCellConnectionStatus + && mRegistered == cellInfo.mRegistered + && mTimeStamp == cellInfo.mTimeStamp; } @Override @@ -353,6 +345,13 @@ public abstract class CellInfo implements Parcelable { } /** @hide */ + protected CellInfo(android.hardware.radio.V1_5.CellInfo ci, long timeStamp) { + this.mRegistered = ci.registered; + this.mTimeStamp = timeStamp; + this.mCellConnectionStatus = ci.connectionStatus; + } + + /** @hide */ public static CellInfo create(android.hardware.radio.V1_0.CellInfo ci) { if (ci == null) return null; switch(ci.cellInfoType) { @@ -391,4 +390,24 @@ public abstract class CellInfo implements Parcelable { default: return null; } } + + /** @hide */ + public static CellInfo create(android.hardware.radio.V1_5.CellInfo ci, long timeStamp) { + if (ci == null) return null; + switch (ci.ratSpecificInfo.getDiscriminator()) { + case CellInfoRatSpecificInfo.hidl_discriminator.gsm: + return new CellInfoGsm(ci, timeStamp); + case CellInfoRatSpecificInfo.hidl_discriminator.cdma: + return new CellInfoCdma(ci, timeStamp); + case CellInfoRatSpecificInfo.hidl_discriminator.lte: + return new CellInfoLte(ci, timeStamp); + case CellInfoRatSpecificInfo.hidl_discriminator.wcdma: + return new CellInfoWcdma(ci, timeStamp); + case CellInfoRatSpecificInfo.hidl_discriminator.tdscdma: + return new CellInfoTdscdma(ci, timeStamp); + case CellInfoRatSpecificInfo.hidl_discriminator.nr: + return new CellInfoNr(ci, timeStamp); + default: return null; + } + } } diff --git a/telephony/java/android/telephony/CellInfoCdma.java b/telephony/java/android/telephony/CellInfoCdma.java index 0edb4a4eed9b..1bef681619ed 100644 --- a/telephony/java/android/telephony/CellInfoCdma.java +++ b/telephony/java/android/telephony/CellInfoCdma.java @@ -78,6 +78,15 @@ public final class CellInfoCdma extends CellInfo implements Parcelable { new CellSignalStrengthCdma(cic.signalStrengthCdma, cic.signalStrengthEvdo); } + /** @hide */ + public CellInfoCdma(android.hardware.radio.V1_5.CellInfo ci, long timeStamp) { + super(ci, timeStamp); + final android.hardware.radio.V1_2.CellInfoCdma cic = ci.ratSpecificInfo.cdma(); + mCellIdentityCdma = new CellIdentityCdma(cic.cellIdentityCdma); + mCellSignalStrengthCdma = + new CellSignalStrengthCdma(cic.signalStrengthCdma, cic.signalStrengthEvdo); + } + /** * @return a {@link CellIdentityCdma} instance. */ diff --git a/telephony/java/android/telephony/CellInfoGsm.java b/telephony/java/android/telephony/CellInfoGsm.java index 2dddd3f935cd..c19521fdfa99 100644 --- a/telephony/java/android/telephony/CellInfoGsm.java +++ b/telephony/java/android/telephony/CellInfoGsm.java @@ -73,6 +73,14 @@ public final class CellInfoGsm extends CellInfo implements Parcelable { mCellSignalStrengthGsm = new CellSignalStrengthGsm(cig.signalStrengthGsm); } + /** @hide */ + public CellInfoGsm(android.hardware.radio.V1_5.CellInfo ci, long timeStamp) { + super(ci, timeStamp); + final android.hardware.radio.V1_5.CellInfoGsm cig = ci.ratSpecificInfo.gsm(); + mCellIdentityGsm = new CellIdentityGsm(cig.cellIdentityGsm); + mCellSignalStrengthGsm = new CellSignalStrengthGsm(cig.signalStrengthGsm); + } + /** * @return a {@link CellIdentityGsm} instance. */ diff --git a/telephony/java/android/telephony/CellInfoLte.java b/telephony/java/android/telephony/CellInfoLte.java index a57c7cd136db..320925ea63ae 100644 --- a/telephony/java/android/telephony/CellInfoLte.java +++ b/telephony/java/android/telephony/CellInfoLte.java @@ -82,6 +82,15 @@ public final class CellInfoLte extends CellInfo implements Parcelable { mCellConfig = new CellConfigLte(cil.cellConfig); } + /** @hide */ + public CellInfoLte(android.hardware.radio.V1_5.CellInfo ci, long timeStamp) { + super(ci, timeStamp); + final android.hardware.radio.V1_5.CellInfoLte cil = ci.ratSpecificInfo.lte(); + mCellIdentityLte = new CellIdentityLte(cil.cellIdentityLte); + mCellSignalStrengthLte = new CellSignalStrengthLte(cil.signalStrengthLte); + mCellConfig = new CellConfigLte(); + } + /** * @return a {@link CellIdentityLte} instance. */ diff --git a/telephony/java/android/telephony/CellInfoNr.java b/telephony/java/android/telephony/CellInfoNr.java index 8b41b8be7137..a7e79f93ae89 100644 --- a/telephony/java/android/telephony/CellInfoNr.java +++ b/telephony/java/android/telephony/CellInfoNr.java @@ -53,6 +53,14 @@ public final class CellInfoNr extends CellInfo { mCellSignalStrength = new CellSignalStrengthNr(cil.signalStrength); } + /** @hide */ + public CellInfoNr(android.hardware.radio.V1_5.CellInfo ci, long timeStamp) { + super(ci, timeStamp); + final android.hardware.radio.V1_5.CellInfoNr cil = ci.ratSpecificInfo.nr(); + mCellIdentity = new CellIdentityNr(cil.cellIdentityNr); + mCellSignalStrength = new CellSignalStrengthNr(cil.signalStrengthNr); + } + /** * @return a {@link CellIdentityNr} instance. */ diff --git a/telephony/java/android/telephony/CellInfoTdscdma.java b/telephony/java/android/telephony/CellInfoTdscdma.java index d2cc9c6ce422..038c49ac37ee 100644 --- a/telephony/java/android/telephony/CellInfoTdscdma.java +++ b/telephony/java/android/telephony/CellInfoTdscdma.java @@ -77,6 +77,14 @@ public final class CellInfoTdscdma extends CellInfo implements Parcelable { mCellSignalStrengthTdscdma = new CellSignalStrengthTdscdma(cit.signalStrengthTdscdma); } + /** @hide */ + public CellInfoTdscdma(android.hardware.radio.V1_5.CellInfo ci, long timeStamp) { + super(ci, timeStamp); + final android.hardware.radio.V1_5.CellInfoTdscdma cit = ci.ratSpecificInfo.tdscdma(); + mCellIdentityTdscdma = new CellIdentityTdscdma(cit.cellIdentityTdscdma); + mCellSignalStrengthTdscdma = new CellSignalStrengthTdscdma(cit.signalStrengthTdscdma); + } + /** * @return a {@link CellIdentityTdscdma} instance. */ diff --git a/telephony/java/android/telephony/CellInfoWcdma.java b/telephony/java/android/telephony/CellInfoWcdma.java index 3f792d17b8ef..c74955f807b0 100644 --- a/telephony/java/android/telephony/CellInfoWcdma.java +++ b/telephony/java/android/telephony/CellInfoWcdma.java @@ -72,6 +72,14 @@ public final class CellInfoWcdma extends CellInfo implements Parcelable { mCellSignalStrengthWcdma = new CellSignalStrengthWcdma(ciw.signalStrengthWcdma); } + /** @hide */ + public CellInfoWcdma(android.hardware.radio.V1_5.CellInfo ci, long timeStamp) { + super(ci, timeStamp); + final android.hardware.radio.V1_5.CellInfoWcdma ciw = ci.ratSpecificInfo.wcdma(); + mCellIdentityWcdma = new CellIdentityWcdma(ciw.cellIdentityWcdma); + mCellSignalStrengthWcdma = new CellSignalStrengthWcdma(ciw.signalStrengthWcdma); + } + /** * @return a {@link CellIdentityWcdma} instance. */ diff --git a/telephony/java/android/telephony/CellSignalStrengthCdma.java b/telephony/java/android/telephony/CellSignalStrengthCdma.java index 1c92705b9422..d00049c1ebe5 100644 --- a/telephony/java/android/telephony/CellSignalStrengthCdma.java +++ b/telephony/java/android/telephony/CellSignalStrengthCdma.java @@ -314,6 +314,8 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements /** * Get the signal strength as dBm + * + * @return min(CDMA RSSI, EVDO RSSI) of the measured cell. */ @Override public int getDbm() { diff --git a/telephony/java/android/telephony/CellSignalStrengthGsm.java b/telephony/java/android/telephony/CellSignalStrengthGsm.java index 76d2df918423..9d55f109f751 100644 --- a/telephony/java/android/telephony/CellSignalStrengthGsm.java +++ b/telephony/java/android/telephony/CellSignalStrengthGsm.java @@ -145,6 +145,8 @@ public final class CellSignalStrengthGsm extends CellSignalStrength implements P /** * Get the signal strength as dBm. + * + * @return the RSSI of the measured cell. */ @Override public int getDbm() { diff --git a/telephony/java/android/telephony/DataSpecificRegistrationInfo.java b/telephony/java/android/telephony/DataSpecificRegistrationInfo.java index 270eafe642b7..c667165e7a0e 100644 --- a/telephony/java/android/telephony/DataSpecificRegistrationInfo.java +++ b/telephony/java/android/telephony/DataSpecificRegistrationInfo.java @@ -208,7 +208,6 @@ public final class DataSpecificRegistrationInfo implements Parcelable { * @return {@code true} if using carrier aggregation. * @hide */ - @SystemApi public boolean isUsingCarrierAggregation() { return mIsUsingCarrierAggregation; } diff --git a/telephony/java/android/telephony/ims/RcsEventDescriptor.aidl b/telephony/java/android/telephony/DisplayInfo.aidl index ab1c55ec984f..861b0fe04848 100644 --- a/telephony/java/android/telephony/ims/RcsEventDescriptor.aidl +++ b/telephony/java/android/telephony/DisplayInfo.aidl @@ -1,12 +1,11 @@ /* - * - * Copyright 2019, The Android Open Source Project + * Copyright (C) 2020 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 + * 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, @@ -14,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +package android.telephony; -package android.telephony.ims; - -parcelable RcsEventDescriptor; +parcelable DisplayInfo; diff --git a/telephony/java/android/telephony/DisplayInfo.java b/telephony/java/android/telephony/DisplayInfo.java new file mode 100644 index 000000000000..d54bcf931c33 --- /dev/null +++ b/telephony/java/android/telephony/DisplayInfo.java @@ -0,0 +1,172 @@ +/* + * Copyright 2020 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.os.Parcel; +import android.os.Parcelable; +import android.telephony.Annotation.NetworkType; +import android.telephony.Annotation.OverrideNetworkType; + +import java.util.Objects; + +/** + * DisplayInfo contains telephony-related information used for display purposes only. This + * information is provided in accordance with carrier policy and branding preferences; it is not + * necessarily a precise or accurate representation of the current state and should be treated + * accordingly. + */ +public final class DisplayInfo implements Parcelable { + /** + * No override. {@link #getNetworkType()} should be used for display network + * type. + */ + public static final int OVERRIDE_NETWORK_TYPE_NONE = 0; + + /** + * Override network type when the device is connected to + * {@link TelephonyManager#NETWORK_TYPE_LTE} cellular network and is using carrier aggregation. + */ + public static final int OVERRIDE_NETWORK_TYPE_LTE_CA = 1; + + /** + * Override network type when the device is connected to advanced pro + * {@link TelephonyManager#NETWORK_TYPE_LTE} cellular network. + */ + public static final int OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO = 2; + + /** + * Override network type when the device is connected to + * {@link TelephonyManager#NETWORK_TYPE_LTE} network and has E-UTRA-NR Dual Connectivity(EN-DC) + * capability or is currently connected to the secondary + * {@link TelephonyManager#NETWORK_TYPE_NR} cellular network. + */ + public static final int OVERRIDE_NETWORK_TYPE_NR_NSA = 3; + + /** + * Override network type when the device is connected to + * {@link TelephonyManager#NETWORK_TYPE_LTE} network and has E-UTRA-NR Dual Connectivity(EN-DC) + * capability or is currently connected to the secondary + * {@link TelephonyManager#NETWORK_TYPE_NR} cellular network on millimeter wave bands. + * + * @see AccessNetworkConstants.NgranBands#FREQUENCY_RANGE_GROUP_2 + */ + public static final int OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE = 4; + + @NetworkType + private final int mNetworkType; + + @OverrideNetworkType + private final int mOverrideNetworkType; + + /** + * Constructor + * + * @param networkType Current packet-switching cellular network type + * @param overrideNetworkType The override network type + * + * @hide + */ + public DisplayInfo(@NetworkType int networkType, @OverrideNetworkType int overrideNetworkType) { + mNetworkType = networkType; + mOverrideNetworkType = overrideNetworkType; + } + + /** @hide */ + public DisplayInfo(Parcel p) { + mNetworkType = p.readInt(); + mOverrideNetworkType = p.readInt(); + } + + /** + * Get current packet-switching cellular network type. This is the actual network type the + * device is camped on. + * + * @return The network type. + */ + @NetworkType + public int getNetworkType() { + return mNetworkType; + } + + /** + * Get the override network type. Note the override network type is for market branding + * or visualization purposes only. It cannot be treated as the actual network type device is + * camped on. + * + * @return The override network type. + */ + @OverrideNetworkType + public int getOverrideNetworkType() { + return mOverrideNetworkType; + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + dest.writeInt(mNetworkType); + dest.writeInt(mOverrideNetworkType); + } + + public static final @NonNull Parcelable.Creator<DisplayInfo> CREATOR = + new Parcelable.Creator<DisplayInfo>() { + @Override + public DisplayInfo createFromParcel(Parcel source) { + return new DisplayInfo(source); + } + + @Override + public DisplayInfo[] newArray(int size) { + return new DisplayInfo[size]; + } + }; + + @Override + public int describeContents() { + return 0; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DisplayInfo that = (DisplayInfo) o; + return mNetworkType == that.mNetworkType + && mOverrideNetworkType == that.mOverrideNetworkType; + } + + @Override + public int hashCode() { + return Objects.hash(mNetworkType, mOverrideNetworkType); + } + + private static String overrideNetworkTypeToString(@OverrideNetworkType int type) { + switch (type) { + case OVERRIDE_NETWORK_TYPE_NONE: return "NONE"; + case OVERRIDE_NETWORK_TYPE_LTE_CA: return "LTE_CA"; + case OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO: return "LTE_ADV_PRO"; + case OVERRIDE_NETWORK_TYPE_NR_NSA: return "NR_NSA"; + case OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE: return "NR_NSA_MMWAVE"; + default: return "UNKNOWN"; + } + } + + @Override + public String toString() { + return "DisplayInfo {network=" + TelephonyManager.getNetworkTypeName(mNetworkType) + + ", override=" + overrideNetworkTypeToString(mOverrideNetworkType); + } +} diff --git a/telephony/java/android/telephony/ImsManager.java b/telephony/java/android/telephony/ImsManager.java index 704e5aa78188..34bac5de4c43 100644 --- a/telephony/java/android/telephony/ImsManager.java +++ b/telephony/java/android/telephony/ImsManager.java @@ -34,8 +34,9 @@ public class ImsManager { private Context mContext; /** - * <p>Broadcast Action: Indicates that an IMS operation was rejected by the network due to it - * not being authorized on the network. + * <p>Broadcast Action: Indicates that a previously allowed IMS operation was rejected by the + * network due to the network returning a "forbidden" response. This may be due to a + * provisioning change from the network. * May include the {@link SubscriptionManager#EXTRA_SUBSCRIPTION_INDEX} extra to also specify * which subscription the operation was rejected for. * <p class="note"> @@ -74,17 +75,17 @@ public class ImsManager { "android.telephony.ims.action.WFC_IMS_REGISTRATION_ERROR"; /** - * An extra key corresponding to a String value which contains the carrier specific title to be - * displayed as part of the message shown to the user when there is an error registering for - * WiFi calling. + * An extra key corresponding to a {@link CharSequence} value which contains the carrier + * specific title to be displayed as part of the message shown to the user when there is an + * error registering for WiFi calling. */ public static final String EXTRA_WFC_REGISTRATION_FAILURE_TITLE = "android.telephony.ims.extra.WFC_REGISTRATION_FAILURE_TITLE"; /** - * An extra key corresponding to a String value which contains the carrier specific message to - * be displayed as part of the message shown to the user when there is an error registering for - * WiFi calling. + * An extra key corresponding to a {@link CharSequence} value which contains the carrier + * specific message to be displayed as part of the message shown to the user when there is an + * error registering for WiFi calling. */ public static final String EXTRA_WFC_REGISTRATION_FAILURE_MESSAGE = "android.telephony.ims.extra.WFC_REGISTRATION_FAILURE_MESSAGE"; @@ -103,10 +104,7 @@ public class ImsManager { * @param subscriptionId The ID of the subscription that this ImsRcsManager will use. * @throws IllegalArgumentException if the subscription is invalid. * @return a ImsRcsManager instance with the specific subscription ID. - * @hide */ - @SystemApi - @TestApi @NonNull public ImsRcsManager getImsRcsManager(int subscriptionId) { if (!SubscriptionManager.isValidSubscriptionId(subscriptionId)) { diff --git a/telephony/java/android/telephony/ModemActivityInfo.java b/telephony/java/android/telephony/ModemActivityInfo.java index bd2375f7d297..47a9d779fdd5 100644 --- a/telephony/java/android/telephony/ModemActivityInfo.java +++ b/telephony/java/android/telephony/ModemActivityInfo.java @@ -20,11 +20,10 @@ import android.annotation.NonNull; import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; - import android.os.SystemClock; import android.util.Range; + import java.util.ArrayList; -import java.util.Arrays; import java.util.List; /** @@ -64,17 +63,20 @@ public final class ModemActivityInfo implements Parcelable { mTimestamp = timestamp; mSleepTimeMs = sleepTimeMs; mIdleTimeMs = idleTimeMs; - if (txTimeMs != null) { - populateTransmitPowerRange(txTimeMs); - } + populateTransmitPowerRange(txTimeMs); mRxTimeMs = rxTimeMs; } /** helper API to populate tx power range for each bucket **/ private void populateTransmitPowerRange(@NonNull int[] transmitPowerMs) { - for (int i = 0; i < Math.min(transmitPowerMs.length, TX_POWER_LEVELS); i++) { + int i = 0; + for ( ; i < Math.min(transmitPowerMs.length, TX_POWER_LEVELS); i++) { mTransmitPowerInfo.add(i, new TransmitPower(TX_POWER_RANGES[i], transmitPowerMs[i])); } + // Make sure that mTransmitPowerInfo is fully initialized. + for ( ; i < TX_POWER_LEVELS; i++) { + mTransmitPowerInfo.add(i, new TransmitPower(TX_POWER_RANGES[i], 0)); + } } @Override @@ -199,7 +201,7 @@ public final class ModemActivityInfo implements Parcelable { } /** - * Indicate if the ModemActivityInfo is invalid due to modem's invalid reporting. + * Indicates if the modem has reported valid {@link ModemActivityInfo}. * * @return {@code true} if this {@link ModemActivityInfo} record is valid, * {@code false} otherwise. diff --git a/telephony/java/android/telephony/ModemInfo.java b/telephony/java/android/telephony/ModemInfo.java new file mode 100644 index 000000000000..c0833af954d8 --- /dev/null +++ b/telephony/java/android/telephony/ModemInfo.java @@ -0,0 +1,109 @@ +/* + * Copyright (C) 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 android.telephony; + +import android.os.Parcel; +import android.os.Parcelable; + +import java.util.Objects; + +/** + * Information of a single logical modem indicating + * its id, supported rats and whether it supports voice or data, etc. + * @hide + */ +public class ModemInfo implements Parcelable { + public final int modemId; + public final int rat; /* bitset */ + public final boolean isVoiceSupported; + public final boolean isDataSupported; + + // TODO b/121394331: Clean up this class after V1_1.PhoneCapability cleanup. + public ModemInfo(int modemId) { + this(modemId, 0, true, true); + } + + public ModemInfo(int modemId, int rat, boolean isVoiceSupported, boolean isDataSupported) { + this.modemId = modemId; + this.rat = rat; + this.isVoiceSupported = isVoiceSupported; + this.isDataSupported = isDataSupported; + } + + public ModemInfo(Parcel in) { + modemId = in.readInt(); + rat = in.readInt(); + isVoiceSupported = in.readBoolean(); + isDataSupported = in.readBoolean(); + } + + @Override + public String toString() { + return "modemId=" + modemId + " rat=" + rat + " isVoiceSupported:" + isVoiceSupported + + " isDataSupported:" + isDataSupported; + } + + @Override + public int hashCode() { + return Objects.hash(modemId, rat, isVoiceSupported, isDataSupported); + } + + @Override + public boolean equals(Object o) { + if (o == null || !(o instanceof ModemInfo) || hashCode() != o.hashCode()) { + return false; + } + + if (this == o) { + return true; + } + + ModemInfo s = (ModemInfo) o; + + return (modemId == s.modemId + && rat == s.rat + && isVoiceSupported == s.isVoiceSupported + && isDataSupported == s.isDataSupported); + } + + /** + * {@link Parcelable#describeContents} + */ + public @ContentsFlags int describeContents() { + return 0; + } + + /** + * {@link Parcelable#writeToParcel} + */ + public void writeToParcel(Parcel dest, @WriteFlags int flags) { + dest.writeInt(modemId); + dest.writeInt(rat); + dest.writeBoolean(isVoiceSupported); + dest.writeBoolean(isDataSupported); + } + + public static final @android.annotation.NonNull Parcelable.Creator<ModemInfo> CREATOR = new Parcelable.Creator() { + public ModemInfo createFromParcel(Parcel in) { + return new ModemInfo(in); + } + + public ModemInfo[] newArray(int size) { + return new ModemInfo[size]; + } + }; +} diff --git a/telephony/java/android/telephony/NetworkRegistrationInfo.java b/telephony/java/android/telephony/NetworkRegistrationInfo.java index 32ffb75f373c..93fbb00ff9d5 100644 --- a/telephony/java/android/telephony/NetworkRegistrationInfo.java +++ b/telephony/java/android/telephony/NetworkRegistrationInfo.java @@ -25,6 +25,7 @@ import android.os.Parcel; import android.os.Parcelable; import android.telephony.AccessNetworkConstants.TransportType; import android.telephony.Annotation.NetworkType; +import android.text.TextUtils; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -214,6 +215,9 @@ public final class NetworkRegistrationInfo implements Parcelable { @Nullable private DataSpecificRegistrationInfo mDataSpecificInfo; + @NonNull + private String mRplmn; + /** * @param domain Network domain. Must be a {@link Domain}. For transport type * {@link AccessNetworkConstants#TRANSPORT_TYPE_WLAN}, this must set to {@link #DOMAIN_PS}. @@ -234,13 +238,14 @@ public final class NetworkRegistrationInfo implements Parcelable { * @param availableServices The list of the supported services. * @param cellIdentity The identity representing a unique cell or wifi AP. Set to null if the * information is not available. + * @param rplmn the registered plmn or the last plmn for attempted registration if reg failed. */ private NetworkRegistrationInfo(@Domain int domain, @TransportType int transportType, @RegistrationState int registrationState, @NetworkType int accessNetworkTechnology, int rejectCause, boolean emergencyOnly, @Nullable @ServiceType List<Integer> availableServices, - @Nullable CellIdentity cellIdentity) { + @Nullable CellIdentity cellIdentity, @Nullable String rplmn) { mDomain = domain; mTransportType = transportType; mRegistrationState = registrationState; @@ -253,6 +258,7 @@ public final class NetworkRegistrationInfo implements Parcelable { mCellIdentity = cellIdentity; mEmergencyOnly = emergencyOnly; mNrState = NR_STATE_NONE; + mRplmn = rplmn; } /** @@ -263,11 +269,11 @@ public final class NetworkRegistrationInfo implements Parcelable { int registrationState, int accessNetworkTechnology, int rejectCause, boolean emergencyOnly, @Nullable List<Integer> availableServices, - @Nullable CellIdentity cellIdentity, boolean cssSupported, - int roamingIndicator, int systemIsInPrl, + @Nullable CellIdentity cellIdentity, @Nullable String rplmn, + boolean cssSupported, int roamingIndicator, int systemIsInPrl, int defaultRoamingIndicator) { this(domain, transportType, registrationState, accessNetworkTechnology, rejectCause, - emergencyOnly, availableServices, cellIdentity); + emergencyOnly, availableServices, cellIdentity, rplmn); mVoiceSpecificInfo = new VoiceSpecificRegistrationInfo(cssSupported, roamingIndicator, systemIsInPrl, defaultRoamingIndicator); @@ -281,17 +287,17 @@ public final class NetworkRegistrationInfo implements Parcelable { int registrationState, int accessNetworkTechnology, int rejectCause, boolean emergencyOnly, @Nullable List<Integer> availableServices, - @Nullable CellIdentity cellIdentity, int maxDataCalls, - boolean isDcNrRestricted, boolean isNrAvailable, - boolean isEndcAvailable, + @Nullable CellIdentity cellIdentity, @Nullable String rplmn, + int maxDataCalls, boolean isDcNrRestricted, + boolean isNrAvailable, boolean isEndcAvailable, LteVopsSupportInfo lteVopsSupportInfo, boolean isUsingCarrierAggregation) { this(domain, transportType, registrationState, accessNetworkTechnology, rejectCause, - emergencyOnly, availableServices, cellIdentity); + emergencyOnly, availableServices, cellIdentity, rplmn); mDataSpecificInfo = new DataSpecificRegistrationInfo( maxDataCalls, isDcNrRestricted, isNrAvailable, isEndcAvailable, lteVopsSupportInfo, isUsingCarrierAggregation); - updateNrState(mDataSpecificInfo); + updateNrState(); } private NetworkRegistrationInfo(Parcel source) { @@ -310,6 +316,7 @@ public final class NetworkRegistrationInfo implements Parcelable { mDataSpecificInfo = source.readParcelable( DataSpecificRegistrationInfo.class.getClassLoader()); mNrState = source.readInt(); + mRplmn = source.readString(); } /** @@ -343,6 +350,7 @@ public final class NetworkRegistrationInfo implements Parcelable { mDataSpecificInfo = new DataSpecificRegistrationInfo(nri.mDataSpecificInfo); } mNrState = nri.mNrState; + mRplmn = nri.mRplmn; } /** @@ -359,6 +367,7 @@ public final class NetworkRegistrationInfo implements Parcelable { * Get the 5G NR connection state. * * @return the 5G NR connection state. + * @hide */ public @NRState int getNrState() { return mNrState; @@ -395,6 +404,22 @@ public final class NetworkRegistrationInfo implements Parcelable { } /** + * Get the PLMN-ID for this Network Registration, also known as the RPLMN. + * + * <p>If the device is registered, this will return the registered PLMN-ID. If registration + * has failed, then this will return the PLMN ID of the last attempted registration. If the + * device is not registered, or if is registered to a non-3GPP radio technology, then this + * will return null. + * + * <p>See 3GPP TS 23.122 for further information about the Registered PLMN. + * + * @return the registered PLMN-ID or null. + */ + @Nullable public String getRegisteredPlmn() { + return mRplmn; + } + + /** * @return {@code true} if registered on roaming network, {@code false} otherwise. */ public boolean isRoaming() { @@ -590,6 +615,7 @@ public final class NetworkRegistrationInfo implements Parcelable { .append(" voiceSpecificInfo=").append(mVoiceSpecificInfo) .append(" dataSpecificInfo=").append(mDataSpecificInfo) .append(" nrState=").append(nrStateToString(mNrState)) + .append(" rRplmn=").append(mRplmn) .append("}").toString(); } @@ -597,7 +623,7 @@ public final class NetworkRegistrationInfo implements Parcelable { public int hashCode() { return Objects.hash(mDomain, mTransportType, mRegistrationState, mRoamingType, mAccessNetworkTechnology, mRejectCause, mEmergencyOnly, mAvailableServices, - mCellIdentity, mVoiceSpecificInfo, mDataSpecificInfo, mNrState); + mCellIdentity, mVoiceSpecificInfo, mDataSpecificInfo, mNrState, mRplmn); } @Override @@ -620,6 +646,7 @@ public final class NetworkRegistrationInfo implements Parcelable { && Objects.equals(mCellIdentity, other.mCellIdentity) && Objects.equals(mVoiceSpecificInfo, other.mVoiceSpecificInfo) && Objects.equals(mDataSpecificInfo, other.mDataSpecificInfo) + && TextUtils.equals(mRplmn, other.mRplmn) && mNrState == other.mNrState; } @@ -641,6 +668,7 @@ public final class NetworkRegistrationInfo implements Parcelable { dest.writeParcelable(mVoiceSpecificInfo, 0); dest.writeParcelable(mDataSpecificInfo, 0); dest.writeInt(mNrState); + dest.writeString(mRplmn); } /** @@ -658,12 +686,12 @@ public final class NetworkRegistrationInfo implements Parcelable { * DCNR is not restricted and NR is supported by the selected PLMN. Otherwise the use of 5G * NR is restricted. * - * @param state data specific registration state contains the 5G NR indicators. + * @hide */ - private void updateNrState(DataSpecificRegistrationInfo state) { + public void updateNrState() { mNrState = NR_STATE_NONE; - if (state.isEnDcAvailable) { - if (!state.isDcNrRestricted && state.isNrAvailable) { + if (mDataSpecificInfo != null && mDataSpecificInfo.isEnDcAvailable) { + if (!mDataSpecificInfo.isDcNrRestricted && mDataSpecificInfo.isNrAvailable) { mNrState = NR_STATE_NOT_RESTRICTED; } else { mNrState = NR_STATE_RESTRICTED; @@ -741,6 +769,9 @@ public final class NetworkRegistrationInfo implements Parcelable { @Nullable private CellIdentity mCellIdentity; + @NonNull + private String mRplmn = ""; + /** * Default constructor for Builder. */ @@ -855,6 +886,18 @@ public final class NetworkRegistrationInfo implements Parcelable { } /** + * Set the registered PLMN. + * + * @param rplmn the registered plmn. + * + * @return The same instance of the builder. + */ + public @NonNull Builder setRegisteredPlmn(@Nullable String rplmn) { + mRplmn = rplmn; + return this; + } + + /** * Build the NetworkRegistrationInfo. * @return the NetworkRegistrationInfo object. * @hide @@ -863,7 +906,7 @@ public final class NetworkRegistrationInfo implements Parcelable { public @NonNull NetworkRegistrationInfo build() { return new NetworkRegistrationInfo(mDomain, mTransportType, mRegistrationState, mAccessNetworkTechnology, mRejectCause, mEmergencyOnly, mAvailableServices, - mCellIdentity); + mCellIdentity, mRplmn); } } } diff --git a/telephony/java/android/telephony/NetworkService.java b/telephony/java/android/telephony/NetworkService.java index 87d94bfda662..c75de42707a6 100644 --- a/telephony/java/android/telephony/NetworkService.java +++ b/telephony/java/android/telephony/NetworkService.java @@ -234,6 +234,9 @@ public abstract class NetworkService extends Service { * this method to facilitate the creation of {@link NetworkServiceProvider} instances. The system * will call this method after binding the network service for each active SIM slot id. * + * This methead is guaranteed to be invoked in {@link NetworkService}'s internal handler thread + * whose looper can be retrieved with {@link Looper.myLooper()} when override this method. + * * @param slotIndex SIM slot id the network service associated with. * @return Network service object. Null if failed to create the provider (e.g. invalid slot * index) diff --git a/telephony/java/android/telephony/PhoneCapability.java b/telephony/java/android/telephony/PhoneCapability.java index c66aceba95d4..238766a17a0f 100644 --- a/telephony/java/android/telephony/PhoneCapability.java +++ b/telephony/java/android/telephony/PhoneCapability.java @@ -16,20 +16,12 @@ package android.telephony; -import android.annotation.LongDef; import android.annotation.NonNull; -import android.annotation.Nullable; import android.os.Parcel; import android.os.Parcelable; -import android.telephony.AccessNetworkConstants.AccessNetworkType; -import android.telephony.AccessNetworkConstants.RadioAccessNetworkType; -import android.telephony.TelephonyManager.NetworkTypeBitMask; -import com.android.internal.telephony.util.TelephonyUtils; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Objects; @@ -38,365 +30,68 @@ import java.util.Objects; * are shared between those modems defined by list of modem IDs. */ public final class PhoneCapability implements Parcelable { - /** Modem feature indicating 3GPP2 capability. */ - public static final long MODEM_FEATURE_3GPP2_REG = 1 << 0; - /** Modem feature indicating 3GPP capability. */ - public static final long MODEM_FEATURE_3GPP_REG = 1 << 1; - /** Modem feature indicating CDMA 2000 with EHRPD capability. */ - public static final long MODEM_FEATURE_CDMA2000_EHRPD_REG = 1 << 2; - /** Modem feature indicating GSM capability. */ - public static final long MODEM_FEATURE_GERAN_REG = 1 << 3; - /** Modem feature indicating UMTS capability. */ - public static final long MODEM_FEATURE_UTRAN_REG = 1 << 4; - /** Modem feature indicating LTE capability. */ - public static final long MODEM_FEATURE_EUTRAN_REG = 1 << 5; - /** Modem feature indicating 5G capability.*/ - public static final long MODEM_FEATURE_NGRAN_REG = 1 << 6; - /** Modem feature indicating EN-DC capability. */ - public static final long MODEM_FEATURE_EUTRA_NR_DUAL_CONNECTIVITY_REG = 1 << 7; - /** Modem feature indicating VoLTE capability (IMS registered). */ - public static final long MODEM_FEATURE_PS_VOICE_REG = 1 << 8; - /** Modem feature indicating CS voice call capability. */ - public static final long MODEM_FEATURE_CS_VOICE_SESSION = 1 << 9; - /** Modem feature indicating Internet connection capability. */ - public static final long MODEM_FEATURE_INTERACTIVE_DATA_SESSION = 1 << 10; - /** - * Modem feature indicating dedicated bearer capability. - * For services that require a high level QoS (eg. VoLTE), the network can create - * a dedicated bearer with the required QoS on top of an established default bearer. - * This will provide a dedicated tunnel for one or more specific traffic types. - */ - public static final long MODEM_FEATURE_DEDICATED_BEARER = 1 << 11; - /** Modem feature indicating network scan capability. */ - public static final long MODEM_FEATURE_NETWORK_SCAN = 1 << 12; - /** Modem feature indicating corresponding SIM has CDMA capability. */ - public static final long MODEM_FEATURE_CSIM = 1 << 13; - + // Hardcoded default DSDS capability. /** @hide */ - @LongDef(flag = true, prefix = {"MODEM_FEATURE_" }, value = { - MODEM_FEATURE_3GPP2_REG, - MODEM_FEATURE_3GPP_REG, - MODEM_FEATURE_CDMA2000_EHRPD_REG, - MODEM_FEATURE_GERAN_REG, - MODEM_FEATURE_UTRAN_REG, - MODEM_FEATURE_EUTRAN_REG, - MODEM_FEATURE_NGRAN_REG, - MODEM_FEATURE_EUTRA_NR_DUAL_CONNECTIVITY_REG, - MODEM_FEATURE_PS_VOICE_REG, - MODEM_FEATURE_CS_VOICE_SESSION, - MODEM_FEATURE_INTERACTIVE_DATA_SESSION, - MODEM_FEATURE_DEDICATED_BEARER, - MODEM_FEATURE_NETWORK_SCAN, - MODEM_FEATURE_CSIM, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface ModemFeature { - } - - /** - * Hardcoded default DSDS capability. - * @hide - */ public static final PhoneCapability DEFAULT_DSDS_CAPABILITY; - /** - * Hardcoded default Single SIM single standby capability. - * @hide - */ + // Hardcoded default Single SIM single standby capability. + /** @hide */ public static final PhoneCapability DEFAULT_SSSS_CAPABILITY; static { - List<List<Long>> capabilities = new ArrayList<>(); - List<Long> modem1 = new ArrayList<>(); - List<Long> modem2 = new ArrayList<>(); - modem1.add(MODEM_FEATURE_GERAN_REG | MODEM_FEATURE_UTRAN_REG | MODEM_FEATURE_EUTRAN_REG - | MODEM_FEATURE_PS_VOICE_REG | MODEM_FEATURE_CS_VOICE_SESSION - | MODEM_FEATURE_INTERACTIVE_DATA_SESSION | MODEM_FEATURE_DEDICATED_BEARER); - modem2.add(MODEM_FEATURE_GERAN_REG | MODEM_FEATURE_UTRAN_REG | MODEM_FEATURE_EUTRAN_REG - | MODEM_FEATURE_PS_VOICE_REG | MODEM_FEATURE_INTERACTIVE_DATA_SESSION - | MODEM_FEATURE_DEDICATED_BEARER); - capabilities.add(modem1); - capabilities.add(modem2); - List<String> uuids = new ArrayList<>(); - uuids.add("com.xxxx.lm0"); - uuids.add("com.xxxx.lm1"); - long rats = TelephonyManager.NETWORK_TYPE_BITMASK_GSM - | TelephonyManager.NETWORK_TYPE_BITMASK_GPRS - | TelephonyManager.NETWORK_TYPE_BITMASK_EDGE - | TelephonyManager.NETWORK_TYPE_BITMASK_UMTS - | TelephonyManager.NETWORK_TYPE_BITMASK_LTE; - DEFAULT_DSDS_CAPABILITY = new PhoneCapability(0, 0, 0, 0, 0, rats, null, null, null, null, - uuids, null, capabilities); - - capabilities = new ArrayList<>(); - capabilities.add(modem1); - uuids = new ArrayList<>(); - uuids.add("com.xxxx.lm0"); - DEFAULT_SSSS_CAPABILITY = new PhoneCapability(0, 0, 0, 0, 0, rats, null, null, null, null, - uuids, null, capabilities); - } - - private final int mUtranUeCategoryDl; - private final int mUtranUeCategoryUl; - private final int mEutranUeCategoryDl; - private final int mEutranUeCategoryUl; - private final long mPsDataConnectionLingerTimeMillis; - private final @NetworkTypeBitMask long mSupportedRats; - private final List<Integer> mGeranBands; - private final List<Integer> mUtranBands; - private final List<Integer> mEutranBands; - private final List<Integer> mNgranBands; - private final List<String> mLogicalModemUuids; - private final List<SimSlotCapability> mSimSlotCapabilities; - private final @ModemFeature List<List<Long>> mConcurrentFeaturesSupport; - - /** - * Default constructor to create a PhoneCapability object. - * @param utranUeCategoryDl 3GPP UE category for UTRAN downlink. - * @param utranUeCategoryUl 3GPP UE category for UTRAN uplink. - * @param eutranUeCategoryDl 3GPP UE category for EUTRAN downlink. - * @param eutranUeCategoryUl 3GPP UE category for EUTRAN uplink. - * @param psDataConnectionLingerTimeMillis length of the grace period to allow a smooth - * "handover" between data connections. - * @param supportedRats all radio access technologies this phone is capable of supporting. - * @param geranBands list of supported {@link AccessNetworkConstants.GeranBand}. - * @param utranBands list of supported {@link AccessNetworkConstants.UtranBand}. - * @param eutranBands list of supported {@link AccessNetworkConstants.EutranBand}. - * @param ngranBands list of supported {@link AccessNetworkConstants.NgranBands}. - * @param logicalModemUuids list of logical modem UUIDs, typically of the form - * "com.xxxx.lmX", where X is the logical modem ID. - * @param simSlotCapabilities list of {@link SimSlotCapability} for the device - * @param concurrentFeaturesSupport list of list of concurrently supportable modem feature sets. - * @hide - */ - public PhoneCapability(int utranUeCategoryDl, int utranUeCategoryUl, int eutranUeCategoryDl, - int eutranUeCategoryUl, long psDataConnectionLingerTimeMillis, - @NetworkTypeBitMask long supportedRats, @Nullable List<Integer> geranBands, - @Nullable List<Integer> utranBands, @Nullable List<Integer> eutranBands, - @Nullable List<Integer> ngranBands, @Nullable List<String> logicalModemUuids, - @Nullable List<SimSlotCapability> simSlotCapabilities, - @Nullable @ModemFeature List<List<Long>> concurrentFeaturesSupport) { - this.mUtranUeCategoryDl = utranUeCategoryDl; - this.mUtranUeCategoryUl = utranUeCategoryUl; - this.mEutranUeCategoryDl = eutranUeCategoryDl; - this.mEutranUeCategoryUl = eutranUeCategoryUl; - this.mPsDataConnectionLingerTimeMillis = psDataConnectionLingerTimeMillis; - this.mSupportedRats = supportedRats; - this.mGeranBands = TelephonyUtils.emptyIfNull(geranBands); - this.mUtranBands = TelephonyUtils.emptyIfNull(utranBands); - this.mEutranBands = TelephonyUtils.emptyIfNull(eutranBands); - this.mNgranBands = TelephonyUtils.emptyIfNull(ngranBands); - this.mLogicalModemUuids = TelephonyUtils.emptyIfNull(logicalModemUuids); - this.mSimSlotCapabilities = TelephonyUtils.emptyIfNull(simSlotCapabilities); - this.mConcurrentFeaturesSupport = TelephonyUtils.emptyIfNull(concurrentFeaturesSupport); - } - - private PhoneCapability(Parcel in) { - mUtranUeCategoryDl = in.readInt(); - mUtranUeCategoryUl = in.readInt(); - mEutranUeCategoryDl = in.readInt(); - mEutranUeCategoryUl = in.readInt(); - mPsDataConnectionLingerTimeMillis = in.readLong(); - mSupportedRats = in.readLong(); - mGeranBands = new ArrayList<>(); - in.readList(mGeranBands, Integer.class.getClassLoader()); - mUtranBands = new ArrayList<>(); - in.readList(mUtranBands, Integer.class.getClassLoader()); - mEutranBands = new ArrayList<>(); - in.readList(mEutranBands, Integer.class.getClassLoader()); - mNgranBands = new ArrayList<>(); - in.readList(mNgranBands, Integer.class.getClassLoader()); - mLogicalModemUuids = in.createStringArrayList(); - mSimSlotCapabilities = in.createTypedArrayList(SimSlotCapability.CREATOR); - int length = in.readInt(); - mConcurrentFeaturesSupport = new ArrayList<>(); - for (int i = 0; i < length; i++) { - ArrayList<Long> feature = new ArrayList<>(); - in.readList(feature, Long.class.getClassLoader()); - mConcurrentFeaturesSupport.add(feature); - } - } - - /** - * 3GPP UE category for a given Radio Access Network and direction. - * - * References are: - * TS 25.306 Table 4.1a EUTRAN downlink - * TS 25.306 Table 5.1a-2 EUTRAN uplink - * TS 25.306 Table 5.1a UTRAN downlink - * TS 25.306 Table 5.1g UTRAN uplink - * - * @param uplink true for uplink direction and false for downlink direction. - * @param accessNetworkType accessNetworkType, defined in {@link AccessNetworkType}. - * @return the UE category, or -1 if it is not supported. - */ - public int getUeCategory(boolean uplink, @RadioAccessNetworkType int accessNetworkType) { - if (uplink) { - switch (accessNetworkType) { - case AccessNetworkType.UTRAN: return mUtranUeCategoryUl; - case AccessNetworkType.EUTRAN: return mEutranUeCategoryUl; - default: return -1; - } - } else { - switch (accessNetworkType) { - case AccessNetworkType.UTRAN: return mUtranUeCategoryDl; - case AccessNetworkType.EUTRAN: return mEutranUeCategoryDl; - default: return -1; - } - } - } - - /** - * In cellular devices that support a greater number of logical modems than - * Internet connections, some devices support a grace period to allow a smooth "handover" - * between those connections. If that feature is supported, then this API will provide - * the length of that grace period in milliseconds. If it is not supported, the default value - * for the grace period is 0. - * @return handover linger time in milliseconds, or 0 if it is not supported. - */ - public long getPsDataConnectionLingerTimeMillis() { - return mPsDataConnectionLingerTimeMillis; - } - - /** - * The radio access technologies this device is capable of supporting. - * @return a bitfield of all supported network types, defined in {@link TelephonyManager} - */ - public @NetworkTypeBitMask long getSupportedRats() { - return mSupportedRats; - } - - /** - * List of supported cellular bands for the given accessNetworkType. - * @param accessNetworkType accessNetworkType, defined in {@link AccessNetworkType}. - * @return a list of bands, or an empty list if the access network type is unsupported. - */ - public @NonNull List<Integer> getBands(@RadioAccessNetworkType int accessNetworkType) { - switch (accessNetworkType) { - case AccessNetworkType.GERAN: return mGeranBands; - case AccessNetworkType.UTRAN: return mUtranBands; - case AccessNetworkType.EUTRAN: return mEutranBands; - case AccessNetworkType.NGRAN: return mNgranBands; - default: return new ArrayList<>(); - } - } - - /** - * List of logical modem UUIDs, each typically "com.xxxx.lmX", where X is the logical modem ID. - * @return a list of modem UUIDs, one for every logical modem the device has. - */ - public @NonNull List<String> getLogicalModemUuids() { - return mLogicalModemUuids; - } - - /** - * List of {@link SimSlotCapability} for the device. The order of SIMs corresponds to the - * order of modems in {@link #getLogicalModemUuids}. - * @return a list of SIM slot capabilities, one for every SIM slot the device has. - */ - public @NonNull List<SimSlotCapability> getSimSlotCapabilities() { - return mSimSlotCapabilities; - } - - /** - * A List of Lists of concurrently supportable modem feature sets. - * - * Each entry in the top-level list is an independent configuration across all modems - * that describes the capabilities of the device as a whole. - * - * Each entry in the second-level list is a bitfield of ModemFeatures that describes - * the capabilities for a single modem. In the second-level list, the order of the modems - * corresponds to order of the UUIDs in {@link #getLogicalModemUuids}. - * - * For symmetric capabilities that can only be active on one modem at a time, there will be - * multiple configurations (equal to the number of modems) that shows it active on each modem. - * For asymmetric capabilities that are only available on one of the modems, all configurations - * will have that capability on just that one modem. - * - * The example below shows the concurrentFeaturesSupport for a 3-modem device with - * theoretical capabilities SYMMETRIC (available on all modems, but only one at a time) and - * ASYMMETRIC (only available on the first modem): - * { - * Configuration 1: ASYMMETRIC and SYMMETRIC on modem 1, modem 2 empty, modem 3 empty - * {(ASYMMETRIC | SYMMETRIC), (), ()}, - * - * Configuration 2: ASYMMETRIC on modem 1, SYMMETRIC on modem 2, modem 3 empty - * {(ASYMMETRIC), (SYMMETRIC), ()}, - * - * Configuration 3: ASYMMETRIC on modem 1, modem 2 empty, SYMMETRIC on modem 3 - * {(ASYMMETRIC), (), (SYMMETRIC)} - * } - * - * @return List of all concurrently supportable modem features. - */ - public @NonNull @ModemFeature List<List<Long>> getConcurrentFeaturesSupport() { - return mConcurrentFeaturesSupport; - } + ModemInfo modemInfo1 = new ModemInfo(0, 0, true, true); + ModemInfo modemInfo2 = new ModemInfo(1, 0, true, true); - /** - * How many modems can simultaneously have PS attached. - * @return maximum number of active PS voice connections. - */ - public int getMaxActivePsVoice() { - return countFeature(MODEM_FEATURE_PS_VOICE_REG); - } + List<ModemInfo> logicalModemList = new ArrayList<>(); + logicalModemList.add(modemInfo1); + logicalModemList.add(modemInfo2); + DEFAULT_DSDS_CAPABILITY = new PhoneCapability(1, 1, 0, logicalModemList, false); - /** - * How many modems can simultaneously support active data connections. - * For DSDS, this will be 1, and for DSDA this will be 2. - * @return maximum number of active Internet data sessions. - */ - public int getMaxActiveInternetData() { - return countFeature(MODEM_FEATURE_INTERACTIVE_DATA_SESSION); - } - - /** - * How many modems can simultaneously have dedicated bearer capability. - * @return maximum number of active dedicated bearers. - */ - public int getMaxActiveDedicatedBearers() { - return countFeature(MODEM_FEATURE_DEDICATED_BEARER); - } - - /** - * Whether the CBRS band 48 is supported or not. - * @return true if any RadioAccessNetwork supports CBRS and false if none do. - * @hide - */ - public boolean isCbrsSupported() { - return mEutranBands.contains(AccessNetworkConstants.EutranBand.BAND_48) - || mNgranBands.contains(AccessNetworkConstants.NgranBands.BAND_48); + logicalModemList = new ArrayList<>(); + logicalModemList.add(modemInfo1); + DEFAULT_SSSS_CAPABILITY = new PhoneCapability(1, 1, 0, logicalModemList, false); } + /** @hide */ + public final int maxActiveVoiceCalls; + /** @hide */ + public final int maxActiveData; + /** @hide */ + public final int max5G; + /** @hide */ + public final boolean validationBeforeSwitchSupported; + /** @hide */ + public final List<ModemInfo> logicalModemList; - private int countFeature(@ModemFeature long feature) { - int count = 0; - for (long featureSet : mConcurrentFeaturesSupport.get(0)) { - if ((featureSet & feature) != 0) { - count++; - } - } - return count; + /** @hide */ + public PhoneCapability(int maxActiveVoiceCalls, int maxActiveData, int max5G, + List<ModemInfo> logicalModemList, boolean validationBeforeSwitchSupported) { + this.maxActiveVoiceCalls = maxActiveVoiceCalls; + this.maxActiveData = maxActiveData; + this.max5G = max5G; + // Make sure it's not null. + this.logicalModemList = logicalModemList == null ? new ArrayList<>() : logicalModemList; + this.validationBeforeSwitchSupported = validationBeforeSwitchSupported; } @Override public String toString() { - return "utranUeCategoryDl=" + mUtranUeCategoryDl - + " utranUeCategoryUl=" + mUtranUeCategoryUl - + " eutranUeCategoryDl=" + mEutranUeCategoryDl - + " eutranUeCategoryUl=" + mEutranUeCategoryUl - + " psDataConnectionLingerTimeMillis=" + mPsDataConnectionLingerTimeMillis - + " supportedRats=" + mSupportedRats + " geranBands=" + mGeranBands - + " utranBands=" + mUtranBands + " eutranBands=" + mEutranBands - + " ngranBands=" + mNgranBands + " logicalModemUuids=" + mLogicalModemUuids - + " simSlotCapabilities=" + mSimSlotCapabilities - + " concurrentFeaturesSupport=" + mConcurrentFeaturesSupport; + return "maxActiveVoiceCalls=" + maxActiveVoiceCalls + " maxActiveData=" + maxActiveData + + " max5G=" + max5G + "logicalModemList:" + + Arrays.toString(logicalModemList.toArray()); + } + + private PhoneCapability(Parcel in) { + maxActiveVoiceCalls = in.readInt(); + maxActiveData = in.readInt(); + max5G = in.readInt(); + validationBeforeSwitchSupported = in.readBoolean(); + logicalModemList = new ArrayList<>(); + in.readList(logicalModemList, ModemInfo.class.getClassLoader()); } @Override public int hashCode() { - return Objects.hash(mUtranUeCategoryDl, mUtranUeCategoryUl, mEutranUeCategoryDl, - mEutranUeCategoryUl, mPsDataConnectionLingerTimeMillis, mSupportedRats, mGeranBands, - mUtranBands, mEutranBands, mNgranBands, mLogicalModemUuids, mSimSlotCapabilities, - mConcurrentFeaturesSupport); + return Objects.hash(maxActiveVoiceCalls, maxActiveData, max5G, logicalModemList, + validationBeforeSwitchSupported); } @Override @@ -411,19 +106,11 @@ public final class PhoneCapability implements Parcelable { PhoneCapability s = (PhoneCapability) o; - return (mUtranUeCategoryDl == s.mUtranUeCategoryDl - && mUtranUeCategoryUl == s.mUtranUeCategoryUl - && mEutranUeCategoryDl == s.mEutranUeCategoryDl - && mEutranUeCategoryUl == s.mEutranUeCategoryUl - && mPsDataConnectionLingerTimeMillis == s.mPsDataConnectionLingerTimeMillis - && mSupportedRats == s.mSupportedRats - && mGeranBands.equals(s.mGeranBands) - && mUtranBands.equals(s.mUtranBands) - && mEutranBands.equals(s.mEutranBands) - && mNgranBands.equals(s.mNgranBands) - && mLogicalModemUuids.equals(s.mLogicalModemUuids) - && mSimSlotCapabilities.equals(s.mSimSlotCapabilities) - && mConcurrentFeaturesSupport.equals(s.mConcurrentFeaturesSupport)); + return (maxActiveVoiceCalls == s.maxActiveVoiceCalls + && maxActiveData == s.maxActiveData + && max5G == s.max5G + && validationBeforeSwitchSupported == s.validationBeforeSwitchSupported + && logicalModemList.equals(s.logicalModemList)); } /** @@ -437,32 +124,20 @@ public final class PhoneCapability implements Parcelable { * {@link Parcelable#writeToParcel} */ public void writeToParcel(@NonNull Parcel dest, @Parcelable.WriteFlags int flags) { - dest.writeInt(mUtranUeCategoryDl); - dest.writeInt(mUtranUeCategoryUl); - dest.writeInt(mEutranUeCategoryDl); - dest.writeInt(mEutranUeCategoryUl); - dest.writeLong(mPsDataConnectionLingerTimeMillis); - dest.writeLong(mSupportedRats); - dest.writeList(mGeranBands); - dest.writeList(mUtranBands); - dest.writeList(mEutranBands); - dest.writeList(mNgranBands); - dest.writeStringList(mLogicalModemUuids); - dest.writeTypedList(mSimSlotCapabilities); - dest.writeInt(mConcurrentFeaturesSupport.size()); - for (List<Long> feature : mConcurrentFeaturesSupport) { - dest.writeList(feature); - } + dest.writeInt(maxActiveVoiceCalls); + dest.writeInt(maxActiveData); + dest.writeInt(max5G); + dest.writeBoolean(validationBeforeSwitchSupported); + dest.writeList(logicalModemList); } - public static final @NonNull Parcelable.Creator<PhoneCapability> CREATOR = - new Parcelable.Creator() { - public PhoneCapability createFromParcel(Parcel in) { - return new PhoneCapability(in); - } + public static final @android.annotation.NonNull Parcelable.Creator<PhoneCapability> CREATOR = new Parcelable.Creator() { + public PhoneCapability createFromParcel(Parcel in) { + return new PhoneCapability(in); + } - public PhoneCapability[] newArray(int size) { - return new PhoneCapability[size]; - } - }; + public PhoneCapability[] newArray(int size) { + return new PhoneCapability[size]; + } + }; } diff --git a/telephony/java/android/telephony/PinResult.java b/telephony/java/android/telephony/PinResult.java new file mode 100644 index 000000000000..68c9d998ba92 --- /dev/null +++ b/telephony/java/android/telephony/PinResult.java @@ -0,0 +1,171 @@ +/* + * Copyright (C) 2020 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.IntDef; +import android.annotation.NonNull; +import android.annotation.Nullable; +import android.os.Parcel; +import android.os.Parcelable; + +import com.android.internal.telephony.PhoneConstants; + +import java.util.Objects; + +/** + * Holds the result from a pin attempt. + * + * @hide + */ +public final class PinResult implements Parcelable { + /** @hide */ + @IntDef({ + PIN_RESULT_TYPE_SUCCESS, + PIN_RESULT_TYPE_INCORRECT, + PIN_RESULT_TYPE_FAILURE, + }) + public @interface PinResultType {} + + /** + * Indicates that the pin attempt was a success. + */ + public static final int PIN_RESULT_TYPE_SUCCESS = PhoneConstants.PIN_RESULT_SUCCESS; + + /** + * Indicates that the pin attempt was incorrect. + */ + public static final int PIN_RESULT_TYPE_INCORRECT = PhoneConstants.PIN_PASSWORD_INCORRECT; + + /** + * Indicates that the pin attempt was a failure. + */ + public static final int PIN_RESULT_TYPE_FAILURE = PhoneConstants.PIN_GENERAL_FAILURE; + + private static final PinResult sFailedResult = + new PinResult(PinResult.PIN_RESULT_TYPE_FAILURE, -1); + + private final @PinResultType int mType; + + private final int mAttemptsRemaining; + + /** + * Returns either success, incorrect or failure. + * + * @see: #PIN_RESULT_TYPE_SUCCESS + * @see: #PIN_RESULT_TYPE_INCORRECT + * @see: #PIN_RESULT_TYPE_FAILURE + * @return The result type of the pin attempt. + */ + public @PinResultType int getType() { + return mType; + } + + /** + * The number of pin attempts remaining. + * + * @return Number of attempts remaining. + */ + public int getAttemptsRemaining() { + return mAttemptsRemaining; + } + + @NonNull + public static PinResult getDefaultFailedResult() { + return sFailedResult; + } + + /** + * PinResult constructor + * + * @param type The type of pin result. + * @see: #PIN_RESULT_TYPE_SUCCESS + * @see: #PIN_RESULT_TYPE_INCORRECT + * @see: #PIN_RESULT_TYPE_FAILURE + * @param attemptsRemaining Number of pin attempts remaining. + */ + public PinResult(@PinResultType int type, int attemptsRemaining) { + mType = type; + mAttemptsRemaining = attemptsRemaining; + } + + /** + * Construct a PinResult object from the given parcel. + * + * @hide + */ + private PinResult(Parcel in) { + mType = in.readInt(); + mAttemptsRemaining = in.readInt(); + } + + /** + * String representation of the Pin Result. + */ + @NonNull + @Override + public String toString() { + return "type: " + getType() + ", attempts remaining: " + getAttemptsRemaining(); + } + + /** + * Required to be Parcelable + */ + @Override + public int describeContents() { + return 0; + } + + /** + * Required to be Parcelable + */ + @Override + public void writeToParcel(@NonNull Parcel out, int flags) { + out.writeInt(mType); + out.writeInt(mAttemptsRemaining); + } + + /** Required to be Parcelable */ + public static final @NonNull Parcelable.Creator<PinResult> CREATOR = new Creator<PinResult>() { + public PinResult createFromParcel(Parcel in) { + return new PinResult(in); + } + public PinResult[] newArray(int size) { + return new PinResult[size]; + } + }; + + @Override + public int hashCode() { + return Objects.hash(mAttemptsRemaining, mType); + } + + @Override + public boolean equals(@Nullable Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + PinResult other = (PinResult) obj; + return (mType == other.mType + && mAttemptsRemaining == other.mAttemptsRemaining); + } +} diff --git a/telephony/java/android/telephony/PreciseDataConnectionState.java b/telephony/java/android/telephony/PreciseDataConnectionState.java index 54c22ae282fb..a9abe89abab0 100644 --- a/telephony/java/android/telephony/PreciseDataConnectionState.java +++ b/telephony/java/android/telephony/PreciseDataConnectionState.java @@ -95,7 +95,6 @@ public final class PreciseDataConnectionState implements Parcelable { * if there is no valid APN setting for the specific type, then this will be null * @hide */ - @SystemApi public PreciseDataConnectionState(@DataState int state, @NetworkType int networkType, @ApnType int apnTypes, @NonNull String apn, @@ -265,10 +264,10 @@ public final class PreciseDataConnectionState implements Parcelable { /** * Return the APN Settings for this data connection. * - * Returns the ApnSetting that was used to configure this data connection. + * @return the ApnSetting that was used to configure this data connection. */ // FIXME: This shouldn't be nullable; update once the ApnSetting is supplied correctly - @Nullable ApnSetting getApnSetting() { + public @Nullable ApnSetting getApnSetting() { return mApnSetting; } diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index 9ef361d82d19..82470d41842d 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -317,6 +317,14 @@ public class ServiceState implements Parcelable { */ public static final int UNKNOWN_ID = -1; + /** + * A parcelable extra used with {@link Intent#ACTION_SERVICE_STATE} representing the service + * state. + * @hide + */ + private static final String EXTRA_SERVICE_STATE = "android.intent.extra.SERVICE_STATE"; + + private String mOperatorAlphaLong; private String mOperatorAlphaShort; private String mOperatorNumeric; @@ -353,6 +361,7 @@ public class ServiceState implements Parcelable { private String mOperatorAlphaLongRaw; private String mOperatorAlphaShortRaw; + private boolean mIsDataRoamingFromRegistration; private boolean mIsIwlanPreferred; /** @@ -438,6 +447,7 @@ public class ServiceState implements Parcelable { mNrFrequencyRange = s.mNrFrequencyRange; mOperatorAlphaLongRaw = s.mOperatorAlphaLongRaw; mOperatorAlphaShortRaw = s.mOperatorAlphaShortRaw; + mIsDataRoamingFromRegistration = s.mIsDataRoamingFromRegistration; mIsIwlanPreferred = s.mIsIwlanPreferred; } @@ -472,6 +482,7 @@ public class ServiceState implements Parcelable { mNrFrequencyRange = in.readInt(); mOperatorAlphaLongRaw = in.readString(); mOperatorAlphaShortRaw = in.readString(); + mIsDataRoamingFromRegistration = in.readBoolean(); mIsIwlanPreferred = in.readBoolean(); } @@ -499,6 +510,7 @@ public class ServiceState implements Parcelable { out.writeInt(mNrFrequencyRange); out.writeString(mOperatorAlphaLongRaw); out.writeString(mOperatorAlphaShortRaw); + out.writeBoolean(mIsDataRoamingFromRegistration); out.writeBoolean(mIsIwlanPreferred); } @@ -568,7 +580,6 @@ public class ServiceState implements Parcelable { * * @hide */ - @SystemApi public @RegState int getDataRegistrationState() { return getDataRegState(); } @@ -649,7 +660,9 @@ public class ServiceState implements Parcelable { } /** - * Get current data network roaming type + * Get whether the current data network is roaming. + * This value may be overwritten by resource overlay or carrier configuration. + * @see #getDataRoamingFromRegistration() to get the value from the network registration. * @return roaming type * @hide */ @@ -659,18 +672,25 @@ public class ServiceState implements Parcelable { } /** - * Get whether data network registration state is roaming + * Set whether the data network registration state is roaming. + * This should only be set to the roaming value received + * once the data registration phase has completed. + * @hide + */ + public void setDataRoamingFromRegistration(boolean dataRoaming) { + mIsDataRoamingFromRegistration = dataRoaming; + } + + /** + * Get whether data network registration state is roaming. + * This value is set directly from the modem and will not be overwritten + * by resource overlay or carrier configuration. * @return true if registration indicates roaming, false otherwise * @hide */ + @SystemApi public boolean getDataRoamingFromRegistration() { - final NetworkRegistrationInfo regState = getNetworkRegistrationInfo( - NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); - if (regState != null) { - return regState.getRegistrationState() - == NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING; - } - return false; + return mIsDataRoamingFromRegistration; } /** @@ -873,6 +893,7 @@ public class ServiceState implements Parcelable { mNrFrequencyRange, mOperatorAlphaLongRaw, mOperatorAlphaShortRaw, + mIsDataRoamingFromRegistration, mIsIwlanPreferred); } } @@ -903,6 +924,7 @@ public class ServiceState implements Parcelable { && mNetworkRegistrationInfos.size() == s.mNetworkRegistrationInfos.size() && mNetworkRegistrationInfos.containsAll(s.mNetworkRegistrationInfos) && mNrFrequencyRange == s.mNrFrequencyRange + && mIsDataRoamingFromRegistration == s.mIsDataRoamingFromRegistration && mIsIwlanPreferred == s.mIsIwlanPreferred; } } @@ -1062,6 +1084,8 @@ public class ServiceState implements Parcelable { .append(", mNrFrequencyRange=").append(mNrFrequencyRange) .append(", mOperatorAlphaLongRaw=").append(mOperatorAlphaLongRaw) .append(", mOperatorAlphaShortRaw=").append(mOperatorAlphaShortRaw) + .append(", mIsDataRoamingFromRegistration=") + .append(mIsDataRoamingFromRegistration) .append(", mIsIwlanPreferred=").append(mIsIwlanPreferred) .append("}").toString(); } @@ -1102,6 +1126,7 @@ public class ServiceState implements Parcelable { } mOperatorAlphaLongRaw = null; mOperatorAlphaShortRaw = null; + mIsDataRoamingFromRegistration = false; mIsIwlanPreferred = false; } @@ -1274,7 +1299,7 @@ public class ServiceState implements Parcelable { */ @UnsupportedAppUsage private void setFromNotifierBundle(Bundle m) { - ServiceState ssFromBundle = m.getParcelable(Intent.EXTRA_SERVICE_STATE); + ServiceState ssFromBundle = m.getParcelable(EXTRA_SERVICE_STATE); if (ssFromBundle != null) { copyFrom(ssFromBundle); } @@ -1292,7 +1317,7 @@ public class ServiceState implements Parcelable { */ @SystemApi public void fillInNotifierBundle(@NonNull Bundle m) { - m.putParcelable(Intent.EXTRA_SERVICE_STATE, this); + m.putParcelable(EXTRA_SERVICE_STATE, this); // serviceState already consists of below entries. // for backward compatibility, we continue fill in below entries. m.putInt("voiceRegState", mVoiceRegState); @@ -1385,6 +1410,7 @@ public class ServiceState implements Parcelable { DataSpecificRegistrationInfo dsri = nri.getDataSpecificInfo(); if (dsri != null) { dsri.setIsUsingCarrierAggregation(ca); + addNetworkRegistrationInfo(nri); } } } @@ -1395,7 +1421,6 @@ public class ServiceState implements Parcelable { * @return the frequency range of 5G NR. * @hide */ - @SystemApi public @FrequencyRange int getNrFrequencyRange() { return mNrFrequencyRange; } @@ -1966,7 +1991,6 @@ public class ServiceState implements Parcelable { * @return the copied ServiceState with location info sanitized. * @hide */ - @SystemApi @NonNull public ServiceState createLocationInfoSanitizedCopy(boolean removeCoarseLocation) { ServiceState state = new ServiceState(this); diff --git a/telephony/java/android/telephony/SimSlotCapability.java b/telephony/java/android/telephony/SimSlotCapability.java deleted file mode 100644 index 3d38d0429908..000000000000 --- a/telephony/java/android/telephony/SimSlotCapability.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2019 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.IntDef; -import android.annotation.NonNull; -import android.os.Parcel; -import android.os.Parcelable; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.util.Objects; - -/** - * Capabilities for a SIM Slot. - */ -public final class SimSlotCapability implements Parcelable { - /** Slot type for UICC (removable SIM). */ - public static final int SLOT_TYPE_UICC = 1; - /** Slot type for iUICC/iSIM (integrated SIM). */ - public static final int SLOT_TYPE_IUICC = 2; - /** Slot type for eUICC/eSIM (embedded SIM). */ - public static final int SLOT_TYPE_EUICC = 3; - /** Slot type for soft SIM (no physical SIM). */ - public static final int SLOT_TYPE_SOFT_SIM = 4; - - /** @hide */ - @IntDef(prefix = {"SLOT_TYPE_" }, value = { - SLOT_TYPE_UICC, - SLOT_TYPE_IUICC, - SLOT_TYPE_EUICC, - SLOT_TYPE_SOFT_SIM, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface SlotType { - } - - private final int mPhysicalSlotIndex; - private final int mSlotType; - - /** @hide */ - public SimSlotCapability(int physicalSlotId, int slotType) { - this.mPhysicalSlotIndex = physicalSlotId; - this.mSlotType = slotType; - } - - private SimSlotCapability(Parcel in) { - mPhysicalSlotIndex = in.readInt(); - mSlotType = in.readInt(); - } - - /** - * @return physical SIM slot index - */ - public int getPhysicalSlotIndex() { - return mPhysicalSlotIndex; - } - - /** - * @return type of SIM {@link SlotType} - */ - public @SlotType int getSlotType() { - return mSlotType; - } - - @Override - public String toString() { - return "mPhysicalSlotIndex=" + mPhysicalSlotIndex + " slotType=" + mSlotType; - } - - @Override - public int hashCode() { - return Objects.hash(mPhysicalSlotIndex, mSlotType); - } - - @Override - public boolean equals(Object o) { - if (o == null || !(o instanceof SimSlotCapability) || hashCode() != o.hashCode()) { - return false; - } - - if (this == o) { - return true; - } - - SimSlotCapability s = (SimSlotCapability) o; - - return (mPhysicalSlotIndex == s.mPhysicalSlotIndex && mSlotType == s.mSlotType); - } - - /** - * {@link Parcelable#describeContents} - */ - public @ContentsFlags int describeContents() { - return 0; - } - - /** - * {@link Parcelable#writeToParcel} - */ - public void writeToParcel(@NonNull Parcel dest, @WriteFlags int flags) { - dest.writeInt(mPhysicalSlotIndex); - dest.writeInt(mSlotType); - } - - public static final @NonNull Parcelable.Creator<SimSlotCapability> CREATOR = - new Parcelable.Creator() { - public SimSlotCapability createFromParcel(Parcel in) { - return new SimSlotCapability(in); - } - - public SimSlotCapability[] newArray(int size) { - return new SimSlotCapability[size]; - } - }; -} diff --git a/telephony/java/android/telephony/SmsManager.java b/telephony/java/android/telephony/SmsManager.java index f86eeb2bf3df..0f52ba7935ab 100644 --- a/telephony/java/android/telephony/SmsManager.java +++ b/telephony/java/android/telephony/SmsManager.java @@ -389,7 +389,7 @@ public final class SmsManager { String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent) { sendTextMessageInternal(destinationAddress, scAddress, text, sentIntent, deliveryIntent, - true /* persistMessage*/, null); + true /* persistMessage*/, null, null); } /** @@ -507,7 +507,7 @@ public final class SmsManager { private void sendTextMessageInternal(String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, - boolean persistMessage, String packageName) { + boolean persistMessage, String packageName, String attributionTag) { if (TextUtils.isEmpty(destinationAddress)) { throw new IllegalArgumentException("Invalid destinationAddress"); } @@ -532,7 +532,7 @@ public final class SmsManager { public void onSuccess(int subId) { ISms iSms = getISmsServiceOrThrow(); try { - iSms.sendTextForSubscriber(subId, packageName, + iSms.sendTextForSubscriber(subId, packageName, attributionTag, destinationAddress, scAddress, text, sentIntent, deliveryIntent, persistMessage); } catch (RemoteException e) { @@ -552,7 +552,7 @@ public final class SmsManager { // visible to the user. ISms iSms = getISmsServiceOrThrow(); try { - iSms.sendTextForSubscriber(getSubscriptionId(), packageName, + iSms.sendTextForSubscriber(getSubscriptionId(), packageName, attributionTag, destinationAddress, scAddress, text, sentIntent, deliveryIntent, persistMessage); } catch (RemoteException e) { @@ -599,7 +599,7 @@ public final class SmsManager { String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent) { sendTextMessageInternal(destinationAddress, scAddress, text, sentIntent, deliveryIntent, - false /* persistMessage */, null); + false /* persistMessage */, null, null); } private void sendTextMessageInternal( @@ -642,7 +642,7 @@ public final class SmsManager { ISms iSms = getISmsServiceOrThrow(); if (iSms != null) { iSms.sendTextForSubscriberWithOptions(subId, - null, destinationAddress, + null, null, destinationAddress, scAddress, text, sentIntent, deliveryIntent, persistMessage, finalPriority, expectMore, finalValidity); @@ -664,7 +664,7 @@ public final class SmsManager { ISms iSms = getISmsServiceOrThrow(); if (iSms != null) { iSms.sendTextForSubscriberWithOptions(getSubscriptionId(), - null, destinationAddress, + null, null, destinationAddress, scAddress, text, sentIntent, deliveryIntent, persistMessage, finalPriority, expectMore, finalValidity); @@ -882,7 +882,24 @@ public final class SmsManager { String destinationAddress, String scAddress, ArrayList<String> parts, ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents) { sendMultipartTextMessageInternal(destinationAddress, scAddress, parts, sentIntents, - deliveryIntents, true /* persistMessage*/, null); + deliveryIntents, true /* persistMessage*/, null, null); + } + + /** + * @deprecated Use {@link #sendMultipartTextMessage(String, String, List, List, List, String, + * String)} instead. + * + * @hide + */ + @Deprecated + @SystemApi + @TestApi + public void sendMultipartTextMessage( + @NonNull String destinationAddress, @NonNull String scAddress, + @NonNull List<String> parts, @Nullable List<PendingIntent> sentIntents, + @Nullable List<PendingIntent> deliveryIntents, @NonNull String packageName) { + sendMultipartTextMessage(destinationAddress, scAddress, parts, sentIntents, deliveryIntents, + packageName, null); } /** @@ -909,15 +926,16 @@ public final class SmsManager { public void sendMultipartTextMessage( @NonNull String destinationAddress, @NonNull String scAddress, @NonNull List<String> parts, @Nullable List<PendingIntent> sentIntents, - @Nullable List<PendingIntent> deliveryIntents, @NonNull String packageName) { + @Nullable List<PendingIntent> deliveryIntents, @NonNull String packageName, + @Nullable String attributionTag) { sendMultipartTextMessageInternal(destinationAddress, scAddress, parts, sentIntents, - deliveryIntents, true /* persistMessage*/, packageName); + deliveryIntents, true /* persistMessage*/, packageName, attributionTag); } private void sendMultipartTextMessageInternal( String destinationAddress, String scAddress, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents, - boolean persistMessage, String packageName) { + boolean persistMessage, String packageName, String attributionTag) { if (TextUtils.isEmpty(destinationAddress)) { throw new IllegalArgumentException("Invalid destinationAddress"); } @@ -942,7 +960,7 @@ public final class SmsManager { public void onSuccess(int subId) { try { ISms iSms = getISmsServiceOrThrow(); - iSms.sendMultipartTextForSubscriber(subId, packageName, + iSms.sendMultipartTextForSubscriber(subId, packageName, attributionTag, destinationAddress, scAddress, parts, sentIntents, deliveryIntents, persistMessage); } catch (RemoteException e) { @@ -963,8 +981,8 @@ public final class SmsManager { ISms iSms = getISmsServiceOrThrow(); if (iSms != null) { iSms.sendMultipartTextForSubscriber(getSubscriptionId(), packageName, - destinationAddress, scAddress, parts, sentIntents, deliveryIntents, - persistMessage); + attributionTag, destinationAddress, scAddress, parts, sentIntents, + deliveryIntents, persistMessage); } } catch (RemoteException e) { Log.e(TAG, "sendMultipartTextMessageInternal: Couldn't send SMS - " @@ -982,7 +1000,7 @@ public final class SmsManager { deliveryIntent = deliveryIntents.get(0); } sendTextMessageInternal(destinationAddress, scAddress, parts.get(0), - sentIntent, deliveryIntent, true, packageName); + sentIntent, deliveryIntent, true, packageName, attributionTag); } } @@ -1012,7 +1030,7 @@ public final class SmsManager { String destinationAddress, String scAddress, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents) { sendMultipartTextMessageInternal(destinationAddress, scAddress, parts, sentIntents, - deliveryIntents, false /* persistMessage*/, null); + deliveryIntents, false /* persistMessage*/, null, null); } /** @@ -1174,7 +1192,7 @@ public final class SmsManager { ISms iSms = getISmsServiceOrThrow(); if (iSms != null) { iSms.sendMultipartTextForSubscriberWithOptions(subId, - null, destinationAddress, + null, null, destinationAddress, scAddress, parts, sentIntents, deliveryIntents, persistMessage, finalPriority, expectMore, finalValidity); } @@ -1196,7 +1214,7 @@ public final class SmsManager { ISms iSms = getISmsServiceOrThrow(); if (iSms != null) { iSms.sendMultipartTextForSubscriberWithOptions(getSubscriptionId(), - null, destinationAddress, + null, null, destinationAddress, scAddress, parts, sentIntents, deliveryIntents, persistMessage, finalPriority, expectMore, finalValidity); } @@ -1327,9 +1345,8 @@ public final class SmsManager { public void onSuccess(int subId) { try { ISms iSms = getISmsServiceOrThrow(); - iSms.sendDataForSubscriber(subId, null, - destinationAddress, scAddress, destinationPort & 0xFFFF, data, - sentIntent, deliveryIntent); + iSms.sendDataForSubscriber(subId, null, null, destinationAddress, scAddress, + destinationPort & 0xFFFF, data, sentIntent, deliveryIntent); } catch (RemoteException e) { Log.e(TAG, "sendDataMessage: Couldn't send SMS - Exception: " + e.getMessage()); notifySmsError(sentIntent, RESULT_REMOTE_EXCEPTION); @@ -1481,7 +1498,7 @@ public final class SmsManager { // it here because we do not have access to the activity context that is performing this // operation. // Requires that the calling process has the SEND_SMS permission. - getITelephony().enqueueSmsPickResult(null, + getITelephony().enqueueSmsPickResult(null, null, new IIntegerConsumer.Stub() { @Override public void accept(int subId) { @@ -2378,14 +2395,18 @@ public final class SmsManager { * @param sentIntent if not NULL this <code>PendingIntent</code> is * broadcast when the message is successfully sent, or failed * @throws IllegalArgumentException if contentUri is empty + * @deprecated use {@link MmsManager#sendMultimediaMessage} instead. */ public void sendMultimediaMessage(Context context, Uri contentUri, String locationUrl, Bundle configOverrides, PendingIntent sentIntent) { if (contentUri == null) { throw new IllegalArgumentException("Uri contentUri null"); } - MmsManager.getInstance().sendMultimediaMessage(getSubscriptionId(), contentUri, - locationUrl, configOverrides, sentIntent); + MmsManager m = (MmsManager) context.getSystemService(Context.MMS_SERVICE); + if (m != null) { + m.sendMultimediaMessage(getSubscriptionId(), contentUri, locationUrl, configOverrides, + sentIntent); + } } /** @@ -2409,6 +2430,7 @@ public final class SmsManager { * @param downloadedIntent if not NULL this <code>PendingIntent</code> is * broadcast when the message is downloaded, or the download is failed * @throws IllegalArgumentException if locationUrl or contentUri is empty + * @deprecated use {@link MmsManager#downloadMultimediaMessage} instead. */ public void downloadMultimediaMessage(Context context, String locationUrl, Uri contentUri, Bundle configOverrides, PendingIntent downloadedIntent) { @@ -2418,8 +2440,11 @@ public final class SmsManager { if (contentUri == null) { throw new IllegalArgumentException("Uri contentUri null"); } - MmsManager.getInstance().downloadMultimediaMessage(getSubscriptionId(), locationUrl, - contentUri, configOverrides, downloadedIntent); + MmsManager m = (MmsManager) context.getSystemService(Context.MMS_SERVICE); + if (m != null) { + m.downloadMultimediaMessage(getSubscriptionId(), locationUrl, contentUri, + configOverrides, downloadedIntent); + } } // MMS send/download failure result codes @@ -2451,9 +2476,9 @@ public final class SmsManager { * </p> * * @return the bundle key/values pairs that contains MMS configuration values + * or an empty Bundle if they cannot be found. */ - @Nullable - public Bundle getCarrierConfigValues() { + @NonNull public Bundle getCarrierConfigValues() { try { ISms iSms = getISmsService(); if (iSms != null) { @@ -2462,7 +2487,7 @@ public final class SmsManager { } catch (RemoteException ex) { // ignore it } - return null; + return new Bundle(); } /** diff --git a/telephony/java/android/telephony/SmsMessage.java b/telephony/java/android/telephony/SmsMessage.java index c68fecffc6dc..52f089894b30 100644 --- a/telephony/java/android/telephony/SmsMessage.java +++ b/telephony/java/android/telephony/SmsMessage.java @@ -20,6 +20,7 @@ import static android.telephony.TelephonyManager.PHONE_TYPE_CDMA; import android.Manifest; import android.annotation.IntDef; +import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; @@ -320,12 +321,9 @@ public class SmsMessage { * @param data Message data. * @param isCdma Indicates weather the type of the SMS is CDMA. * @return An SmsMessage representing the message. - * - * @hide */ - @SystemApi @Nullable - public static SmsMessage createFromNativeSmsSubmitPdu(@NonNull byte[] data, boolean isCdma) { + public static SmsMessage createSmsSubmitPdu(@NonNull byte[] data, boolean isCdma) { SmsMessageBase wrappedMessage; if (isCdma) { @@ -719,9 +717,9 @@ public class SmsMessage { * 23.040 9.2.3.24.16 * @param languageShiftTable GSM national language shift table to use, specified by 3GPP * 23.040 9.2.3.24.15 - * @param refNumber parameter to create SmsHeader - * @param seqNumber parameter to create SmsHeader - * @param msgCount parameter to create SmsHeader + * @param refNumber reference number of concatenated SMS, specified by 3GPP 23.040 9.2.3.24.1 + * @param seqNumber sequence number of concatenated SMS, specified by 3GPP 23.040 9.2.3.24.1 + * @param msgCount count of messages of concatenated SMS, specified by 3GPP 23.040 9.2.3.24.2 * @return a byte[] containing the encoded message * * @hide @@ -732,9 +730,12 @@ public class SmsMessage { public static byte[] getSubmitPduEncodedMessage(boolean isTypeGsm, @NonNull String destinationAddress, @NonNull String message, - @EncodingSize int encoding, int languageTable, - int languageShiftTable, int refNumber, - int seqNumber, int msgCount) { + @EncodingSize int encoding, + @IntRange(from = 0) int languageTable, + @IntRange(from = 0) int languageShiftTable, + @IntRange(from = 0, to = 255) int refNumber, + @IntRange(from = 1, to = 255) int seqNumber, + @IntRange(from = 1, to = 255) int msgCount) { byte[] data; SmsHeader.ConcatRef concatRef = new SmsHeader.ConcatRef(); concatRef.refNumber = refNumber; diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java index 832771daa409..dc75c58e9420 100644 --- a/telephony/java/android/telephony/SubscriptionInfo.java +++ b/telephony/java/android/telephony/SubscriptionInfo.java @@ -226,7 +226,7 @@ public class SubscriptionInfo implements Parcelable { this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number, roaming, icon, mcc, mnc, countryIso, isEmbedded, nativeAccessRules, cardString, -1, false, null, false, TelephonyManager.UNKNOWN_CARRIER_ID, - SubscriptionManager.PROFILE_CLASS_DEFAULT, + SubscriptionManager.PROFILE_CLASS_UNSET, SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM, null, null, true); } @@ -798,7 +798,7 @@ public class SubscriptionInfo implements Parcelable { + " hplmns=" + Arrays.toString(mHplmns) + " subscriptionType=" + mSubscriptionType + " mGroupOwner=" + mGroupOwner - + " carrierConfigAccessRules=" + mCarrierConfigAccessRules + + " carrierConfigAccessRules=" + Arrays.toString(mCarrierConfigAccessRules) + " mAreUiccApplicationsEnabled=" + mAreUiccApplicationsEnabled + "}"; } diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index 1cf8f1e72a27..d4a76b7c1154 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -265,7 +265,8 @@ public class SubscriptionManager { * <P>Type: TEXT (String)</P> */ /** @hide */ - public static final String UNIQUE_KEY_SUBSCRIPTION_ID = SimInfo.UNIQUE_KEY_SUBSCRIPTION_ID; + public static final String UNIQUE_KEY_SUBSCRIPTION_ID = + SimInfo.COLUMN_UNIQUE_KEY_SUBSCRIPTION_ID; /** * TelephonyProvider column name for a unique identifier for the subscription within the @@ -274,14 +275,14 @@ public class SubscriptionManager { * <P>Type: TEXT (String)</P> */ /** @hide */ - public static final String ICC_ID = SimInfo.ICC_ID; + public static final String ICC_ID = SimInfo.COLUMN_ICC_ID; /** * TelephonyProvider column name for user SIM_SlOT_INDEX * <P>Type: INTEGER (int)</P> */ /** @hide */ - public static final String SIM_SLOT_INDEX = SimInfo.SIM_SLOT_INDEX; + public static final String SIM_SLOT_INDEX = SimInfo.COLUMN_SIM_SLOT_INDEX; /** SIM is not inserted */ /** @hide */ @@ -300,7 +301,7 @@ public class SubscriptionManager { * Default value is 0. */ /** @hide */ - public static final String SUBSCRIPTION_TYPE = SimInfo.SUBSCRIPTION_TYPE; + public static final String SUBSCRIPTION_TYPE = SimInfo.COLUMN_SUBSCRIPTION_TYPE; /** * TelephonyProvider column name data_enabled_override_rules. @@ -313,7 +314,8 @@ public class SubscriptionManager { * * @hide */ - public static final String DATA_ENABLED_OVERRIDE_RULES = SimInfo.DATA_ENABLED_OVERRIDE_RULES; + public static final String DATA_ENABLED_OVERRIDE_RULES = + SimInfo.COLUMN_DATA_ENABLED_OVERRIDE_RULES; /** @hide */ @Retention(RetentionPolicy.SOURCE) @@ -362,14 +364,14 @@ public class SubscriptionManager { * <P>Type: TEXT (String)</P> */ /** @hide */ - public static final String DISPLAY_NAME = SimInfo.DISPLAY_NAME; + public static final String DISPLAY_NAME = SimInfo.COLUMN_DISPLAY_NAME; /** * TelephonyProvider column name for the service provider name for the SIM. * <P>Type: TEXT (String)</P> */ /** @hide */ - public static final String CARRIER_NAME = SimInfo.CARRIER_NAME; + public static final String CARRIER_NAME = SimInfo.COLUMN_CARRIER_NAME; /** * Default name resource @@ -383,13 +385,13 @@ public class SubscriptionManager { * * @hide */ - public static final String NAME_SOURCE = SimInfo.NAME_SOURCE; + public static final String NAME_SOURCE = SimInfo.COLUMN_NAME_SOURCE; /** - * The name_source is the default, which is from the carrier id. + * The name_source is from the carrier id. * @hide */ - public static final int NAME_SOURCE_DEFAULT = SimInfo.NAME_SOURCE_DEFAULT; + public static final int NAME_SOURCE_CARRIER_ID = SimInfo.NAME_SOURCE_CARRIER_ID; /** * The name_source is from SIM EF_SPN. @@ -420,7 +422,7 @@ public class SubscriptionManager { @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = {"NAME_SOURCE_"}, value = { - NAME_SOURCE_DEFAULT, + NAME_SOURCE_CARRIER_ID, NAME_SOURCE_SIM_SPN, NAME_SOURCE_USER_INPUT, NAME_SOURCE_CARRIER, @@ -433,21 +435,21 @@ public class SubscriptionManager { * <P>Type: INTEGER (int)</P> */ /** @hide */ - public static final String COLOR = SimInfo.COLOR; + public static final String HUE = SimInfo.COLUMN_COLOR; /** * TelephonyProvider column name for the phone number of a SIM. * <P>Type: TEXT (String)</P> */ /** @hide */ - public static final String NUMBER = SimInfo.NUMBER; + public static final String NUMBER = SimInfo.COLUMN_NUMBER; /** * TelephonyProvider column name for whether data roaming is enabled. * <P>Type: INTEGER (int)</P> */ /** @hide */ - public static final String DATA_ROAMING = SimInfo.DATA_ROAMING; + public static final String DATA_ROAMING = SimInfo.COLUMN_DATA_ROAMING; /** Indicates that data roaming is enabled for a subscription */ public static final int DATA_ROAMING_ENABLE = SimInfo.DATA_ROAMING_ENABLE; @@ -455,70 +457,60 @@ public class SubscriptionManager { /** Indicates that data roaming is disabled for a subscription */ public static final int DATA_ROAMING_DISABLE = SimInfo.DATA_ROAMING_DISABLE; - /** @hide */ - public static final int DATA_ROAMING_DEFAULT = SimInfo.DATA_ROAMING_DEFAULT; - /** * TelephonyProvider column name for subscription carrier id. * @see TelephonyManager#getSimCarrierId() * <p>Type: INTEGER (int) </p> * @hide */ - public static final String CARRIER_ID = SimInfo.CARRIER_ID; + public static final String CARRIER_ID = SimInfo.COLUMN_CARRIER_ID; /** * @hide A comma-separated list of EHPLMNs associated with the subscription * <P>Type: TEXT (String)</P> */ - public static final String EHPLMNS = SimInfo.EHPLMNS; + public static final String EHPLMNS = SimInfo.COLUMN_EHPLMNS; /** * @hide A comma-separated list of HPLMNs associated with the subscription * <P>Type: TEXT (String)</P> */ - public static final String HPLMNS = SimInfo.HPLMNS; + public static final String HPLMNS = SimInfo.COLUMN_HPLMNS; /** * TelephonyProvider column name for the MCC associated with a SIM, stored as a string. * <P>Type: TEXT (String)</P> * @hide */ - public static final String MCC_STRING = SimInfo.MCC_STRING; + public static final String MCC_STRING = SimInfo.COLUMN_MCC_STRING; /** * TelephonyProvider column name for the MNC associated with a SIM, stored as a string. * <P>Type: TEXT (String)</P> * @hide */ - public static final String MNC_STRING = SimInfo.MNC_STRING; + public static final String MNC_STRING = SimInfo.COLUMN_MNC_STRING; /** * TelephonyProvider column name for the MCC associated with a SIM. * <P>Type: INTEGER (int)</P> * @hide */ - public static final String MCC = SimInfo.MCC; + public static final String MCC = SimInfo.COLUMN_MCC; /** * TelephonyProvider column name for the MNC associated with a SIM. * <P>Type: INTEGER (int)</P> * @hide */ - public static final String MNC = SimInfo.MNC; + public static final String MNC = SimInfo.COLUMN_MNC; /** * TelephonyProvider column name for the iso country code associated with a SIM. * <P>Type: TEXT (String)</P> * @hide */ - public static final String ISO_COUNTRY_CODE = SimInfo.ISO_COUNTRY_CODE; - - /** - * TelephonyProvider column name for the sim provisioning status associated with a SIM. - * <P>Type: INTEGER (int)</P> - * @hide - */ - public static final String SIM_PROVISIONING_STATUS = SimInfo.SIM_PROVISIONING_STATUS; + public static final String ISO_COUNTRY_CODE = SimInfo.COLUMN_ISO_COUNTRY_CODE; /** * TelephonyProvider column name for whether a subscription is embedded (that is, present on an @@ -526,7 +518,7 @@ public class SubscriptionManager { * <p>Type: INTEGER (int), 1 for embedded or 0 for non-embedded. * @hide */ - public static final String IS_EMBEDDED = SimInfo.IS_EMBEDDED; + public static final String IS_EMBEDDED = SimInfo.COLUMN_IS_EMBEDDED; /** * TelephonyProvider column name for SIM card identifier. For UICC card it is the ICCID of the @@ -534,7 +526,7 @@ public class SubscriptionManager { * <P>Type: TEXT (String)</P> * @hide */ - public static final String CARD_ID = SimInfo.CARD_ID; + public static final String CARD_ID = SimInfo.COLUMN_CARD_ID; /** * TelephonyProvider column name for the encoded {@link UiccAccessRule}s from @@ -542,7 +534,7 @@ public class SubscriptionManager { * <p>TYPE: BLOB * @hide */ - public static final String ACCESS_RULES = SimInfo.ACCESS_RULES; + public static final String ACCESS_RULES = SimInfo.COLUMN_ACCESS_RULES; /** * TelephonyProvider column name for the encoded {@link UiccAccessRule}s from @@ -552,7 +544,7 @@ public class SubscriptionManager { * @hide */ public static final String ACCESS_RULES_FROM_CARRIER_CONFIGS = - SimInfo.ACCESS_RULES_FROM_CARRIER_CONFIGS; + SimInfo.COLUMN_ACCESS_RULES_FROM_CARRIER_CONFIGS; /** * TelephonyProvider column name identifying whether an embedded subscription is on a removable @@ -562,79 +554,82 @@ public class SubscriptionManager { * <p>TYPE: INTEGER (int), 1 for removable or 0 for non-removable. * @hide */ - public static final String IS_REMOVABLE = SimInfo.IS_REMOVABLE; + public static final String IS_REMOVABLE = SimInfo.COLUMN_IS_REMOVABLE; /** * TelephonyProvider column name for extreme threat in CB settings * @hide */ - public static final String CB_EXTREME_THREAT_ALERT = SimInfo.CB_EXTREME_THREAT_ALERT; + public static final String CB_EXTREME_THREAT_ALERT = + SimInfo.COLUMN_CB_EXTREME_THREAT_ALERT; /** * TelephonyProvider column name for severe threat in CB settings *@hide */ - public static final String CB_SEVERE_THREAT_ALERT = SimInfo.CB_SEVERE_THREAT_ALERT; + public static final String CB_SEVERE_THREAT_ALERT = SimInfo.COLUMN_CB_SEVERE_THREAT_ALERT; /** * TelephonyProvider column name for amber alert in CB settings *@hide */ - public static final String CB_AMBER_ALERT = SimInfo.CB_AMBER_ALERT; + public static final String CB_AMBER_ALERT = SimInfo.COLUMN_CB_AMBER_ALERT; /** * TelephonyProvider column name for emergency alert in CB settings *@hide */ - public static final String CB_EMERGENCY_ALERT = SimInfo.CB_EMERGENCY_ALERT; + public static final String CB_EMERGENCY_ALERT = SimInfo.COLUMN_CB_EMERGENCY_ALERT; /** * TelephonyProvider column name for alert sound duration in CB settings *@hide */ - public static final String CB_ALERT_SOUND_DURATION = SimInfo.CB_ALERT_SOUND_DURATION; + public static final String CB_ALERT_SOUND_DURATION = + SimInfo.COLUMN_CB_ALERT_SOUND_DURATION; /** * TelephonyProvider column name for alert reminder interval in CB settings *@hide */ - public static final String CB_ALERT_REMINDER_INTERVAL = SimInfo.CB_ALERT_REMINDER_INTERVAL; + public static final String CB_ALERT_REMINDER_INTERVAL = + SimInfo.COLUMN_CB_ALERT_REMINDER_INTERVAL; /** * TelephonyProvider column name for enabling vibrate in CB settings *@hide */ - public static final String CB_ALERT_VIBRATE = SimInfo.CB_ALERT_VIBRATE; + public static final String CB_ALERT_VIBRATE = SimInfo.COLUMN_CB_ALERT_VIBRATE; /** * TelephonyProvider column name for enabling alert speech in CB settings *@hide */ - public static final String CB_ALERT_SPEECH = SimInfo.CB_ALERT_SPEECH; + public static final String CB_ALERT_SPEECH = SimInfo.COLUMN_CB_ALERT_SPEECH; /** * TelephonyProvider column name for ETWS test alert in CB settings *@hide */ - public static final String CB_ETWS_TEST_ALERT = SimInfo.CB_ETWS_TEST_ALERT; + public static final String CB_ETWS_TEST_ALERT = SimInfo.COLUMN_CB_ETWS_TEST_ALERT; /** * TelephonyProvider column name for enable channel50 alert in CB settings *@hide */ - public static final String CB_CHANNEL_50_ALERT = SimInfo.CB_CHANNEL_50_ALERT; + public static final String CB_CHANNEL_50_ALERT = SimInfo.COLUMN_CB_CHANNEL_50_ALERT; /** * TelephonyProvider column name for CMAS test alert in CB settings *@hide */ - public static final String CB_CMAS_TEST_ALERT = SimInfo.CB_CMAS_TEST_ALERT; + public static final String CB_CMAS_TEST_ALERT = SimInfo.COLUMN_CB_CMAS_TEST_ALERT; /** * TelephonyProvider column name for Opt out dialog in CB settings *@hide */ - public static final String CB_OPT_OUT_DIALOG = SimInfo.CB_OPT_OUT_DIALOG; + public static final String CB_OPT_OUT_DIALOG = SimInfo.COLUMN_CB_OPT_OUT_DIALOG; /** * TelephonyProvider column name for enable Volte. @@ -643,44 +638,45 @@ public class SubscriptionManager { * {@link CarrierConfigManager#KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL}. *@hide */ - public static final String ENHANCED_4G_MODE_ENABLED = SimInfo.ENHANCED_4G_MODE_ENABLED; + public static final String ENHANCED_4G_MODE_ENABLED = + SimInfo.COLUMN_ENHANCED_4G_MODE_ENABLED; /** * TelephonyProvider column name for enable VT (Video Telephony over IMS) *@hide */ - public static final String VT_IMS_ENABLED = SimInfo.VT_IMS_ENABLED; + public static final String VT_IMS_ENABLED = SimInfo.COLUMN_VT_IMS_ENABLED; /** * TelephonyProvider column name for enable Wifi calling *@hide */ - public static final String WFC_IMS_ENABLED = SimInfo.WFC_IMS_ENABLED; + public static final String WFC_IMS_ENABLED = SimInfo.COLUMN_WFC_IMS_ENABLED; /** * TelephonyProvider column name for Wifi calling mode *@hide */ - public static final String WFC_IMS_MODE = SimInfo.WFC_IMS_MODE; + public static final String WFC_IMS_MODE = SimInfo.COLUMN_WFC_IMS_MODE; /** * TelephonyProvider column name for Wifi calling mode in roaming *@hide */ - public static final String WFC_IMS_ROAMING_MODE = SimInfo.WFC_IMS_ROAMING_MODE; + public static final String WFC_IMS_ROAMING_MODE = SimInfo.COLUMN_WFC_IMS_ROAMING_MODE; /** * TelephonyProvider column name for enable Wifi calling in roaming *@hide */ - public static final String WFC_IMS_ROAMING_ENABLED = SimInfo.WFC_IMS_ROAMING_ENABLED; + public static final String WFC_IMS_ROAMING_ENABLED = SimInfo.COLUMN_WFC_IMS_ROAMING_ENABLED; /** * Determines if the user has enabled IMS RCS User Capability Exchange (UCE) for this * subscription. * @hide */ - public static final String IMS_RCS_UCE_ENABLED = SimInfo.IMS_RCS_UCE_ENABLED; + public static final String IMS_RCS_UCE_ENABLED = SimInfo.COLUMN_IMS_RCS_UCE_ENABLED; /** * TelephonyProvider column name for whether a subscription is opportunistic, that is, @@ -689,7 +685,7 @@ public class SubscriptionManager { * <p>Type: INTEGER (int), 1 for opportunistic or 0 for non-opportunistic. * @hide */ - public static final String IS_OPPORTUNISTIC = SimInfo.IS_OPPORTUNISTIC; + public static final String IS_OPPORTUNISTIC = SimInfo.COLUMN_IS_OPPORTUNISTIC; /** * TelephonyProvider column name for group ID. Subscriptions with same group ID @@ -698,7 +694,7 @@ public class SubscriptionManager { * * @hide */ - public static final String GROUP_UUID = SimInfo.GROUP_UUID; + public static final String GROUP_UUID = SimInfo.COLUMN_GROUP_UUID; /** * TelephonyProvider column name for group owner. It's the package name who created @@ -706,7 +702,7 @@ public class SubscriptionManager { * * @hide */ - public static final String GROUP_OWNER = SimInfo.GROUP_OWNER; + public static final String GROUP_OWNER = SimInfo.COLUMN_GROUP_OWNER; /** * TelephonyProvider column name for the profile class of a subscription @@ -714,7 +710,7 @@ public class SubscriptionManager { * <P>Type: INTEGER (int)</P> * @hide */ - public static final String PROFILE_CLASS = SimInfo.PROFILE_CLASS; + public static final String PROFILE_CLASS = SimInfo.COLUMN_PROFILE_CLASS; /** * Profile class of the subscription @@ -726,7 +722,6 @@ public class SubscriptionManager { SimInfo.PROFILE_CLASS_PROVISIONING, SimInfo.PROFILE_CLASS_OPERATIONAL, SimInfo.PROFILE_CLASS_UNSET, - SimInfo.PROFILE_CLASS_DEFAULT }) public @interface ProfileClass {} @@ -772,7 +767,8 @@ public class SubscriptionManager { * @hide */ @SystemApi - public static final int PROFILE_CLASS_DEFAULT = SimInfo.PROFILE_CLASS_DEFAULT; + @Deprecated + public static final int PROFILE_CLASS_DEFAULT = SimInfo.PROFILE_CLASS_UNSET; /** * IMSI (International Mobile Subscriber Identity). @@ -780,19 +776,19 @@ public class SubscriptionManager { * @hide */ //TODO: add @SystemApi - public static final String IMSI = SimInfo.IMSI; + public static final String IMSI = SimInfo.COLUMN_IMSI; /** * Whether uicc applications is set to be enabled or disabled. By default it's enabled. * @hide */ - public static final String UICC_APPLICATIONS_ENABLED = SimInfo.UICC_APPLICATIONS_ENABLED; + public static final String UICC_APPLICATIONS_ENABLED = SimInfo.COLUMN_UICC_APPLICATIONS_ENABLED; /** * Indicate which network type is allowed. By default it's enabled. * @hide */ - public static final String ALLOWED_NETWORK_TYPES = SimInfo.ALLOWED_NETWORK_TYPES; + public static final String ALLOWED_NETWORK_TYPES = SimInfo.COLUMN_ALLOWED_NETWORK_TYPES; /** * Broadcast Action: The user has changed one of the default subs related to @@ -992,11 +988,15 @@ public class SubscriptionManager { * individual records themselves. When a change occurs the onSubscriptionsChanged method of * the listener will be invoked immediately if there has been a notification. The * onSubscriptionChanged method will also be triggered once initially when calling this - * function. + * function. The callback will be invoked on the looper specified in the listener's constructor. * * @param listener an instance of {@link OnSubscriptionsChangedListener} with * onSubscriptionsChanged overridden. + * + * @deprecated Will get exception if the parameter listener is not initialized with a Looper. + * Use {@link #addOnSubscriptionsChangedListener(Executor, OnSubscriptionsChangedListener)}. */ + @Deprecated public void addOnSubscriptionsChangedListener(OnSubscriptionsChangedListener listener) { if (listener == null) return; addOnSubscriptionsChangedListener(listener.mExecutor, listener); @@ -1303,6 +1303,11 @@ public class SubscriptionManager { * The records will be sorted by {@link SubscriptionInfo#getSimSlotIndex} * then by {@link SubscriptionInfo#getSubscriptionId}. * + * Hidden subscriptions refer to those are not meant visible to the users. + * For example, an opportunistic subscription that is grouped with other + * subscriptions should remain invisible to users as they are only functionally + * supplementary to primary ones. + * * <p>Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} * or that the calling app has carrier privileges (see * {@link TelephonyManager#hasCarrierPrivileges}). In the latter case, only records accessible @@ -2139,6 +2144,7 @@ public class SubscriptionManager { } else { logd("putPhoneIdAndSubIdExtra: no valid subs"); intent.putExtra(PhoneConstants.PHONE_KEY, phoneId); + intent.putExtra(EXTRA_SLOT_INDEX, phoneId); } } @@ -2146,27 +2152,41 @@ public class SubscriptionManager { @UnsupportedAppUsage public static void putPhoneIdAndSubIdExtra(Intent intent, int phoneId, int subId) { if (VDBG) logd("putPhoneIdAndSubIdExtra: phoneId=" + phoneId + " subId=" + subId); - intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId); - intent.putExtra(EXTRA_SUBSCRIPTION_INDEX, subId); intent.putExtra(EXTRA_SLOT_INDEX, phoneId); intent.putExtra(PhoneConstants.PHONE_KEY, phoneId); + putSubscriptionIdExtra(intent, subId); } /** - * TODO(b/137102918) Make this static, tests use this as an instance method currently. + * Get visible subscription Id(s) of the currently active SIM(s). * * @return the list of subId's that are active, - * is never null but the length maybe 0. + * is never null but the length may be 0. * @hide */ - @UnsupportedAppUsage + @SystemApi public @NonNull int[] getActiveSubscriptionIdList() { return getActiveSubscriptionIdList(/* visibleOnly */ true); } /** - * TODO(b/137102918) Make this static, tests use this as an instance method currently. + * Get both hidden and visible subscription Id(s) of the currently active SIM(s). + * + * Hidden subscriptions refer to those are not meant visible to the users. + * For example, an opportunistic subscription that is grouped with other + * subscriptions should remain invisible to users as they are only functionally + * supplementary to primary ones. * + * @return the list of subId's that are active, + * is never null but the length may be 0. + * @hide + */ + @SystemApi + public @NonNull int[] getActiveAndHiddenSubscriptionIdList() { + return getActiveSubscriptionIdList(/* visibleOnly */false); + } + + /** * @return a non-null list of subId's that are active. * * @hide @@ -2663,8 +2683,8 @@ public class SubscriptionManager { * @hide */ @SystemApi - public boolean canManageSubscription(@Nullable SubscriptionInfo info, - @Nullable String packageName) { + public boolean canManageSubscription(@NonNull SubscriptionInfo info, + @NonNull String packageName) { if (info == null || info.getAllAccessRules() == null || packageName == null) { return false; } @@ -3169,13 +3189,13 @@ public class SubscriptionManager { * * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required * - * @param enabled whether uicc applications are enabled or disabled. * @param subscriptionId which subscription to operate on. + * @param enabled whether uicc applications are enabled or disabled. * @hide */ @SystemApi @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) - public void setUiccApplicationsEnabled(boolean enabled, int subscriptionId) { + public void setUiccApplicationsEnabled(int subscriptionId, boolean enabled) { if (VDBG) { logd("setUiccApplicationsEnabled subId= " + subscriptionId + " enable " + enabled); } @@ -3311,4 +3331,19 @@ public class SubscriptionManager { } return SubscriptionManager.INVALID_SUBSCRIPTION_ID; } + + /** + * Helper method that puts a subscription id on an intent with the constants: + * PhoneConstant.SUBSCRIPTION_KEY and SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX. + * Both constants are used to support backwards compatibility. Once we know we got all places, + * we can remove PhoneConstants.SUBSCRIPTION_KEY. + * @param intent Intent to put sub id on. + * @param subId SubscriptionId to put on intent. + * + * @hide + */ + public static void putSubscriptionIdExtra(Intent intent, int subId) { + intent.putExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX, subId); + intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId); + } } diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index e97b6eeb97b6..992d749067a2 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -53,6 +53,7 @@ import android.os.Binder; import android.os.Build; import android.os.Bundle; import android.os.Handler; +import android.os.ParcelFileDescriptor; import android.os.PersistableBundle; import android.os.Process; import android.os.RemoteException; @@ -69,13 +70,13 @@ import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; import android.telephony.Annotation.ApnType; -import android.telephony.Annotation.CallForwardingReason; import android.telephony.Annotation.CallState; -import android.telephony.Annotation.CallWaitingStatus; +import android.telephony.Annotation.CarrierPrivilegeStatus; import android.telephony.Annotation.NetworkType; import android.telephony.Annotation.RadioPowerState; import android.telephony.Annotation.SimActivationState; import android.telephony.Annotation.UiccAppType; +import android.telephony.CallForwardingInfo.CallForwardingReason; import android.telephony.VisualVoicemailService.VisualVoicemailTask; import android.telephony.data.ApnSetting; import android.telephony.data.ApnSetting.MvnoType; @@ -95,6 +96,7 @@ import android.util.Pair; import com.android.ims.internal.IImsServiceFeatureCallback; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.CellNetworkScanResult; +import com.android.internal.telephony.IBooleanConsumer; import com.android.internal.telephony.INumberVerificationCallback; import com.android.internal.telephony.IOns; import com.android.internal.telephony.IPhoneSubInfo; @@ -118,6 +120,7 @@ import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Objects; import java.util.UUID; import java.util.concurrent.Executor; import java.util.function.Consumer; @@ -153,7 +156,7 @@ public class TelephonyManager { */ @ChangeId @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.Q) - private static final long CALLBACK_ON_MORE_ERROR_CODE_CHANGE = 130595455L; + public static final long CALLBACK_ON_MORE_ERROR_CODE_CHANGE = 130595455L; /** * The key to use when placing the result of {@link #requestModemActivityInfo(ResultReceiver)} @@ -1028,7 +1031,7 @@ public class TelephonyManager { * or that all steps during multi-SIM change are done. To know those information you still need * to listen to SIM_STATE changes or active subscription changes. * - * See extra of {@link #EXTRA_NUM_OF_ACTIVE_SIM_SUPPORTED} for updated value. + * See extra of {@link #EXTRA_ACTIVE_SIM_SUPPORTED_COUNT} for updated value. */ public static final String ACTION_MULTI_SIM_CONFIG_CHANGED = "android.telephony.action.MULTI_SIM_CONFIG_CHANGED"; @@ -1038,6 +1041,8 @@ public class TelephonyManager { * The number of active SIM supported by current multi-SIM config. It's not related to how many * SIM/subscriptions are currently active. * + * Same value will be returned by {@link #getActiveModemCount()}. + * * For single SIM mode, it's 1. * For DSDS or DSDA mode, it's 2. * For triple-SIM mode, it's 3. @@ -1046,8 +1051,8 @@ public class TelephonyManager { * * type: integer */ - public static final String EXTRA_NUM_OF_ACTIVE_SIM_SUPPORTED = - "android.telephony.extra.NUM_OF_ACTIVE_SIM_SUPPORTED"; + public static final String EXTRA_ACTIVE_SIM_SUPPORTED_COUNT = + "android.telephony.extra.ACTIVE_SIM_SUPPORTED_COUNT"; /** * @hide @@ -1530,6 +1535,40 @@ public class TelephonyManager { "android.telephony.extra.SIM_COMBINATION_NAMES"; /** + * <p>Broadcast Action: The emergency callback mode is changed. + * <ul> + * <li><em>EXTRA_PHONE_IN_ECM_STATE</em> - A boolean value,true=phone in ECM, + * false=ECM off</li> + * </ul> + * <p class="note"> + * You can <em>not</em> receive this through components declared + * in manifests, only by explicitly registering for it with + * {@link android.content.Context#registerReceiver(android.content.BroadcastReceiver, + * android.content.IntentFilter) Context.registerReceiver()}. + * + * <p class="note">This is a protected intent that can only be sent by the system. + * + * @see #EXTRA_PHONE_IN_ECM_STATE + * + * @hide + */ + @SystemApi + @SuppressLint("ActionValue") + public static final String ACTION_EMERGENCY_CALLBACK_MODE_CHANGED = + "android.intent.action.EMERGENCY_CALLBACK_MODE_CHANGED"; + + + /** + * Extra included in {@link #ACTION_EMERGENCY_CALLBACK_MODE_CHANGED}. + * Indicates whether the phone is in an emergency phone state. + * + * @hide + */ + @SystemApi + public static final String EXTRA_PHONE_IN_ECM_STATE = + "android.telephony.extra.PHONE_IN_ECM_STATE"; + + /** * <p>Broadcast Action: when data connections get redirected with validation failure. * intended for sim/account status checks and only sent to the specified carrier app * The intent will have the following extra values:</p> @@ -1716,6 +1755,40 @@ public class TelephonyManager { @SuppressLint("ActionValue") public static final String EXTRA_DEFAULT_NETWORK_AVAILABLE = "defaultNetworkAvailable"; + /** + * <p>Broadcast Action: The emergency call state is changed. + * <ul> + * <li><em>EXTRA_PHONE_IN_EMERGENCY_CALL</em> - A boolean value, true if phone in emergency + * call, false otherwise</li> + * </ul> + * <p class="note"> + * You can <em>not</em> receive this through components declared + * in manifests, only by explicitly registering for it with + * {@link android.content.Context#registerReceiver(android.content.BroadcastReceiver, + * android.content.IntentFilter) Context.registerReceiver()}. + * + * <p class="note">This is a protected intent that can only be sent by the system. + * + * @see #EXTRA_PHONE_IN_EMERGENCY_CALL + * + * @hide + */ + @SystemApi + @SuppressLint("ActionValue") + public static final String ACTION_EMERGENCY_CALL_STATE_CHANGED = + "android.intent.action.EMERGENCY_CALL_STATE_CHANGED"; + + + /** + * Extra included in {@link #ACTION_EMERGENCY_CALL_STATE_CHANGED}. + * It indicates whether the phone is making an emergency call. + * + * @hide + */ + @SystemApi + public static final String EXTRA_PHONE_IN_EMERGENCY_CALL = + "android.telephony.extra.PHONE_IN_EMERGENCY_CALL"; + // // // Device Info @@ -1723,24 +1796,6 @@ public class TelephonyManager { // /** - * Returns the {@link PhoneCapability} for the device or null if it is not available. - * <p> - * Requires Permission: READ_PHONE_STATE or that the calling app has - * carrier privileges (see {@link #hasCarrierPrivileges}). - */ - @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) - @Nullable - public PhoneCapability getPhoneCapability() { - try { - ITelephony telephony = getITelephony(); - return telephony == null ? null : - telephony.getPhoneCapability(getSubId(), getOpPackageName(), getFeatureId()); - } catch (RemoteException ex) { - return null; - } - } - - /** * Returns the software version number for the device, for example, * the IMEI/SV for GSM phones. Return null if the software version is * not available. @@ -2248,7 +2303,12 @@ public class TelephonyManager { public static final int PHONE_TYPE_CDMA = PhoneConstants.PHONE_TYPE_CDMA; /** Phone is via SIP. */ public static final int PHONE_TYPE_SIP = PhoneConstants.PHONE_TYPE_SIP; - /** Phone is via IMS. */ + + /** + * Phone is via IMS. + * + * @hide + */ public static final int PHONE_TYPE_IMS = PhoneConstants.PHONE_TYPE_IMS; /** @@ -2256,7 +2316,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi public static final int PHONE_TYPE_THIRD_PARTY = PhoneConstants.PHONE_TYPE_THIRD_PARTY; /** @@ -2653,39 +2712,22 @@ public class TelephonyManager { /** * Returns the ISO-3166 country code equivalent of the MCC (Mobile Country Code) of the current * registered operator or the cell nearby, if available. - * <p> - * The ISO-3166 country code is provided in lowercase 2 character format. - * <p> - * Note: In multi-sim, this returns a shared emergency network country iso from other - * subscription if the subscription used to create the TelephonyManager doesn't camp on - * a network due to some reason (e.g. pin/puk locked), or sim is absent in the corresponding - * slot. + * * Note: Result may be unreliable on CDMA networks (use {@link #getPhoneType()} to determine * if on a CDMA network). * <p> * @return the lowercase 2 character ISO-3166 country code, or empty string if not available. */ public String getNetworkCountryIso() { - try { - ITelephony telephony = getITelephony(); - if (telephony == null) return ""; - return telephony.getNetworkCountryIsoForPhone(getPhoneId(), - null /* no permission check */, null); - } catch (RemoteException ex) { - return ""; - } + return getNetworkCountryIso(getSlotIndex()); } /** * Returns the ISO-3166 country code equivalent of the MCC (Mobile Country Code) of the current - * registered operator or the cell nearby, if available. - * <p> - * The ISO-3166 country code is provided in lowercase 2 character format. - * <p> - * Note: In multi-sim, this returns a shared emergency network country iso from other - * subscription if the subscription used to create the TelephonyManager doesn't camp on - * a network due to some reason (e.g. pin/puk locked), or sim is absent in the corresponding - * slot. + * registered operator or the cell nearby, if available. This is same as + * {@link #getNetworkCountryIso()} but allowing specifying the SIM slot index. This is used for + * accessing network country info from the SIM slot that does not have SIM inserted. + * * Note: Result may be unreliable on CDMA networks (use {@link #getPhoneType()} to determine * if on a CDMA network). * <p> @@ -2696,27 +2738,34 @@ public class TelephonyManager { * * @throws IllegalArgumentException when the slotIndex is invalid. * - * {@hide} */ - @SystemApi - @TestApi @NonNull - @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getNetworkCountryIso(int slotIndex) { try { - if (!SubscriptionManager.isValidSlotIndex(slotIndex)) { + if (slotIndex != SubscriptionManager.DEFAULT_SIM_SLOT_INDEX + && !SubscriptionManager.isValidSlotIndex(slotIndex)) { throw new IllegalArgumentException("invalid slot index " + slotIndex); } ITelephony telephony = getITelephony(); if (telephony == null) return ""; - return telephony.getNetworkCountryIsoForPhone(slotIndex, getOpPackageName(), - getFeatureId()); + return telephony.getNetworkCountryIsoForPhone(slotIndex); } catch (RemoteException ex) { return ""; } } + /** + * @hide + * @deprecated Use {@link #getNetworkCountryIso(int)} instead. + */ + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q, + publicAlternatives = "Use {@link #getNetworkCountryIso(int)} instead.") + public String getNetworkCountryIsoForPhone(int phoneId) { + return getNetworkCountryIso(phoneId); + } + /* * When adding a network type to the list below, make sure to add the correct icon to * MobileSignalController.mapIconSets() as well as NETWORK_TYPES @@ -3800,21 +3849,20 @@ public class TelephonyManager { } /** - * Return if the current radio is LTE on CDMA. This is a tri-state return value as for a period - * of time the mode may be unknown. + * Return if the current radio has global mode enabled, meaning it supports + * both 3GPP and 3GPP2 radio technologies at the same time. * * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the - * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()} - * - * @return {@link PhoneConstants#LTE_ON_CDMA_UNKNOWN}, {@link PhoneConstants#LTE_ON_CDMA_FALSE} - * or {@link PhoneConstants#LTE_ON_CDMA_TRUE} + * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}. * + * @return {@code true} if global mode is enabled + * {@code false} if global mode is not enabled or unknown * @hide */ - @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) - @UnsupportedAppUsage - public int getLteOnCdmaMode() { - return getLteOnCdmaMode(getSubId()); + @SystemApi + @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + public boolean isGlobalModeEnabled() { + return getLteOnCdmaMode(getSubId()) == PhoneConstants.LTE_ON_CDMA_TRUE; } /** @@ -3827,7 +3875,7 @@ public class TelephonyManager { * or {@link PhoneConstants#LTE_ON_CDMA_TRUE} * @hide */ - @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) + @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @UnsupportedAppUsage public int getLteOnCdmaMode(int subId) { try { @@ -4826,7 +4874,7 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony != null) { telephony.sendVisualVoicemailSmsForSubscriber( - mContext.getOpPackageName(), subId, number, port, text, sentIntent); + mContext.getOpPackageName(), null, subId, number, port, text, sentIntent); } } catch (RemoteException ex) { } @@ -8596,9 +8644,13 @@ public class TelephonyManager { return false; } - /** @hide */ + /** + * @deprecated use {@link #supplyPinReportPinResult(String pin)} instead. + * + * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + @Deprecated public int[] supplyPinReportResult(String pin) { try { ITelephony telephony = getITelephony(); @@ -8610,9 +8662,13 @@ public class TelephonyManager { return new int[0]; } - /** @hide */ + /** + * @deprecated use {@link #supplyPukReportPinResult(String puk, String pin)} instead. + * + * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + @Deprecated public int[] supplyPukReportResult(String puk, String pin) { try { ITelephony telephony = getITelephony(); @@ -8625,6 +8681,53 @@ public class TelephonyManager { } /** + * Used when the user attempts to enter their pin. + * + * @param pin The user entered pin. + * @return The result of the pin. + * + * @hide + */ + @Nullable + @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + public PinResult supplyPinReportPinResult(@NonNull String pin) { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + int[] result = telephony.supplyPinReportResultForSubscriber(getSubId(), pin); + return new PinResult(result[0], result[1]); + } + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelephony#supplyPinReportResultForSubscriber", e); + } + return null; + } + + /** + * Used when the user attempts to enter the puk or their pin. + * + * @param puk The product unblocking key. + * @param pin The user entered pin. + * @return The result of the pin. + * + * @hide + */ + @Nullable + @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + public PinResult supplyPukReportPinResult(@NonNull String puk, @NonNull String pin) { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + int[] result = telephony.supplyPukReportResultForSubscriber(getSubId(), puk, pin); + return new PinResult(result[0], result[1]); + } + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelephony#]", e); + } + return null; + } + + /** * Used to notify callers of * {@link TelephonyManager#sendUssdRequest(String, UssdResponseCallback, Handler)} when the * network either successfully executes a USSD request, or if there was a failure while @@ -8800,7 +8903,10 @@ public class TelephonyManager { } /** - * Shut down all the live radios over all the slot index. + * Shut down all the live radios over all the slot indexes. + * + * <p>To know when the radio has completed powering off, use + * {@link PhoneStateListener#LISTEN_SERVICE_STATE LISTEN_SERVICE_STATE}. * * @hide */ @@ -8813,7 +8919,8 @@ public class TelephonyManager { telephony.shutdownMobileRadios(); } } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#shutdownMobileRadios", e); + Log.e(TAG, "Error calling ITelephony#shutdownAllRadios", e); + e.rethrowAsRuntimeException(); } } @@ -8832,7 +8939,8 @@ public class TelephonyManager { return telephony.needMobileRadioShutdown(); } } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#needMobileRadioShutdown", e); + Log.e(TAG, "Error calling ITelephony#isAnyRadioPoweredOn", e); + e.rethrowAsRuntimeException(); } return false; } @@ -9062,7 +9170,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public @CdmaRoamingMode int getCdmaRoamingMode() { int mode = CDMA_ROAMING_MODE_RADIO_DEFAULT; @@ -9091,7 +9198,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setCdmaRoamingMode(@CdmaRoamingMode int mode) { try { @@ -9117,19 +9223,16 @@ public class TelephonyManager { /** Used for CDMA subscription mode, it'll be UNKNOWN if there is no Subscription source. * @hide */ - @SystemApi public static final int CDMA_SUBSCRIPTION_UNKNOWN = -1; /** Used for CDMA subscription mode: RUIM/SIM (default) * @hide */ - @SystemApi public static final int CDMA_SUBSCRIPTION_RUIM_SIM = 0; /** Used for CDMA subscription mode: NV -> non-volatile memory * @hide */ - @SystemApi public static final int CDMA_SUBSCRIPTION_NV = 1; /** @hide */ @@ -9148,7 +9251,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setCdmaSubscriptionMode(@CdmaSubscription int mode) { try { @@ -9705,32 +9807,12 @@ public class TelephonyManager { } /** - * Get baseband version for the default phone using the legacy approach. - * This change was added in P, to ensure backward compatiblity. - * - * @return baseband version. - * @hide - */ - private String getBasebandVersionLegacy(int phoneId) { - if (SubscriptionManager.isValidPhoneId(phoneId)) { - String prop = "gsm.version.baseband" - + ((phoneId == 0) ? "" : Integer.toString(phoneId)); - return SystemProperties.get(prop); - } - return null; - } - - /** * Get baseband version by phone id. * * @return baseband version. * @hide */ public String getBasebandVersionForPhone(int phoneId) { - String version = getBasebandVersionLegacy(phoneId); - if (version != null && !version.isEmpty()) { - setBasebandVersionForPhone(phoneId, version); - } return getTelephonyProperty(phoneId, TelephonyProperties.baseband_version(), ""); } @@ -10966,7 +11048,6 @@ public class TelephonyManager { * @param isEnabled {@code true} for enabling; {@code false} for disabling. * @hide */ - @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setAlwaysReportSignalStrength(boolean isEnabled) { try { @@ -11001,21 +11082,21 @@ public class TelephonyManager { } /** - * Checks whether cellular data connection is enabled in the device. - * - * Whether cellular data connection is enabled, meaning upon request whether will try to setup - * metered data connection considering all factors below: - * 1) User turned on data setting {@link #isDataEnabled}. - * 2) Carrier allows data to be on. - * 3) Network policy. - * And possibly others. + * Checks whether cellular data connection is allowed in the device. * - * @return {@code true} if the overall data connection is capable; {@code false} if not. + * <p>Whether cellular data connection is allowed considers all factors below: + * <UL> + * <LI>User turned on data setting {@link #isDataEnabled}.</LI> + * <LI>Carrier allows data to be on.</LI> + * <LI>Network policy.</LI> + * <LI>And possibly others.</LI> + * </UL> + * @return {@code true} if the overall data connection is allowed; {@code false} if not. * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) - public boolean isDataConnectionEnabled() { + public boolean isDataConnectionAllowed() { boolean retVal = false; try { int subId = getSubId(SubscriptionManager.getDefaultDataSubscriptionId()); @@ -11023,16 +11104,21 @@ public class TelephonyManager { if (telephony != null) retVal = telephony.isDataEnabled(subId); } catch (RemoteException e) { - Log.e(TAG, "Error isDataConnectionEnabled", e); - } catch (NullPointerException e) { + Log.e(TAG, "Error isDataConnectionAllowed", e); } return retVal; } /** - * Checks if FEATURE_TELEPHONY_DATA is enabled. - * - * @hide + * @return true if the current device is "data capable" over a radio on the device. + * <p> + * "Data capable" means that this device supports packet-switched + * data connections over the telephony network. + * <p> + * Note: the meaning of this flag is subtly different from the + * PackageManager.FEATURE_TELEPHONY system feature, which is available + * on any device with a telephony radio, even if the device is + * voice-only. */ public boolean isDataCapable() { if (mContext == null) return true; @@ -11052,14 +11138,6 @@ public class TelephonyManager { */ public static final int INDICATION_UPDATE_MODE_IGNORE_SCREEN_OFF = 2; - /** @hide */ - @IntDef(prefix = { "INDICATION_UPDATE_MODE_" }, value = { - INDICATION_UPDATE_MODE_NORMAL, - INDICATION_UPDATE_MODE_IGNORE_SCREEN_OFF - }) - @Retention(RetentionPolicy.SOURCE) - public @interface IndicationUpdateMode{} - /** * The indication for signal strength update. * @hide @@ -11090,51 +11168,6 @@ public class TelephonyManager { */ public static final int INDICATION_FILTER_PHYSICAL_CHANNEL_CONFIG = 0x10; - /** @hide */ - @IntDef(flag = true, prefix = { "INDICATION_FILTER_" }, value = { - INDICATION_FILTER_SIGNAL_STRENGTH, - INDICATION_FILTER_FULL_NETWORK_STATE, - INDICATION_FILTER_DATA_CALL_DORMANCY_CHANGED, - INDICATION_FILTER_LINK_CAPACITY_ESTIMATE, - INDICATION_FILTER_PHYSICAL_CHANNEL_CONFIG - }) - @Retention(RetentionPolicy.SOURCE) - public @interface IndicationFilters{} - - /** - * Sets radio indication update mode. This can be used to control the behavior of indication - * update from modem to Android frameworks. For example, by default several indication updates - * are turned off when screen is off, but in some special cases (e.g. carkit is connected but - * screen is off) we want to turn on those indications even when the screen is off. - * - * <p>Requires Permission: - * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} - * - * @param filters Indication filters. Should be a bitmask of INDICATION_FILTER_XXX. - * @see #INDICATION_FILTER_SIGNAL_STRENGTH - * @see #INDICATION_FILTER_FULL_NETWORK_STATE - * @see #INDICATION_FILTER_DATA_CALL_DORMANCY_CHANGED - * @param updateMode The voice activation state - * @see #INDICATION_UPDATE_MODE_NORMAL - * @see #INDICATION_UPDATE_MODE_IGNORE_SCREEN_OFF - * @hide - */ - @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) - public void setRadioIndicationUpdateMode(@IndicationFilters int filters, - @IndicationUpdateMode int updateMode) { - try { - ITelephony telephony = getITelephony(); - if (telephony != null) { - telephony.setRadioIndicationUpdateMode(getSubId(), filters, updateMode); - } - } catch (RemoteException ex) { - // This could happen if binder process crashes. - if (!isSystemProcess()) { - ex.rethrowAsRuntimeException(); - } - } - } - /** * A test API to override carrier information including mccmnc, imsi, iccid, gid1, gid2, * plmn and spn. This would be handy for, eg, forcing a particular carrier id, carrier's config @@ -11502,11 +11535,9 @@ public class TelephonyManager { } /** - * Override the file path for testing OTA emergency number database in a file partition. + * Override the file path for OTA emergency number database in a file partition. * - * @param otaFilePath The test OTA emergency number database file path; - * if "RESET", recover the original database file partition. - * Format: <root file folder>@<file path> + * @param otaParcelFileDescriptor parcelable file descriptor for OTA emergency number database. * * <p> Requires permission: * {@link android.Manifest.permission#READ_ACTIVE_EMERGENCY_SESSION} @@ -11516,16 +11547,42 @@ public class TelephonyManager { @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) @SystemApi @TestApi - public void updateTestOtaEmergencyNumberDbFilePath(@NonNull String otaFilePath) { + public void updateOtaEmergencyNumberDbFilePath( + @NonNull ParcelFileDescriptor otaParcelFileDescriptor) { try { ITelephony telephony = getITelephony(); if (telephony != null) { - telephony.updateTestOtaEmergencyNumberDbFilePath(otaFilePath); + telephony.updateOtaEmergencyNumberDbFilePath(otaParcelFileDescriptor); } else { throw new IllegalStateException("telephony service is null."); } } catch (RemoteException ex) { - Log.e(TAG, "notifyOtaEmergencyNumberDatabaseInstalled RemoteException", ex); + Log.e(TAG, "updateOtaEmergencyNumberDbFilePath RemoteException", ex); + ex.rethrowAsRuntimeException(); + } + } + + /** + * Reset the file path to default for OTA emergency number database in a file partition. + * + * <p> Requires permission: + * {@link android.Manifest.permission#READ_ACTIVE_EMERGENCY_SESSION} + * + * @hide + */ + @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) + @SystemApi + @TestApi + public void resetOtaEmergencyNumberDbFilePath() { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + telephony.resetOtaEmergencyNumberDbFilePath(); + } else { + throw new IllegalStateException("telephony service is null."); + } + } catch (RemoteException ex) { + Log.e(TAG, "resetOtaEmergencyNumberDbFilePath RemoteException", ex); ex.rethrowAsRuntimeException(); } } @@ -11624,6 +11681,7 @@ public class TelephonyManager { * subscription, the key is {@link SubscriptionManager#getDefaultSubscriptionId}) and the value * as the list of {@link EmergencyNumber}; empty Map if this information is not available; * or throw a SecurityException if the caller does not have the permission. + * @throws IllegalStateException if the Telephony process is not currently available. */ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @NonNull @@ -11671,6 +11729,7 @@ public class TelephonyManager { * @param number - the number to look up * @return {@code true} if the given number is an emergency number based on current locale, * SIM card(s), Android database, modem, network or defaults; {@code false} otherwise. + * @throws IllegalStateException if the Telephony process is not currently available. */ public boolean isEmergencyNumber(@NonNull String number) { try { @@ -11706,7 +11765,7 @@ public class TelephonyManager { * the same digits of any current emergency number based on current locale, sim, modem and * network; {@code false} if it is not; or throw an SecurityException if the caller does not * have the required permission/privileges - * + * @throws IllegalStateException if the Telephony process is not currently available. * @hide */ @SystemApi @@ -11727,7 +11786,7 @@ public class TelephonyManager { } /** - * A test API to return the emergency number db version. + * Returns the emergency number database version. * * <p>Requires Permission: * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE} @@ -11736,6 +11795,7 @@ public class TelephonyManager { */ @TestApi @SystemApi + @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getEmergencyNumberDbVersion() { try { ITelephony telephony = getITelephony(); @@ -12279,7 +12339,7 @@ public class TelephonyManager { */ @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) - public int getCarrierPrivilegeStatus(int uid) { + public @CarrierPrivilegeStatus int getCarrierPrivilegeStatus(int uid) { try { ITelephony telephony = getITelephony(); if (telephony != null) { @@ -12431,6 +12491,69 @@ public class TelephonyManager { } /** + * Specify which bands modem's background scan must act on. + * If {@code specifiers} is non-empty, the scan will be restricted to the bands specified. + * Otherwise, it scans all bands. + * + * For example, CBRS is only on LTE band 48. By specifying this band, + * modem saves more power. + * + * @param specifiers which bands to scan. + * @param executor The executor to execute the callback on + * @param callback The callback that gets invoked when the radio responds to the request. Called + * with {@code true} if the request succeeded, {@code false} otherwise. + * @hide + */ + @SystemApi + @TestApi + @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + public void setSystemSelectionChannels(@NonNull List<RadioAccessSpecifier> specifiers, + @NonNull @CallbackExecutor Executor executor, + @NonNull Consumer<Boolean> callback) { + Objects.requireNonNull(specifiers, "Specifiers must not be null."); + Objects.requireNonNull(executor, "Executor must not be null."); + Objects.requireNonNull(callback, "Callback must not be null."); + setSystemSelectionChannelsInternal(specifiers, executor, callback); + } + + /** + * Same as {@link #setSystemSelectionChannels(List, Executor, Consumer<Boolean>)}, but to be + * used when the caller does not need feedback on the results of the operation. + * @param specifiers which bands to scan. + * @hide + */ + @SystemApi + @TestApi + @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + public void setSystemSelectionChannels(@NonNull List<RadioAccessSpecifier> specifiers) { + Objects.requireNonNull(specifiers, "Specifiers must not be null."); + setSystemSelectionChannelsInternal(specifiers, null, null); + } + + + private void setSystemSelectionChannelsInternal(@NonNull List<RadioAccessSpecifier> specifiers, + @Nullable @CallbackExecutor Executor executor, + @Nullable Consumer<Boolean> callback) { + IBooleanConsumer aidlConsumer = callback == null ? null : new IBooleanConsumer.Stub() { + @Override + public void accept(boolean result) { + executor.execute(() -> callback.accept(result)); + } + }; + + try { + ITelephony service = getITelephony(); + if (service != null) { + service.setSystemSelectionChannels(specifiers, getSubId(), aidlConsumer); + } + } catch (RemoteException ex) { + if (!isSystemProcess()) { + ex.rethrowAsRuntimeException(); + } + } + } + + /** * Verifies whether the input MCC/MNC and MVNO correspond to the current carrier. * * @param mccmnc the carrier's mccmnc that you want to match @@ -12462,7 +12585,6 @@ public class TelephonyManager { } /** -<<<<<<< HEAD * Gets the voice call forwarding info {@link CallForwardingInfo}, given the call forward * reason. * @@ -12482,7 +12604,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @NonNull public CallForwardingInfo getCallForwarding(@CallForwardingReason int callForwardingReason) { @@ -12529,7 +12650,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setCallForwarding(@NonNull CallForwardingInfo callForwardingInfo) { if (callForwardingInfo == null) { @@ -12570,7 +12690,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi public static final int CALL_WAITING_STATUS_ACTIVE = 1; /** @@ -12578,7 +12697,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi public static final int CALL_WAITING_STATUS_INACTIVE = 2; /** @@ -12586,7 +12704,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi public static final int CALL_WAITING_STATUS_UNKNOWN_ERROR = 3; /** @@ -12594,10 +12711,24 @@ public class TelephonyManager { * * @hide */ - @SystemApi public static final int CALL_WAITING_STATUS_NOT_SUPPORTED = 4; /** + * Call waiting function status + * + * @hide + */ + @IntDef(prefix = { "CALL_WAITING_STATUS_" }, value = { + CALL_WAITING_STATUS_ACTIVE, + CALL_WAITING_STATUS_INACTIVE, + CALL_WAITING_STATUS_NOT_SUPPORTED, + CALL_WAITING_STATUS_UNKNOWN_ERROR + }) + @Retention(RetentionPolicy.SOURCE) + public @interface CallWaitingStatus { + } + + /** * Gets the status of voice call waiting function. Call waiting function enables the waiting * for the incoming call when it reaches the user who is busy to make another call and allows * users to decide whether to switch to the incoming call. @@ -12605,7 +12736,6 @@ public class TelephonyManager { * @return the status of call waiting function. * @hide */ - @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public @CallWaitingStatus int getCallWaitingStatus() { try { @@ -12631,7 +12761,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setCallWaitingStatus(boolean isEnable) { try { @@ -12662,7 +12791,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setDataAllowedDuringVoiceCall(boolean allow) { try { @@ -12691,7 +12819,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isDataAllowedInVoiceCall() { try { @@ -12738,7 +12865,6 @@ public class TelephonyManager { * The IccLock state or password was changed successfully. * @hide */ - @SystemApi public static final int CHANGE_ICC_LOCK_SUCCESS = Integer.MAX_VALUE; /** @@ -12751,7 +12877,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi @WorkerThread @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isIccLockEnabled() { @@ -12788,7 +12913,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setIccLockEnabled(boolean enabled, @NonNull String password) { checkNotNull(password, "setIccLockEnabled password can't be null."); @@ -12822,7 +12946,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int changeIccLockPassword(@NonNull String oldPassword, @NonNull String newPassword) { checkNotNull(oldPassword, "changeIccLockPassword oldPassword can't be null."); diff --git a/telephony/java/android/telephony/data/ApnSetting.java b/telephony/java/android/telephony/data/ApnSetting.java index de4b61163fb5..158ada94e3c6 100644 --- a/telephony/java/android/telephony/data/ApnSetting.java +++ b/telephony/java/android/telephony/data/ApnSetting.java @@ -125,6 +125,118 @@ public class ApnSetting implements Parcelable { public static final int AUTH_TYPE_PAP_OR_CHAP = 3; /** @hide */ + @IntDef({ + Telephony.Carriers.SKIP_464XLAT_DEFAULT, + Telephony.Carriers.SKIP_464XLAT_DISABLE, + Telephony.Carriers.SKIP_464XLAT_ENABLE, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface Skip464XlatStatus {} + + /** + * APN types for data connections. These are usage categories for an APN + * entry. One APN entry may support multiple APN types, eg, a single APN + * may service regular internet traffic ("default") as well as MMS-specific + * connections.<br/> + * APN_TYPE_ALL is a special type to indicate that this APN entry can + * service all data connections. + * <p> + * Note: The goal is to deprecate this. Due to the Carrier Table being used + * directly, this isn't feasible right now. + * + * @hide + */ + public static final String TYPE_ALL_STRING = "*"; + + /** + * APN type for default data traffic + * + * @hide + */ + public static final String TYPE_DEFAULT_STRING = "default"; + + + /** + * APN type for MMS traffic + * + * @hide + */ + public static final String TYPE_MMS_STRING = "mms"; + + + /** + * APN type for SUPL assisted GPS + * + * @hide + */ + public static final String TYPE_SUPL_STRING = "supl"; + + /** + * APN type for DUN traffic + * + * @hide + */ + public static final String TYPE_DUN_STRING = "dun"; + + /** + * APN type for HiPri traffic + * + * @hide + */ + public static final String TYPE_HIPRI_STRING = "hipri"; + + /** + * APN type for FOTA + * + * @hide + */ + public static final String TYPE_FOTA_STRING = "fota"; + + /** + * APN type for IMS + * + * @hide + */ + public static final String TYPE_IMS_STRING = "ims"; + + /** + * APN type for CBS + * + * @hide + */ + public static final String TYPE_CBS_STRING = "cbs"; + + /** + * APN type for IA Initial Attach APN + * + * @hide + */ + public static final String TYPE_IA_STRING = "ia"; + + /** + * APN type for Emergency PDN. This is not an IA apn, but is used + * for access to carrier services in an emergency call situation. + * + * @hide + */ + public static final String TYPE_EMERGENCY_STRING = "emergency"; + + /** + * APN type for Mission Critical Services + * + * @hide + */ + public static final String TYPE_MCX_STRING = "mcx"; + + /** + * APN type for XCAP + * + * @hide + */ + public static final String TYPE_XCAP_STRING = "xcap"; + + + /** @hide */ @IntDef(prefix = { "AUTH_TYPE_" }, value = { AUTH_TYPE_NONE, AUTH_TYPE_PAP, @@ -624,7 +736,7 @@ public class ApnSetting implements Parcelable { * @return SKIP_464XLAT_DEFAULT, SKIP_464XLAT_DISABLE or SKIP_464XLAT_ENABLE * @hide */ - @Carriers.Skip464XlatStatus + @Skip464XlatStatus public int getSkip464Xlat() { return mSkip464Xlat; } @@ -1290,10 +1402,12 @@ public class ApnSetting implements Parcelable { } /** + * Converts the integer value of an APN type to the string version. * @param apnTypeBitmask bitmask of APN types. * @return comma delimited list of APN types. * @hide */ + @NonNull public static String getApnTypesStringFromBitmask(int apnTypeBitmask) { List<String> types = new ArrayList<>(); for (Integer type : APN_TYPE_INT_MAP.keySet()) { @@ -1941,7 +2055,7 @@ public class ApnSetting implements Parcelable { * @param skip464xlat skip464xlat for this APN * @hide */ - public Builder setSkip464Xlat(@Carriers.Skip464XlatStatus int skip464xlat) { + public Builder setSkip464Xlat(@Skip464XlatStatus int skip464xlat) { this.mSkip464Xlat = skip464xlat; return this; } diff --git a/telephony/java/android/telephony/data/DataService.java b/telephony/java/android/telephony/data/DataService.java index 6c4e7ce51ebf..f56bbe13051c 100644 --- a/telephony/java/android/telephony/data/DataService.java +++ b/telephony/java/android/telephony/data/DataService.java @@ -458,6 +458,9 @@ public abstract class DataService extends Service { * this method to facilitate the creation of {@link DataServiceProvider} instances. The system * will call this method after binding the data service for each active SIM slot id. * + * This methead is guaranteed to be invoked in {@link DataService}'s internal handler thread + * whose looper can be retrieved with {@link Looper.myLooper()} when override this method. + * * @param slotIndex SIM slot id the data service associated with. * @return Data service object. Null if failed to create the provider (e.g. invalid slot index) */ diff --git a/telephony/java/android/telephony/euicc/EuiccManager.java b/telephony/java/android/telephony/euicc/EuiccManager.java index ccd28f433e40..44b0968eaa90 100644 --- a/telephony/java/android/telephony/euicc/EuiccManager.java +++ b/telephony/java/android/telephony/euicc/EuiccManager.java @@ -249,13 +249,69 @@ public class EuiccManager { * Key for an extra set on {@link PendingIntent} result callbacks providing a detailed result * code. * - * <p>This code is an implementation detail of the embedded subscription manager and is only - * intended for logging or debugging purposes. + * <p>The value of this key is an integer and contains two portions. The first byte is + * OperationCode and the reaming three bytes is the ErrorCode. + * + * OperationCode is the first byte of the result code and is a categorization which defines what + * type of operation took place when an error occurred. e.g {@link #OPERATION_DOWNLOAD} means + * the error is related to download.Since the OperationCode only uses at most one byte, the + * maximum allowed quantity is 255(0xFF). + * + * ErrorCode is the remaining three bytes of the result code, and it denotes what happened. + * e.g a combination of {@link #OPERATION_DOWNLOAD} and {@link #ERROR_TIME_OUT} will suggest the + * download operation has timed out. The only exception here is + * {@link #OPERATION_SMDX_SUBJECT_REASON_CODE}, where instead of ErrorCode, SubjectCode[5.2.6.1 + * from GSMA (SGP.22 v2.2) and ReasonCode[5.2.6.2] from GSMA (SGP.22 v2.2) are encoded. @see + * {@link #EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_SUBJECT_CODE} and + * {@link #EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_REASON_CODE} + * + * In the case where ErrorCode contains a value of 0, it means it's an unknown error. E.g Intent + * only contains {@link #OPERATION_DOWNLOAD} and ErrorCode is 0 implies this is an unknown + * Download error. + * + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_OPERATION_CODE} + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_ERROR_CODE} + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_SUBJECT_CODE} + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_REASON_CODE} */ public static final String EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_DETAILED_CODE"; /** + * Key for an extra set on {@link PendingIntent} result callbacks providing a + * OperationCode of {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE}, + * value will be an int. + */ + public static final String EXTRA_EMBEDDED_SUBSCRIPTION_OPERATION_CODE = + "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_OPERATION_CODE"; + + /** + * Key for an extra set on {@link PendingIntent} result callbacks providing a + * ErrorCode of {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE}, + * value will be an int. + */ + public static final String EXTRA_EMBEDDED_SUBSCRIPTION_ERROR_CODE = + "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_ERROR_CODE"; + + /** + * Key for an extra set on {@link PendingIntent} result callbacks providing a + * SubjectCode[5.2.6.1] from GSMA (SGP.22 v2.2) decoded from + * {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE}. + * The value of this extra will be a String. + */ + public static final String EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_SUBJECT_CODE = + "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_SMDX_SUBJECT_CODE"; + + /** + * Key for an extra set on {@link PendingIntent} result callbacks providing a + * ReasonCode[5.2.6.2] from GSMA (SGP.22 v2.2) decoded from + * {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE}. + * The value of this extra will be a String. + */ + public static final String EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_REASON_CODE = + "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_SMDX_REASON_CODE"; + + /** * Key for an extra set on {@code #getDownloadableSubscriptionMetadata} PendingIntent result * callbacks providing the downloadable subscription metadata. */ @@ -494,6 +550,259 @@ public class EuiccManager { @SystemApi public static final int EUICC_OTA_STATUS_UNAVAILABLE = 5; + /** + * List of OperationCode corresponding to {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE}'s + * value, an integer. @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + * + * @hide + */ + @Retention(RetentionPolicy.SOURCE) + @IntDef(prefix = {"OPERATION_"}, value = { + OPERATION_SYSTEM, + OPERATION_SIM_SLOT, + OPERATION_EUICC_CARD, + OPERATION_SWITCH, + OPERATION_DOWNLOAD, + OPERATION_METADATA, + OPERATION_EUICC_GSMA, + OPERATION_APDU, + OPERATION_SMDX, + OPERATION_HTTP, + OPERATION_SMDX_SUBJECT_REASON_CODE, + }) + public @interface OperationCode { + } + + /** + * Internal system error. + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int OPERATION_SYSTEM = 1; + + /** + * SIM slot error. Failed to switch slot, failed to access the physical slot etc. + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int OPERATION_SIM_SLOT = 2; + + /** + * eUICC card error. + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int OPERATION_EUICC_CARD = 3; + + /** + * Generic switching profile error + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int OPERATION_SWITCH = 4; + + /** + * Download profile error. + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int OPERATION_DOWNLOAD = 5; + + /** + * Subscription's metadata error + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int OPERATION_METADATA = 6; + + /** + * eUICC returned an error defined in GSMA (SGP.22 v2.2) while running one of the ES10x + * functions. + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int OPERATION_EUICC_GSMA = 7; + + /** + * The exception of failing to execute an APDU command. It can be caused by an error + * happening on opening the basic or logical channel, or the response of the APDU command is + * not success (0x9000). + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int OPERATION_APDU = 8; + + /** + * SMDX(SMDP/SMDS) error + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int OPERATION_SMDX = 9; + + /** + * SubjectCode[5.2.6.1] and ReasonCode[5.2.6.2] error from GSMA (SGP.22 v2.2) + * When {@link #OPERATION_SMDX_SUBJECT_REASON_CODE} is used as the + * {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE}, the remaining three bytes of the integer + * result from {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} will be used to stored the + * SubjectCode and ReasonCode from the GSMA spec and NOT ErrorCode. + * + * The encoding will follow the format of: + * 1. The first byte of the result will be 255(0xFF). + * 2. Remaining three bytes(24 bits) will be split into six sections, 4 bits in each section. + * 3. A SubjectCode/ReasonCode will take 12 bits each. + * 4. The maximum number can be represented per section is 15, as that is the maximum number + * allowed to be stored into 4 bits + * 5. Maximum supported nested category from GSMA is three layers. E.g 8.11.1.2 is not + * supported. + * + * E.g given SubjectCode(8.11.1) and ReasonCode(5.1) + * + * Base10: 0 10 8 11 1 0 5 1 + * Base2: 0000 1010 1000 1011 0001 0000 0101 0001 + * Base16: 0 A 8 B 1 0 5 1 + * + * Thus the integer stored in {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} is + * 0xA8B1051(176885841) + * + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int OPERATION_SMDX_SUBJECT_REASON_CODE = 10; + + /** + * HTTP error + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int OPERATION_HTTP = 11; + + /** + * List of ErrorCode corresponding to {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + * @hide + */ + @Retention(RetentionPolicy.SOURCE) + @IntDef(prefix = {"ERROR_"}, value = { + ERROR_CARRIER_LOCKED, + ERROR_INVALID_ACTIVATION_CODE, + ERROR_INVALID_CONFIRMATION_CODE, + ERROR_INCOMPATIBLE_CARRIER, + ERROR_EUICC_INSUFFICIENT_MEMORY, + ERROR_TIME_OUT, + ERROR_EUICC_MISSING, + ERROR_UNSUPPORTED_VERSION, + ERROR_SIM_MISSING, + ERROR_INSTALL_PROFILE, + ERROR_DISALLOWED_BY_PPR, + ERROR_ADDRESS_MISSING, + ERROR_CERTIFICATE_ERROR, + ERROR_NO_PROFILES_AVAILABLE, + ERROR_CONNECTION_ERROR, + ERROR_INVALID_RESPONSE, + ERROR_OPERATION_BUSY, + }) + public @interface ErrorCode{} + + /** + * Operation such as downloading/switching to another profile failed due to device being + * carrier locked. + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int ERROR_CARRIER_LOCKED = 10000; + + /** + * The activation code(SGP.22 v2.2 section[4.1]) is invalid. + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int ERROR_INVALID_ACTIVATION_CODE = 10001; + + /** + * The confirmation code(SGP.22 v2.2 section[4.7]) is invalid. + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int ERROR_INVALID_CONFIRMATION_CODE = 10002; + + /** + * The profile's carrier is incompatible with the LPA. + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int ERROR_INCOMPATIBLE_CARRIER = 10003; + + /** + * There is no more space available on the eUICC for new profiles. + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int ERROR_EUICC_INSUFFICIENT_MEMORY = 10004; + + /** + * Timed out while waiting for an operation to complete. i.e restart, disable, + * switch reset etc. + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int ERROR_TIME_OUT = 10005; + + /** + * eUICC is missing or defective on the device. + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int ERROR_EUICC_MISSING = 10006; + + /** + * The eUICC card(hardware) version is incompatible with the software + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int ERROR_UNSUPPORTED_VERSION = 10007; + + /** + * No SIM card is available in the device. + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int ERROR_SIM_MISSING = 10008; + + /** + * Failure to load the profile onto the eUICC card. e.g + * 1. iccid of the profile already exists on the eUICC. + * 2. GSMA(.22 v2.2) Profile Install Result - installFailedDueToDataMismatch + * 3. operation was interrupted + * 4. SIMalliance error in PEStatus(SGP.22 v2.2 section 2.5.6.1) + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int ERROR_INSTALL_PROFILE = 10009; + + /** + * Failed to load profile onto eUICC due to Profile Poicly Rules. + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int ERROR_DISALLOWED_BY_PPR = 10010; + + + /** + * Address is missing e.g SMDS/SMDP address is missing. + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int ERROR_ADDRESS_MISSING = 10011; + + /** + * Certificate needed for authentication is not valid or missing. E.g SMDP/SMDS authentication + * failed. + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int ERROR_CERTIFICATE_ERROR = 10012; + + + /** + * No profiles available. + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int ERROR_NO_PROFILES_AVAILABLE = 10013; + + /** + * Failure to create a connection. + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int ERROR_CONNECTION_ERROR = 10014; + + /** + * Response format is invalid. e.g SMDP/SMDS response contains invalid json, header or/and ASN1. + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int ERROR_INVALID_RESPONSE = 10015; + + /** + * The operation is currently busy, try again later. + * @see {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} for details + */ + public static final int ERROR_OPERATION_BUSY = 10016; + private final Context mContext; private int mCardId; diff --git a/telephony/java/android/telephony/ims/ImsCallProfile.java b/telephony/java/android/telephony/ims/ImsCallProfile.java index a7d553b60abf..1e8fdceac1e6 100644 --- a/telephony/java/android/telephony/ims/ImsCallProfile.java +++ b/telephony/java/android/telephony/ims/ImsCallProfile.java @@ -18,7 +18,6 @@ package android.telephony.ims; import android.annotation.IntDef; import android.annotation.NonNull; -import android.annotation.Nullable; import android.annotation.SystemApi; import android.annotation.TestApi; import android.compat.annotation.UnsupportedAppUsage; @@ -182,6 +181,25 @@ public final class ImsCallProfile implements Parcelable { * {@link ImsCallProfile#DIALSTRING_USSD} */ public static final String EXTRA_DIALSTRING = "dialstring"; + /** + * This extra holds call fail cause because of which redial is attempted. + * see {@link android.telephony.ims.ImsReasonInfo} {@code CODE_*} + * for possible values this extra can hold. + * + * @hide + */ + public static final String EXTRA_RETRY_CALL_FAIL_REASON = + "android.telephony.ims.extra.RETRY_CALL_FAIL_REASON"; + /** + * This extra holds call network type on which lower layers + * may try attempting redial. + * See {@link TelephonyManager} {@code NETWORK_TYPE_*} + * for possible values this extra can hold. + * + * @hide + */ + public static final String EXTRA_RETRY_CALL_FAIL_NETWORKTYPE = + "android.telephony.ims.extra.RETRY_CALL_FAIL_NETWORKTYPE"; /** * Values for EXTRA_OIR / EXTRA_CNAP @@ -702,11 +720,16 @@ public final class ImsCallProfile implements Parcelable { * @return A {@link Bundle} containing proprietary call extras that were not set by the * platform. */ - public @Nullable Bundle getProprietaryCallExtras() { + public @NonNull Bundle getProprietaryCallExtras() { if (mCallExtras == null) { - return null; + return new Bundle(); + } + Bundle proprietaryExtras = mCallExtras.getBundle(EXTRA_OEM_EXTRAS); + if (proprietaryExtras == null) { + return new Bundle(); } - return mCallExtras.getBundle(EXTRA_OEM_EXTRAS); + // Make a copy so users do not accidentally change this copy of the extras. + return new Bundle(proprietaryExtras); } public ImsStreamMediaProfile getMediaProfile() { diff --git a/telephony/java/android/telephony/ims/ImsCallSessionListener.java b/telephony/java/android/telephony/ims/ImsCallSessionListener.java index 025721c89f70..81af99fb40b7 100644 --- a/telephony/java/android/telephony/ims/ImsCallSessionListener.java +++ b/telephony/java/android/telephony/ims/ImsCallSessionListener.java @@ -58,7 +58,7 @@ public class ImsCallSessionListener { try { mListener.callSessionProgressing(profile); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -71,7 +71,7 @@ public class ImsCallSessionListener { try { mListener.callSessionInitiated(profile); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -85,7 +85,7 @@ public class ImsCallSessionListener { try { mListener.callSessionInitiatedFailed(reasonInfo); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -98,7 +98,7 @@ public class ImsCallSessionListener { try { mListener.callSessionTerminated(reasonInfo); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -115,7 +115,7 @@ public class ImsCallSessionListener { try { mListener.callSessionHeld(profile); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -128,7 +128,7 @@ public class ImsCallSessionListener { try { mListener.callSessionHoldFailed(reasonInfo); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -141,7 +141,7 @@ public class ImsCallSessionListener { try { mListener.callSessionHoldReceived(profile); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -155,7 +155,7 @@ public class ImsCallSessionListener { try { mListener.callSessionResumed(profile); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -169,7 +169,7 @@ public class ImsCallSessionListener { try { mListener.callSessionResumeFailed(reasonInfo); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -182,7 +182,7 @@ public class ImsCallSessionListener { try { mListener.callSessionResumeReceived(profile); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -201,7 +201,7 @@ public class ImsCallSessionListener { mListener.callSessionMergeStarted(newSession != null ? newSession.getServiceImpl() : null, profile); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -216,7 +216,7 @@ public class ImsCallSessionListener { try { mListener.callSessionMergeStarted(newSession, profile); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -232,7 +232,7 @@ public class ImsCallSessionListener { mListener.callSessionMergeComplete(newSession != null ? newSession.getServiceImpl() : null); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -247,7 +247,7 @@ public class ImsCallSessionListener { try { mListener.callSessionMergeComplete(newSession); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -260,7 +260,7 @@ public class ImsCallSessionListener { try { mListener.callSessionMergeFailed(reasonInfo); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -273,7 +273,7 @@ public class ImsCallSessionListener { try { mListener.callSessionUpdated(profile); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -286,7 +286,7 @@ public class ImsCallSessionListener { try { mListener.callSessionUpdateFailed(reasonInfo); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -299,7 +299,7 @@ public class ImsCallSessionListener { try { mListener.callSessionUpdateReceived(profile); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -319,7 +319,7 @@ public class ImsCallSessionListener { mListener.callSessionConferenceExtended( newSession != null ? newSession.getServiceImpl() : null, profile); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -333,7 +333,7 @@ public class ImsCallSessionListener { try { mListener.callSessionConferenceExtended(newSession, profile); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -347,7 +347,7 @@ public class ImsCallSessionListener { try { mListener.callSessionConferenceExtendFailed(reasonInfo); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -364,7 +364,7 @@ public class ImsCallSessionListener { mListener.callSessionConferenceExtendReceived(newSession != null ? newSession.getServiceImpl() : null, profile); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -379,7 +379,7 @@ public class ImsCallSessionListener { try { mListener.callSessionConferenceExtendReceived(newSession, profile); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -391,7 +391,7 @@ public class ImsCallSessionListener { try { mListener.callSessionInviteParticipantsRequestDelivered(); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -407,7 +407,7 @@ public class ImsCallSessionListener { try { mListener.callSessionInviteParticipantsRequestFailed(reasonInfo); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -419,7 +419,7 @@ public class ImsCallSessionListener { try { mListener.callSessionRemoveParticipantsRequestDelivered(); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -435,7 +435,7 @@ public class ImsCallSessionListener { try { mListener.callSessionInviteParticipantsRequestFailed(reasonInfo); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -448,7 +448,7 @@ public class ImsCallSessionListener { try { mListener.callSessionConferenceStateUpdated(state); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -465,7 +465,7 @@ public class ImsCallSessionListener { try { mListener.callSessionUssdMessageReceived(mode, ussdMessage); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -501,7 +501,7 @@ public class ImsCallSessionListener { try { mListener.callSessionMayHandover(srcNetworkType, targetNetworkType); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -537,7 +537,7 @@ public class ImsCallSessionListener { try { mListener.callSessionHandover(srcNetworkType, targetNetworkType, reasonInfo); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -570,7 +570,7 @@ public class ImsCallSessionListener { try { mListener.callSessionHandoverFailed(srcNetworkType, targetNetworkType, reasonInfo); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -587,7 +587,7 @@ public class ImsCallSessionListener { try { mListener.callSessionTtyModeReceived(mode); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -600,7 +600,7 @@ public class ImsCallSessionListener { try { mListener.callSessionMultipartyStateChanged(isMultiParty); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -614,7 +614,7 @@ public class ImsCallSessionListener { try { mListener.callSessionSuppServiceReceived(suppSrvNotification); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -628,7 +628,7 @@ public class ImsCallSessionListener { try { mListener.callSessionRttModifyRequestReceived(callProfile); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -641,7 +641,7 @@ public class ImsCallSessionListener { try { mListener.callSessionRttModifyResponseReceived(status); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -654,7 +654,7 @@ public class ImsCallSessionListener { try { mListener.callSessionRttMessageReceived(rttMessage); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -667,7 +667,7 @@ public class ImsCallSessionListener { try { mListener.callSessionRttAudioIndicatorChanged(profile); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } @@ -680,7 +680,7 @@ public class ImsCallSessionListener { try { mListener.callQualityChanged(callQuality); } catch (RemoteException e) { - throw new RuntimeException(e); + e.rethrowFromSystemServer(); } } } diff --git a/telephony/java/android/telephony/ims/ImsException.java b/telephony/java/android/telephony/ims/ImsException.java index 643f452d2e75..1c3d58d98b4a 100644 --- a/telephony/java/android/telephony/ims/ImsException.java +++ b/telephony/java/android/telephony/ims/ImsException.java @@ -47,11 +47,12 @@ public final class ImsException extends Exception { public static final int CODE_ERROR_SERVICE_UNAVAILABLE = 1; /** - * This device or carrier configuration does not support IMS for this subscription. + * This device or carrier configuration does not support this feature for this subscription. * <p> - * This is a permanent configuration error and there should be no retry. Usually this is - * because {@link PackageManager#FEATURE_TELEPHONY_IMS} is not available - * or the device has no ImsService implementation to service this request. + * This is a permanent configuration error and there should be no retry until the subscription + * changes if this operation is denied due to a carrier configuration. If this is due to a + * device configuration, the feature {@link PackageManager#FEATURE_TELEPHONY_IMS} is not + * available or the device has no ImsService implementation to service this request. */ public static final int CODE_ERROR_UNSUPPORTED_OPERATION = 2; diff --git a/telephony/java/android/telephony/ims/ImsMmTelManager.java b/telephony/java/android/telephony/ims/ImsMmTelManager.java index 494009f35dba..dc8d750f6be4 100644 --- a/telephony/java/android/telephony/ims/ImsMmTelManager.java +++ b/telephony/java/android/telephony/ims/ImsMmTelManager.java @@ -21,7 +21,6 @@ import android.Manifest; import android.annotation.CallbackExecutor; import android.annotation.IntDef; import android.annotation.NonNull; -import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SuppressAutoDoc; import android.annotation.SuppressLint; @@ -125,7 +124,7 @@ public class ImsMmTelManager implements RegistrationManager { * @param info the {@link ImsReasonInfo} associated with why registration was disconnected. */ @Override - public void onUnregistered(@Nullable ImsReasonInfo info) { + public void onUnregistered(@NonNull ImsReasonInfo info) { } /** @@ -137,7 +136,7 @@ public class ImsMmTelManager implements RegistrationManager { @Override public void onTechnologyChangeFailed( @AccessNetworkConstants.TransportType int imsTransportType, - @Nullable ImsReasonInfo info) { + @NonNull ImsReasonInfo info) { } } diff --git a/telephony/java/android/telephony/ims/ImsRcsManager.java b/telephony/java/android/telephony/ims/ImsRcsManager.java index a2ad21c03f98..ed9b94b3d85e 100644 --- a/telephony/java/android/telephony/ims/ImsRcsManager.java +++ b/telephony/java/android/telephony/ims/ImsRcsManager.java @@ -20,14 +20,16 @@ import android.Manifest; import android.annotation.CallbackExecutor; import android.annotation.NonNull; import android.annotation.RequiresPermission; -import android.annotation.SystemApi; -import android.annotation.TestApi; +import android.annotation.SdkConstant; import android.content.Context; +import android.content.Intent; import android.os.Binder; import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; +import android.provider.Settings; import android.telephony.AccessNetworkConstants; +import android.telephony.CarrierConfigManager; import android.telephony.SubscriptionManager; import android.telephony.ims.aidl.IImsCapabilityCallback; import android.telephony.ims.aidl.IImsRcsController; @@ -46,14 +48,34 @@ import java.util.function.Consumer; * (UCE) service, as well as managing user settings. * * Use {@link ImsManager#getImsRcsManager(int)} to create an instance of this manager. - * @hide */ -@SystemApi -@TestApi public class ImsRcsManager implements RegistrationManager { private static final String TAG = "ImsRcsManager"; /** + * Activity Action: Show the opt-in dialog for enabling or disabling RCS contact discovery + * using User Capability Exchange (UCE). + * <p> + * An application that depends on contact discovery being enabled may send this intent + * using {@link Context#startActivity(Intent)} to ask the user to opt-in for contacts upload for + * capability exchange if it is currently disabled. Whether or not this setting has been enabled + * can be queried using {@link RcsUceAdapter#isUceSettingEnabled()}. + * <p> + * This intent should only be sent if the carrier supports RCS capability exchange, which can be + * queried using the key {@link CarrierConfigManager#KEY_USE_RCS_PRESENCE_BOOL}. Otherwise, the + * setting will not be present. + * <p> + * Input: A mandatory {@link Settings#EXTRA_SUB_ID} extra containing the subscription that the + * setting will be be shown for. + * <p> + * Output: Nothing + * @see RcsUceAdapter + */ + @SdkConstant(SdkConstant.SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_SHOW_CAPABILITY_DISCOVERY_OPT_IN = + "android.telephony.ims.action.SHOW_CAPABILITY_DISCOVERY_OPT_IN"; + + /** * Receives RCS availability status updates from the ImsService. * * @see #isAvailable(int) @@ -145,11 +167,10 @@ public class ImsRcsManager implements RegistrationManager { */ @NonNull public RcsUceAdapter getUceAdapter() { - return new RcsUceAdapter(mSubId); + return new RcsUceAdapter(mContext, mSubId); } /** - * {@inheritDoc} * @hide */ @Override @@ -181,7 +202,6 @@ public class ImsRcsManager implements RegistrationManager { } /** - * {@inheritDoc * @hide */ @Override @@ -206,7 +226,6 @@ public class ImsRcsManager implements RegistrationManager { } /** - * {@inheritDoc} * @hide */ @Override @@ -239,7 +258,6 @@ public class ImsRcsManager implements RegistrationManager { } /** - * {@inheritDoc} * @hide */ @Override diff --git a/telephony/java/android/telephony/ims/ImsUtListener.java b/telephony/java/android/telephony/ims/ImsUtListener.java index bc12404461c7..460a032ce7e0 100644 --- a/telephony/java/android/telephony/ims/ImsUtListener.java +++ b/telephony/java/android/telephony/ims/ImsUtListener.java @@ -49,7 +49,8 @@ public class ImsUtListener { * {@link ImsSsInfo#CLIR_STATUS_TEMPORARILY_RESTRICTED}, and * {@link ImsSsInfo#CLIR_STATUS_TEMPORARILY_ALLOWED}. * @deprecated Use {@link #onLineIdentificationSupplementaryServiceResponse(int, ImsSsInfo)} - * instead. + * instead, this key has been added for backwards compatibility with older proprietary + * implementations only and is being phased out. */ @Deprecated public static final String BUNDLE_KEY_CLIR = "queryClir"; @@ -60,7 +61,8 @@ public class ImsUtListener { * response. The value will be an instance of {@link ImsSsInfo}, which contains the response to * the query. * @deprecated Use {@link #onLineIdentificationSupplementaryServiceResponse(int, ImsSsInfo)} - * instead. + * instead, this key has been added for backwards compatibility with older proprietary + * implementations only and is being phased out. */ @Deprecated public static final String BUNDLE_KEY_SSINFO = "imsSsInfo"; @@ -123,7 +125,7 @@ public class ImsUtListener { try { mServiceInterface.lineIdentificationSupplementaryServiceResponse(id, configuration); } catch (RemoteException e) { - Log.w(LOG_TAG, "onLineIdentificationSupplementaryServicesResponse: remote exception"); + e.rethrowFromSystemServer(); } } diff --git a/telephony/java/android/telephony/ims/ProvisioningManager.java b/telephony/java/android/telephony/ims/ProvisioningManager.java index 6125001850db..ad54cbf3daea 100644 --- a/telephony/java/android/telephony/ims/ProvisioningManager.java +++ b/telephony/java/android/telephony/ims/ProvisioningManager.java @@ -306,13 +306,13 @@ public class ProvisioningManager { /** * An integer key associated with the carrier configured expiration time in seconds for - * RCS presence published offline availability in RCS presence. + * published offline availability in RCS presence provided, which is provided to the network. * <p> * Value is in Integer format. * @see #setProvisioningIntValue(int, int) * @see #getProvisioningIntValue(int) */ - public static final int KEY_RCS_PUBLISH_TIMER_EXTENDED_SEC = 16; + public static final int KEY_RCS_PUBLISH_OFFLINE_AVAILABILITY_TIMER_SEC = 16; /** * An integer key associated with whether or not capability discovery is provisioned for this @@ -327,8 +327,10 @@ public class ProvisioningManager { public static final int KEY_RCS_CAPABILITY_DISCOVERY_ENABLED = 17; /** - * An integer key associated with the period of time the capability information of each contact - * is cached on the device. + * An integer key associated with the period of time in seconds the capability information of + * each contact is cached on the device. + * <p> + * Seconds are used because this is usually measured in the span of days. * <p> * Value is in Integer format. * @see #setProvisioningIntValue(int, int) @@ -338,7 +340,8 @@ public class ProvisioningManager { /** * An integer key associated with the period of time in seconds that the availability - * information of a contact is cached on the device. + * information of a contact is cached on the device, which is based on the carrier provisioning + * configuration from the network. * <p> * Value is in Integer format. * @see #setProvisioningIntValue(int, int) @@ -348,7 +351,8 @@ public class ProvisioningManager { /** * An integer key associated with the carrier configured interval in seconds expected between - * successive capability polling attempts. + * successive capability polling attempts, which is based on the carrier provisioning + * configuration from the network. * <p> * Value is in Integer format. * @see #setProvisioningIntValue(int, int) @@ -358,7 +362,7 @@ public class ProvisioningManager { /** * An integer key representing the minimum time allowed between two consecutive presence publish - * messages from the device. + * messages from the device in milliseconds. * <p> * Value is in Integer format. * @see #setProvisioningIntValue(int, int) @@ -379,7 +383,7 @@ public class ProvisioningManager { /** * An integer associated with the expiration timer used during the SIP subscription of a * Request Contained List (RCL), which is used to retrieve the RCS capabilities of the contact - * book. + * book. This timer value is sent in seconds to the network. * <p> * Value is in Integer format. * @see #setProvisioningIntValue(int, int) @@ -471,7 +475,8 @@ public class ProvisioningManager { public static final int KEY_SIP_KEEP_ALIVE_ENABLED = 32; /** - * Registration retry Base Time value in seconds. + * Registration retry Base Time value in seconds, which is based off of the carrier + * configuration. * Value is in Integer format. * @see #setProvisioningIntValue(int, int) * @see #getProvisioningIntValue(int) @@ -479,7 +484,8 @@ public class ProvisioningManager { public static final int KEY_REGISTRATION_RETRY_BASE_TIME_SEC = 33; /** - * Registration retry Max Time value in seconds. + * Registration retry Max Time value in seconds, which is based off of the carrier + * configuration. * Value is in Integer format. * @see #setProvisioningIntValue(int, int) * @see #getProvisioningIntValue(int) diff --git a/telephony/java/android/telephony/ims/Rcs1To1Thread.java b/telephony/java/android/telephony/ims/Rcs1To1Thread.java deleted file mode 100644 index e90548a4445f..000000000000 --- a/telephony/java/android/telephony/ims/Rcs1To1Thread.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.annotation.NonNull; -import android.annotation.WorkerThread; - -/** - * Rcs1To1Thread represents a single RCS conversation thread with a total of two - * {@link RcsParticipant}s. Please see Section 5 (1-to-1 Messaging) - GSMA RCC.71 (RCS Universal - * Profile Service Definition Document) - * - * @hide - */ -public class Rcs1To1Thread extends RcsThread { - private int mThreadId; - - /** - * Public constructor only for RcsMessageStoreController to initialize new threads. - * - * @hide - */ - public Rcs1To1Thread(RcsControllerCall rcsControllerCall, int threadId) { - super(rcsControllerCall, threadId); - mThreadId = threadId; - } - - /** - * @return Returns {@code false} as this is always a 1 to 1 thread. - */ - @Override - public boolean isGroup() { - return false; - } - - /** - * {@link Rcs1To1Thread}s can fall back to SMS as a back-up protocol. This function returns the - * thread id to be used to query {@code content://mms-sms/conversation/#} to get the fallback - * thread. - * - * @return The thread id to be used to query the mms-sms authority - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public long getFallbackThreadId() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.get1To1ThreadFallbackThreadId(mThreadId, - callingPackage)); - } - - /** - * If the RCS client allows falling back to SMS, it needs to create an MMS-SMS thread in the - * SMS/MMS Provider( see {@link android.provider.Telephony.MmsSms#CONTENT_CONVERSATIONS_URI}. - * Use this function to link the {@link Rcs1To1Thread} to the MMS-SMS thread. This function - * also updates the storage. - * - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setFallbackThreadId(long fallbackThreadId) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.set1To1ThreadFallbackThreadId(mThreadId, - fallbackThreadId, callingPackage)); - } - - /** - * @return Returns the {@link RcsParticipant} that receives the messages sent in this thread. - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @NonNull - @WorkerThread - public RcsParticipant getRecipient() throws RcsMessageStoreException { - return new RcsParticipant( - mRcsControllerCall, - mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.get1To1ThreadOtherParticipantId(mThreadId, - callingPackage))); - } -} diff --git a/telephony/java/android/telephony/ims/RcsControllerCall.java b/telephony/java/android/telephony/ims/RcsControllerCall.java deleted file mode 100644 index ce03c3c799bb..000000000000 --- a/telephony/java/android/telephony/ims/RcsControllerCall.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.content.Context; -import android.os.RemoteException; -import android.os.ServiceManager; -import android.telephony.ims.aidl.IRcsMessage; - -/** - * A wrapper class around RPC calls that {@link RcsMessageManager} APIs to minimize boilerplate - * code. - * - * @hide - not meant for public use - */ -class RcsControllerCall { - private final Context mContext; - - RcsControllerCall(Context context) { - mContext = context; - } - - <R> R call(RcsServiceCall<R> serviceCall) throws RcsMessageStoreException { - IRcsMessage iRcsMessage = IRcsMessage.Stub.asInterface(ServiceManager.getService( - Context.TELEPHONY_RCS_MESSAGE_SERVICE)); - if (iRcsMessage == null) { - throw new RcsMessageStoreException("Could not connect to RCS storage service"); - } - - try { - return serviceCall.methodOnIRcs(iRcsMessage, mContext.getOpPackageName()); - } catch (RemoteException exception) { - throw new RcsMessageStoreException(exception.getMessage()); - } - } - - void callWithNoReturn(RcsServiceCallWithNoReturn serviceCall) - throws RcsMessageStoreException { - call((iRcsMessage, callingPackage) -> { - serviceCall.methodOnIRcs(iRcsMessage, callingPackage); - return null; - }); - } - - interface RcsServiceCall<R> { - R methodOnIRcs(IRcsMessage iRcs, String callingPackage) throws RemoteException; - } - - interface RcsServiceCallWithNoReturn { - void methodOnIRcs(IRcsMessage iRcs, String callingPackage) throws RemoteException; - } -} diff --git a/telephony/java/android/telephony/ims/RcsEvent.java b/telephony/java/android/telephony/ims/RcsEvent.java deleted file mode 100644 index 9dd07209fcfd..000000000000 --- a/telephony/java/android/telephony/ims/RcsEvent.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 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 android.telephony.ims; - -/** - * The base class for events that can happen on {@link RcsParticipant}s and {@link RcsThread}s. - * - * @hide - */ -public abstract class RcsEvent { - private final long mTimestamp; - - protected RcsEvent(long timestamp) { - mTimestamp = timestamp; - } - - /** - * @return Returns the time of when this event happened. The timestamp is defined as - * milliseconds passed after midnight, January 1, 1970 UTC - */ - public long getTimestamp() { - return mTimestamp; - } - - /** - * Persists the event to the data store - * - * @hide - */ - abstract void persist(RcsControllerCall rcsControllerCall) throws RcsMessageStoreException; -} diff --git a/telephony/java/android/telephony/ims/RcsEventDescriptor.java b/telephony/java/android/telephony/ims/RcsEventDescriptor.java deleted file mode 100644 index b44adeaa62bb..000000000000 --- a/telephony/java/android/telephony/ims/RcsEventDescriptor.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import static com.android.internal.annotations.VisibleForTesting.Visibility.PROTECTED; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.android.internal.annotations.VisibleForTesting; - -/** - * @hide - used only for internal communication with the ircs service - */ -public abstract class RcsEventDescriptor implements Parcelable { - protected final long mTimestamp; - - RcsEventDescriptor(long timestamp) { - mTimestamp = timestamp; - } - - /** - * Creates an RcsEvent based on this RcsEventDescriptor. Overriding this method practically - * allows an injection point for RcsEvent dependencies outside of the values contained in the - * descriptor. - */ - @VisibleForTesting(visibility = PROTECTED) - public abstract RcsEvent createRcsEvent(RcsControllerCall rcsControllerCall); - - RcsEventDescriptor(Parcel in) { - mTimestamp = in.readLong(); - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(mTimestamp); - } - - @Override - public int describeContents() { - return 0; - } -} diff --git a/telephony/java/android/telephony/ims/RcsEventQueryParams.java b/telephony/java/android/telephony/ims/RcsEventQueryParams.java deleted file mode 100644 index 0024cf7b8662..000000000000 --- a/telephony/java/android/telephony/ims/RcsEventQueryParams.java +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import static android.provider.Telephony.RcsColumns.RcsEventTypes.ICON_CHANGED_EVENT_TYPE; -import static android.provider.Telephony.RcsColumns.RcsEventTypes.NAME_CHANGED_EVENT_TYPE; -import static android.provider.Telephony.RcsColumns.RcsEventTypes.PARTICIPANT_ALIAS_CHANGED_EVENT_TYPE; -import static android.provider.Telephony.RcsColumns.RcsEventTypes.PARTICIPANT_JOINED_EVENT_TYPE; -import static android.provider.Telephony.RcsColumns.RcsEventTypes.PARTICIPANT_LEFT_EVENT_TYPE; - -import android.annotation.CheckResult; -import android.annotation.IntDef; -import android.annotation.IntRange; -import android.annotation.NonNull; -import android.os.Parcel; -import android.os.Parcelable; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.security.InvalidParameterException; - -/** - * The parameters to pass into - * {@link RcsMessageStore#getRcsEvents(RcsEventQueryParams)} in order to select a - * subset of {@link RcsEvent}s present in the message store. - * - * @hide - */ -public final class RcsEventQueryParams implements Parcelable { - /** - * Flag to be used with {@link Builder#setEventType(int)} to make - * {@link RcsMessageStore#getRcsEvents(RcsEventQueryParams)} return all types of - * {@link RcsEvent}s - */ - public static final int ALL_EVENTS = -1; - - /** - * Flag to be used with {@link Builder#setEventType(int)} to make - * {@link RcsMessageStore#getRcsEvents(RcsEventQueryParams)} return sub-types of - * {@link RcsGroupThreadEvent}s - */ - public static final int ALL_GROUP_THREAD_EVENTS = 0; - - /** - * Flag to be used with {@link Builder#setEventType(int)} to make - * {@link RcsMessageStore#getRcsEvents(RcsEventQueryParams)} return only - * {@link RcsParticipantAliasChangedEvent}s - */ - public static final int PARTICIPANT_ALIAS_CHANGED_EVENT = - PARTICIPANT_ALIAS_CHANGED_EVENT_TYPE; - - /** - * Flag to be used with {@link Builder#setEventType(int)} to make - * {@link RcsMessageStore#getRcsEvents(RcsEventQueryParams)} return only - * {@link RcsGroupThreadParticipantJoinedEvent}s - */ - public static final int GROUP_THREAD_PARTICIPANT_JOINED_EVENT = - PARTICIPANT_JOINED_EVENT_TYPE; - - /** - * Flag to be used with {@link Builder#setEventType(int)} to make - * {@link RcsMessageStore#getRcsEvents(RcsEventQueryParams)} return only - * {@link RcsGroupThreadParticipantLeftEvent}s - */ - public static final int GROUP_THREAD_PARTICIPANT_LEFT_EVENT = - PARTICIPANT_LEFT_EVENT_TYPE; - - /** - * Flag to be used with {@link Builder#setEventType(int)} to make - * {@link RcsMessageStore#getRcsEvents(RcsEventQueryParams)} return only - * {@link RcsGroupThreadNameChangedEvent}s - */ - public static final int GROUP_THREAD_NAME_CHANGED_EVENT = NAME_CHANGED_EVENT_TYPE; - - /** - * Flag to be used with {@link Builder#setEventType(int)} to make - * {@link RcsMessageStore#getRcsEvents(RcsEventQueryParams)} return only - * {@link RcsGroupThreadIconChangedEvent}s - */ - public static final int GROUP_THREAD_ICON_CHANGED_EVENT = ICON_CHANGED_EVENT_TYPE; - - @Retention(RetentionPolicy.SOURCE) - @IntDef({ALL_EVENTS, ALL_GROUP_THREAD_EVENTS, PARTICIPANT_ALIAS_CHANGED_EVENT, - GROUP_THREAD_PARTICIPANT_JOINED_EVENT, GROUP_THREAD_PARTICIPANT_LEFT_EVENT, - GROUP_THREAD_NAME_CHANGED_EVENT, GROUP_THREAD_ICON_CHANGED_EVENT}) - public @interface EventType { - } - - /** - * Flag to be used with {@link Builder#setSortProperty(int)} that makes the result set sorted - * in the order of creation for faster query results. - */ - public static final int SORT_BY_CREATION_ORDER = 0; - - /** - * Flag to be used with {@link Builder#setSortProperty(int)} that makes the result set sorted - * with respect to {@link RcsEvent#getTimestamp()} - */ - public static final int SORT_BY_TIMESTAMP = 1; - - @Retention(RetentionPolicy.SOURCE) - @IntDef({SORT_BY_CREATION_ORDER, SORT_BY_TIMESTAMP}) - public @interface SortingProperty { - } - - /** - * The key to pass into a Bundle, for usage in RcsProvider.query(Bundle) - * @hide - not meant for public use - */ - public static final String EVENT_QUERY_PARAMETERS_KEY = "event_query_parameters"; - - // Which types of events the results should be limited to - private @EventType int mEventType; - // The property which the results should be sorted against - private int mSortingProperty; - // Whether the results should be sorted in ascending order - private boolean mIsAscending; - // The number of results that should be returned with this query - private int mLimit; - // The thread that the results are limited to - private int mThreadId; - - RcsEventQueryParams(@EventType int eventType, int threadId, - @SortingProperty int sortingProperty, boolean isAscending, int limit) { - mEventType = eventType; - mSortingProperty = sortingProperty; - mIsAscending = isAscending; - mLimit = limit; - mThreadId = threadId; - } - - /** - * @return Returns the type of {@link RcsEvent}s that this {@link RcsEventQueryParams} is - * set to query for. - */ - public @EventType int getEventType() { - return mEventType; - } - - /** - * @return Returns the number of {@link RcsEvent}s to be returned from the query. A value of - * 0 means there is no set limit. - */ - public int getLimit() { - return mLimit; - } - - /** - * @return Returns the property where the results should be sorted against. - * @see SortingProperty - */ - public int getSortingProperty() { - return mSortingProperty; - } - - /** - * @return Returns {@code true} if the result set will be sorted in ascending order, - * {@code false} if it will be sorted in descending order. - */ - public boolean getSortDirection() { - return mIsAscending; - } - - /** - * @return Returns the ID of the {@link RcsGroupThread} that the results are limited to. As this - * API exposes an ID, it should stay hidden. - * - * @hide - */ - public int getThreadId() { - return mThreadId; - } - - /** - * A helper class to build the {@link RcsEventQueryParams}. - */ - public static class Builder { - private @EventType int mEventType; - private @SortingProperty int mSortingProperty; - private boolean mIsAscending; - private int mLimit = 100; - private int mThreadId; - - /** - * Creates a new builder for {@link RcsEventQueryParams} to be used in - * {@link RcsMessageStore#getRcsEvents(RcsEventQueryParams)} - */ - public Builder() { - // empty implementation - } - - /** - * Desired number of events to be returned from the query. Passing in 0 will return all - * existing events at once. The limit defaults to 100. - * - * @param limit The number to limit the query result to. - * @return The same instance of the builder to chain parameters. - * @throws InvalidParameterException If the given limit is negative. - */ - @CheckResult - public Builder setResultLimit(@IntRange(from = 0) int limit) - throws InvalidParameterException { - if (limit < 0) { - throw new InvalidParameterException("The query limit must be non-negative"); - } - - mLimit = limit; - return this; - } - - /** - * Sets the type of events to be returned from the query. - * - * @param eventType The type of event to be returned. - * @return The same instance of the builder to chain parameters. - */ - @CheckResult - public Builder setEventType(@EventType int eventType) { - mEventType = eventType; - return this; - } - - /** - * Sets the property where the results should be sorted against. Defaults to - * {@link RcsEventQueryParams.SortingProperty#SORT_BY_CREATION_ORDER} - * - * @param sortingProperty against which property the results should be sorted - * @return The same instance of the builder to chain parameters. - */ - @CheckResult - public Builder setSortProperty(@SortingProperty int sortingProperty) { - mSortingProperty = sortingProperty; - return this; - } - - /** - * Sets whether the results should be sorted ascending or descending - * - * @param isAscending whether the results should be sorted ascending - * @return The same instance of the builder to chain parameters. - */ - @CheckResult - public Builder setSortDirection(boolean isAscending) { - mIsAscending = isAscending; - return this; - } - - /** - * Limits the results to the given {@link RcsGroupThread}. Setting this value prevents - * returning any instances of {@link RcsParticipantAliasChangedEvent}. - * - * @param groupThread The thread to limit the results to. - * @return The same instance of the builder to chain parameters. - */ - @CheckResult - public Builder setGroupThread(@NonNull RcsGroupThread groupThread) { - mThreadId = groupThread.getThreadId(); - return this; - } - - /** - * Builds the {@link RcsEventQueryParams} to use in - * {@link RcsMessageStore#getRcsEvents(RcsEventQueryParams)} - * - * @return An instance of {@link RcsEventQueryParams} to use with the event query. - */ - public RcsEventQueryParams build() { - return new RcsEventQueryParams(mEventType, mThreadId, mSortingProperty, - mIsAscending, mLimit); - } - } - - private RcsEventQueryParams(Parcel in) { - mEventType = in.readInt(); - mThreadId = in.readInt(); - mSortingProperty = in.readInt(); - mIsAscending = in.readBoolean(); - mLimit = in.readInt(); - } - - public static final @android.annotation.NonNull Creator<RcsEventQueryParams> CREATOR = - new Creator<RcsEventQueryParams>() { - @Override - public RcsEventQueryParams createFromParcel(Parcel in) { - return new RcsEventQueryParams(in); - } - - @Override - public RcsEventQueryParams[] newArray(int size) { - return new RcsEventQueryParams[size]; - } - }; - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(mEventType); - dest.writeInt(mThreadId); - dest.writeInt(mSortingProperty); - dest.writeBoolean(mIsAscending); - dest.writeInt(mLimit); - } -} diff --git a/telephony/java/android/telephony/ims/RcsEventQueryResult.java b/telephony/java/android/telephony/ims/RcsEventQueryResult.java deleted file mode 100644 index d6347e3ec693..000000000000 --- a/telephony/java/android/telephony/ims/RcsEventQueryResult.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import java.util.List; - -/** - * The result of a {@link RcsMessageStore#getRcsEvents(RcsEventQueryParams)} - * call. This class allows getting the token for querying the next batch of events in order to - * prevent handling large amounts of data at once. - * - * @hide - */ -public class RcsEventQueryResult { - private RcsQueryContinuationToken mContinuationToken; - private List<RcsEvent> mEvents; - - /** - * Internal constructor for {@link com.android.internal.telephony.ims.RcsMessageStoreController} - * to create query results - * - * @hide - */ - public RcsEventQueryResult( - RcsQueryContinuationToken continuationToken, - List<RcsEvent> events) { - mContinuationToken = continuationToken; - mEvents = events; - } - - /** - * Returns a token to call - * {@link RcsMessageStore#getRcsEvents(RcsQueryContinuationToken)} - * to get the next batch of {@link RcsEvent}s. - */ - public RcsQueryContinuationToken getContinuationToken() { - return mContinuationToken; - } - - /** - * Returns all the {@link RcsEvent}s in the current query result. Call {@link - * RcsMessageStore#getRcsEvents(RcsQueryContinuationToken)} to get the next batch - * of {@link RcsEvent}s. - */ - public List<RcsEvent> getEvents() { - return mEvents; - } -} diff --git a/telephony/java/android/telephony/ims/RcsEventQueryResultDescriptor.java b/telephony/java/android/telephony/ims/RcsEventQueryResultDescriptor.java deleted file mode 100644 index b972d557fae0..000000000000 --- a/telephony/java/android/telephony/ims/RcsEventQueryResultDescriptor.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.os.Parcel; -import android.os.Parcelable; - -import java.util.LinkedList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * Contains the raw data backing a {@link RcsEventQueryResult}. - * - * @hide - used only for internal communication with the ircs service - */ -public class RcsEventQueryResultDescriptor implements Parcelable { - private final RcsQueryContinuationToken mContinuationToken; - private final List<RcsEventDescriptor> mEvents; - - public RcsEventQueryResultDescriptor( - RcsQueryContinuationToken continuationToken, - List<RcsEventDescriptor> events) { - mContinuationToken = continuationToken; - mEvents = events; - } - - protected RcsEventQueryResult getRcsEventQueryResult(RcsControllerCall rcsControllerCall) { - List<RcsEvent> rcsEvents = mEvents.stream() - .map(rcsEvent -> rcsEvent.createRcsEvent(rcsControllerCall)) - .collect(Collectors.toList()); - - return new RcsEventQueryResult(mContinuationToken, rcsEvents); - } - - protected RcsEventQueryResultDescriptor(Parcel in) { - mContinuationToken = in.readParcelable(RcsQueryContinuationToken.class.getClassLoader()); - mEvents = new LinkedList<>(); - in.readList(mEvents, null); - } - - public static final @android.annotation.NonNull Creator<RcsEventQueryResultDescriptor> CREATOR = - new Creator<RcsEventQueryResultDescriptor>() { - @Override - public RcsEventQueryResultDescriptor createFromParcel(Parcel in) { - return new RcsEventQueryResultDescriptor(in); - } - - @Override - public RcsEventQueryResultDescriptor[] newArray(int size) { - return new RcsEventQueryResultDescriptor[size]; - } - }; - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeParcelable(mContinuationToken, flags); - dest.writeList(mEvents); - } -} diff --git a/telephony/java/android/telephony/ims/RcsFileTransferCreationParams.aidl b/telephony/java/android/telephony/ims/RcsFileTransferCreationParams.aidl deleted file mode 100644 index 155219038d7b..000000000000 --- a/telephony/java/android/telephony/ims/RcsFileTransferCreationParams.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * - * Copyright 2019, 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.ims; - -parcelable RcsFileTransferCreationParams; diff --git a/telephony/java/android/telephony/ims/RcsFileTransferCreationParams.java b/telephony/java/android/telephony/ims/RcsFileTransferCreationParams.java deleted file mode 100644 index e43552d74bf3..000000000000 --- a/telephony/java/android/telephony/ims/RcsFileTransferCreationParams.java +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.annotation.CheckResult; -import android.net.Uri; -import android.os.Parcel; -import android.os.Parcelable; - -/** - * Pass an instance of this class to - * {@link RcsMessage#insertFileTransfer(RcsFileTransferCreationParams)} create an - * {@link RcsFileTransferPart} and save it into storage. - * - * @hide - */ -public final class RcsFileTransferCreationParams implements Parcelable { - private String mRcsFileTransferSessionId; - private Uri mContentUri; - private String mContentMimeType; - private long mFileSize; - private long mTransferOffset; - private int mWidth; - private int mHeight; - private long mMediaDuration; - private Uri mPreviewUri; - private String mPreviewMimeType; - private @RcsFileTransferPart.RcsFileTransferStatus int mFileTransferStatus; - - /** - * @return Returns the globally unique RCS file transfer session ID for the - * {@link RcsFileTransferPart} to be created - */ - public String getRcsFileTransferSessionId() { - return mRcsFileTransferSessionId; - } - - /** - * @return Returns the URI for the content of the {@link RcsFileTransferPart} to be created - */ - public Uri getContentUri() { - return mContentUri; - } - - /** - * @return Returns the MIME type for the content of the {@link RcsFileTransferPart} to be - * created - */ - public String getContentMimeType() { - return mContentMimeType; - } - - /** - * @return Returns the file size in bytes for the {@link RcsFileTransferPart} to be created - */ - public long getFileSize() { - return mFileSize; - } - - /** - * @return Returns the transfer offset for the {@link RcsFileTransferPart} to be created. The - * file transfer offset is defined as how many bytes have been successfully transferred to the - * receiver of this file transfer. - */ - public long getTransferOffset() { - return mTransferOffset; - } - - /** - * @return Returns the width of the {@link RcsFileTransferPart} to be created. The value is in - * pixels. - */ - public int getWidth() { - return mWidth; - } - - /** - * @return Returns the height of the {@link RcsFileTransferPart} to be created. The value is in - * pixels. - */ - public int getHeight() { - return mHeight; - } - - /** - * @return Returns the duration of the {@link RcsFileTransferPart} to be created. - */ - public long getMediaDuration() { - return mMediaDuration; - } - - /** - * @return Returns the URI of the preview of the content of the {@link RcsFileTransferPart} to - * be created. This should only be used for multi-media files. - */ - public Uri getPreviewUri() { - return mPreviewUri; - } - - /** - * @return Returns the MIME type of the preview of the content of the - * {@link RcsFileTransferPart} to be created. This should only be used for multi-media files. - */ - public String getPreviewMimeType() { - return mPreviewMimeType; - } - - /** - * @return Returns the status of the {@link RcsFileTransferPart} to be created. - */ - public @RcsFileTransferPart.RcsFileTransferStatus int getFileTransferStatus() { - return mFileTransferStatus; - } - - /** - * @hide - */ - RcsFileTransferCreationParams(Builder builder) { - mRcsFileTransferSessionId = builder.mRcsFileTransferSessionId; - mContentUri = builder.mContentUri; - mContentMimeType = builder.mContentMimeType; - mFileSize = builder.mFileSize; - mTransferOffset = builder.mTransferOffset; - mWidth = builder.mWidth; - mHeight = builder.mHeight; - mMediaDuration = builder.mLength; - mPreviewUri = builder.mPreviewUri; - mPreviewMimeType = builder.mPreviewMimeType; - mFileTransferStatus = builder.mFileTransferStatus; - } - - /** - * A builder to create instances of {@link RcsFileTransferCreationParams} - */ - public class Builder { - private String mRcsFileTransferSessionId; - private Uri mContentUri; - private String mContentMimeType; - private long mFileSize; - private long mTransferOffset; - private int mWidth; - private int mHeight; - private long mLength; - private Uri mPreviewUri; - private String mPreviewMimeType; - private @RcsFileTransferPart.RcsFileTransferStatus int mFileTransferStatus; - - /** - * Sets the globally unique RCS file transfer session ID for the {@link RcsFileTransferPart} - * to be created - * - * @param sessionId The RCS file transfer session ID - * @return The same instance of {@link Builder} to chain methods - */ - @CheckResult - public Builder setFileTransferSessionId(String sessionId) { - mRcsFileTransferSessionId = sessionId; - return this; - } - - /** - * Sets the URI for the content of the {@link RcsFileTransferPart} to be created - * - * @param contentUri The URI for the file - * @return The same instance of {@link Builder} to chain methods - */ - @CheckResult - public Builder setContentUri(Uri contentUri) { - mContentUri = contentUri; - return this; - } - - /** - * Sets the MIME type for the content of the {@link RcsFileTransferPart} to be created - * - * @param contentType The MIME type of the file - * @return The same instance of {@link Builder} to chain methods - */ - @CheckResult - public Builder setContentMimeType(String contentType) { - mContentMimeType = contentType; - return this; - } - - /** - * Sets the file size for the {@link RcsFileTransferPart} to be created - * - * @param size The size of the file in bytes - * @return The same instance of {@link Builder} to chain methods - */ - @CheckResult - public Builder setFileSize(long size) { - mFileSize = size; - return this; - } - - /** - * Sets the transfer offset for the {@link RcsFileTransferPart} to be created. The file - * transfer offset is defined as how many bytes have been successfully transferred to the - * receiver of this file transfer. - * - * @param offset The transfer offset in bytes - * @return The same instance of {@link Builder} to chain methods - */ - @CheckResult - public Builder setTransferOffset(long offset) { - mTransferOffset = offset; - return this; - } - - /** - * Sets the width of the {@link RcsFileTransferPart} to be created. This should only be used - * for multi-media files. - * - * @param width The width of the multi-media file in pixels. - * @return The same instance of {@link Builder} to chain methods - */ - @CheckResult - public Builder setWidth(int width) { - mWidth = width; - return this; - } - - /** - * Sets the height of the {@link RcsFileTransferPart} to be created. This should only be - * used for multi-media files. - * - * @param height The height of the multi-media file in pixels. - * @return The same instance of {@link Builder} to chain methods - */ - @CheckResult - public Builder setHeight(int height) { - mHeight = height; - return this; - } - - /** - * Sets the length of the {@link RcsFileTransferPart} to be created. This should only be - * used for multi-media files such as audio or video. - * - * @param length The length of the multi-media file in milliseconds - * @return The same instance of {@link Builder} to chain methods - */ - @CheckResult - public Builder setMediaDuration(long length) { - mLength = length; - return this; - } - - /** - * Sets the URI of the preview of the content of the {@link RcsFileTransferPart} to be - * created. This should only be used for multi-media files. - * - * @param previewUri The URI of the preview of the file transfer - * @return The same instance of {@link Builder} to chain methods - */ - @CheckResult - public Builder setPreviewUri(Uri previewUri) { - mPreviewUri = previewUri; - return this; - } - - /** - * Sets the MIME type of the preview of the content of the {@link RcsFileTransferPart} to - * be created. This should only be used for multi-media files. - * - * @param previewType The MIME type of the preview of the file transfer - * @return The same instance of {@link Builder} to chain methods - */ - @CheckResult - public Builder setPreviewMimeType(String previewType) { - mPreviewMimeType = previewType; - return this; - } - - /** - * Sets the status of the {@link RcsFileTransferPart} to be created. - * - * @param status The status of the file transfer - * @return The same instance of {@link Builder} to chain methods - */ - @CheckResult - public Builder setFileTransferStatus( - @RcsFileTransferPart.RcsFileTransferStatus int status) { - mFileTransferStatus = status; - return this; - } - - /** - * Creates an instance of {@link RcsFileTransferCreationParams} with the given - * parameters. - * - * @return The same instance of {@link Builder} to chain methods - * @see RcsMessage#insertFileTransfer(RcsFileTransferCreationParams) - */ - public RcsFileTransferCreationParams build() { - return new RcsFileTransferCreationParams(this); - } - } - - private RcsFileTransferCreationParams(Parcel in) { - mRcsFileTransferSessionId = in.readString(); - mContentUri = in.readParcelable(Uri.class.getClassLoader()); - mContentMimeType = in.readString(); - mFileSize = in.readLong(); - mTransferOffset = in.readLong(); - mWidth = in.readInt(); - mHeight = in.readInt(); - mMediaDuration = in.readLong(); - mPreviewUri = in.readParcelable(Uri.class.getClassLoader()); - mPreviewMimeType = in.readString(); - mFileTransferStatus = in.readInt(); - } - - public static final @android.annotation.NonNull Creator<RcsFileTransferCreationParams> CREATOR = - new Creator<RcsFileTransferCreationParams>() { - @Override - public RcsFileTransferCreationParams createFromParcel(Parcel in) { - return new RcsFileTransferCreationParams(in); - } - - @Override - public RcsFileTransferCreationParams[] newArray(int size) { - return new RcsFileTransferCreationParams[size]; - } - }; - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeString(mRcsFileTransferSessionId); - dest.writeParcelable(mContentUri, flags); - dest.writeString(mContentMimeType); - dest.writeLong(mFileSize); - dest.writeLong(mTransferOffset); - dest.writeInt(mWidth); - dest.writeInt(mHeight); - dest.writeLong(mMediaDuration); - dest.writeParcelable(mPreviewUri, flags); - dest.writeString(mPreviewMimeType); - dest.writeInt(mFileTransferStatus); - } -} diff --git a/telephony/java/android/telephony/ims/RcsFileTransferPart.java b/telephony/java/android/telephony/ims/RcsFileTransferPart.java deleted file mode 100644 index ef66a76a5902..000000000000 --- a/telephony/java/android/telephony/ims/RcsFileTransferPart.java +++ /dev/null @@ -1,388 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.annotation.IntDef; -import android.annotation.Nullable; -import android.annotation.WorkerThread; -import android.net.Uri; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -/** - * A part of a composite {@link RcsMessage} that holds a file transfer. Please see Section 7 - * (File Transfer) - GSMA RCC.71 (RCS Universal Profile Service Definition Document) - * - * @hide - */ -public class RcsFileTransferPart { - /** - * The status to indicate that this {@link RcsFileTransferPart} is not set yet. - */ - public static final int NOT_SET = 0; - - /** - * The status to indicate that this {@link RcsFileTransferPart} is a draft and is not in the - * process of sending yet. - */ - public static final int DRAFT = 1; - - /** - * The status to indicate that this {@link RcsFileTransferPart} is actively being sent right - * now. - */ - public static final int SENDING = 2; - - /** - * The status to indicate that this {@link RcsFileTransferPart} was being sent, but the user has - * paused the sending process. - */ - public static final int SENDING_PAUSED = 3; - - /** - * The status to indicate that this {@link RcsFileTransferPart} was attempted, but failed to - * send. - */ - public static final int SENDING_FAILED = 4; - - /** - * The status to indicate that this {@link RcsFileTransferPart} is permanently cancelled to - * send. - */ - public static final int SENDING_CANCELLED = 5; - - /** - * The status to indicate that this {@link RcsFileTransferPart} is actively being downloaded - * right now. - */ - public static final int DOWNLOADING = 6; - - /** - * The status to indicate that this {@link RcsFileTransferPart} was being downloaded, but the - * user paused the downloading process. - */ - public static final int DOWNLOADING_PAUSED = 7; - - /** - * The status to indicate that this {@link RcsFileTransferPart} was attempted, but failed to - * download. - */ - public static final int DOWNLOADING_FAILED = 8; - - /** - * The status to indicate that this {@link RcsFileTransferPart} is permanently cancelled to - * download. - */ - public static final int DOWNLOADING_CANCELLED = 9; - - /** - * The status to indicate that this {@link RcsFileTransferPart} was successfully sent or - * received. - */ - public static final int SUCCEEDED = 10; - - @IntDef({ - DRAFT, SENDING, SENDING_PAUSED, SENDING_FAILED, SENDING_CANCELLED, DOWNLOADING, - DOWNLOADING_PAUSED, DOWNLOADING_FAILED, DOWNLOADING_CANCELLED, SUCCEEDED - }) - @Retention(RetentionPolicy.SOURCE) - public @interface RcsFileTransferStatus { - } - - private final RcsControllerCall mRcsControllerCall; - - private int mId; - - /** - * @hide - */ - RcsFileTransferPart(RcsControllerCall rcsControllerCall, int id) { - mRcsControllerCall = rcsControllerCall; - mId = id; - } - - /** - * @hide - */ - public void setId(int id) { - mId = id; - } - - /** - * @hide - */ - public int getId() { - return mId; - } - - /** - * Sets the RCS file transfer session ID for this file transfer and persists into storage. - * - * @param sessionId The session ID to be used for this file transfer. - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setFileTransferSessionId(String sessionId) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setFileTransferSessionId(mId, sessionId, - callingPackage)); - } - - /** - * @return Returns the file transfer session ID. - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public String getFileTransferSessionId() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getFileTransferSessionId(mId, callingPackage)); - } - - /** - * Sets the content URI for this file transfer and persists into storage. The file transfer - * should be reachable using this URI. - * - * @param contentUri The URI for this file transfer. - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setContentUri(Uri contentUri) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setFileTransferContentUri(mId, contentUri, - callingPackage)); - } - - /** - * @return Returns the URI for this file transfer - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @Nullable - @WorkerThread - public Uri getContentUri() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getFileTransferContentUri(mId, callingPackage)); - } - - /** - * Sets the MIME type of this file transfer and persists into storage. Whether this type - * actually matches any known or supported types is not checked. - * - * @param contentMimeType The type of this file transfer. - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setContentMimeType(String contentMimeType) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setFileTransferContentType(mId, contentMimeType, - callingPackage)); - } - - /** - * @return Returns the content type of this file transfer - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - @Nullable - public String getContentMimeType() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getFileTransferContentType(mId, callingPackage)); - } - - /** - * Sets the content length (i.e. file size) for this file transfer and persists into storage. - * - * @param contentLength The content length of this file transfer - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setFileSize(long contentLength) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setFileTransferFileSize(mId, contentLength, - callingPackage)); - } - - /** - * @return Returns the content length (i.e. file size) for this file transfer. - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public long getFileSize() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getFileTransferFileSize(mId, callingPackage)); - } - - /** - * Sets the transfer offset for this file transfer and persists into storage. The file transfer - * offset is defined as how many bytes have been successfully transferred to the receiver of - * this file transfer. - * - * @param transferOffset The transfer offset for this file transfer. - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setTransferOffset(long transferOffset) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setFileTransferTransferOffset(mId, transferOffset, - callingPackage)); - } - - /** - * @return Returns the number of bytes that have successfully transferred. - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public long getTransferOffset() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getFileTransferTransferOffset(mId, callingPackage)); - } - - /** - * Sets the status for this file transfer and persists into storage. - * - * @param status The status of this file transfer. - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setFileTransferStatus(@RcsFileTransferStatus int status) - throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setFileTransferStatus(mId, status, callingPackage)); - } - - /** - * @return Returns the status of this file transfer. - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public @RcsFileTransferStatus int getFileTransferStatus() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getFileTransferStatus(mId, callingPackage)); - } - - /** - * @return Returns the width of this multi-media message part in pixels. - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public int getWidth() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getFileTransferWidth(mId, callingPackage)); - } - - /** - * Sets the width of this RCS multi-media message part and persists into storage. - * - * @param width The width value in pixels - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setWidth(int width) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setFileTransferWidth(mId, width, callingPackage)); - } - - /** - * @return Returns the height of this multi-media message part in pixels. - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public int getHeight() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getFileTransferHeight(mId, callingPackage)); - } - - /** - * Sets the height of this RCS multi-media message part and persists into storage. - * - * @param height The height value in pixels - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setHeight(int height) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setFileTransferHeight(mId, height, callingPackage)); - } - - /** - * @return Returns the length of this multi-media file (e.g. video or audio) in milliseconds. - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public long getLength() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getFileTransferLength(mId, callingPackage)); - } - - /** - * Sets the length of this multi-media file (e.g. video or audio) and persists into storage. - * - * @param length The length of the file in milliseconds. - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setLength(long length) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setFileTransferLength(mId, length, callingPackage)); - } - - /** - * @return Returns the URI for the preview of this multi-media file (e.g. an image thumbnail for - * a video) - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public Uri getPreviewUri() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getFileTransferPreviewUri(mId, callingPackage)); - } - - /** - * Sets the URI for the preview of this multi-media file and persists into storage. - * - * @param previewUri The URI to access to the preview file. - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setPreviewUri(Uri previewUri) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setFileTransferPreviewUri(mId, previewUri, - callingPackage)); - } - - /** - * @return Returns the MIME type of this multi-media file's preview. - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public String getPreviewMimeType() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getFileTransferPreviewType(mId, callingPackage)); - } - - /** - * Sets the MIME type for this multi-media file's preview and persists into storage. - * - * @param previewMimeType The MIME type for the preview - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setPreviewMimeType(String previewMimeType) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setFileTransferPreviewType(mId, previewMimeType, - callingPackage)); - } -} diff --git a/telephony/java/android/telephony/ims/RcsGroupThread.java b/telephony/java/android/telephony/ims/RcsGroupThread.java deleted file mode 100644 index 30abcb4abb3d..000000000000 --- a/telephony/java/android/telephony/ims/RcsGroupThread.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.annotation.NonNull; -import android.annotation.Nullable; -import android.annotation.WorkerThread; -import android.net.Uri; - -import java.util.Collections; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -/** - * RcsGroupThread represents a single RCS conversation thread where {@link RcsParticipant}s can join - * or leave. Please see Section 6 (Group Chat) - GSMA RCC.71 (RCS Universal Profile Service - * Definition Document) - * - * @hide - */ -public class RcsGroupThread extends RcsThread { - /** - * Public constructor only for RcsMessageStoreController to initialize new threads. - * - * @hide - */ - public RcsGroupThread(RcsControllerCall rcsControllerCall, int threadId) { - super(rcsControllerCall, threadId); - } - - /** - * @return Returns {@code true} as this is always a group thread - */ - @Override - public boolean isGroup() { - return true; - } - - /** - * @return Returns the given name of this {@link RcsGroupThread}. Please see US6-2 - GSMA RCC.71 - * (RCS Universal Profile Service Definition Document) - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @Nullable - @WorkerThread - public String getGroupName() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getGroupThreadName(mThreadId, callingPackage)); - } - - /** - * Sets the name of this {@link RcsGroupThread} and saves it into storage. Please see US6-2 - - * GSMA RCC.71 (RCS Universal Profile Service Definition Document) - * - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setGroupName(String groupName) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setGroupThreadName(mThreadId, groupName, - callingPackage)); - } - - /** - * @return Returns a URI that points to the group's icon {@link RcsGroupThread}. Please see - * US6-2 - GSMA RCC.71 (RCS Universal Profile Service Definition Document) - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @Nullable - public Uri getGroupIcon() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getGroupThreadIcon(mThreadId, callingPackage)); - } - - /** - * Sets the icon for this {@link RcsGroupThread} and saves it into storage. Please see US6-2 - - * GSMA RCC.71 (RCS Universal Profile Service Definition Document) - * - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setGroupIcon(@Nullable Uri groupIcon) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setGroupThreadIcon(mThreadId, groupIcon, - callingPackage)); - } - - /** - * @return Returns the owner of this thread or {@code null} if there doesn't exist an owner - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @Nullable - @WorkerThread - public RcsParticipant getOwner() throws RcsMessageStoreException { - return new RcsParticipant( - mRcsControllerCall, - mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getGroupThreadOwner(mThreadId, - callingPackage))); - } - - /** - * Sets the owner of this {@link RcsGroupThread} and saves it into storage. This is intended to - * be used for selecting a new owner for a group thread if the owner leaves the thread. The - * owner needs to be in the list of existing participants. - * - * @param participant The new owner of the thread. {@code null} values are allowed. - * @throws RcsMessageStoreException if the operation could not be persisted into storage - */ - @WorkerThread - public void setOwner(@Nullable RcsParticipant participant) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setGroupThreadOwner(mThreadId, participant.getId(), - callingPackage)); - } - - /** - * Adds a new {@link RcsParticipant} to this group thread and persists into storage. If the user - * is actively participating in this {@link RcsGroupThread}, an {@link RcsParticipant} on behalf - * of them should be added. - * - * @param participant The new participant to be added to the thread. - * @throws RcsMessageStoreException if the operation could not be persisted into storage - */ - @WorkerThread - public void addParticipant(@NonNull RcsParticipant participant) - throws RcsMessageStoreException { - if (participant == null) { - return; - } - - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.addParticipantToGroupThread(mThreadId, - participant.getId(), callingPackage)); - } - - /** - * Removes an {@link RcsParticipant} from this group thread and persists into storage. If the - * removed participant was the owner of this group, the owner will become null. - * - * @throws RcsMessageStoreException if the operation could not be persisted into storage - */ - @WorkerThread - public void removeParticipant(@NonNull RcsParticipant participant) - throws RcsMessageStoreException { - if (participant == null) { - return; - } - - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.removeParticipantFromGroupThread(mThreadId, - participant.getId(), callingPackage)); - } - - /** - * Returns the set of {@link RcsParticipant}s that contribute to this group thread. The - * returned set does not support modifications, please use - * {@link RcsGroupThread#addParticipant(RcsParticipant)} - * and {@link RcsGroupThread#removeParticipant(RcsParticipant)} instead. - * - * @return the immutable set of {@link RcsParticipant} in this group thread. - * @throws RcsMessageStoreException if the values could not be read from the storage - */ - @WorkerThread - @NonNull - public Set<RcsParticipant> getParticipants() throws RcsMessageStoreException { - RcsParticipantQueryParams queryParameters = - new RcsParticipantQueryParams.Builder().setThread(this).build(); - - RcsParticipantQueryResult queryResult = new RcsParticipantQueryResult( - mRcsControllerCall, - mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getParticipants(queryParameters, - callingPackage))); - - List<RcsParticipant> participantList = queryResult.getParticipants(); - Set<RcsParticipant> participantSet = new LinkedHashSet<>(participantList); - return Collections.unmodifiableSet(participantSet); - } - - /** - * Returns the conference URI for this {@link RcsGroupThread}. Please see 4.4.5.2 - GSMA RCC.53 - * (RCS Device API 1.6 Specification - * - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @Nullable - @WorkerThread - public Uri getConferenceUri() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getGroupThreadConferenceUri(mThreadId, - callingPackage)); - } - - /** - * Sets the conference URI for this {@link RcsGroupThread} and persists into storage. Please see - * 4.4.5.2 - GSMA RCC.53 (RCS Device API 1.6 Specification - * - * @param conferenceUri The URI as String to be used as the conference URI. - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @Nullable - @WorkerThread - public void setConferenceUri(Uri conferenceUri) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setGroupThreadConferenceUri(mThreadId, conferenceUri, - callingPackage)); - } -} diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadEvent.java b/telephony/java/android/telephony/ims/RcsGroupThreadEvent.java deleted file mode 100644 index f4beef7f9843..000000000000 --- a/telephony/java/android/telephony/ims/RcsGroupThreadEvent.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 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 android.telephony.ims; - -import android.annotation.NonNull; - -/** - * An event that happened on an {@link RcsGroupThread}. - * - * @hide - */ -public abstract class RcsGroupThreadEvent extends RcsEvent { - private final RcsGroupThread mRcsGroupThread; - private final RcsParticipant mOriginatingParticipant; - - RcsGroupThreadEvent(long timestamp, RcsGroupThread rcsGroupThread, - RcsParticipant originatingParticipant) { - super(timestamp); - mRcsGroupThread = rcsGroupThread; - mOriginatingParticipant = originatingParticipant; - } - - /** - * @return Returns the {@link RcsGroupThread} that this event happened on. - */ - @NonNull - public RcsGroupThread getRcsGroupThread() { - return mRcsGroupThread; - } - - /** - * @return Returns the {@link RcsParticipant} that performed the event. - */ - @NonNull - public RcsParticipant getOriginatingParticipant() { - return mOriginatingParticipant; - } -} diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadEventDescriptor.aidl b/telephony/java/android/telephony/ims/RcsGroupThreadEventDescriptor.aidl deleted file mode 100644 index 6299d8a5eb71..000000000000 --- a/telephony/java/android/telephony/ims/RcsGroupThreadEventDescriptor.aidl +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2019, 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.ims; - -parcelable RcsGroupThreadEventDescriptor; diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadEventDescriptor.java b/telephony/java/android/telephony/ims/RcsGroupThreadEventDescriptor.java deleted file mode 100644 index 662a264b6d67..000000000000 --- a/telephony/java/android/telephony/ims/RcsGroupThreadEventDescriptor.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.os.Parcel; - -/** - * @hide - used only for internal communication with the ircs service - */ -public abstract class RcsGroupThreadEventDescriptor extends RcsEventDescriptor { - protected final int mRcsGroupThreadId; - protected final int mOriginatingParticipantId; - - RcsGroupThreadEventDescriptor(long timestamp, int rcsGroupThreadId, - int originatingParticipantId) { - super(timestamp); - mRcsGroupThreadId = rcsGroupThreadId; - mOriginatingParticipantId = originatingParticipantId; - } - - RcsGroupThreadEventDescriptor(Parcel in) { - super(in); - mRcsGroupThreadId = in.readInt(); - mOriginatingParticipantId = in.readInt(); - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - super.writeToParcel(dest, flags); - dest.writeInt(mRcsGroupThreadId); - dest.writeInt(mOriginatingParticipantId); - } -} diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEvent.java b/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEvent.java deleted file mode 100644 index 23e39ffb3680..000000000000 --- a/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEvent.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 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 android.telephony.ims; - -import android.annotation.NonNull; -import android.annotation.Nullable; -import android.net.Uri; - -/** - * An event that indicates an {@link RcsGroupThread}'s icon was changed. Please see R6-2-5 - GSMA - * RCC.71 (RCS Universal Profile Service Definition Document) - * - * @hide - */ -public final class RcsGroupThreadIconChangedEvent extends RcsGroupThreadEvent { - private final Uri mNewIcon; - - /** - * Creates a new {@link RcsGroupThreadIconChangedEvent}. This event is not persisted into - * storage until {@link RcsMessageStore#persistRcsEvent(RcsEvent)} is called. - * - * @param timestamp The timestamp of when this event happened, in milliseconds passed after - * midnight, January 1st, 1970 UTC - * @param rcsGroupThread The {@link RcsGroupThread} that this event happened on - * @param originatingParticipant The {@link RcsParticipant} that changed the - * {@link RcsGroupThread}'s icon. - * @param newIcon {@link Uri} to the new icon of this {@link RcsGroupThread} - * @see RcsMessageStore#persistRcsEvent(RcsEvent) - */ - public RcsGroupThreadIconChangedEvent(long timestamp, - @NonNull RcsGroupThread rcsGroupThread, @NonNull RcsParticipant originatingParticipant, - @Nullable Uri newIcon) { - super(timestamp, rcsGroupThread, originatingParticipant); - mNewIcon = newIcon; - } - - /** - * @return Returns the {@link Uri} to the icon of the {@link RcsGroupThread} after this - * {@link RcsGroupThreadIconChangedEvent} occured. - */ - @Nullable - public Uri getNewIcon() { - return mNewIcon; - } - - /** - * Persists the event to the data store. - * - * @hide - not meant for public use. - */ - @Override - void persist(RcsControllerCall rcsControllerCall) throws RcsMessageStoreException { - // TODO ensure failure throws - rcsControllerCall.call((iRcs, callingPackage) -> iRcs.createGroupThreadIconChangedEvent( - getTimestamp(), getRcsGroupThread().getThreadId(), - getOriginatingParticipant().getId(), mNewIcon, callingPackage)); - } -} diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEventDescriptor.aidl b/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEventDescriptor.aidl deleted file mode 100644 index 4bcc5a043acd..000000000000 --- a/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEventDescriptor.aidl +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2019, 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.ims; - -parcelable RcsGroupThreadIconChangedEventDescriptor; diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEventDescriptor.java b/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEventDescriptor.java deleted file mode 100644 index 9350e402c04e..000000000000 --- a/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEventDescriptor.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import static com.android.internal.annotations.VisibleForTesting.Visibility.PROTECTED; - -import android.annotation.NonNull; -import android.annotation.Nullable; -import android.net.Uri; -import android.os.Parcel; - -import com.android.internal.annotations.VisibleForTesting; - -/** - * @hide - used only for internal communication with the ircs service - */ -public class RcsGroupThreadIconChangedEventDescriptor extends RcsGroupThreadEventDescriptor { - private final Uri mNewIcon; - - public RcsGroupThreadIconChangedEventDescriptor(long timestamp, int rcsGroupThreadId, - int originatingParticipantId, @Nullable Uri newIcon) { - super(timestamp, rcsGroupThreadId, originatingParticipantId); - mNewIcon = newIcon; - } - - @Override - @VisibleForTesting(visibility = PROTECTED) - public RcsGroupThreadIconChangedEvent createRcsEvent(RcsControllerCall rcsControllerCall) { - return new RcsGroupThreadIconChangedEvent(mTimestamp, - new RcsGroupThread(rcsControllerCall, mRcsGroupThreadId), - new RcsParticipant(rcsControllerCall, mOriginatingParticipantId), mNewIcon); - } - - public static final @NonNull Creator<RcsGroupThreadIconChangedEventDescriptor> CREATOR = - new Creator<RcsGroupThreadIconChangedEventDescriptor>() { - @Override - public RcsGroupThreadIconChangedEventDescriptor createFromParcel(Parcel in) { - return new RcsGroupThreadIconChangedEventDescriptor(in); - } - - @Override - public RcsGroupThreadIconChangedEventDescriptor[] newArray(int size) { - return new RcsGroupThreadIconChangedEventDescriptor[size]; - } - }; - - protected RcsGroupThreadIconChangedEventDescriptor(Parcel in) { - super(in); - mNewIcon = in.readParcelable(Uri.class.getClassLoader()); - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - super.writeToParcel(dest, flags); - dest.writeParcelable(mNewIcon, flags); - } -} diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEvent.java b/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEvent.java deleted file mode 100644 index a6a0867ca739..000000000000 --- a/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEvent.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 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 android.telephony.ims; - -import android.annotation.NonNull; -import android.annotation.Nullable; - -/** - * An event that indicates an {@link RcsGroupThread}'s name was changed. Please see R6-2-5 - GSMA - * RCC.71 (RCS Universal Profile Service Definition Document) - * - * @hide - */ -public final class RcsGroupThreadNameChangedEvent extends RcsGroupThreadEvent { - private final String mNewName; - - /** - * Creates a new {@link RcsGroupThreadNameChangedEvent}. This event is not persisted into - * storage until {@link RcsMessageStore#persistRcsEvent(RcsEvent)} is called. - * - * @param timestamp The timestamp of when this event happened, in milliseconds passed after - * midnight, January 1st, 1970 UTC - * @param rcsGroupThread The {@link RcsGroupThread} that this event happened on - * @param originatingParticipant The {@link RcsParticipant} that changed the - * {@link RcsGroupThread}'s icon. - * @param newName The new name of the {@link RcsGroupThread} - * @see RcsMessageStore#persistRcsEvent(RcsEvent) - */ - public RcsGroupThreadNameChangedEvent(long timestamp, @NonNull RcsGroupThread rcsGroupThread, - @NonNull RcsParticipant originatingParticipant, @Nullable String newName) { - super(timestamp, rcsGroupThread, originatingParticipant); - mNewName = newName; - } - - /** - * @return Returns the name of this {@link RcsGroupThread} after this - * {@link RcsGroupThreadNameChangedEvent} happened. - */ - @Nullable - public String getNewName() { - return mNewName; - } - - /** - * Persists the event to the data store. - * - * @hide - not meant for public use. - */ - @Override - void persist(RcsControllerCall rcsControllerCall) throws RcsMessageStoreException { - rcsControllerCall.call((iRcs, callingPackage) -> iRcs.createGroupThreadNameChangedEvent( - getTimestamp(), getRcsGroupThread().getThreadId(), - getOriginatingParticipant().getId(), mNewName, callingPackage)); - } -} diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEventDescriptor.aidl b/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEventDescriptor.aidl deleted file mode 100644 index 480e86b73ea9..000000000000 --- a/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEventDescriptor.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * - * Copyright 2019, 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.ims; - -parcelable RcsGroupThreadNameChangedEventDescriptor; diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEventDescriptor.java b/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEventDescriptor.java deleted file mode 100644 index f9ccdd53f0a2..000000000000 --- a/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEventDescriptor.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import static com.android.internal.annotations.VisibleForTesting.Visibility.PROTECTED; - -import android.annotation.NonNull; -import android.annotation.Nullable; -import android.os.Parcel; - -import com.android.internal.annotations.VisibleForTesting; - -/** - * @hide - used only for internal communication with the ircs service - */ -public class RcsGroupThreadNameChangedEventDescriptor extends RcsGroupThreadEventDescriptor { - private final String mNewName; - - public RcsGroupThreadNameChangedEventDescriptor(long timestamp, int rcsGroupThreadId, - int originatingParticipantId, @Nullable String newName) { - super(timestamp, rcsGroupThreadId, originatingParticipantId); - mNewName = newName; - } - - @Override - @VisibleForTesting(visibility = PROTECTED) - public RcsGroupThreadNameChangedEvent createRcsEvent(RcsControllerCall rcsControllerCall) { - return new RcsGroupThreadNameChangedEvent( - mTimestamp, - new RcsGroupThread(rcsControllerCall, mRcsGroupThreadId), - new RcsParticipant(rcsControllerCall, mOriginatingParticipantId), - mNewName); - } - - public static final @NonNull Creator<RcsGroupThreadNameChangedEventDescriptor> CREATOR = - new Creator<RcsGroupThreadNameChangedEventDescriptor>() { - @Override - public RcsGroupThreadNameChangedEventDescriptor createFromParcel(Parcel in) { - return new RcsGroupThreadNameChangedEventDescriptor(in); - } - - @Override - public RcsGroupThreadNameChangedEventDescriptor[] newArray(int size) { - return new RcsGroupThreadNameChangedEventDescriptor[size]; - } - }; - - protected RcsGroupThreadNameChangedEventDescriptor(Parcel in) { - super(in); - mNewName = in.readString(); - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - super.writeToParcel(dest, flags); - dest.writeString(mNewName); - } -} diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEvent.java b/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEvent.java deleted file mode 100644 index 694c7de96eee..000000000000 --- a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 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 android.telephony.ims; - -import android.annotation.NonNull; - -/** - * An event that indicates an RCS participant has joined an {@link RcsThread}. Please see US6-3 - - * GSMA RCC.71 (RCS Universal Profile Service Definition Document) - * - * @hide - */ -public final class RcsGroupThreadParticipantJoinedEvent extends RcsGroupThreadEvent { - private final RcsParticipant mJoinedParticipantId; - - /** - * Creates a new {@link RcsGroupThreadParticipantJoinedEvent}. This event is not persisted into - * storage until {@link RcsMessageStore#persistRcsEvent(RcsEvent)} is called. - * - * @param timestamp The timestamp of when this event happened, in milliseconds - * passed after - * midnight, January 1st, 1970 UTC - * @param rcsGroupThread The {@link RcsGroupThread} that this event happened on - * @param originatingParticipant The {@link RcsParticipant} that added or invited the new - * {@link RcsParticipant} into the {@link RcsGroupThread} - * @param joinedParticipant The new {@link RcsParticipant} that joined the - * {@link RcsGroupThread} - * @see RcsMessageStore#persistRcsEvent(RcsEvent) - */ - public RcsGroupThreadParticipantJoinedEvent(long timestamp, - @NonNull RcsGroupThread rcsGroupThread, @NonNull RcsParticipant originatingParticipant, - @NonNull RcsParticipant joinedParticipant) { - super(timestamp, rcsGroupThread, originatingParticipant); - mJoinedParticipantId = joinedParticipant; - } - - /** - * @return Returns the {@link RcsParticipant} that joined the associated {@link RcsGroupThread} - */ - public RcsParticipant getJoinedParticipant() { - return mJoinedParticipantId; - } - - /** - * Persists the event to the data store. - * - * @hide - not meant for public use. - */ - @Override - void persist(RcsControllerCall rcsControllerCall) throws RcsMessageStoreException { - rcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.createGroupThreadParticipantJoinedEvent( - getTimestamp(), - getRcsGroupThread().getThreadId(), getOriginatingParticipant().getId(), - getJoinedParticipant().getId(), callingPackage)); - } -} diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEventDescriptor.aidl b/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEventDescriptor.aidl deleted file mode 100644 index 7210b9f2fab1..000000000000 --- a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEventDescriptor.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * - * 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 android.telephony.ims; - -parcelable RcsGroupThreadParticipantJoinedEventDescriptor; diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEventDescriptor.java b/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEventDescriptor.java deleted file mode 100644 index 4a6803ebc52c..000000000000 --- a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEventDescriptor.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import static com.android.internal.annotations.VisibleForTesting.Visibility.PROTECTED; - -import android.annotation.NonNull; -import android.os.Parcel; - -import com.android.internal.annotations.VisibleForTesting; - -/** - * @hide - used only for internal communication with the ircs service - */ -public class RcsGroupThreadParticipantJoinedEventDescriptor extends RcsGroupThreadEventDescriptor { - private final int mJoinedParticipantId; - - public RcsGroupThreadParticipantJoinedEventDescriptor(long timestamp, int rcsGroupThreadId, - int originatingParticipantId, int joinedParticipantId) { - super(timestamp, rcsGroupThreadId, originatingParticipantId); - mJoinedParticipantId = joinedParticipantId; - } - - @Override - @VisibleForTesting(visibility = PROTECTED) - public RcsGroupThreadParticipantJoinedEvent createRcsEvent( - RcsControllerCall rcsControllerCall) { - return new RcsGroupThreadParticipantJoinedEvent( - mTimestamp, - new RcsGroupThread(rcsControllerCall, mRcsGroupThreadId), - new RcsParticipant(rcsControllerCall, mOriginatingParticipantId), - new RcsParticipant(rcsControllerCall, mJoinedParticipantId)); - } - - public static final @NonNull Creator<RcsGroupThreadParticipantJoinedEventDescriptor> CREATOR = - new Creator<RcsGroupThreadParticipantJoinedEventDescriptor>() { - @Override - public RcsGroupThreadParticipantJoinedEventDescriptor createFromParcel(Parcel in) { - return new RcsGroupThreadParticipantJoinedEventDescriptor(in); - } - - @Override - public RcsGroupThreadParticipantJoinedEventDescriptor[] newArray(int size) { - return new RcsGroupThreadParticipantJoinedEventDescriptor[size]; - } - }; - - protected RcsGroupThreadParticipantJoinedEventDescriptor(Parcel in) { - super(in); - mJoinedParticipantId = in.readInt(); - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - super.writeToParcel(dest, flags); - dest.writeInt(mJoinedParticipantId); - } -} diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEvent.java b/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEvent.java deleted file mode 100644 index fec4354a293a..000000000000 --- a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEvent.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 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 android.telephony.ims; - -import android.annotation.NonNull; - -/** - * An event that indicates an RCS participant has left an {@link RcsThread}. Please see US6-23 - - * GSMA RCC.71 (RCS Universal Profile Service Definition Document) - * - * @hide - */ -public final class RcsGroupThreadParticipantLeftEvent extends RcsGroupThreadEvent { - private RcsParticipant mLeavingParticipant; - - /** - * Creates a new {@link RcsGroupThreadParticipantLeftEvent}. his event is not persisted into - * storage until {@link RcsMessageStore#persistRcsEvent(RcsEvent)} is called. - * - * @param timestamp The timestamp of when this event happened, in milliseconds passed after - * midnight, January 1st, 1970 UTC - * @param rcsGroupThread The {@link RcsGroupThread} that this event happened on - * @param originatingParticipant The {@link RcsParticipant} that removed the - * {@link RcsParticipant} from the {@link RcsGroupThread}. It is - * possible that originatingParticipant and leavingParticipant are - * the same (i.e. {@link RcsParticipant} left the group - * themselves) - * @param leavingParticipant The {@link RcsParticipant} that left the {@link RcsGroupThread} - * @see RcsMessageStore#persistRcsEvent(RcsEvent) - */ - public RcsGroupThreadParticipantLeftEvent(long timestamp, - @NonNull RcsGroupThread rcsGroupThread, @NonNull RcsParticipant originatingParticipant, - @NonNull RcsParticipant leavingParticipant) { - super(timestamp, rcsGroupThread, originatingParticipant); - mLeavingParticipant = leavingParticipant; - } - - /** - * @return Returns the {@link RcsParticipant} that left the associated {@link RcsGroupThread} - * after this {@link RcsGroupThreadParticipantLeftEvent} happened. - */ - @NonNull - public RcsParticipant getLeavingParticipant() { - return mLeavingParticipant; - } - - @Override - void persist(RcsControllerCall rcsControllerCall) throws RcsMessageStoreException { - rcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.createGroupThreadParticipantLeftEvent(getTimestamp(), - getRcsGroupThread().getThreadId(), getOriginatingParticipant().getId(), - getLeavingParticipant().getId(), callingPackage)); - } -} diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEventDescriptor.aidl b/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEventDescriptor.aidl deleted file mode 100644 index 3ef921001ce7..000000000000 --- a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEventDescriptor.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * - * 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 android.telephony.ims; - -parcelable RcsGroupThreadParticipantLeftEventDescriptor; diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEventDescriptor.java b/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEventDescriptor.java deleted file mode 100644 index 9b1085c3d178..000000000000 --- a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEventDescriptor.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import static com.android.internal.annotations.VisibleForTesting.Visibility.PROTECTED; - -import android.annotation.NonNull; -import android.os.Parcel; -import android.os.Parcelable; - -import com.android.internal.annotations.VisibleForTesting; - -/** - * @hide - used only for internal communication with the ircs service - */ -public class RcsGroupThreadParticipantLeftEventDescriptor extends RcsGroupThreadEventDescriptor { - private int mLeavingParticipantId; - - public RcsGroupThreadParticipantLeftEventDescriptor(long timestamp, int rcsGroupThreadId, - int originatingParticipantId, int leavingParticipantId) { - super(timestamp, rcsGroupThreadId, originatingParticipantId); - mLeavingParticipantId = leavingParticipantId; - } - - @Override - @VisibleForTesting(visibility = PROTECTED) - public RcsGroupThreadParticipantLeftEvent createRcsEvent(RcsControllerCall rcsControllerCall) { - return new RcsGroupThreadParticipantLeftEvent( - mTimestamp, - new RcsGroupThread(rcsControllerCall, mRcsGroupThreadId), - new RcsParticipant(rcsControllerCall, mOriginatingParticipantId), - new RcsParticipant(rcsControllerCall, mLeavingParticipantId)); - } - - @NonNull - public static final Parcelable.Creator<RcsGroupThreadParticipantLeftEventDescriptor> CREATOR = - new Creator<RcsGroupThreadParticipantLeftEventDescriptor>() { - @Override - public RcsGroupThreadParticipantLeftEventDescriptor createFromParcel(Parcel in) { - return new RcsGroupThreadParticipantLeftEventDescriptor(in); - } - - @Override - public RcsGroupThreadParticipantLeftEventDescriptor[] newArray(int size) { - return new RcsGroupThreadParticipantLeftEventDescriptor[size]; - } - }; - - protected RcsGroupThreadParticipantLeftEventDescriptor(Parcel in) { - super(in); - mLeavingParticipantId = in.readInt(); - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - super.writeToParcel(dest, flags); - dest.writeInt(mLeavingParticipantId); - } -} diff --git a/telephony/java/android/telephony/ims/RcsIncomingMessage.java b/telephony/java/android/telephony/ims/RcsIncomingMessage.java deleted file mode 100644 index 2810a49927c5..000000000000 --- a/telephony/java/android/telephony/ims/RcsIncomingMessage.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.annotation.WorkerThread; - -/** - * This is a single instance of a message received over RCS. - * - * @hide - */ -public class RcsIncomingMessage extends RcsMessage { - /** - * @hide - */ - RcsIncomingMessage(RcsControllerCall rcsControllerCall, int id) { - super(rcsControllerCall, id); - } - - /** - * Sets the timestamp of arrival for this message and persists into storage. The timestamp is - * defined as milliseconds passed after midnight, January 1, 1970 UTC - * - * @param arrivalTimestamp The timestamp to set to. - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setArrivalTimestamp(long arrivalTimestamp) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setMessageArrivalTimestamp(mId, true, - arrivalTimestamp, callingPackage)); - } - - /** - * @return Returns the timestamp of arrival for this message. The timestamp is defined as - * milliseconds passed after midnight, January 1, 1970 UTC - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public long getArrivalTimestamp() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getMessageArrivalTimestamp(mId, true, - callingPackage)); - } - - /** - * Sets the timestamp of when the user saw this message and persists into storage. The timestamp - * is defined as milliseconds passed after midnight, January 1, 1970 UTC - * - * @param notifiedTimestamp The timestamp to set to. - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setSeenTimestamp(long notifiedTimestamp) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setMessageSeenTimestamp(mId, true, notifiedTimestamp, - callingPackage)); - } - - /** - * @return Returns the timestamp of when the user saw this message. The timestamp is defined as - * milliseconds passed after midnight, January 1, 1970 UTC - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public long getSeenTimestamp() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getMessageSeenTimestamp(mId, true, callingPackage)); - } - - /** - * @return Returns the sender of this incoming message. - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public RcsParticipant getSenderParticipant() throws RcsMessageStoreException { - return new RcsParticipant( - mRcsControllerCall, - mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getSenderParticipant(mId, callingPackage))); - } - - /** - * @return Returns {@code true} as this is an incoming message - */ - @Override - public boolean isIncoming() { - return true; - } -} diff --git a/telephony/java/android/telephony/ims/RcsIncomingMessageCreationParams.aidl b/telephony/java/android/telephony/ims/RcsIncomingMessageCreationParams.aidl deleted file mode 100644 index 1f1d4f68213a..000000000000 --- a/telephony/java/android/telephony/ims/RcsIncomingMessageCreationParams.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * - * Copyright 2019, 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.ims; - -parcelable RcsIncomingMessageCreationParams; diff --git a/telephony/java/android/telephony/ims/RcsIncomingMessageCreationParams.java b/telephony/java/android/telephony/ims/RcsIncomingMessageCreationParams.java deleted file mode 100644 index d95dc4fda3e3..000000000000 --- a/telephony/java/android/telephony/ims/RcsIncomingMessageCreationParams.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.annotation.CheckResult; -import android.annotation.NonNull; -import android.os.Parcel; -import android.os.Parcelable; - -/** - * {@link RcsIncomingMessageCreationParams} is a collection of parameters that should be passed - * into {@link RcsThread#addIncomingMessage(RcsIncomingMessageCreationParams)} to generate an - * {@link RcsIncomingMessage} on that {@link RcsThread} - * - * @hide - */ -public final class RcsIncomingMessageCreationParams extends RcsMessageCreationParams implements - Parcelable { - // The arrival timestamp for the RcsIncomingMessage to be created - private final long mArrivalTimestamp; - // The seen timestamp for the RcsIncomingMessage to be created - private final long mSeenTimestamp; - // The participant that sent this incoming message - private final int mSenderParticipantId; - - /** - * Builder to help create an {@link RcsIncomingMessageCreationParams} - * - * @see RcsThread#addIncomingMessage(RcsIncomingMessageCreationParams) - */ - public static class Builder extends RcsMessageCreationParams.Builder { - private RcsParticipant mSenderParticipant; - private long mArrivalTimestamp; - private long mSeenTimestamp; - - /** - * Creates a {@link Builder} to create an instance of - * {@link RcsIncomingMessageCreationParams} - * - * @param originationTimestamp The timestamp of {@link RcsMessage} creation. The origination - * timestamp value in milliseconds passed after midnight, - * January 1, 1970 UTC - * @param arrivalTimestamp The timestamp of arrival, defined as milliseconds passed after - * midnight, January 1, 1970 UTC - * @param subscriptionId The subscription ID that was used to send or receive this - * {@link RcsMessage} - */ - public Builder(long originationTimestamp, long arrivalTimestamp, int subscriptionId) { - super(originationTimestamp, subscriptionId); - mArrivalTimestamp = arrivalTimestamp; - } - - /** - * Sets the {@link RcsParticipant} that send this {@link RcsIncomingMessage} - * - * @param senderParticipant The {@link RcsParticipant} that sent this - * {@link RcsIncomingMessage} - * @return The same instance of {@link Builder} to chain methods. - */ - @CheckResult - public Builder setSenderParticipant(RcsParticipant senderParticipant) { - mSenderParticipant = senderParticipant; - return this; - } - - /** - * Sets the time of the arrival of this {@link RcsIncomingMessage} - - * @return The same instance of {@link Builder} to chain methods. - * @see RcsIncomingMessage#setArrivalTimestamp(long) - */ - @CheckResult - public Builder setArrivalTimestamp(long arrivalTimestamp) { - mArrivalTimestamp = arrivalTimestamp; - return this; - } - - /** - * Sets the time of the when this user saw the {@link RcsIncomingMessage} - * @param seenTimestamp The seen timestamp , defined as milliseconds passed after midnight, - * January 1, 1970 UTC - * @return The same instance of {@link Builder} to chain methods. - * @see RcsIncomingMessage#setSeenTimestamp(long) - */ - @CheckResult - public Builder setSeenTimestamp(long seenTimestamp) { - mSeenTimestamp = seenTimestamp; - return this; - } - - /** - * Creates parameters for creating a new incoming message. - * @return A new instance of {@link RcsIncomingMessageCreationParams} to create a new - * {@link RcsIncomingMessage} - */ - public RcsIncomingMessageCreationParams build() { - return new RcsIncomingMessageCreationParams(this); - } - } - - private RcsIncomingMessageCreationParams(Builder builder) { - super(builder); - mArrivalTimestamp = builder.mArrivalTimestamp; - mSeenTimestamp = builder.mSeenTimestamp; - mSenderParticipantId = builder.mSenderParticipant.getId(); - } - - private RcsIncomingMessageCreationParams(Parcel in) { - super(in); - mArrivalTimestamp = in.readLong(); - mSeenTimestamp = in.readLong(); - mSenderParticipantId = in.readInt(); - } - - /** - * @return Returns the arrival timestamp for the {@link RcsIncomingMessage} to be created. - * Timestamp is defined as milliseconds passed after midnight, January 1, 1970 UTC - */ - public long getArrivalTimestamp() { - return mArrivalTimestamp; - } - - /** - * @return Returns the seen timestamp for the {@link RcsIncomingMessage} to be created. - * Timestamp is defined as milliseconds passed after midnight, January 1, 1970 UTC - */ - public long getSeenTimestamp() { - return mSeenTimestamp; - } - - /** - * Helper getter for {@link com.android.internal.telephony.ims.RcsMessageStoreController} to - * create {@link RcsIncomingMessage}s - * - * Since the API doesn't expose any ID's to API users, this should be hidden. - * @hide - */ - public int getSenderParticipantId() { - return mSenderParticipantId; - } - - public static final @NonNull Creator<RcsIncomingMessageCreationParams> CREATOR = - new Creator<RcsIncomingMessageCreationParams>() { - @Override - public RcsIncomingMessageCreationParams createFromParcel(Parcel in) { - return new RcsIncomingMessageCreationParams(in); - } - - @Override - public RcsIncomingMessageCreationParams[] newArray(int size) { - return new RcsIncomingMessageCreationParams[size]; - } - }; - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - super.writeToParcel(dest); - dest.writeLong(mArrivalTimestamp); - dest.writeLong(mSeenTimestamp); - dest.writeInt(mSenderParticipantId); - } -} diff --git a/telephony/java/android/telephony/ims/RcsMessage.java b/telephony/java/android/telephony/ims/RcsMessage.java deleted file mode 100644 index 4601bfd0ff2c..000000000000 --- a/telephony/java/android/telephony/ims/RcsMessage.java +++ /dev/null @@ -1,358 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.annotation.IntDef; -import android.annotation.NonNull; -import android.annotation.WorkerThread; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -/** - * This is a single instance of a message sent or received over RCS. - * - * @hide - */ -public abstract class RcsMessage { - /** - * The value to indicate that this {@link RcsMessage} does not have any location information. - */ - public static final double LOCATION_NOT_SET = Double.MIN_VALUE; - - /** - * The status to indicate that this {@link RcsMessage}s status is not set yet. - */ - public static final int NOT_SET = 0; - - /** - * The status to indicate that this {@link RcsMessage} is a draft and is not in the process of - * sending yet. - */ - public static final int DRAFT = 1; - - /** - * The status to indicate that this {@link RcsMessage} was successfully sent. - */ - public static final int QUEUED = 2; - - /** - * The status to indicate that this {@link RcsMessage} is actively being sent. - */ - public static final int SENDING = 3; - - /** - * The status to indicate that this {@link RcsMessage} was successfully sent. - */ - public static final int SENT = 4; - - /** - * The status to indicate that this {@link RcsMessage} failed to send in an attempt before, and - * now being retried. - */ - public static final int RETRYING = 5; - - /** - * The status to indicate that this {@link RcsMessage} has permanently failed to send. - */ - public static final int FAILED = 6; - - /** - * The status to indicate that this {@link RcsMessage} was successfully received. - */ - public static final int RECEIVED = 7; - - /** - * The status to indicate that this {@link RcsMessage} was seen. - */ - public static final int SEEN = 9; - - /** - * @hide - */ - protected final RcsControllerCall mRcsControllerCall; - - /** - * @hide - */ - protected final int mId; - - @IntDef({ - DRAFT, QUEUED, SENDING, SENT, RETRYING, FAILED, RECEIVED, SEEN - }) - @Retention(RetentionPolicy.SOURCE) - public @interface RcsMessageStatus { - } - - RcsMessage(RcsControllerCall rcsControllerCall, int id) { - mRcsControllerCall = rcsControllerCall; - mId = id; - } - - /** - * Returns the row Id from the common message. - * - * @hide - */ - public int getId() { - return mId; - } - - /** - * @return Returns the subscription ID that this {@link RcsMessage} was sent from, or delivered - * to. - * @throws RcsMessageStoreException if the value could not be read from the storage - * @see android.telephony.SubscriptionInfo#getSubscriptionId - */ - public int getSubscriptionId() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getMessageSubId(mId, isIncoming(), callingPackage)); - } - - /** - * Sets the subscription ID that this {@link RcsMessage} was sent from, or delivered to and - * persists it into storage. - * - * @param subId The subscription ID to persists into storage. - * @throws RcsMessageStoreException if the value could not be persisted into storage - * @see android.telephony.SubscriptionInfo#getSubscriptionId - */ - @WorkerThread - public void setSubscriptionId(int subId) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setMessageSubId(mId, isIncoming(), subId, - callingPackage)); - } - - /** - * Sets the status of this message and persists it into storage. Please see - * {@link RcsFileTransferPart#setFileTransferStatus(int)} to set statuses around file transfers. - * - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setStatus(@RcsMessageStatus int rcsMessageStatus) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setMessageStatus(mId, isIncoming(), rcsMessageStatus, - callingPackage)); - } - - /** - * @return Returns the status of this message. Please see - * {@link RcsFileTransferPart#setFileTransferStatus(int)} to set statuses around file transfers. - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public @RcsMessageStatus int getStatus() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getMessageStatus(mId, isIncoming(), callingPackage)); - } - - /** - * Sets the origination timestamp of this message and persists it into storage. Origination is - * defined as when the sender tapped the send button. - * - * @param timestamp The origination timestamp value in milliseconds passed after midnight, - * January 1, 1970 UTC - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setOriginationTimestamp(long timestamp) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setMessageOriginationTimestamp(mId, isIncoming(), - timestamp, callingPackage)); - } - - /** - * @return Returns the origination timestamp of this message in milliseconds passed after - * midnight, January 1, 1970 UTC. Origination is defined as when the sender tapped the send - * button. - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public long getOriginationTimestamp() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getMessageOriginationTimestamp(mId, isIncoming(), - callingPackage)); - } - - /** - * Sets the globally unique RCS message identifier for this message and persists it into - * storage. This function does not confirm that this message id is unique. Please see 4.4.5.2 - * - GSMA RCC.53 (RCS Device API 1.6 Specification - * - * @param rcsMessageGlobalId The globally RCS message identifier - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setRcsMessageId(String rcsMessageGlobalId) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setGlobalMessageIdForMessage(mId, isIncoming(), - rcsMessageGlobalId, callingPackage)); - } - - /** - * @return Returns the globally unique RCS message identifier for this message. Please see - * 4.4.5.2 - GSMA RCC.53 (RCS Device API 1.6 Specification - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public String getRcsMessageId() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getGlobalMessageIdForMessage(mId, isIncoming(), - callingPackage)); - } - - /** - * @return Returns the user visible text included in this message. - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public String getText() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getTextForMessage(mId, isIncoming(), - callingPackage)); - } - - /** - * Sets the user visible text for this message and persists in storage. - * - * @param text The text this message now has - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setText(String text) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setTextForMessage(mId, isIncoming(), text, - callingPackage)); - } - - /** - * @return Returns the associated latitude for this message, or - * {@link RcsMessage#LOCATION_NOT_SET} if it does not contain a location. - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public double getLatitude() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getLatitudeForMessage(mId, isIncoming(), - callingPackage)); - } - - /** - * Sets the latitude for this message and persists in storage. - * - * @param latitude The latitude for this location message. - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setLatitude(double latitude) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setLatitudeForMessage(mId, isIncoming(), latitude, - callingPackage)); - } - - /** - * @return Returns the associated longitude for this message, or - * {@link RcsMessage#LOCATION_NOT_SET} if it does not contain a location. - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public double getLongitude() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getLongitudeForMessage(mId, isIncoming(), - callingPackage)); - } - - /** - * Sets the longitude for this message and persists in storage. - * - * @param longitude The longitude for this location message. - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setLongitude(double longitude) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setLongitudeForMessage(mId, isIncoming(), longitude, - callingPackage)); - } - - /** - * Attaches an {@link RcsFileTransferPart} to this message and persists into storage. - * - * @param fileTransferCreationParameters The parameters to be used to create the - * {@link RcsFileTransferPart} - * @return A new instance of {@link RcsFileTransferPart} - * @throws RcsMessageStoreException if the file transfer could not be persisted into storage. - */ - @NonNull - @WorkerThread - public RcsFileTransferPart insertFileTransfer( - RcsFileTransferCreationParams fileTransferCreationParameters) - throws RcsMessageStoreException { - return new RcsFileTransferPart(mRcsControllerCall, mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.storeFileTransfer(mId, isIncoming(), - fileTransferCreationParameters, callingPackage))); - } - - /** - * @return Returns all the {@link RcsFileTransferPart}s associated with this message in an - * unmodifiable set. - * @throws RcsMessageStoreException if the file transfers could not be read from the storage - */ - @NonNull - @WorkerThread - public Set<RcsFileTransferPart> getFileTransferParts() throws RcsMessageStoreException { - Set<RcsFileTransferPart> fileTransferParts = new HashSet<>(); - - int[] fileTransferIds = mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getFileTransfersAttachedToMessage(mId, isIncoming(), - callingPackage)); - - for (int fileTransfer : fileTransferIds) { - fileTransferParts.add(new RcsFileTransferPart(mRcsControllerCall, fileTransfer)); - } - - return Collections.unmodifiableSet(fileTransferParts); - } - - /** - * Removes a {@link RcsFileTransferPart} from this message, and deletes it in storage. - * - * @param fileTransferPart The part to delete. - * @throws RcsMessageStoreException if the file transfer could not be removed from storage - */ - @WorkerThread - public void removeFileTransferPart(@NonNull RcsFileTransferPart fileTransferPart) - throws RcsMessageStoreException { - if (fileTransferPart == null) { - return; - } - - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.deleteFileTransfer(fileTransferPart.getId(), - callingPackage)); - } - - /** - * @return Returns {@code true} if this message was received on this device, {@code false} if it - * was sent. - */ - public abstract boolean isIncoming(); -} diff --git a/telephony/java/android/telephony/ims/RcsMessageCreationParams.java b/telephony/java/android/telephony/ims/RcsMessageCreationParams.java deleted file mode 100644 index f0eea88ac8a9..000000000000 --- a/telephony/java/android/telephony/ims/RcsMessageCreationParams.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import static android.telephony.ims.RcsMessage.LOCATION_NOT_SET; - -import android.annotation.CheckResult; -import android.annotation.Nullable; -import android.os.Parcel; - -/** - * The collection of parameters to be passed into - * {@link RcsThread#addIncomingMessage(RcsIncomingMessageCreationParams)} and - * {@link RcsThread#addOutgoingMessage(RcsOutgoingMessageCreationParams)} to create and persist - * {@link RcsMessage}s on an {@link RcsThread} - * - * @hide - */ -public class RcsMessageCreationParams { - // The globally unique id of the RcsMessage to be created. - private final String mRcsMessageGlobalId; - - // The subscription that this message was/will be received/sent from. - private final int mSubId; - // The sending/receiving status of the message - private final @RcsMessage.RcsMessageStatus int mMessageStatus; - // The timestamp of message creation - private final long mOriginationTimestamp; - // The user visible content of the message - private final String mText; - // The latitude of the message if this is a location message - private final double mLatitude; - // The longitude of the message if this is a location message - private final double mLongitude; - - /** - * @return Returns the globally unique RCS Message ID for the {@link RcsMessage} to be created. - * Please see 4.4.5.2 - GSMA RCC.53 (RCS Device API 1.6 Specification - */ - @Nullable - public String getRcsMessageGlobalId() { - return mRcsMessageGlobalId; - } - - /** - * @return Returns the subscription ID that was used to send or receive the {@link RcsMessage} - * to be created. - */ - public int getSubId() { - return mSubId; - } - - /** - * @return Returns the status for the {@link RcsMessage} to be created. - * @see RcsMessage.RcsMessageStatus - */ - public int getMessageStatus() { - return mMessageStatus; - } - - /** - * @return Returns the origination timestamp of the {@link RcsMessage} to be created in - * milliseconds passed after midnight, January 1, 1970 UTC. Origination is defined as when - * the sender tapped the send button. - */ - public long getOriginationTimestamp() { - return mOriginationTimestamp; - } - - /** - * @return Returns the user visible text contained in the {@link RcsMessage} to be created - */ - @Nullable - public String getText() { - return mText; - } - - /** - * @return Returns the latitude of the {@link RcsMessage} to be created, or - * {@link RcsMessage#LOCATION_NOT_SET} if the message does not contain a location. - */ - public double getLatitude() { - return mLatitude; - } - - /** - * @return Returns the longitude of the {@link RcsMessage} to be created, or - * {@link RcsMessage#LOCATION_NOT_SET} if the message does not contain a location. - */ - public double getLongitude() { - return mLongitude; - } - - /** - * The base builder for creating {@link RcsMessage}s on {@link RcsThread}s. - * - * @see RcsIncomingMessageCreationParams - */ - public static class Builder { - private String mRcsMessageGlobalId; - private int mSubId; - private @RcsMessage.RcsMessageStatus int mMessageStatus; - private long mOriginationTimestamp; - private String mText; - private double mLatitude = LOCATION_NOT_SET; - private double mLongitude = LOCATION_NOT_SET; - - /** - * @hide - */ - public Builder(long originationTimestamp, int subscriptionId) { - mOriginationTimestamp = originationTimestamp; - mSubId = subscriptionId; - } - - /** - * Sets the status of the {@link RcsMessage} to be built. - * - * @param rcsMessageStatus The status to be set - * @return The same instance of {@link Builder} to chain methods - * @see RcsMessage#setStatus(int) - */ - @CheckResult - public Builder setStatus(@RcsMessage.RcsMessageStatus int rcsMessageStatus) { - mMessageStatus = rcsMessageStatus; - return this; - } - - /** - * Sets the globally unique RCS message identifier for the {@link RcsMessage} to be built. - * This function does not confirm that this message id is unique. Please see 4.4.5.2 - GSMA - * RCC.53 (RCS Device API 1.6 Specification) - * - * @param rcsMessageId The ID to be set - * @return The same instance of {@link Builder} to chain methods - * @see RcsMessage#setRcsMessageId(String) - */ - @CheckResult - public Builder setRcsMessageId(String rcsMessageId) { - mRcsMessageGlobalId = rcsMessageId; - return this; - } - - /** - * Sets the text of the {@link RcsMessage} to be built. - * - * @param text The user visible text of the message - * @return The same instance of {@link Builder} to chain methods - * @see RcsMessage#setText(String) - */ - @CheckResult - public Builder setText(String text) { - mText = text; - return this; - } - - /** - * Sets the latitude of the {@link RcsMessage} to be built. Please see US5-24 - GSMA RCC.71 - * (RCS Universal Profile Service Definition Document) - * - * @param latitude The latitude of the location information associated with this message. - * @return The same instance of {@link Builder} to chain methods - * @see RcsMessage#setLatitude(double) - */ - @CheckResult - public Builder setLatitude(double latitude) { - mLatitude = latitude; - return this; - } - - /** - * Sets the longitude of the {@link RcsMessage} to be built. Please see US5-24 - GSMA RCC.71 - * (RCS Universal Profile Service Definition Document) - * - * @param longitude The longitude of the location information associated with this message. - * @return The same instance of {@link Builder} to chain methods - * @see RcsMessage#setLongitude(double) - */ - @CheckResult - public Builder setLongitude(double longitude) { - mLongitude = longitude; - return this; - } - - /** - * @return Builds and returns a newly created {@link RcsMessageCreationParams} - */ - public RcsMessageCreationParams build() { - return new RcsMessageCreationParams(this); - } - } - - protected RcsMessageCreationParams(Builder builder) { - mRcsMessageGlobalId = builder.mRcsMessageGlobalId; - mSubId = builder.mSubId; - mMessageStatus = builder.mMessageStatus; - mOriginationTimestamp = builder.mOriginationTimestamp; - mText = builder.mText; - mLatitude = builder.mLatitude; - mLongitude = builder.mLongitude; - } - - /** - * @hide - */ - RcsMessageCreationParams(Parcel in) { - mRcsMessageGlobalId = in.readString(); - mSubId = in.readInt(); - mMessageStatus = in.readInt(); - mOriginationTimestamp = in.readLong(); - mText = in.readString(); - mLatitude = in.readDouble(); - mLongitude = in.readDouble(); - } - - /** - * @hide - */ - public void writeToParcel(Parcel dest) { - dest.writeString(mRcsMessageGlobalId); - dest.writeInt(mSubId); - dest.writeInt(mMessageStatus); - dest.writeLong(mOriginationTimestamp); - dest.writeString(mText); - dest.writeDouble(mLatitude); - dest.writeDouble(mLongitude); - } -} diff --git a/telephony/java/android/telephony/ims/RcsMessageManager.java b/telephony/java/android/telephony/ims/RcsMessageManager.java deleted file mode 100644 index a1c7c0fefab2..000000000000 --- a/telephony/java/android/telephony/ims/RcsMessageManager.java +++ /dev/null @@ -1,281 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.annotation.NonNull; -import android.annotation.Nullable; -import android.annotation.SystemService; -import android.annotation.WorkerThread; -import android.content.Context; -import android.net.Uri; - -import java.util.List; - -/** - * RcsMessageManager is the application interface to RcsProvider and provides access methods to - * RCS related database tables. - * - * @hide - */ -@SystemService(Context.TELEPHONY_RCS_MESSAGE_SERVICE) -public class RcsMessageManager { - RcsControllerCall mRcsControllerCall; - - /** - * Use {@link Context#getSystemService(String)} to get an instance of this service. - * @hide - */ - public RcsMessageManager(Context context) { - mRcsControllerCall = new RcsControllerCall(context); - } - - /** - * Returns the first chunk of existing {@link RcsThread}s in the common storage. - * - * @param queryParameters Parameters to specify to return a subset of all RcsThreads. - * Passing a value of null will return all threads. - * @throws RcsMessageStoreException if the query could not be completed on the storage - */ - @WorkerThread - @NonNull - public RcsThreadQueryResult getRcsThreads(@Nullable RcsThreadQueryParams queryParameters) - throws RcsMessageStoreException { - return new RcsThreadQueryResult(mRcsControllerCall, - mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getRcsThreads(queryParameters, - callingPackage))); - } - - /** - * Returns the next chunk of {@link RcsThread}s in the common storage. - * - * @param continuationToken A token to continue the query to get the next chunk. This is - * obtained through {@link RcsThreadQueryResult#getContinuationToken}. - * @throws RcsMessageStoreException if the query could not be completed on the storage - */ - @WorkerThread - @NonNull - public RcsThreadQueryResult getRcsThreads(@NonNull RcsQueryContinuationToken continuationToken) - throws RcsMessageStoreException { - return new RcsThreadQueryResult(mRcsControllerCall, - mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getRcsThreadsWithToken(continuationToken, - callingPackage))); - } - - /** - * Returns the first chunk of existing {@link RcsParticipant}s in the common storage. - * - * @param queryParameters Parameters to specify to return a subset of all RcsParticipants. - * Passing a value of null will return all participants. - * @throws RcsMessageStoreException if the query could not be completed on the storage - */ - @WorkerThread - @NonNull - public RcsParticipantQueryResult getRcsParticipants( - @Nullable RcsParticipantQueryParams queryParameters) - throws RcsMessageStoreException { - return new RcsParticipantQueryResult(mRcsControllerCall, - mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getParticipants(queryParameters, - callingPackage))); - } - - /** - * Returns the next chunk of {@link RcsParticipant}s in the common storage. - * - * @param continuationToken A token to continue the query to get the next chunk. This is - * obtained through - * {@link RcsParticipantQueryResult#getContinuationToken} - * @throws RcsMessageStoreException if the query could not be completed on the storage - */ - @WorkerThread - @NonNull - public RcsParticipantQueryResult getRcsParticipants( - @NonNull RcsQueryContinuationToken continuationToken) - throws RcsMessageStoreException { - return new RcsParticipantQueryResult(mRcsControllerCall, - mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getParticipantsWithToken(continuationToken, - callingPackage))); - } - - /** - * Returns the first chunk of existing {@link RcsMessage}s in the common storage. - * - * @param queryParams Parameters to specify to return a subset of all RcsMessages. - * Passing a value of null will return all messages. - * @throws RcsMessageStoreException if the query could not be completed on the storage - */ - @WorkerThread - @NonNull - public RcsMessageQueryResult getRcsMessages( - @Nullable RcsMessageQueryParams queryParams) throws RcsMessageStoreException { - return new RcsMessageQueryResult(mRcsControllerCall, - mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getMessages(queryParams, callingPackage))); - } - - /** - * Returns the next chunk of {@link RcsMessage}s in the common storage. - * - * @param continuationToken A token to continue the query to get the next chunk. This is - * obtained through {@link RcsMessageQueryResult#getContinuationToken} - * @throws RcsMessageStoreException if the query could not be completed on the storage - */ - @WorkerThread - @NonNull - public RcsMessageQueryResult getRcsMessages( - @NonNull RcsQueryContinuationToken continuationToken) throws RcsMessageStoreException { - return new RcsMessageQueryResult(mRcsControllerCall, - mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getMessagesWithToken(continuationToken, - callingPackage))); - } - - /** - * Returns the first chunk of existing {@link RcsEvent}s in the common storage. - * - * @param queryParams Parameters to specify to return a subset of all RcsEvents. - * Passing a value of null will return all events. - * @throws RcsMessageStoreException if the query could not be completed on the storage - */ - @WorkerThread - @NonNull - public RcsEventQueryResult getRcsEvents( - @Nullable RcsEventQueryParams queryParams) throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getEvents(queryParams, callingPackage)) - .getRcsEventQueryResult(mRcsControllerCall); - } - - /** - * Returns the next chunk of {@link RcsEvent}s in the common storage. - * - * @param continuationToken A token to continue the query to get the next chunk. This is - * obtained through {@link RcsEventQueryResult#getContinuationToken}. - * @throws RcsMessageStoreException if the query could not be completed on the storage - */ - @WorkerThread - @NonNull - public RcsEventQueryResult getRcsEvents( - @NonNull RcsQueryContinuationToken continuationToken) throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getEventsWithToken(continuationToken, - callingPackage)) - .getRcsEventQueryResult(mRcsControllerCall); - } - - /** - * Persists an {@link RcsEvent} to common storage. - * - * @param rcsEvent The {@link RcsEvent} to persist into storage. - * @throws RcsMessageStoreException if the query could not be completed on the storage - * @see RcsGroupThreadNameChangedEvent - * @see RcsGroupThreadIconChangedEvent - * @see RcsGroupThreadParticipantJoinedEvent - * @see RcsGroupThreadParticipantLeftEvent - * @see RcsParticipantAliasChangedEvent - */ - @WorkerThread - @NonNull - public void persistRcsEvent(RcsEvent rcsEvent) throws RcsMessageStoreException { - rcsEvent.persist(mRcsControllerCall); - } - - /** - * Creates a new 1 to 1 thread with the given participant and persists it in the storage. - * - * @param recipient The {@link RcsParticipant} that will receive the messages in this thread. - * @return The newly created {@link Rcs1To1Thread} - * @throws RcsMessageStoreException if the thread could not be persisted in the storage - */ - @WorkerThread - @NonNull - public Rcs1To1Thread createRcs1To1Thread(@NonNull RcsParticipant recipient) - throws RcsMessageStoreException { - return new Rcs1To1Thread( - mRcsControllerCall, - mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.createRcs1To1Thread(recipient.getId(), - callingPackage))); - } - - /** - * Creates a new group thread with the given participants and persists it in the storage. - * - * @throws RcsMessageStoreException if the thread could not be persisted in the storage - */ - @WorkerThread - @NonNull - public RcsGroupThread createGroupThread(@Nullable List<RcsParticipant> recipients, - @Nullable String groupName, @Nullable Uri groupIcon) throws RcsMessageStoreException { - int[] recipientIds = null; - if (recipients != null) { - recipientIds = new int[recipients.size()]; - - for (int i = 0; i < recipients.size(); i++) { - recipientIds[i] = recipients.get(i).getId(); - } - } - - int[] finalRecipientIds = recipientIds; - - int threadId = mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.createGroupThread(finalRecipientIds, groupName, - groupIcon, callingPackage)); - - return new RcsGroupThread(mRcsControllerCall, threadId); - } - - /** - * Delete the given {@link RcsThread} from the storage. - * - * @param thread The thread to be deleted. - * @throws RcsMessageStoreException if the thread could not be deleted from the storage - */ - @WorkerThread - public void deleteThread(@NonNull RcsThread thread) throws RcsMessageStoreException { - if (thread == null) { - return; - } - - boolean isDeleteSucceeded = mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.deleteThread(thread.getThreadId(), - thread.getThreadType(), callingPackage)); - - if (!isDeleteSucceeded) { - throw new RcsMessageStoreException("Could not delete RcsThread"); - } - } - - /** - * Creates a new participant and persists it in the storage. - * - * @param canonicalAddress The defining address (e.g. phone number) of the participant. - * @param alias The RCS alias for the participant. - * @throws RcsMessageStoreException if the participant could not be created on the storage - */ - @WorkerThread - @NonNull - public RcsParticipant createRcsParticipant(String canonicalAddress, @Nullable String alias) - throws RcsMessageStoreException { - return new RcsParticipant(mRcsControllerCall, mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.createRcsParticipant(canonicalAddress, alias, - callingPackage))); - } -} diff --git a/telephony/java/android/telephony/ims/RcsMessageQueryParams.aidl b/telephony/java/android/telephony/ims/RcsMessageQueryParams.aidl deleted file mode 100644 index e9cbd9cc4ebe..000000000000 --- a/telephony/java/android/telephony/ims/RcsMessageQueryParams.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * - * Copyright 2019, 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.ims; - -parcelable RcsMessageQueryParams; diff --git a/telephony/java/android/telephony/ims/RcsMessageQueryParams.java b/telephony/java/android/telephony/ims/RcsMessageQueryParams.java deleted file mode 100644 index 9f9eafbd179b..000000000000 --- a/telephony/java/android/telephony/ims/RcsMessageQueryParams.java +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.annotation.CheckResult; -import android.annotation.IntDef; -import android.annotation.IntRange; -import android.annotation.Nullable; -import android.os.Parcel; -import android.os.Parcelable; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.security.InvalidParameterException; - -/** - * The parameters to pass into - * {@link RcsMessageStore#getRcsMessages(RcsMessageQueryParams)} in order to select a - * subset of {@link RcsMessage}s present in the message store. - * - * @hide - */ -public final class RcsMessageQueryParams implements Parcelable { - /** - * @hide - not meant for public use - */ - public static final int THREAD_ID_NOT_SET = -1; - - /** - * Flag to be used with {@link Builder#setSortProperty(int)} to denote that the results should - * be sorted in the same order of {@link RcsMessage}s that got persisted into storage for faster - * results. - */ - public static final int SORT_BY_CREATION_ORDER = 0; - - /** - * Flag to be used with {@link Builder#setSortProperty(int)} to denote that the results should - * be sorted according to the timestamp of {@link RcsMessage#getOriginationTimestamp()} - */ - public static final int SORT_BY_TIMESTAMP = 1; - - @Retention(RetentionPolicy.SOURCE) - @IntDef({SORT_BY_CREATION_ORDER, SORT_BY_TIMESTAMP}) - public @interface SortingProperty { - } - - /** - * Bitmask flag to be used with {@link Builder#setMessageType(int)} to make - * {@link RcsMessageStore#getRcsMessages(RcsMessageQueryParams)} return - * {@link RcsIncomingMessage}s. - */ - public static final int MESSAGE_TYPE_INCOMING = 0x0001; - - /** - * Bitmask flag to be used with {@link Builder#setMessageType(int)} to make - * {@link RcsMessageStore#getRcsMessages(RcsMessageQueryParams)} return - * {@link RcsOutgoingMessage}s. - */ - public static final int MESSAGE_TYPE_OUTGOING = 0x0002; - - /** - * Bitmask flag to be used with {@link Builder#setFileTransferPresence(int)} to make - * {@link RcsMessageStore#getRcsMessages(RcsMessageQueryParams)} return {@link RcsMessage}s - * that have an {@link RcsFileTransferPart} attached. - */ - public static final int MESSAGES_WITH_FILE_TRANSFERS = 0x0004; - - /** - * Bitmask flag to be used with {@link Builder#setFileTransferPresence(int)} to make - * {@link RcsMessageStore#getRcsMessages(RcsMessageQueryParams)} return {@link RcsMessage}s - * that don't have an {@link RcsFileTransferPart} attached. - */ - public static final int MESSAGES_WITHOUT_FILE_TRANSFERS = 0x0008; - - /** - * @hide - not meant for public use - */ - public static final String MESSAGE_QUERY_PARAMETERS_KEY = "message_query_parameters"; - - // Whether the result should be filtered against incoming or outgoing messages - private int mMessageType; - // Whether the result should have file transfer messages attached or not - private int mFileTransferPresence; - // The SQL "Like" clause to filter messages - private String mMessageLike; - // The property the messages should be sorted against - private @SortingProperty int mSortingProperty; - // Whether the messages should be sorted in ascending order - private boolean mIsAscending; - // The number of results that should be returned with this query - private int mLimit; - // The thread that the results should be limited to - private int mThreadId; - - RcsMessageQueryParams(int messageType, int fileTransferPresence, String messageLike, - int threadId, @SortingProperty int sortingProperty, boolean isAscending, int limit) { - mMessageType = messageType; - mFileTransferPresence = fileTransferPresence; - mMessageLike = messageLike; - mSortingProperty = sortingProperty; - mIsAscending = isAscending; - mLimit = limit; - mThreadId = threadId; - } - - /** - * @return Returns the type of {@link RcsMessage}s that this {@link RcsMessageQueryParams} - * is set to query for. - */ - public int getMessageType() { - return mMessageType; - } - - /** - * @return Returns whether the result query should return {@link RcsMessage}s with - * {@link RcsFileTransferPart}s or not - */ - public int getFileTransferPresence() { - return mFileTransferPresence; - } - - /** - * @return Returns the SQL-inspired "LIKE" clause that will be used to match {@link RcsMessage}s - */ - public String getMessageLike() { - return mMessageLike; - } - - /** - * @return Returns the number of {@link RcsThread}s to be returned from the query. A value of - * 0 means there is no set limit. - */ - public int getLimit() { - return mLimit; - } - - /** - * @return Returns the property that will be used to sort the result against. - * @see SortingProperty - */ - public @SortingProperty int getSortingProperty() { - return mSortingProperty; - } - - /** - * @return Returns {@code true} if the result set will be sorted in ascending order, - * {@code false} if it will be sorted in descending order. - */ - public boolean getSortDirection() { - return mIsAscending; - } - - /** - * This is used in {@link com.android.internal.telephony.ims.RcsMessageStoreController} to get - * the thread that the result query should be limited to. - * - * As we do not expose any sort of integer ID's to public usage, this should be hidden. - * - * @hide - not meant for public use - */ - public int getThreadId() { - return mThreadId; - } - - /** - * A helper class to build the {@link RcsMessageQueryParams}. - */ - public static class Builder { - private @SortingProperty int mSortingProperty; - private int mMessageType; - private int mFileTransferPresence; - private String mMessageLike; - private boolean mIsAscending; - private int mLimit = 100; - private int mThreadId = THREAD_ID_NOT_SET; - - /** - * Creates a new builder for {@link RcsMessageQueryParams} to be used in - * {@link RcsMessageStore#getRcsMessages(RcsMessageQueryParams)} - * - */ - public Builder() { - // empty implementation - } - - /** - * Desired number of threads to be returned from the query. Passing in 0 will return all - * existing threads at once. The limit defaults to 100. - * - * @param limit The number to limit the query result to. - * @return The same instance of the builder to chain parameters. - * @throws InvalidParameterException If the given limit is negative. - */ - @CheckResult - public Builder setResultLimit(@IntRange(from = 0) int limit) - throws InvalidParameterException { - if (limit < 0) { - throw new InvalidParameterException("The query limit must be non-negative"); - } - - mLimit = limit; - return this; - } - - /** - * Sets the type of messages to be returned from the query. - * - * @param messageType The type of message to be returned. - * @return The same instance of the builder to chain parameters. - * @see RcsMessageQueryParams#MESSAGE_TYPE_INCOMING - * @see RcsMessageQueryParams#MESSAGE_TYPE_OUTGOING - */ - @CheckResult - public Builder setMessageType(int messageType) { - mMessageType = messageType; - return this; - } - - /** - * Sets whether file transfer messages should be included in the query result or not. - * - * @param fileTransferPresence Whether file transfers should be included in the result - * @return The same instance of the builder to chain parameters. - * @see RcsMessageQueryParams#MESSAGES_WITH_FILE_TRANSFERS - * @see RcsMessageQueryParams#MESSAGES_WITHOUT_FILE_TRANSFERS - */ - @CheckResult - public Builder setFileTransferPresence(int fileTransferPresence) { - mFileTransferPresence = fileTransferPresence; - return this; - } - - /** - * Sets an SQL-inspired "like" clause to match with messages. Using a percent sign ('%') - * wildcard matches any sequence of zero or more characters. Using an underscore ('_') - * wildcard matches any single character. Not using any wildcards would only perform a - * string match. The input string is case-insensitive. - * - * The input "Wh%" would match messages "who", "where" and "what", while the input "Wh_" - * would only match "who" - * - * @param messageLike The "like" clause for matching {@link RcsMessage}s. - * @return The same instance of the builder to chain parameters. - */ - @CheckResult - public Builder setMessageLike(String messageLike) { - mMessageLike = messageLike; - return this; - } - - /** - * Sets the property where the results should be sorted against. Defaults to - * {@link RcsMessageQueryParams.SortingProperty#SORT_BY_CREATION_ORDER} - * - * @param sortingProperty against which property the results should be sorted - * @return The same instance of the builder to chain parameters. - */ - @CheckResult - public Builder setSortProperty(@SortingProperty int sortingProperty) { - mSortingProperty = sortingProperty; - return this; - } - - /** - * Sets whether the results should be sorted ascending or descending - * - * @param isAscending whether the results should be sorted ascending - * @return The same instance of the builder to chain parameters. - */ - @CheckResult - public Builder setSortDirection(boolean isAscending) { - mIsAscending = isAscending; - return this; - } - - /** - * Limits the results to the given thread. - * - * @param thread the {@link RcsThread} that results should be limited to. If set to - * {@code null}, messages on all threads will be queried - * @return The same instance of the builder to chain parameters. - */ - @CheckResult - public Builder setThread(@Nullable RcsThread thread) { - if (thread == null) { - mThreadId = THREAD_ID_NOT_SET; - } else { - mThreadId = thread.getThreadId(); - } - return this; - } - - /** - * Builds the {@link RcsMessageQueryParams} to use in - * {@link RcsMessageStore#getRcsMessages(RcsMessageQueryParams)} - * - * @return An instance of {@link RcsMessageQueryParams} to use with the message - * query. - */ - public RcsMessageQueryParams build() { - return new RcsMessageQueryParams(mMessageType, mFileTransferPresence, mMessageLike, - mThreadId, mSortingProperty, mIsAscending, mLimit); - } - } - - /** - * Parcelable boilerplate below. - */ - private RcsMessageQueryParams(Parcel in) { - mMessageType = in.readInt(); - mFileTransferPresence = in.readInt(); - mMessageLike = in.readString(); - mSortingProperty = in.readInt(); - mIsAscending = in.readBoolean(); - mLimit = in.readInt(); - mThreadId = in.readInt(); - } - - public static final @android.annotation.NonNull Creator<RcsMessageQueryParams> CREATOR = - new Creator<RcsMessageQueryParams>() { - @Override - public RcsMessageQueryParams createFromParcel(Parcel in) { - return new RcsMessageQueryParams(in); - } - - @Override - public RcsMessageQueryParams[] newArray(int size) { - return new RcsMessageQueryParams[size]; - } - }; - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(mMessageType); - dest.writeInt(mFileTransferPresence); - dest.writeString(mMessageLike); - dest.writeInt(mSortingProperty); - dest.writeBoolean(mIsAscending); - dest.writeInt(mLimit); - dest.writeInt(mThreadId); - } -} diff --git a/telephony/java/android/telephony/ims/RcsMessageQueryResult.java b/telephony/java/android/telephony/ims/RcsMessageQueryResult.java deleted file mode 100644 index 36bb78a0594b..000000000000 --- a/telephony/java/android/telephony/ims/RcsMessageQueryResult.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import static android.provider.Telephony.RcsColumns.RcsUnifiedMessageColumns.MESSAGE_TYPE_INCOMING; - -import android.annotation.NonNull; -import android.annotation.Nullable; - -import java.util.List; -import java.util.stream.Collectors; - -/** - * The result of a {@link RcsMessageStore#getRcsMessages(RcsMessageQueryParams)} - * call. This class allows getting the token for querying the next batch of messages in order to - * prevent handling large amounts of data at once. - * - * @hide - */ -public final class RcsMessageQueryResult { - private final RcsControllerCall mRcsControllerCall; - private final RcsMessageQueryResultParcelable mRcsMessageQueryResultParcelable; - - RcsMessageQueryResult(RcsControllerCall rcsControllerCall, - RcsMessageQueryResultParcelable rcsMessageQueryResultParcelable) { - mRcsControllerCall = rcsControllerCall; - mRcsMessageQueryResultParcelable = rcsMessageQueryResultParcelable; - } - - /** - * Returns a token to call - * {@link RcsMessageStore#getRcsMessages(RcsQueryContinuationToken)} - * to get the next batch of {@link RcsMessage}s. - */ - @Nullable - public RcsQueryContinuationToken getContinuationToken() { - return mRcsMessageQueryResultParcelable.mContinuationToken; - } - - /** - * Returns all the {@link RcsMessage}s in the current query result. Call {@link - * RcsMessageStore#getRcsMessages(RcsQueryContinuationToken)} to get the next batch - * of {@link RcsMessage}s. - */ - @NonNull - public List<RcsMessage> getMessages() { - return mRcsMessageQueryResultParcelable.mMessageTypeIdPairs.stream() - .map(typeIdPair -> typeIdPair.getType() == MESSAGE_TYPE_INCOMING - ? new RcsIncomingMessage(mRcsControllerCall, typeIdPair.getId()) - : new RcsOutgoingMessage(mRcsControllerCall, typeIdPair.getId())) - .collect(Collectors.toList()); - } -} diff --git a/telephony/java/android/telephony/ims/RcsMessageQueryResultParcelable.aidl b/telephony/java/android/telephony/ims/RcsMessageQueryResultParcelable.aidl deleted file mode 100644 index 86928bfa41b8..000000000000 --- a/telephony/java/android/telephony/ims/RcsMessageQueryResultParcelable.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * - * Copyright 2019, 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.ims; - -parcelable RcsMessageQueryResultParcelable; diff --git a/telephony/java/android/telephony/ims/RcsMessageQueryResultParcelable.java b/telephony/java/android/telephony/ims/RcsMessageQueryResultParcelable.java deleted file mode 100644 index 4972f9bc4956..000000000000 --- a/telephony/java/android/telephony/ims/RcsMessageQueryResultParcelable.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.android.ims.RcsTypeIdPair; - -import java.util.ArrayList; -import java.util.List; - -/** - * @hide - used only for internal communication with the ircs service - */ -public class RcsMessageQueryResultParcelable implements Parcelable { - // The token to continue the query to get the next batch of results - final RcsQueryContinuationToken mContinuationToken; - // The message type and message ID pairs for all the messages in this query result - final List<RcsTypeIdPair> mMessageTypeIdPairs; - - public RcsMessageQueryResultParcelable( - RcsQueryContinuationToken continuationToken, - List<RcsTypeIdPair> messageTypeIdPairs) { - mContinuationToken = continuationToken; - mMessageTypeIdPairs = messageTypeIdPairs; - } - - private RcsMessageQueryResultParcelable(Parcel in) { - mContinuationToken = in.readParcelable( - RcsQueryContinuationToken.class.getClassLoader()); - - mMessageTypeIdPairs = new ArrayList<>(); - in.readTypedList(mMessageTypeIdPairs, RcsTypeIdPair.CREATOR); - } - - public static final Creator<RcsMessageQueryResultParcelable> CREATOR = - new Creator<RcsMessageQueryResultParcelable>() { - @Override - public RcsMessageQueryResultParcelable createFromParcel(Parcel in) { - return new RcsMessageQueryResultParcelable(in); - } - - @Override - public RcsMessageQueryResultParcelable[] newArray(int size) { - return new RcsMessageQueryResultParcelable[size]; - } - }; - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeParcelable(mContinuationToken, flags); - dest.writeTypedList(mMessageTypeIdPairs); - } -} diff --git a/telephony/java/android/telephony/ims/RcsMessageSnippet.java b/telephony/java/android/telephony/ims/RcsMessageSnippet.java deleted file mode 100644 index 810316040470..000000000000 --- a/telephony/java/android/telephony/ims/RcsMessageSnippet.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.annotation.Nullable; -import android.os.Parcel; -import android.os.Parcelable; -import android.telephony.ims.RcsMessage.RcsMessageStatus; - -/** - * An immutable summary of the latest {@link RcsMessage} on an {@link RcsThread} - * - * @hide - */ -public final class RcsMessageSnippet implements Parcelable { - private final String mText; - private final @RcsMessageStatus int mStatus; - private final long mTimestamp; - - /** - * @hide - */ - public RcsMessageSnippet(String text, @RcsMessageStatus int status, long timestamp) { - mText = text; - mStatus = status; - mTimestamp = timestamp; - } - - /** - * @return Returns the text of the {@link RcsMessage} with highest origination timestamp value - * (i.e. latest) in this thread - */ - @Nullable - public String getSnippetText() { - return mText; - } - - /** - * @return Returns the status of the {@link RcsMessage} with highest origination timestamp value - * (i.e. latest) in this thread - */ - public @RcsMessageStatus int getSnippetStatus() { - return mStatus; - } - - /** - * @return Returns the timestamp of the {@link RcsMessage} with highest origination timestamp - * value (i.e. latest) in this thread - */ - public long getSnippetTimestamp() { - return mTimestamp; - } - - private RcsMessageSnippet(Parcel in) { - mText = in.readString(); - mStatus = in.readInt(); - mTimestamp = in.readLong(); - } - - public static final @android.annotation.NonNull Creator<RcsMessageSnippet> CREATOR = - new Creator<RcsMessageSnippet>() { - @Override - public RcsMessageSnippet createFromParcel(Parcel in) { - return new RcsMessageSnippet(in); - } - - @Override - public RcsMessageSnippet[] newArray(int size) { - return new RcsMessageSnippet[size]; - } - }; - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeString(mText); - dest.writeInt(mStatus); - dest.writeLong(mTimestamp); - } -} diff --git a/telephony/java/android/telephony/ims/RcsMessageStoreException.java b/telephony/java/android/telephony/ims/RcsMessageStoreException.java deleted file mode 100644 index 3b3fcf21dd7a..000000000000 --- a/telephony/java/android/telephony/ims/RcsMessageStoreException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2019 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.ims; - -/** - * An exception that happened on {@link RcsMessageStore} or one of the derived storage classes in - * {@link android.telephony.ims} - * - * @hide - */ -public class RcsMessageStoreException extends Exception { - - /** - * Constructs an {@link RcsMessageStoreException} with the specified detail message. - * @param message The detail message - * @see Throwable#getMessage() - */ - public RcsMessageStoreException(String message) { - super(message); - } -} diff --git a/telephony/java/android/telephony/ims/RcsOutgoingMessage.java b/telephony/java/android/telephony/ims/RcsOutgoingMessage.java deleted file mode 100644 index 7080ec6c5281..000000000000 --- a/telephony/java/android/telephony/ims/RcsOutgoingMessage.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.annotation.NonNull; -import android.annotation.WorkerThread; - -import java.util.ArrayList; -import java.util.List; - -/** - * This is a single instance of a message sent over RCS. - * - * @hide - */ -public class RcsOutgoingMessage extends RcsMessage { - RcsOutgoingMessage(RcsControllerCall rcsControllerCall, int id) { - super(rcsControllerCall, id); - } - - /** - * @return Returns the {@link RcsOutgoingMessageDelivery}s associated with this message. Please - * note that the deliveries returned for the {@link RcsOutgoingMessage} may not always match the - * {@link RcsParticipant}s on the {@link RcsGroupThread} as the group recipients may have - * changed. - * @throws RcsMessageStoreException if the outgoing deliveries could not be read from storage. - */ - @NonNull - @WorkerThread - public List<RcsOutgoingMessageDelivery> getOutgoingDeliveries() - throws RcsMessageStoreException { - int[] deliveryParticipants; - List<RcsOutgoingMessageDelivery> messageDeliveries = new ArrayList<>(); - - deliveryParticipants = mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getMessageRecipients(mId, callingPackage)); - - if (deliveryParticipants != null) { - for (Integer deliveryParticipant : deliveryParticipants) { - messageDeliveries.add(new RcsOutgoingMessageDelivery( - mRcsControllerCall, deliveryParticipant, mId)); - } - } - - return messageDeliveries; - } - - /** - * @return Returns {@code false} as this is not an incoming message. - */ - @Override - public boolean isIncoming() { - return false; - } -} diff --git a/telephony/java/android/telephony/ims/RcsOutgoingMessageCreationParams.aidl b/telephony/java/android/telephony/ims/RcsOutgoingMessageCreationParams.aidl deleted file mode 100644 index 0c38d9f5766b..000000000000 --- a/telephony/java/android/telephony/ims/RcsOutgoingMessageCreationParams.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * - * Copyright 2019, 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.ims; - -parcelable RcsOutgoingMessageCreationParams; diff --git a/telephony/java/android/telephony/ims/RcsOutgoingMessageCreationParams.java b/telephony/java/android/telephony/ims/RcsOutgoingMessageCreationParams.java deleted file mode 100644 index c001ffb354b0..000000000000 --- a/telephony/java/android/telephony/ims/RcsOutgoingMessageCreationParams.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.annotation.NonNull; -import android.os.Parcel; -import android.os.Parcelable; - -/** - * {@link RcsOutgoingMessageCreationParams} is a collection of parameters that should be passed - * into {@link RcsThread#addOutgoingMessage(RcsOutgoingMessageCreationParams)} to generate an - * {@link RcsOutgoingMessage} on that {@link RcsThread} - * - * @hide - */ -public final class RcsOutgoingMessageCreationParams extends RcsMessageCreationParams - implements Parcelable { - /** - * A builder to instantiate and persist an {@link RcsOutgoingMessage} - */ - public static class Builder extends RcsMessageCreationParams.Builder { - - /** - * Creates a new {@link Builder} to create an instance of - * {@link RcsOutgoingMessageCreationParams}. - * - * @param originationTimestamp The timestamp of {@link RcsMessage} creation. The origination - * timestamp value in milliseconds passed after midnight, - * January 1, 1970 UTC - * @param subscriptionId The subscription ID that was used to send or receive this - * {@link RcsMessage} - * @see android.telephony.SubscriptionInfo#getSubscriptionId() - */ - public Builder(long originationTimestamp, int subscriptionId) { - super(originationTimestamp, subscriptionId); - } - - /** - * Creates configuration parameters for a new message. - */ - public RcsOutgoingMessageCreationParams build() { - return new RcsOutgoingMessageCreationParams(this); - } - } - - private RcsOutgoingMessageCreationParams(Builder builder) { - super(builder); - } - - private RcsOutgoingMessageCreationParams(Parcel in) { - super(in); - } - - public static final @NonNull Creator<RcsOutgoingMessageCreationParams> CREATOR = - new Creator<RcsOutgoingMessageCreationParams>() { - @Override - public RcsOutgoingMessageCreationParams createFromParcel(Parcel in) { - return new RcsOutgoingMessageCreationParams(in); - } - - @Override - public RcsOutgoingMessageCreationParams[] newArray(int size) { - return new RcsOutgoingMessageCreationParams[size]; - } - }; - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - super.writeToParcel(dest); - } -} diff --git a/telephony/java/android/telephony/ims/RcsOutgoingMessageDelivery.java b/telephony/java/android/telephony/ims/RcsOutgoingMessageDelivery.java deleted file mode 100644 index df4a3e45bc03..000000000000 --- a/telephony/java/android/telephony/ims/RcsOutgoingMessageDelivery.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 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 android.telephony.ims; - -import android.annotation.NonNull; -import android.annotation.WorkerThread; - -/** - * This class holds the delivery information of an {@link RcsOutgoingMessage} for each - * {@link RcsParticipant} that the message was intended for. - * - * @hide - */ -public class RcsOutgoingMessageDelivery { - private final RcsControllerCall mRcsControllerCall; - // The participant that this delivery is intended for - private final int mRecipientId; - // The message this delivery is associated with - private final int mRcsOutgoingMessageId; - - /** - * Constructor to be used with RcsOutgoingMessage.getDelivery() - * - * @hide - */ - RcsOutgoingMessageDelivery( - RcsControllerCall rcsControllerCall, int recipientId, int messageId) { - mRcsControllerCall = rcsControllerCall; - mRecipientId = recipientId; - mRcsOutgoingMessageId = messageId; - } - - /** - * Sets the delivery time of this outgoing delivery and persists into storage. - * - * @param deliveredTimestamp The timestamp to set to delivery. It is defined as milliseconds - * passed after midnight, January 1, 1970 UTC - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setDeliveredTimestamp(long deliveredTimestamp) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setOutgoingDeliveryDeliveredTimestamp( - mRcsOutgoingMessageId, mRecipientId, deliveredTimestamp, callingPackage)); - } - - /** - * @return Returns the delivered timestamp of the associated message to the associated - * participant. Timestamp is defined as milliseconds passed after midnight, January 1, 1970 UTC. - * Returns 0 if the {@link RcsOutgoingMessage} is not delivered yet. - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public long getDeliveredTimestamp() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getOutgoingDeliveryDeliveredTimestamp( - mRcsOutgoingMessageId, mRecipientId, callingPackage)); - } - - /** - * Sets the seen time of this outgoing delivery and persists into storage. - * - * @param seenTimestamp The timestamp to set to delivery. It is defined as milliseconds - * passed after midnight, January 1, 1970 UTC - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setSeenTimestamp(long seenTimestamp) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setOutgoingDeliverySeenTimestamp( - mRcsOutgoingMessageId, mRecipientId, seenTimestamp, callingPackage)); - } - - /** - * @return Returns the seen timestamp of the associated message by the associated - * participant. Timestamp is defined as milliseconds passed after midnight, January 1, 1970 UTC. - * Returns 0 if the {@link RcsOutgoingMessage} is not seen yet. - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public long getSeenTimestamp() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getOutgoingDeliverySeenTimestamp( - mRcsOutgoingMessageId, mRecipientId, callingPackage)); - } - - /** - * Sets the status of this outgoing delivery and persists into storage. - * - * @param status The status of the associated {@link RcsMessage}s delivery to the associated - * {@link RcsParticipant} - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setStatus(@RcsMessage.RcsMessageStatus int status) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setOutgoingDeliveryStatus( - mRcsOutgoingMessageId, mRecipientId, status, callingPackage)); - } - - /** - * @return Returns the status of this outgoing delivery. - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @WorkerThread - public @RcsMessage.RcsMessageStatus int getStatus() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getOutgoingDeliveryStatus(mRcsOutgoingMessageId, - mRecipientId, callingPackage)); - } - - /** - * @return Returns the recipient associated with this delivery. - */ - @NonNull - public RcsParticipant getRecipient() { - return new RcsParticipant(mRcsControllerCall, mRecipientId); - } - - /** - * @return Returns the {@link RcsOutgoingMessage} associated with this delivery. - */ - @NonNull - public RcsOutgoingMessage getMessage() { - return new RcsOutgoingMessage(mRcsControllerCall, mRcsOutgoingMessageId); - } -} diff --git a/telephony/java/android/telephony/ims/RcsParticipant.java b/telephony/java/android/telephony/ims/RcsParticipant.java deleted file mode 100644 index 8512e960bfe6..000000000000 --- a/telephony/java/android/telephony/ims/RcsParticipant.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.annotation.Nullable; -import android.annotation.WorkerThread; - -/** - * RcsParticipant is an RCS capable contact that can participate in {@link RcsThread}s. - * - * @hide - */ -public class RcsParticipant { - private final RcsControllerCall mRcsControllerCall; - // The row ID of this participant in the database - private final int mId; - - /** - * Constructor for {@link com.android.internal.telephony.ims.RcsMessageStoreController} - * to create instances of participants. This is not meant to be part of the SDK. - * - * @hide - */ - public RcsParticipant(RcsControllerCall rcsControllerCall, int id) { - mRcsControllerCall = rcsControllerCall; - mId = id; - } - - /** - * @return Returns the canonical address (i.e. normalized phone number) for this - * {@link RcsParticipant} - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @Nullable - @WorkerThread - public String getCanonicalAddress() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getRcsParticipantCanonicalAddress(mId, - callingPackage)); - } - - /** - * @return Returns the alias for this {@link RcsParticipant}. Alias is usually the real name of - * the person themselves. Please see US5-15 - GSMA RCC.71 (RCS Universal Profile Service - * Definition Document) - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @Nullable - @WorkerThread - public String getAlias() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getRcsParticipantAlias(mId, callingPackage)); - } - - /** - * Sets the alias for this {@link RcsParticipant} and persists it in storage. Alias is usually - * the real name of the person themselves. Please see US5-15 - GSMA RCC.71 (RCS Universal - * Profile Service Definition Document) - * - * @param alias The alias to set to. - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setAlias(String alias) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setRcsParticipantAlias(mId, alias, callingPackage)); - } - - /** - * @return Returns the contact ID for this {@link RcsParticipant}. Contact ID is a unique ID for - * an {@link RcsParticipant} that is RCS provisioned. Please see 4.4.5 - GSMA RCC.53 (RCS Device - * API 1.6 Specification) - * @throws RcsMessageStoreException if the value could not be read from the storage - */ - @Nullable - @WorkerThread - public String getContactId() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getRcsParticipantContactId(mId, callingPackage)); - } - - /** - * Sets the contact ID for this {@link RcsParticipant}. Contact ID is a unique ID for - * an {@link RcsParticipant} that is RCS provisioned. Please see 4.4.5 - GSMA RCC.53 (RCS Device - * API 1.6 Specification) - * - * @param contactId The contact ID to set to. - * @throws RcsMessageStoreException if the value could not be persisted into storage - */ - @WorkerThread - public void setContactId(String contactId) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.setRcsParticipantContactId(mId, contactId, - callingPackage)); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof RcsParticipant)) { - return false; - } - RcsParticipant other = (RcsParticipant) obj; - - return mId == other.mId; - } - - @Override - public int hashCode() { - return mId; - } - - /** - * Returns the row id of this participant. This is not meant to be part of the SDK - * - * @hide - */ - public int getId() { - return mId; - } -} diff --git a/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEvent.java b/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEvent.java deleted file mode 100644 index 865bc05132a2..000000000000 --- a/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEvent.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.annotation.NonNull; -import android.annotation.Nullable; - -/** - * An event that indicates an {@link RcsParticipant}'s alias was changed. Please see US18-2 - GSMA - * RCC.71 (RCS Universal Profile Service Definition Document) - * - * @hide - */ -public final class RcsParticipantAliasChangedEvent extends RcsEvent { - // The participant that changed their alias - private final RcsParticipant mParticipant; - // The new alias of the above participant - private final String mNewAlias; - - /** - * Creates a new {@link RcsParticipantAliasChangedEvent}. This event is not persisted into - * storage until {@link RcsMessageStore#persistRcsEvent(RcsEvent)} is called. - * - * @param timestamp The timestamp of when this event happened, in milliseconds passed after - * midnight, January 1st, 1970 UTC - * @param participant The {@link RcsParticipant} that got their alias changed - * @param newAlias The new alias the {@link RcsParticipant} has. - * @see RcsMessageStore#persistRcsEvent(RcsEvent) - */ - public RcsParticipantAliasChangedEvent(long timestamp, @NonNull RcsParticipant participant, - @Nullable String newAlias) { - super(timestamp); - mParticipant = participant; - mNewAlias = newAlias; - } - - /** - * @return Returns the {@link RcsParticipant} whose alias was changed. - */ - @NonNull - public RcsParticipant getParticipant() { - return mParticipant; - } - - /** - * @return Returns the alias of the associated {@link RcsParticipant} after this event happened - */ - @Nullable - public String getNewAlias() { - return mNewAlias; - } - - /** - * Persists the event to the data store. - * - * @hide - not meant for public use. - */ - @Override - void persist(RcsControllerCall rcsControllerCall) throws RcsMessageStoreException { - rcsControllerCall.call((iRcs, callingPackage) -> iRcs.createParticipantAliasChangedEvent( - getTimestamp(), getParticipant().getId(), getNewAlias(), callingPackage)); - } -} diff --git a/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEventDescriptor.aidl b/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEventDescriptor.aidl deleted file mode 100644 index 64fe3b891572..000000000000 --- a/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEventDescriptor.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * - * Copyright 2019, 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.ims; - -parcelable RcsParticipantAliasChangedEventDescriptor; diff --git a/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEventDescriptor.java b/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEventDescriptor.java deleted file mode 100644 index 43b918c3e0f4..000000000000 --- a/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEventDescriptor.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import static com.android.internal.annotations.VisibleForTesting.Visibility.PROTECTED; - -import android.annotation.NonNull; -import android.annotation.Nullable; -import android.os.Parcel; - -import com.android.internal.annotations.VisibleForTesting; - -/** - * @hide - used only for internal communication with the ircs service - */ -public class RcsParticipantAliasChangedEventDescriptor extends RcsEventDescriptor { - // The ID of the participant that changed their alias - protected int mParticipantId; - // The new alias of the above participant - protected String mNewAlias; - - public RcsParticipantAliasChangedEventDescriptor(long timestamp, int participantId, - @Nullable String newAlias) { - super(timestamp); - mParticipantId = participantId; - mNewAlias = newAlias; - } - - @Override - @VisibleForTesting(visibility = PROTECTED) - public RcsParticipantAliasChangedEvent createRcsEvent(RcsControllerCall rcsControllerCall) { - return new RcsParticipantAliasChangedEvent( - mTimestamp, new RcsParticipant(rcsControllerCall, mParticipantId), mNewAlias); - } - - public static final @NonNull Creator<RcsParticipantAliasChangedEventDescriptor> CREATOR = - new Creator<RcsParticipantAliasChangedEventDescriptor>() { - @Override - public RcsParticipantAliasChangedEventDescriptor createFromParcel(Parcel in) { - return new RcsParticipantAliasChangedEventDescriptor(in); - } - - @Override - public RcsParticipantAliasChangedEventDescriptor[] newArray(int size) { - return new RcsParticipantAliasChangedEventDescriptor[size]; - } - }; - - protected RcsParticipantAliasChangedEventDescriptor(Parcel in) { - super(in); - mNewAlias = in.readString(); - mParticipantId = in.readInt(); - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - super.writeToParcel(dest, flags); - dest.writeString(mNewAlias); - dest.writeInt(mParticipantId); - } -} diff --git a/telephony/java/android/telephony/ims/RcsParticipantQueryParams.aidl b/telephony/java/android/telephony/ims/RcsParticipantQueryParams.aidl deleted file mode 100644 index b7c0f93c8c5f..000000000000 --- a/telephony/java/android/telephony/ims/RcsParticipantQueryParams.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * - * Copyright 2019, 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.ims; - -parcelable RcsParticipantQueryParams; diff --git a/telephony/java/android/telephony/ims/RcsParticipantQueryParams.java b/telephony/java/android/telephony/ims/RcsParticipantQueryParams.java deleted file mode 100644 index 21107a2f54e5..000000000000 --- a/telephony/java/android/telephony/ims/RcsParticipantQueryParams.java +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.annotation.CheckResult; -import android.annotation.IntDef; -import android.annotation.IntRange; -import android.os.Parcel; -import android.os.Parcelable; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.security.InvalidParameterException; - -/** - * The parameters to pass into - * {@link RcsMessageStore#getRcsParticipants(RcsParticipantQueryParams)} in order to select a - * subset of {@link RcsThread}s present in the message store. - * - * @hide - */ -public final class RcsParticipantQueryParams implements Parcelable { - /** - * Flag to set with {@link Builder#setSortProperty(int)} to sort the results in the order of - * creation time for faster query results - */ - public static final int SORT_BY_CREATION_ORDER = 0; - - /** - * Flag to set with {@link Builder#setSortProperty(int)} to sort depending on the - * {@link RcsParticipant} aliases - */ - public static final int SORT_BY_ALIAS = 1; - - /** - * Flag to set with {@link Builder#setSortProperty(int)} to sort depending on the - * {@link RcsParticipant} canonical addresses - */ - public static final int SORT_BY_CANONICAL_ADDRESS = 2; - - @Retention(RetentionPolicy.SOURCE) - @IntDef({SORT_BY_CREATION_ORDER, SORT_BY_ALIAS, SORT_BY_CANONICAL_ADDRESS}) - public @interface SortingProperty { - } - - // The SQL "like" statement to filter against participant aliases - private String mAliasLike; - // The SQL "like" statement to filter against canonical addresses - private String mCanonicalAddressLike; - // The property to sort the result against - private @SortingProperty int mSortingProperty; - // Whether to sort the result in ascending order - private boolean mIsAscending; - // The number of results to be returned from the query - private int mLimit; - // Used to limit the results to participants of a single thread - private int mThreadId; - - /** - * @hide - */ - public static final String PARTICIPANT_QUERY_PARAMETERS_KEY = "participant_query_parameters"; - - RcsParticipantQueryParams(int rcsThreadId, String aliasLike, String canonicalAddressLike, - @SortingProperty int sortingProperty, boolean isAscending, - int limit) { - mThreadId = rcsThreadId; - mAliasLike = aliasLike; - mCanonicalAddressLike = canonicalAddressLike; - mSortingProperty = sortingProperty; - mIsAscending = isAscending; - mLimit = limit; - } - - /** - * This is used in {@link com.android.internal.telephony.ims.RcsMessageStoreController} to get - * the thread that the result query should be limited to. - * - * As we do not expose any sort of integer ID's to public usage, this should be hidden. - * - * @hide - not meant for public use - */ - public int getThreadId() { - return mThreadId; - } - - /** - * @return Returns the SQL-inspired "LIKE" clause that will be used to match - * {@link RcsParticipant}s with respect to their aliases - * - * @see RcsParticipant#getAlias() - */ - public String getAliasLike() { - return mAliasLike; - } - - /** - * @return Returns the SQL-inspired "LIKE" clause that will be used to match - * {@link RcsParticipant}s with respect to their canonical addresses. - * - * @see RcsParticipant#getCanonicalAddress() - */ - public String getCanonicalAddressLike() { - return mCanonicalAddressLike; - } - - /** - * @return Returns the number of {@link RcsParticipant}s to be returned from the query. A value - * of 0 means there is no set limit. - */ - public int getLimit() { - return mLimit; - } - - /** - * @return Returns the property that will be used to sort the result against. - * @see SortingProperty - */ - public int getSortingProperty() { - return mSortingProperty; - } - - /** - * @return Returns {@code true} if the result set will be sorted in ascending order, - * {@code false} if it will be sorted in descending order. - */ - public boolean getSortDirection() { - return mIsAscending; - } - - /** - * A helper class to build the {@link RcsParticipantQueryParams}. - */ - public static class Builder { - private String mAliasLike; - private String mCanonicalAddressLike; - private @SortingProperty int mSortingProperty; - private boolean mIsAscending; - private int mLimit = 100; - private int mThreadId; - - /** - * Creates a new builder for {@link RcsParticipantQueryParams} to be used in - * {@link RcsMessageStore#getRcsParticipants(RcsParticipantQueryParams)} - */ - public Builder() { - // empty implementation - } - - /** - * Limits the resulting {@link RcsParticipant}s to only the given {@link RcsThread} - * - * @param rcsThread The thread that the participants should be searched in. - * @return The same {@link Builder} to chain methods. - */ - @CheckResult - public Builder setThread(RcsThread rcsThread) { - mThreadId = rcsThread.getThreadId(); - return this; - } - - /** - * Sets an SQL-inspired "like" clause to match with participant aliases. Using a percent - * sign ('%') wildcard matches any sequence of zero or more characters. Using an underscore - * ('_') wildcard matches any single character. Not using any wildcards would only perform a - * string match.The input string is case-insensitive. - * - * The input "An%e" would match {@link RcsParticipant}s with names Anne, Annie, Antonie, - * while the input "An_e" would only match Anne. - * - * @param likeClause The like clause to use for matching {@link RcsParticipant} aliases. - * @return The same {@link Builder} to chain methods - */ - @CheckResult - public Builder setAliasLike(String likeClause) { - mAliasLike = likeClause; - return this; - } - - /** - * Sets an SQL-inspired "like" clause to match with participant addresses. Using a percent - * sign ('%') wildcard matches any sequence of zero or more characters. Using an underscore - * ('_') wildcard matches any single character. Not using any wildcards would only perform a - * string match. The input string is case-insensitive. - * - * The input "+999%111" would match {@link RcsParticipant}s with addresses like "+9995111" - * or "+99955555111", while the input "+999_111" would only match "+9995111". - * - * @param likeClause The like clause to use for matching {@link RcsParticipant} canonical - * addresses. - * @return The same {@link Builder} to chain methods - */ - @CheckResult - public Builder setCanonicalAddressLike(String likeClause) { - mCanonicalAddressLike = likeClause; - return this; - } - - /** - * Desired number of threads to be returned from the query. Passing in 0 will return all - * existing threads at once. The limit defaults to 100. - * - * @param limit The number to limit the query result to. - * @return The same instance of the builder to chain parameters. - * @throws InvalidParameterException If the given limit is negative. - */ - @CheckResult - public Builder setResultLimit(@IntRange(from = 0) int limit) - throws InvalidParameterException { - if (limit < 0) { - throw new InvalidParameterException("The query limit must be non-negative"); - } - - mLimit = limit; - return this; - } - - /** - * Sets the property where the results should be sorted against. Defaults to - * {@link RcsParticipantQueryParams.SortingProperty#SORT_BY_CREATION_ORDER} - * - * @param sortingProperty against which property the results should be sorted - * @return The same instance of the builder to chain parameters. - */ - @CheckResult - public Builder setSortProperty(@SortingProperty int sortingProperty) { - mSortingProperty = sortingProperty; - return this; - } - - /** - * Sets whether the results should be sorted ascending or descending - * - * @param isAscending whether the results should be sorted ascending - * @return The same instance of the builder to chain parameters. - */ - @CheckResult - public Builder setSortDirection(boolean isAscending) { - mIsAscending = isAscending; - return this; - } - - /** - * Builds the {@link RcsParticipantQueryParams} to use in - * {@link RcsMessageStore#getRcsParticipants(RcsParticipantQueryParams)} - * - * @return An instance of {@link RcsParticipantQueryParams} to use with the participant - * query. - */ - public RcsParticipantQueryParams build() { - return new RcsParticipantQueryParams(mThreadId, mAliasLike, mCanonicalAddressLike, - mSortingProperty, mIsAscending, mLimit); - } - } - - /** - * Parcelable boilerplate below. - */ - private RcsParticipantQueryParams(Parcel in) { - mAliasLike = in.readString(); - mCanonicalAddressLike = in.readString(); - mSortingProperty = in.readInt(); - mIsAscending = in.readByte() == 1; - mLimit = in.readInt(); - mThreadId = in.readInt(); - } - - public static final @android.annotation.NonNull Creator<RcsParticipantQueryParams> CREATOR = - new Creator<RcsParticipantQueryParams>() { - @Override - public RcsParticipantQueryParams createFromParcel(Parcel in) { - return new RcsParticipantQueryParams(in); - } - - @Override - public RcsParticipantQueryParams[] newArray(int size) { - return new RcsParticipantQueryParams[size]; - } - }; - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeString(mAliasLike); - dest.writeString(mCanonicalAddressLike); - dest.writeInt(mSortingProperty); - dest.writeByte((byte) (mIsAscending ? 1 : 0)); - dest.writeInt(mLimit); - dest.writeInt(mThreadId); - } - -} diff --git a/telephony/java/android/telephony/ims/RcsParticipantQueryResult.java b/telephony/java/android/telephony/ims/RcsParticipantQueryResult.java deleted file mode 100644 index 0721dfdf5803..000000000000 --- a/telephony/java/android/telephony/ims/RcsParticipantQueryResult.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.annotation.NonNull; -import android.annotation.Nullable; - -import java.util.List; -import java.util.stream.Collectors; - -/** - * The result of a {@link RcsMessageStore#getRcsParticipants(RcsParticipantQueryParams)} - * call. This class allows getting the token for querying the next batch of participants in order to - * prevent handling large amounts of data at once. - * - * @hide - */ -public final class RcsParticipantQueryResult { - private final RcsControllerCall mRcsControllerCall; - private final RcsParticipantQueryResultParcelable mRcsParticipantQueryResultParcelable; - - RcsParticipantQueryResult( - RcsControllerCall rcsControllerCall, - RcsParticipantQueryResultParcelable rcsParticipantQueryResultParcelable) { - mRcsControllerCall = rcsControllerCall; - mRcsParticipantQueryResultParcelable = rcsParticipantQueryResultParcelable; - } - - /** - * Returns a token to call - * {@link RcsMessageStore#getRcsParticipants(RcsQueryContinuationToken)} - * to get the next batch of {@link RcsParticipant}s. - */ - @Nullable - public RcsQueryContinuationToken getContinuationToken() { - return mRcsParticipantQueryResultParcelable.mContinuationToken; - } - - /** - * Returns all the {@link RcsParticipant}s in the current query result. Call {@link - * RcsMessageStore#getRcsParticipants(RcsQueryContinuationToken)} to get the next - * batch of {@link RcsParticipant}s. - */ - @NonNull - public List<RcsParticipant> getParticipants() { - return mRcsParticipantQueryResultParcelable.mParticipantIds.stream() - .map(participantId -> new RcsParticipant(mRcsControllerCall, participantId)) - .collect(Collectors.toList()); - } -} diff --git a/telephony/java/android/telephony/ims/RcsParticipantQueryResultParcelable.aidl b/telephony/java/android/telephony/ims/RcsParticipantQueryResultParcelable.aidl deleted file mode 100644 index 54c72e70fac2..000000000000 --- a/telephony/java/android/telephony/ims/RcsParticipantQueryResultParcelable.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * - * Copyright 2019, 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.ims; - -parcelable RcsParticipantQueryResultParcelable; diff --git a/telephony/java/android/telephony/ims/RcsParticipantQueryResultParcelable.java b/telephony/java/android/telephony/ims/RcsParticipantQueryResultParcelable.java deleted file mode 100644 index 239b0e9b0fc0..000000000000 --- a/telephony/java/android/telephony/ims/RcsParticipantQueryResultParcelable.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.os.Parcel; -import android.os.Parcelable; - -import java.util.ArrayList; -import java.util.List; - -/** - * @hide - */ -public final class RcsParticipantQueryResultParcelable implements Parcelable { - final RcsQueryContinuationToken mContinuationToken; - final List<Integer> mParticipantIds; - - public RcsParticipantQueryResultParcelable( - RcsQueryContinuationToken continuationToken, - List<Integer> participantIds) { - mContinuationToken = continuationToken; - mParticipantIds = participantIds; - } - - private RcsParticipantQueryResultParcelable(Parcel in) { - mContinuationToken = in.readParcelable(RcsQueryContinuationToken.class.getClassLoader()); - mParticipantIds = new ArrayList<>(); - in.readList(mParticipantIds, Integer.class.getClassLoader()); - } - - public static final Parcelable.Creator<RcsParticipantQueryResultParcelable> CREATOR = - new Parcelable.Creator<RcsParticipantQueryResultParcelable>() { - @Override - public RcsParticipantQueryResultParcelable createFromParcel(Parcel in) { - return new RcsParticipantQueryResultParcelable(in); - } - - @Override - public RcsParticipantQueryResultParcelable[] newArray(int size) { - return new RcsParticipantQueryResultParcelable[size]; - } - }; - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeParcelable(mContinuationToken, flags); - dest.writeList(mParticipantIds); - } -} diff --git a/telephony/java/android/telephony/ims/RcsQueryContinuationToken.aidl b/telephony/java/android/telephony/ims/RcsQueryContinuationToken.aidl deleted file mode 100644 index 319379a462de..000000000000 --- a/telephony/java/android/telephony/ims/RcsQueryContinuationToken.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * - * Copyright 2019, 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.ims; - -parcelable RcsQueryContinuationToken; diff --git a/telephony/java/android/telephony/ims/RcsQueryContinuationToken.java b/telephony/java/android/telephony/ims/RcsQueryContinuationToken.java deleted file mode 100644 index 982263ac5c97..000000000000 --- a/telephony/java/android/telephony/ims/RcsQueryContinuationToken.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.annotation.IntDef; -import android.os.Parcel; -import android.os.Parcelable; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -/** - * A token for enabling continuation queries. Instances are acquired through - * {@code getContinuationToken} on result objects after initial query is done. - * - * @see RcsEventQueryResult#getContinuationToken() - * @see RcsMessageQueryResult#getContinuationToken() - * @see RcsParticipantQueryResult#getContinuationToken() - * @see RcsThreadQueryResult#getContinuationToken() - * - * @hide - */ -public final class RcsQueryContinuationToken implements Parcelable { - /** - * Denotes that this {@link RcsQueryContinuationToken} token is meant to allow continuing - * {@link RcsEvent} queries - */ - public static final int EVENT_QUERY_CONTINUATION_TOKEN_TYPE = 0; - - /** - * Denotes that this {@link RcsQueryContinuationToken} token is meant to allow continuing - * {@link RcsMessage} queries - */ - public static final int MESSAGE_QUERY_CONTINUATION_TOKEN_TYPE = 1; - - /** - * Denotes that this {@link RcsQueryContinuationToken} token is meant to allow continuing - * {@link RcsParticipant} queries - */ - public static final int PARTICIPANT_QUERY_CONTINUATION_TOKEN_TYPE = 2; - - /** - * Denotes that this {@link RcsQueryContinuationToken} token is meant to allow continuing - * {@link RcsThread} queries - */ - public static final int THREAD_QUERY_CONTINUATION_TOKEN_TYPE = 3; - - /** - * @hide - not meant for public use - */ - public static final String QUERY_CONTINUATION_TOKEN = "query_continuation_token"; - - @Retention(RetentionPolicy.SOURCE) - @IntDef({EVENT_QUERY_CONTINUATION_TOKEN_TYPE, MESSAGE_QUERY_CONTINUATION_TOKEN_TYPE, - PARTICIPANT_QUERY_CONTINUATION_TOKEN_TYPE, THREAD_QUERY_CONTINUATION_TOKEN_TYPE}) - public @interface ContinuationTokenType {} - - // The type of query this token should allow to continue - private @ContinuationTokenType int mQueryType; - // The raw query string for the initial query - private final String mRawQuery; - // The number of results that is returned with each query - private final int mLimit; - // The offset value that this query should start the query from - private int mOffset; - - /** - * @hide - */ - public RcsQueryContinuationToken(@ContinuationTokenType int queryType, String rawQuery, - int limit, int offset) { - mQueryType = queryType; - mRawQuery = rawQuery; - mLimit = limit; - mOffset = offset; - } - - /** - * Returns the original raw query used on {@link com.android.providers.telephony.RcsProvider} - * @hide - */ - public String getRawQuery() { - return mRawQuery; - } - - /** - * Returns which index this continuation query should start from - * @hide - */ - public int getOffset() { - return mOffset; - } - - /** - * Increments the offset by the amount of result rows returned with the continuation query for - * the next query. - * @hide - */ - public void incrementOffset() { - mOffset += mLimit; - } - - /** - * Returns the type of query that this {@link RcsQueryContinuationToken} is intended to be used - * to continue. - */ - public @ContinuationTokenType int getQueryType() { - return mQueryType; - } - - private RcsQueryContinuationToken(Parcel in) { - mQueryType = in.readInt(); - mRawQuery = in.readString(); - mLimit = in.readInt(); - mOffset = in.readInt(); - } - - public static final @android.annotation.NonNull Creator<RcsQueryContinuationToken> CREATOR = - new Creator<RcsQueryContinuationToken>() { - @Override - public RcsQueryContinuationToken createFromParcel(Parcel in) { - return new RcsQueryContinuationToken(in); - } - - @Override - public RcsQueryContinuationToken[] newArray(int size) { - return new RcsQueryContinuationToken[size]; - } - }; - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(mQueryType); - dest.writeString(mRawQuery); - dest.writeInt(mLimit); - dest.writeInt(mOffset); - } -} diff --git a/telephony/java/android/telephony/ims/RcsThread.java b/telephony/java/android/telephony/ims/RcsThread.java deleted file mode 100644 index efb2cca21c19..000000000000 --- a/telephony/java/android/telephony/ims/RcsThread.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import static android.provider.Telephony.RcsColumns.RcsUnifiedThreadColumns.THREAD_TYPE_1_TO_1; -import static android.provider.Telephony.RcsColumns.RcsUnifiedThreadColumns.THREAD_TYPE_GROUP; - -import android.annotation.NonNull; -import android.annotation.WorkerThread; - -import com.android.internal.annotations.VisibleForTesting; - -/** - * RcsThread represents a single RCS conversation thread. It holds messages that were sent and - * received and events that occurred on that thread. - * - * @hide - */ -public abstract class RcsThread { - /** - * The rcs_participant_thread_id that represents this thread in the database - * - * @hide - */ - protected int mThreadId; - - /** - * @hide - */ - protected final RcsControllerCall mRcsControllerCall; - - /** - * @hide - */ - protected RcsThread(RcsControllerCall rcsControllerCall, int threadId) { - mThreadId = threadId; - mRcsControllerCall = rcsControllerCall; - } - - /** - * @return Returns the summary of the latest message in this {@link RcsThread} packaged in an - * {@link RcsMessageSnippet} object - */ - @WorkerThread - @NonNull - public RcsMessageSnippet getSnippet() throws RcsMessageStoreException { - return mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getMessageSnippet(mThreadId, callingPackage)); - } - - /** - * Adds a new {@link RcsIncomingMessage} to this RcsThread and persists it in storage. - * - * @throws RcsMessageStoreException if the message could not be persisted into storage. - */ - @WorkerThread - @NonNull - public RcsIncomingMessage addIncomingMessage( - @NonNull RcsIncomingMessageCreationParams rcsIncomingMessageCreationParams) - throws RcsMessageStoreException { - int messageId = mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.addIncomingMessage(mThreadId, - rcsIncomingMessageCreationParams, callingPackage)); - return new RcsIncomingMessage(mRcsControllerCall, messageId); - } - - /** - * Adds a new {@link RcsOutgoingMessage} to this RcsThread and persists it in storage. - * - * @throws RcsMessageStoreException if the message could not be persisted into storage. - */ - @WorkerThread - @NonNull - public RcsOutgoingMessage addOutgoingMessage( - @NonNull RcsOutgoingMessageCreationParams rcsOutgoingMessageCreationParams) - throws RcsMessageStoreException { - int messageId = mRcsControllerCall.call((iRcs, callingPackage) -> iRcs.addOutgoingMessage( - mThreadId, rcsOutgoingMessageCreationParams, callingPackage)); - - return new RcsOutgoingMessage(mRcsControllerCall, messageId); - } - - /** - * Deletes an {@link RcsMessage} from this RcsThread and updates the storage. - * - * @param rcsMessage The message to delete from the thread - * @throws RcsMessageStoreException if the message could not be deleted - */ - @WorkerThread - public void deleteMessage(@NonNull RcsMessage rcsMessage) throws RcsMessageStoreException { - mRcsControllerCall.callWithNoReturn( - (iRcs, callingPackage) -> iRcs.deleteMessage(rcsMessage.getId(), - rcsMessage.isIncoming(), mThreadId, - isGroup(), callingPackage)); - } - - /** - * Convenience function for loading all the {@link RcsMessage}s in this {@link RcsThread}. For - * a more detailed and paginated query, please use - * {@link RcsMessageStore#getRcsMessages(RcsMessageQueryParams)} - * - * @return Loads the {@link RcsMessage}s in this thread and returns them in an immutable list. - * @throws RcsMessageStoreException if the messages could not be read from the storage - */ - @WorkerThread - @NonNull - public RcsMessageQueryResult getMessages() throws RcsMessageStoreException { - RcsMessageQueryParams queryParams = - new RcsMessageQueryParams.Builder().setThread(this).build(); - return new RcsMessageQueryResult(mRcsControllerCall, - mRcsControllerCall.call( - (iRcs, callingPackage) -> iRcs.getMessages(queryParams, callingPackage))); - } - - /** - * @return Returns whether this is a group thread or not - */ - public abstract boolean isGroup(); - - /** - * @hide - */ - @VisibleForTesting - public int getThreadId() { - return mThreadId; - } - - /** - * @hide - */ - public int getThreadType() { - return isGroup() ? THREAD_TYPE_GROUP : THREAD_TYPE_1_TO_1; - } -} diff --git a/telephony/java/android/telephony/ims/RcsThreadQueryParams.aidl b/telephony/java/android/telephony/ims/RcsThreadQueryParams.aidl deleted file mode 100644 index 3f351dc5efee..000000000000 --- a/telephony/java/android/telephony/ims/RcsThreadQueryParams.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * - * Copyright 2019, 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.ims; - -parcelable RcsThreadQueryParams; diff --git a/telephony/java/android/telephony/ims/RcsThreadQueryParams.java b/telephony/java/android/telephony/ims/RcsThreadQueryParams.java deleted file mode 100644 index da7cdb016034..000000000000 --- a/telephony/java/android/telephony/ims/RcsThreadQueryParams.java +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.annotation.CheckResult; -import android.annotation.IntDef; -import android.annotation.IntRange; -import android.annotation.NonNull; -import android.os.Parcel; -import android.os.Parcelable; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.security.InvalidParameterException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -/** - * The parameters to pass into {@link RcsMessageStore#getRcsThreads(RcsThreadQueryParams)} in - * order to select a subset of {@link RcsThread}s present in the message store. - * - * @hide - */ -public final class RcsThreadQueryParams implements Parcelable { - /** - * Bitmask flag to be used with {@link Builder#setThreadType(int)} to make - * {@link RcsMessageStore#getRcsThreads(RcsThreadQueryParams)} return - * {@link RcsGroupThread}s. - */ - public static final int THREAD_TYPE_GROUP = 0x0001; - - /** - * Bitmask flag to be used with {@link Builder#setThreadType(int)} to make - * {@link RcsMessageStore#getRcsThreads(RcsThreadQueryParams)} return - * {@link Rcs1To1Thread}s. - */ - public static final int THREAD_TYPE_1_TO_1 = 0x0002; - - // The type of threads to be filtered with the query - private final int mThreadType; - // The list of participants that are expected in the resulting threads - private final List<Integer> mRcsParticipantIds; - // The number of RcsThread's that should be returned with this query - private final int mLimit; - // The property which the result of the query should be sorted against - private final @SortingProperty int mSortingProperty; - // Whether the sorting should be done in ascending - private final boolean mIsAscending; - - /** - * Flag to be used with {@link Builder#setSortProperty(int)} to denote that the results should - * be sorted in the order of {@link RcsThread} creation time for faster results. - */ - public static final int SORT_BY_CREATION_ORDER = 0; - - /** - * Flag to be used with {@link Builder#setSortProperty(int)} to denote that the results should - * be sorted according to the timestamp of {@link RcsThread#getSnippet()} - */ - public static final int SORT_BY_TIMESTAMP = 1; - - @Retention(RetentionPolicy.SOURCE) - @IntDef({SORT_BY_CREATION_ORDER, SORT_BY_TIMESTAMP}) - public @interface SortingProperty { - } - - /** - * @hide - */ - public static final String THREAD_QUERY_PARAMETERS_KEY = "thread_query_parameters"; - - RcsThreadQueryParams(int threadType, Set<RcsParticipant> participants, - int limit, int sortingProperty, boolean isAscending) { - mThreadType = threadType; - mRcsParticipantIds = convertParticipantSetToIdList(participants); - mLimit = limit; - mSortingProperty = sortingProperty; - mIsAscending = isAscending; - } - - private static List<Integer> convertParticipantSetToIdList(Set<RcsParticipant> participants) { - List<Integer> ids = new ArrayList<>(participants.size()); - for (RcsParticipant participant : participants) { - ids.add(participant.getId()); - } - return ids; - } - - /** - * This is used in {@link com.android.internal.telephony.ims.RcsMessageStoreController} to get - * the list of participant IDs. - * - * As we don't expose any integer ID's to API users, this should stay hidden - * - * @hide - not meant for public use - */ - public List<Integer> getRcsParticipantsIds() { - return Collections.unmodifiableList(mRcsParticipantIds); - } - - /** - * @return Returns the bitmask flag for types of {@link RcsThread}s that this query should - * return. - */ - public int getThreadType() { - return mThreadType; - } - - /** - * @return Returns the number of {@link RcsThread}s to be returned from the query. A value - * of 0 means there is no set limit. - */ - public int getLimit() { - return mLimit; - } - - /** - * @return Returns the property that will be used to sort the result against. - * @see SortingProperty - */ - public @SortingProperty int getSortingProperty() { - return mSortingProperty; - } - - /** - * @return Returns {@code true} if the result set will be sorted in ascending order, - * {@code false} if it will be sorted in descending order. - */ - public boolean getSortDirection() { - return mIsAscending; - } - - /** - * A helper class to build the {@link RcsThreadQueryParams}. - */ - public static class Builder { - private int mThreadType; - private Set<RcsParticipant> mParticipants; - private int mLimit = 100; - private @SortingProperty int mSortingProperty; - private boolean mIsAscending; - - /** - * Constructs a {@link RcsThreadQueryParams.Builder} to help build an - * {@link RcsThreadQueryParams} - */ - public Builder() { - mParticipants = new HashSet<>(); - } - - /** - * Limits the query to only return group threads. - * - * @param threadType Whether to limit the query result to group threads. - * @return The same instance of the builder to chain parameters. - * @see RcsThreadQueryParams#THREAD_TYPE_GROUP - * @see RcsThreadQueryParams#THREAD_TYPE_1_TO_1 - */ - @CheckResult - public Builder setThreadType(int threadType) { - mThreadType = threadType; - return this; - } - - /** - * Limits the query to only return threads that contain the given participant. If this - * property was not set, participants will not be taken into account while querying for - * threads. - * - * @param participant The participant that must be included in all of the returned threads. - * @return The same instance of the builder to chain parameters. - */ - @CheckResult - public Builder setParticipant(@NonNull RcsParticipant participant) { - mParticipants.add(participant); - return this; - } - - /** - * Limits the query to only return threads that contain the given list of participants. If - * this property was not set, participants will not be taken into account while querying - * for threads. - * - * @param participants An iterable list of participants that must be included in all of the - * returned threads. - * @return The same instance of the builder to chain parameters. - */ - @CheckResult - public Builder setParticipants(@NonNull List<RcsParticipant> participants) { - mParticipants.addAll(participants); - return this; - } - - /** - * Desired number of threads to be returned from the query. Passing in 0 will return all - * existing threads at once. The limit defaults to 100. - * - * @param limit The number to limit the query result to. - * @return The same instance of the builder to chain parameters. - * @throws InvalidParameterException If the given limit is negative. - */ - @CheckResult - public Builder setResultLimit(@IntRange(from = 0) int limit) - throws InvalidParameterException { - if (limit < 0) { - throw new InvalidParameterException("The query limit must be non-negative"); - } - - mLimit = limit; - return this; - } - - /** - * Sets the property where the results should be sorted against. Defaults to - * {@link SortingProperty#SORT_BY_CREATION_ORDER} - * - * @param sortingProperty whether to sort in ascending order or not - * @return The same instance of the builder to chain parameters. - */ - @CheckResult - public Builder setSortProperty(@SortingProperty int sortingProperty) { - mSortingProperty = sortingProperty; - return this; - } - - /** - * Sets whether the results should be sorted ascending or descending - * - * @param isAscending whether the results should be sorted ascending - * @return The same instance of the builder to chain parameters. - */ - @CheckResult - public Builder setSortDirection(boolean isAscending) { - mIsAscending = isAscending; - return this; - } - - /** - * Builds the {@link RcsThreadQueryParams} to use in - * {@link RcsMessageStore#getRcsThreads(RcsThreadQueryParams)} - * - * @return An instance of {@link RcsThreadQueryParams} to use with the thread query. - */ - public RcsThreadQueryParams build() { - return new RcsThreadQueryParams(mThreadType, mParticipants, mLimit, - mSortingProperty, mIsAscending); - } - } - - /** - * Parcelable boilerplate below. - */ - private RcsThreadQueryParams(Parcel in) { - mThreadType = in.readInt(); - mRcsParticipantIds = new ArrayList<>(); - in.readList(mRcsParticipantIds, Integer.class.getClassLoader()); - mLimit = in.readInt(); - mSortingProperty = in.readInt(); - mIsAscending = in.readByte() == 1; - } - - public static final @android.annotation.NonNull Creator<RcsThreadQueryParams> CREATOR = - new Creator<RcsThreadQueryParams>() { - @Override - public RcsThreadQueryParams createFromParcel(Parcel in) { - return new RcsThreadQueryParams(in); - } - - @Override - public RcsThreadQueryParams[] newArray(int size) { - return new RcsThreadQueryParams[size]; - } - }; - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(mThreadType); - dest.writeList(mRcsParticipantIds); - dest.writeInt(mLimit); - dest.writeInt(mSortingProperty); - dest.writeByte((byte) (mIsAscending ? 1 : 0)); - } -} diff --git a/telephony/java/android/telephony/ims/RcsThreadQueryResult.java b/telephony/java/android/telephony/ims/RcsThreadQueryResult.java deleted file mode 100644 index 3de25de19430..000000000000 --- a/telephony/java/android/telephony/ims/RcsThreadQueryResult.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import static android.provider.Telephony.RcsColumns.RcsUnifiedThreadColumns.THREAD_TYPE_1_TO_1; - -import android.annotation.NonNull; -import android.annotation.Nullable; - -import java.util.List; -import java.util.stream.Collectors; - - -/** - * The result of a {@link RcsMessageStore#getRcsThreads(RcsThreadQueryParams)} - * call. This class allows getting the token for querying the next batch of threads in order to - * prevent handling large amounts of data at once. - * - * @hide - */ -public final class RcsThreadQueryResult { - private final RcsControllerCall mRcsControllerCall; - private final RcsThreadQueryResultParcelable mRcsThreadQueryResultParcelable; - - RcsThreadQueryResult(RcsControllerCall rcsControllerCall, - RcsThreadQueryResultParcelable rcsThreadQueryResultParcelable) { - mRcsControllerCall = rcsControllerCall; - mRcsThreadQueryResultParcelable = rcsThreadQueryResultParcelable; - } - - /** - * Returns a token to call - * {@link RcsMessageStore#getRcsThreads(RcsQueryContinuationToken)} - * to get the next batch of {@link RcsThread}s. - */ - @Nullable - public RcsQueryContinuationToken getContinuationToken() { - return mRcsThreadQueryResultParcelable.mContinuationToken; - } - - /** - * Returns all the RcsThreads in the current query result. Call {@link - * RcsMessageStore#getRcsThreads(RcsQueryContinuationToken)} to get the next batch of - * {@link RcsThread}s. - */ - @NonNull - public List<RcsThread> getThreads() { - return mRcsThreadQueryResultParcelable.mRcsThreadIds.stream() - .map(typeIdPair -> typeIdPair.getType() == THREAD_TYPE_1_TO_1 - ? new Rcs1To1Thread(mRcsControllerCall, typeIdPair.getId()) - : new RcsGroupThread(mRcsControllerCall, typeIdPair.getId())) - .collect(Collectors.toList()); - } -} diff --git a/telephony/java/android/telephony/ims/RcsThreadQueryResultParcelable.aidl b/telephony/java/android/telephony/ims/RcsThreadQueryResultParcelable.aidl deleted file mode 100644 index 05bd61de73e3..000000000000 --- a/telephony/java/android/telephony/ims/RcsThreadQueryResultParcelable.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * - * Copyright 2019, 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.ims; - -parcelable RcsThreadQueryResultParcelable; diff --git a/telephony/java/android/telephony/ims/RcsThreadQueryResultParcelable.java b/telephony/java/android/telephony/ims/RcsThreadQueryResultParcelable.java deleted file mode 100644 index 89dd1d48ef9b..000000000000 --- a/telephony/java/android/telephony/ims/RcsThreadQueryResultParcelable.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2019 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.ims; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.android.ims.RcsTypeIdPair; - -import java.util.ArrayList; -import java.util.List; - -/** - * @hide - */ -public final class RcsThreadQueryResultParcelable implements Parcelable { - final RcsQueryContinuationToken mContinuationToken; - final List<RcsTypeIdPair> mRcsThreadIds; - - public RcsThreadQueryResultParcelable( - RcsQueryContinuationToken continuationToken, - List<RcsTypeIdPair> rcsThreadIds) { - mContinuationToken = continuationToken; - mRcsThreadIds = rcsThreadIds; - } - - private RcsThreadQueryResultParcelable(Parcel in) { - mContinuationToken = in.readParcelable(RcsQueryContinuationToken.class.getClassLoader()); - mRcsThreadIds = new ArrayList<>(); - in.readList(mRcsThreadIds, RcsTypeIdPair.class.getClassLoader()); - } - - public static final Parcelable.Creator<RcsThreadQueryResultParcelable> CREATOR = - new Parcelable.Creator<RcsThreadQueryResultParcelable>() { - @Override - public RcsThreadQueryResultParcelable createFromParcel(Parcel in) { - return new RcsThreadQueryResultParcelable(in); - } - - @Override - public RcsThreadQueryResultParcelable[] newArray(int size) { - return new RcsThreadQueryResultParcelable[size]; - } - }; - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeParcelable(mContinuationToken, flags); - dest.writeList(mRcsThreadIds); - } -} diff --git a/telephony/java/android/telephony/ims/RcsUceAdapter.java b/telephony/java/android/telephony/ims/RcsUceAdapter.java index 6974420dbaf4..70edb758bb70 100644 --- a/telephony/java/android/telephony/ims/RcsUceAdapter.java +++ b/telephony/java/android/telephony/ims/RcsUceAdapter.java @@ -43,10 +43,7 @@ import java.util.concurrent.Executor; * Manages RCS User Capability Exchange for the subscription specified. * * @see ImsRcsManager#getUceAdapter() for information on creating an instance of this class. - * @hide */ -@SystemApi -@TestApi public class RcsUceAdapter { private static final String TAG = "RcsUceAdapter"; @@ -139,7 +136,7 @@ public class RcsUceAdapter { * UCE. * @hide */ - public static final int PUBLISH_STATE_200_OK = 1; + public static final int PUBLISH_STATE_OK = 1; /** * The hasn't published its capabilities since boot or hasn't gotten any publish response yet. @@ -179,7 +176,7 @@ public class RcsUceAdapter { /**@hide*/ @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = "PUBLISH_STATE_", value = { - PUBLISH_STATE_200_OK, + PUBLISH_STATE_OK, PUBLISH_STATE_NOT_PUBLISHED, PUBLISH_STATE_VOLTE_PROVISION_ERROR, PUBLISH_STATE_RCS_PROVISION_ERROR, @@ -216,6 +213,7 @@ public class RcsUceAdapter { } } + private final Context mContext; private final int mSubId; /** @@ -223,7 +221,8 @@ public class RcsUceAdapter { * {@link ImsRcsManager#getUceAdapter()} to instantiate this manager class. * @hide */ - RcsUceAdapter(int subId) { + RcsUceAdapter(Context context, int subId) { + mContext = context; mSubId = subId; } @@ -291,7 +290,8 @@ public class RcsUceAdapter { }; try { - imsRcsController.requestCapabilities(mSubId, contactNumbers, internalCallback); + imsRcsController.requestCapabilities(mSubId, mContext.getOpPackageName(), + null /*featureId*/, contactNumbers, internalCallback); } catch (RemoteException e) { Log.e(TAG, "Error calling IImsRcsController#requestCapabilities", e); throw new ImsException("Remote IMS Service is not available", @@ -303,7 +303,7 @@ public class RcsUceAdapter { * Gets the last publish result from the UCE service if the device is using an RCS presence * server. * @return The last publish result from the UCE service. If the device is using SIP OPTIONS, - * this method will return {@link #PUBLISH_STATE_200_OK} as well. + * this method will return {@link #PUBLISH_STATE_OK} as well. * @throws ImsException if the subscription associated with this instance of * {@link RcsUceAdapter} is valid, but the ImsService associated with the subscription is not * available. This can happen if the ImsService has crashed, for example, or if the subscription @@ -341,7 +341,7 @@ public class RcsUceAdapter { * available. This can happen if the ImsService has crashed, for example, or if the subscription * becomes inactive. See {@link ImsException#getCode()} for more information on the error codes. */ - @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @RequiresPermission(Manifest.permission.READ_PHONE_STATE) public boolean isUceSettingEnabled() throws ImsException { IImsRcsController imsRcsController = getIImsRcsController(); if (imsRcsController == null) { @@ -349,9 +349,10 @@ public class RcsUceAdapter { throw new ImsException("Can not find remote IMS service", ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); } - try { - return imsRcsController.isUceSettingEnabled(mSubId); + // Telephony.SimInfo#IMS_RCS_UCE_ENABLED can also be used to listen to changes to this. + return imsRcsController.isUceSettingEnabled(mSubId, mContext.getOpPackageName(), + null /*featureId*/); } catch (RemoteException e) { Log.e(TAG, "Error calling IImsRcsController#isUceSettingEnabled", e); throw new ImsException("Remote IMS Service is not available", @@ -362,6 +363,10 @@ public class RcsUceAdapter { /** * Change the user’s setting for whether or not UCE is enabled for the associated subscription. * <p> + * If an application Requires UCE, they may launch an Activity using the Intent + * {@link ImsRcsManager#ACTION_SHOW_CAPABILITY_DISCOVERY_OPT_IN}, which will ask the user if + * they wish to enable this feature. + * <p> * Note: This setting does not affect whether or not the device publishes its service * capabilities if the subscription supports presence publication. * @@ -371,7 +376,10 @@ public class RcsUceAdapter { * {@link RcsUceAdapter} is valid, but the ImsService associated with the subscription is not * available. This can happen if the ImsService has crashed, for example, or if the subscription * becomes inactive. See {@link ImsException#getCode()} for more information on the error codes. + * @hide */ + @SystemApi + @TestApi @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) public void setUceSettingEnabled(boolean isEnabled) throws ImsException { IImsRcsController imsRcsController = getIImsRcsController(); diff --git a/telephony/java/android/telephony/ims/RegistrationManager.java b/telephony/java/android/telephony/ims/RegistrationManager.java index 5c86ba732701..1dbaff5df802 100644 --- a/telephony/java/android/telephony/ims/RegistrationManager.java +++ b/telephony/java/android/telephony/ims/RegistrationManager.java @@ -196,11 +196,11 @@ public interface RegistrationManager { } /** - * Notifies the framework when the IMS Provider is deregistered from the IMS network. + * Notifies the framework when the IMS Provider is unregistered from the IMS network. * * @param info the {@link ImsReasonInfo} associated with why registration was disconnected. */ - public void onUnregistered(@Nullable ImsReasonInfo info) { + public void onUnregistered(@NonNull ImsReasonInfo info) { } /** @@ -211,7 +211,7 @@ public interface RegistrationManager { */ public void onTechnologyChangeFailed( @AccessNetworkConstants.TransportType int imsTransportType, - @Nullable ImsReasonInfo info) { + @NonNull ImsReasonInfo info) { } /** diff --git a/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl b/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl index 6f6aa44371fa..483c66eedc0c 100644 --- a/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl +++ b/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl @@ -42,8 +42,9 @@ interface IImsRcsController { boolean isAvailable(int subId, int capability); // ImsUceAdapter specific - void requestCapabilities(int subId, in List<Uri> contactNumbers, IRcsUceControllerCallback c); + void requestCapabilities(int subId, String callingPackage, String callingFeatureId, + in List<Uri> contactNumbers, IRcsUceControllerCallback c); int getUcePublishState(int subId); - boolean isUceSettingEnabled(int subId); + boolean isUceSettingEnabled(int subId, String callingPackage, String callingFeatureId); void setUceSettingEnabled(int subId, boolean isEnabled); } diff --git a/telephony/java/android/telephony/ims/aidl/IRcsMessage.aidl b/telephony/java/android/telephony/ims/aidl/IRcsMessage.aidl deleted file mode 100644 index 0ae6303f024e..000000000000 --- a/telephony/java/android/telephony/ims/aidl/IRcsMessage.aidl +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright (C) 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 android.telephony.ims.aidl; - -import android.net.Uri; -import android.telephony.ims.RcsEventQueryParams; -import android.telephony.ims.RcsEventQueryResultDescriptor; -import android.telephony.ims.RcsFileTransferCreationParams; -import android.telephony.ims.RcsIncomingMessageCreationParams; -import android.telephony.ims.RcsMessageSnippet; -import android.telephony.ims.RcsMessageQueryParams; -import android.telephony.ims.RcsMessageQueryResultParcelable; -import android.telephony.ims.RcsOutgoingMessageCreationParams; -import android.telephony.ims.RcsParticipantQueryParams; -import android.telephony.ims.RcsParticipantQueryResultParcelable; -import android.telephony.ims.RcsQueryContinuationToken; -import android.telephony.ims.RcsThreadQueryParams; -import android.telephony.ims.RcsThreadQueryResultParcelable; - -/** - * RPC definition between RCS storage APIs and phone process. - * {@hide} - */ -interface IRcsMessage { - ///////////////////////// - // RcsMessageStore APIs - ///////////////////////// - RcsThreadQueryResultParcelable getRcsThreads(in RcsThreadQueryParams queryParams, String callingPackage); - - RcsThreadQueryResultParcelable getRcsThreadsWithToken( - in RcsQueryContinuationToken continuationToken, String callingPackage); - - RcsParticipantQueryResultParcelable getParticipants(in RcsParticipantQueryParams queryParams, String callingPackage); - - RcsParticipantQueryResultParcelable getParticipantsWithToken( - in RcsQueryContinuationToken continuationToken, String callingPackage); - - RcsMessageQueryResultParcelable getMessages(in RcsMessageQueryParams queryParams, String callingPackage); - - RcsMessageQueryResultParcelable getMessagesWithToken( - in RcsQueryContinuationToken continuationToken, String callingPackage); - - RcsEventQueryResultDescriptor getEvents(in RcsEventQueryParams queryParams, String callingPackage); - - RcsEventQueryResultDescriptor getEventsWithToken( - in RcsQueryContinuationToken continuationToken, String callingPackage); - - // returns true if the thread was successfully deleted - boolean deleteThread(int threadId, int threadType, String callingPackage); - - // Creates an Rcs1To1Thread and returns its row ID - int createRcs1To1Thread(int participantId, String callingPackage); - - // Creates an RcsGroupThread and returns its row ID - int createGroupThread(in int[] participantIds, String groupName, in Uri groupIcon, String callingPackage); - - ///////////////////////// - // RcsThread APIs - ///////////////////////// - - // Creates a new RcsIncomingMessage on the given thread and returns its row ID - int addIncomingMessage(int rcsThreadId, - in RcsIncomingMessageCreationParams rcsIncomingMessageCreationParams, String callingPackage); - - // Creates a new RcsOutgoingMessage on the given thread and returns its row ID - int addOutgoingMessage(int rcsThreadId, - in RcsOutgoingMessageCreationParams rcsOutgoingMessageCreationParams, String callingPackage); - - // TODO: modify RcsProvider URI's to allow deleting a message without specifying its thread - void deleteMessage(int rcsMessageId, boolean isIncoming, int rcsThreadId, boolean isGroup, String callingPackage); - - RcsMessageSnippet getMessageSnippet(int rcsThreadId, String callingPackage); - - ///////////////////////// - // Rcs1To1Thread APIs - ///////////////////////// - void set1To1ThreadFallbackThreadId(int rcsThreadId, long fallbackId, String callingPackage); - - long get1To1ThreadFallbackThreadId(int rcsThreadId, String callingPackage); - - int get1To1ThreadOtherParticipantId(int rcsThreadId, String callingPackage); - - ///////////////////////// - // RcsGroupThread APIs - ///////////////////////// - void setGroupThreadName(int rcsThreadId, String groupName, String callingPackage); - - String getGroupThreadName(int rcsThreadId, String callingPackage); - - void setGroupThreadIcon(int rcsThreadId, in Uri groupIcon, String callingPackage); - - Uri getGroupThreadIcon(int rcsThreadId, String callingPackage); - - void setGroupThreadOwner(int rcsThreadId, int participantId, String callingPackage); - - int getGroupThreadOwner(int rcsThreadId, String callingPackage); - - void setGroupThreadConferenceUri(int rcsThreadId, in Uri conferenceUri, String callingPackage); - - Uri getGroupThreadConferenceUri(int rcsThreadId, String callingPackage); - - void addParticipantToGroupThread(int rcsThreadId, int participantId, String callingPackage); - - void removeParticipantFromGroupThread(int rcsThreadId, int participantId, String callingPackage); - - ///////////////////////// - // RcsParticipant APIs - ///////////////////////// - - // Creates a new RcsParticipant and returns its rowId - int createRcsParticipant(String canonicalAddress, String alias, String callingPackage); - - String getRcsParticipantCanonicalAddress(int participantId, String callingPackage); - - String getRcsParticipantAlias(int participantId, String callingPackage); - - void setRcsParticipantAlias(int id, String alias, String callingPackage); - - String getRcsParticipantContactId(int participantId, String callingPackage); - - void setRcsParticipantContactId(int participantId, String contactId, String callingPackage); - - ///////////////////////// - // RcsMessage APIs - ///////////////////////// - void setMessageSubId(int messageId, boolean isIncoming, int subId, String callingPackage); - - int getMessageSubId(int messageId, boolean isIncoming, String callingPackage); - - void setMessageStatus(int messageId, boolean isIncoming, int status, String callingPackage); - - int getMessageStatus(int messageId, boolean isIncoming, String callingPackage); - - void setMessageOriginationTimestamp(int messageId, boolean isIncoming, long originationTimestamp, String callingPackage); - - long getMessageOriginationTimestamp(int messageId, boolean isIncoming, String callingPackage); - - void setGlobalMessageIdForMessage(int messageId, boolean isIncoming, String globalId, String callingPackage); - - String getGlobalMessageIdForMessage(int messageId, boolean isIncoming, String callingPackage); - - void setMessageArrivalTimestamp(int messageId, boolean isIncoming, long arrivalTimestamp, String callingPackage); - - long getMessageArrivalTimestamp(int messageId, boolean isIncoming, String callingPackage); - - void setMessageSeenTimestamp(int messageId, boolean isIncoming, long seenTimestamp, String callingPackage); - - long getMessageSeenTimestamp(int messageId, boolean isIncoming, String callingPackage); - - void setTextForMessage(int messageId, boolean isIncoming, String text, String callingPackage); - - String getTextForMessage(int messageId, boolean isIncoming, String callingPackage); - - void setLatitudeForMessage(int messageId, boolean isIncoming, double latitude, String callingPackage); - - double getLatitudeForMessage(int messageId, boolean isIncoming, String callingPackage); - - void setLongitudeForMessage(int messageId, boolean isIncoming, double longitude, String callingPackage); - - double getLongitudeForMessage(int messageId, boolean isIncoming, String callingPackage); - - // Returns the ID's of the file transfers attached to the given message - int[] getFileTransfersAttachedToMessage(int messageId, boolean isIncoming, String callingPackage); - - int getSenderParticipant(int messageId, String callingPackage); - - ///////////////////////// - // RcsOutgoingMessageDelivery APIs - ///////////////////////// - - // Returns the participant ID's that this message is intended to be delivered to - int[] getMessageRecipients(int messageId, String callingPackage); - - long getOutgoingDeliveryDeliveredTimestamp(int messageId, int participantId, String callingPackage); - - void setOutgoingDeliveryDeliveredTimestamp(int messageId, int participantId, long deliveredTimestamp, String callingPackage); - - long getOutgoingDeliverySeenTimestamp(int messageId, int participantId, String callingPackage); - - void setOutgoingDeliverySeenTimestamp(int messageId, int participantId, long seenTimestamp, String callingPackage); - - int getOutgoingDeliveryStatus(int messageId, int participantId, String callingPackage); - - void setOutgoingDeliveryStatus(int messageId, int participantId, int status, String callingPackage); - - ///////////////////////// - // RcsFileTransferPart APIs - ///////////////////////// - - // Performs the initial write to storage and returns the row ID. - int storeFileTransfer(int messageId, boolean isIncoming, - in RcsFileTransferCreationParams fileTransferCreationParams, String callingPackage); - - void deleteFileTransfer(int partId, String callingPackage); - - void setFileTransferSessionId(int partId, String sessionId, String callingPackage); - - String getFileTransferSessionId(int partId, String callingPackage); - - void setFileTransferContentUri(int partId, in Uri contentUri, String callingPackage); - - Uri getFileTransferContentUri(int partId, String callingPackage); - - void setFileTransferContentType(int partId, String contentType, String callingPackage); - - String getFileTransferContentType(int partId, String callingPackage); - - void setFileTransferFileSize(int partId, long fileSize, String callingPackage); - - long getFileTransferFileSize(int partId, String callingPackage); - - void setFileTransferTransferOffset(int partId, long transferOffset, String callingPackage); - - long getFileTransferTransferOffset(int partId, String callingPackage); - - void setFileTransferStatus(int partId, int transferStatus, String callingPackage); - - int getFileTransferStatus(int partId, String callingPackage); - - void setFileTransferWidth(int partId, int width, String callingPackage); - - int getFileTransferWidth(int partId, String callingPackage); - - void setFileTransferHeight(int partId, int height, String callingPackage); - - int getFileTransferHeight(int partId, String callingPackage); - - void setFileTransferLength(int partId, long length, String callingPackage); - - long getFileTransferLength(int partId, String callingPackage); - - void setFileTransferPreviewUri(int partId, in Uri uri, String callingPackage); - - Uri getFileTransferPreviewUri(int partId, String callingPackage); - - void setFileTransferPreviewType(int partId, String type, String callingPackage); - - String getFileTransferPreviewType(int partId, String callingPackage); - - ///////////////////////// - // RcsEvent APIs - ///////////////////////// - int createGroupThreadNameChangedEvent(long timestamp, int threadId, int originationParticipantId, String newName, String callingPackage); - - int createGroupThreadIconChangedEvent(long timestamp, int threadId, int originationParticipantId, in Uri newIcon, String callingPackage); - - int createGroupThreadParticipantJoinedEvent(long timestamp, int threadId, int originationParticipantId, int participantId, String callingPackage); - - int createGroupThreadParticipantLeftEvent(long timestamp, int threadId, int originationParticipantId, int participantId, String callingPackage); - - int createParticipantAliasChangedEvent(long timestamp, int participantId, String newAlias, String callingPackage); -}
\ No newline at end of file diff --git a/telephony/java/android/telephony/ims/stub/ImsRegistrationImplBase.java b/telephony/java/android/telephony/ims/stub/ImsRegistrationImplBase.java index 14a64d2585ed..7069e0ab9b1e 100644 --- a/telephony/java/android/telephony/ims/stub/ImsRegistrationImplBase.java +++ b/telephony/java/android/telephony/ims/stub/ImsRegistrationImplBase.java @@ -175,9 +175,11 @@ public class ImsRegistrationImplBase { */ public final void onDeregistered(ImsReasonInfo info) { updateToDisconnectedState(info); + // ImsReasonInfo should never be null. + final ImsReasonInfo reasonInfo = (info != null) ? info : new ImsReasonInfo(); mCallbacks.broadcastAction((c) -> { try { - c.onDeregistered(info); + c.onDeregistered(reasonInfo); } catch (RemoteException e) { Log.w(LOG_TAG, e + " " + "onRegistrationDisconnected() - Skipping " + "callback."); @@ -194,9 +196,10 @@ public class ImsRegistrationImplBase { */ public final void onTechnologyChangeFailed(@ImsRegistrationTech int imsRadioTech, ImsReasonInfo info) { + final ImsReasonInfo reasonInfo = (info != null) ? info : new ImsReasonInfo(); mCallbacks.broadcastAction((c) -> { try { - c.onTechnologyChangeFailed(imsRadioTech, info); + c.onTechnologyChangeFailed(imsRadioTech, reasonInfo); } catch (RemoteException e) { Log.w(LOG_TAG, e + " " + "onRegistrationChangeFailed() - Skipping " + "callback."); diff --git a/telephony/java/com/android/ims/ImsConfig.java b/telephony/java/com/android/ims/ImsConfig.java index 96f77d809183..d0cec52dfc86 100644 --- a/telephony/java/com/android/ims/ImsConfig.java +++ b/telephony/java/com/android/ims/ImsConfig.java @@ -270,11 +270,12 @@ public class ImsConfig { /** * Requested expiration for Published Offline availability. * Value is in Integer format. - * @deprecated use {@link ProvisioningManager#KEY_RCS_PUBLISH_TIMER_EXTENDED_SEC}. + * @deprecated use + * {@link ProvisioningManager#KEY_RCS_PUBLISH_OFFLINE_AVAILABILITY_TIMER_SEC}. */ @Deprecated public static final int PUBLISH_TIMER_EXTENDED = - ProvisioningManager.KEY_RCS_PUBLISH_TIMER_EXTENDED_SEC; + ProvisioningManager.KEY_RCS_PUBLISH_OFFLINE_AVAILABILITY_TIMER_SEC; /** * diff --git a/telephony/java/com/android/internal/telephony/DctConstants.java b/telephony/java/com/android/internal/telephony/DctConstants.java index 1449a62fbf35..f61d4e14f1d3 100644 --- a/telephony/java/com/android/internal/telephony/DctConstants.java +++ b/telephony/java/com/android/internal/telephony/DctConstants.java @@ -114,6 +114,7 @@ public class DctConstants { public static final int EVENT_SERVICE_STATE_CHANGED = BASE + 52; public static final int EVENT_5G_TIMER_HYSTERESIS = BASE + 53; public static final int EVENT_5G_TIMER_WATCHDOG = BASE + 54; + public static final int EVENT_UPDATE_CARRIER_CONFIGS = BASE + 55; /***** Constants *****/ @@ -123,4 +124,6 @@ public class DctConstants { public static final String APN_TYPE_KEY = "apnType"; public static final String PROVISIONING_URL_KEY = "provisioningUrl"; + public static final String BANDWIDTH_SOURCE_MODEM_KEY = "modem"; + public static final String BANDWIDTH_SOURCE_CARRIER_CONFIG_KEY = "carrier_config"; } diff --git a/telephony/java/android/telephony/ims/RcsEventQueryResultDescriptor.aidl b/telephony/java/com/android/internal/telephony/IBooleanConsumer.aidl index 0beaaab4f639..eb5bedabf15f 100644 --- a/telephony/java/android/telephony/ims/RcsEventQueryResultDescriptor.aidl +++ b/telephony/java/com/android/internal/telephony/IBooleanConsumer.aidl @@ -1,12 +1,11 @@ /* - * - * Copyright 2019, The Android Open Source Project + * Copyright (C) 2020 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 + * 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, @@ -15,6 +14,10 @@ * limitations under the License. */ -package android.telephony.ims; +package com.android.internal.telephony; -parcelable RcsEventQueryResultDescriptor; +// Copies consumer pattern for an operation that requires a boolean result from another process to +// finish. +oneway interface IBooleanConsumer { + void accept(boolean result); +}
\ No newline at end of file diff --git a/telephony/java/com/android/internal/telephony/ISms.aidl b/telephony/java/com/android/internal/telephony/ISms.aidl index c07a1711b32e..88da3c94748b 100644 --- a/telephony/java/com/android/internal/telephony/ISms.aidl +++ b/telephony/java/com/android/internal/telephony/ISms.aidl @@ -86,37 +86,9 @@ interface ISms { * raw pdu of the status report is in the extended data ("pdu"). * @param subId the subId id. */ - void sendDataForSubscriber(int subId, String callingPkg, in String destAddr, - in String scAddr, in int destPort, in byte[] data, in PendingIntent sentIntent, - in PendingIntent deliveryIntent); - - /** - * Send a data SMS. Only for use internally. - * - * @param smsc the SMSC to send the message through, or NULL for the - * default SMSC - * @param data the body of the message to send - * @param sentIntent if not NULL this <code>PendingIntent</code> is - * broadcast when the message is sucessfully sent, or failed. - * The result code will be <code>Activity.RESULT_OK<code> for success, - * or one of these errors:<br> - * <code>RESULT_ERROR_GENERIC_FAILURE</code><br> - * <code>RESULT_ERROR_RADIO_OFF</code><br> - * <code>RESULT_ERROR_NULL_PDU</code><br> - * For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include - * the extra "errorCode" containing a radio technology specific value, - * generally only useful for troubleshooting.<br> - * The per-application based SMS control checks sentIntent. If sentIntent - * is NULL the caller will be checked against all unknown applicaitons, - * which cause smaller number of SMS to be sent in checking period. - * @param deliveryIntent if not NULL this <code>PendingIntent</code> is - * broadcast when the message is delivered to the recipient. The - * raw pdu of the status report is in the extended data ("pdu"). - * @param subId the subId id. - */ - void sendDataForSubscriberWithSelfPermissions(int subId, String callingPkg, in String destAddr, - in String scAddr, in int destPort, in byte[] data, in PendingIntent sentIntent, - in PendingIntent deliveryIntent); + void sendDataForSubscriber(int subId, String callingPkg, String callingattributionTag, + in String destAddr, in String scAddr, in int destPort,in byte[] data, + in PendingIntent sentIntent, in PendingIntent deliveryIntent); /** * Send an SMS. @@ -146,37 +118,9 @@ interface ISms { * by a non-default SMS app. Currently only the carrier app can set this * parameter to false to skip auto message persistence. */ - void sendTextForSubscriber(in int subId, String callingPkg, in String destAddr, - in String scAddr, in String text, in PendingIntent sentIntent, - in PendingIntent deliveryIntent, in boolean persistMessageForNonDefaultSmsApp); - - /** - * Send an SMS. Internal use only. - * - * @param smsc the SMSC to send the message through, or NULL for the - * default SMSC - * @param text the body of the message to send - * @param sentIntent if not NULL this <code>PendingIntent</code> is - * broadcast when the message is sucessfully sent, or failed. - * The result code will be <code>Activity.RESULT_OK<code> for success, - * or one of these errors:<br> - * <code>RESULT_ERROR_GENERIC_FAILURE</code><br> - * <code>RESULT_ERROR_RADIO_OFF</code><br> - * <code>RESULT_ERROR_NULL_PDU</code><br> - * For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include - * the extra "errorCode" containing a radio technology specific value, - * generally only useful for troubleshooting.<br> - * The per-application based SMS control checks sentIntent. If sentIntent - * is NULL the caller will be checked against all unknown applications, - * which cause smaller number of SMS to be sent in checking period. - * @param deliveryIntent if not NULL this <code>PendingIntent</code> is - * broadcast when the message is delivered to the recipient. The - * raw pdu of the status report is in the extended data ("pdu"). - * @param subId the subId on which the SMS has to be sent. - */ - void sendTextForSubscriberWithSelfPermissions(in int subId, String callingPkg, + void sendTextForSubscriber(in int subId, String callingPkg, String callingAttributionTag, in String destAddr, in String scAddr, in String text, in PendingIntent sentIntent, - in PendingIntent deliveryIntent, in boolean persistMessage); + in PendingIntent deliveryIntent, in boolean persistMessageForNonDefaultSmsApp); /** * Send an SMS with options using Subscription Id. @@ -224,10 +168,11 @@ interface ISms { * Validity Period(Maximum) -> 635040 mins(i.e.63 weeks). * Any Other values included Negative considered as Invalid Validity Period of the message. */ - void sendTextForSubscriberWithOptions(in int subId, String callingPkg, in String destAddr, - in String scAddr, in String text, in PendingIntent sentIntent, - in PendingIntent deliveryIntent, in boolean persistMessageForNonDefaultSmsApp, - in int priority, in boolean expectMore, in int validityPeriod); + void sendTextForSubscriberWithOptions(in int subId, String callingPkg, + String callingAttributionTag, in String destAddr, in String scAddr, in String text, + in PendingIntent sentIntent, in PendingIntent deliveryIntent, + in boolean persistMessageForNonDefaultSmsApp, in int priority, in boolean expectMore, + in int validityPeriod); /** * Inject an SMS PDU into the android platform. @@ -272,7 +217,7 @@ interface ISms { * parameter to false to skip auto message persistence. */ void sendMultipartTextForSubscriber(in int subId, String callingPkg, - in String destinationAddress, in String scAddress, + String callingAttributionTag, in String destinationAddress, in String scAddress, in List<String> parts, in List<PendingIntent> sentIntents, in List<PendingIntent> deliveryIntents, in boolean persistMessageForNonDefaultSmsApp); @@ -321,10 +266,10 @@ interface ISms { * Any Other values included Negative considered as Invalid Validity Period of the message. */ void sendMultipartTextForSubscriberWithOptions(in int subId, String callingPkg, - in String destinationAddress, in String scAddress, in List<String> parts, - in List<PendingIntent> sentIntents, in List<PendingIntent> deliveryIntents, - in boolean persistMessageForNonDefaultSmsApp, in int priority, in boolean expectMore, - in int validityPeriod); + String callingAttributionTag, in String destinationAddress, in String scAddress, + in List<String> parts, in List<PendingIntent> sentIntents, + in List<PendingIntent> deliveryIntents, in boolean persistMessageForNonDefaultSmsApp, + in int priority, in boolean expectMore, in int validityPeriod); /** * Enable reception of cell broadcast (SMS-CB) messages with the given @@ -482,6 +427,7 @@ interface ISms { * * @param subId the SIM id. * @param callingPkg the package name of the calling app + * @param callingAttributionTag the attribution tag of calling context * @param messageUri the URI of the stored message * @param scAddress is the service center address or null to use the current default SMSC * @param sentIntent if not NULL this <code>PendingIntent</code> is @@ -501,8 +447,9 @@ interface ISms { * broadcast when the message is delivered to the recipient. The * raw pdu of the status report is in the extended data ("pdu"). */ - void sendStoredText(int subId, String callingPkg, in Uri messageUri, String scAddress, - in PendingIntent sentIntent, in PendingIntent deliveryIntent); + void sendStoredText(int subId, String callingPkg, String callingAttributionTag, + in Uri messageUri, String scAddress, in PendingIntent sentIntent, + in PendingIntent deliveryIntent); /** * Send a system stored multi-part text message. @@ -514,6 +461,7 @@ interface ISms { * * @param subId the SIM id. * @param callingPkg the package name of the calling app + * @param callingAttributeTag the attribute tag of the calling context * @param messageUri the URI of the stored message * @param scAddress is the service center address or null to use * the current default SMSC @@ -537,8 +485,8 @@ interface ISms { * to the recipient. The raw pdu of the status report is in the * extended data ("pdu"). */ - void sendStoredMultipartText(int subId, String callingPkg, in Uri messageUri, - String scAddress, in List<PendingIntent> sentIntents, + void sendStoredMultipartText(int subId, String callingPkg, String callingAttributeTag, + in Uri messageUri, String scAddress, in List<PendingIntent> sentIntents, in List<PendingIntent> deliveryIntents); /** diff --git a/telephony/java/com/android/internal/telephony/ISmsImplBase.java b/telephony/java/com/android/internal/telephony/ISmsImplBase.java index ddd3457b3b4d..51af6de78627 100644 --- a/telephony/java/com/android/internal/telephony/ISmsImplBase.java +++ b/telephony/java/com/android/internal/telephony/ISmsImplBase.java @@ -45,38 +45,25 @@ public class ISmsImplBase extends ISms.Stub { } @Override - public void sendDataForSubscriber(int subId, String callingPkg, String destAddr, - String scAddr, int destPort, byte[] data, PendingIntent sentIntent, - PendingIntent deliveryIntent) { - throw new UnsupportedOperationException(); - } - - @Override - public void sendDataForSubscriberWithSelfPermissions(int subId, String callingPkg, + public void sendDataForSubscriber(int subId, String callingPkg, String callingAttributionTag, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) { throw new UnsupportedOperationException(); } @Override - public void sendTextForSubscriber(int subId, String callingPkg, String destAddr, - String scAddr, String text, PendingIntent sentIntent, - PendingIntent deliveryIntent, boolean persistMessageForNonDefaultSmsApp) { - throw new UnsupportedOperationException(); - } - - @Override - public void sendTextForSubscriberWithSelfPermissions(int subId, String callingPkg, + public void sendTextForSubscriber(int subId, String callingPkg, String callingAttributionTag, String destAddr, String scAddr, String text, PendingIntent sentIntent, - PendingIntent deliveryIntent, boolean persistMessage) { + PendingIntent deliveryIntent, boolean persistMessageForNonDefaultSmsApp) { throw new UnsupportedOperationException(); } @Override - public void sendTextForSubscriberWithOptions(int subId, String callingPkg, String destAddr, - String scAddr, String text, PendingIntent sentIntent, - PendingIntent deliveryIntent, boolean persistMessageForNonDefaultSmsApp, - int priority, boolean expectMore, int validityPeriod) { + public void sendTextForSubscriberWithOptions(int subId, String callingPkg, + String callingAttributionTag, String destAddr, String scAddr, String text, + PendingIntent sentIntent, PendingIntent deliveryIntent, + boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore, + int validityPeriod) { throw new UnsupportedOperationException(); } @@ -88,7 +75,7 @@ public class ISmsImplBase extends ISms.Stub { @Override public void sendMultipartTextForSubscriber(int subId, String callingPkg, - String destinationAddress, String scAddress, + String callingAttributionTag, String destinationAddress, String scAddress, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents, boolean persistMessageForNonDefaultSmsApp) { throw new UnsupportedOperationException(); @@ -96,7 +83,7 @@ public class ISmsImplBase extends ISms.Stub { @Override public void sendMultipartTextForSubscriberWithOptions(int subId, String callingPkg, - String destinationAddress, String scAddress, + String callingAttributionTag, String destinationAddress, String scAddress, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents, boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore, int validityPeriod) { @@ -173,14 +160,15 @@ public class ISmsImplBase extends ISms.Stub { } @Override - public void sendStoredText(int subId, String callingPkg, Uri messageUri, String scAddress, - PendingIntent sentIntent, PendingIntent deliveryIntent) { + public void sendStoredText(int subId, String callingPkg, String callingAttributionTag, + Uri messageUri, String scAddress, PendingIntent sentIntent, + PendingIntent deliveryIntent) { throw new UnsupportedOperationException(); } @Override - public void sendStoredMultipartText(int subId, String callingPkg, Uri messageUri, - String scAddress, List<PendingIntent> sentIntents, + public void sendStoredMultipartText(int subId, String callingPkg, String callingAttributionTag, + Uri messageUri, String scAddress, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents) { throw new UnsupportedOperationException(); } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index d8339c8deefa..1face6c4f4cd 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -22,6 +22,7 @@ import android.content.IntentSender; import android.os.Bundle; import android.os.IBinder; import android.os.Messenger; +import android.os.ParcelFileDescriptor; import android.os.ResultReceiver; import android.os.WorkSource; import android.net.NetworkStats; @@ -39,9 +40,9 @@ import android.telephony.ICellInfoCallback; import android.telephony.ModemActivityInfo; import android.telephony.NeighboringCellInfo; import android.telephony.NetworkScanRequest; -import android.telephony.PhoneCapability; import android.telephony.PhoneNumberRange; import android.telephony.RadioAccessFamily; +import android.telephony.RadioAccessSpecifier; import android.telephony.ServiceState; import android.telephony.SignalStrength; import android.telephony.TelephonyHistogram; @@ -56,6 +57,7 @@ import android.telephony.ims.aidl.IImsRegistration; import android.telephony.ims.aidl.IImsRegistrationCallback; import com.android.ims.internal.IImsServiceFeatureCallback; import com.android.internal.telephony.CellNetworkScanResult; +import com.android.internal.telephony.IBooleanConsumer; import com.android.internal.telephony.IIntegerConsumer; import com.android.internal.telephony.INumberVerificationCallback; import com.android.internal.telephony.OperatorInfo; @@ -280,7 +282,7 @@ interface ITelephony { * operator's MCC (Mobile Country Code). * @see android.telephony.TelephonyManager#getNetworkCountryIso */ - String getNetworkCountryIsoForPhone(int phoneId, String callingPkg, String callingFeatureId); + String getNetworkCountryIsoForPhone(int phoneId); /** * Returns the neighboring cell information of the device. @@ -471,8 +473,8 @@ interface ITelephony { * Send a visual voicemail SMS. Internal use only. * Requires caller to be the default dialer and have SEND_SMS permission */ - void sendVisualVoicemailSmsForSubscriber(in String callingPackage, in int subId, - in String number, in int port, in String text, in PendingIntent sentIntent); + void sendVisualVoicemailSmsForSubscriber(in String callingPackage, String callingAttributeTag, + in int subId, in String number, in int port, in String text, in PendingIntent sentIntent); // Send the special dialer code. The IPC caller must be the current default dialer. void sendDialerSpecialCode(String callingPackageName, String inputCode); @@ -1815,14 +1817,6 @@ interface ITelephony { boolean switchSlots(in int[] physicalSlots); /** - * Sets radio indication update mode. This can be used to control the behavior of indication - * update from modem to Android frameworks. For example, by default several indication updates - * are turned off when screen is off, but in some special cases (e.g. carkit is connected but - * screen is off) we want to turn on those indications even when the screen is off. - */ - void setRadioIndicationUpdateMode(int subId, int filters, int mode); - - /** * Returns whether mobile data roaming is enabled on the subscription with id {@code subId}. * * @param subId the subscription id @@ -1895,17 +1889,12 @@ interface ITelephony { /** * Return the network selection mode on the subscription with id {@code subId}. */ - int getNetworkSelectionMode(int subId); - - /** - * Return the PhoneCapability for the device. - */ - PhoneCapability getPhoneCapability(int subId, String callingPackage, String callingFeatureId); + int getNetworkSelectionMode(int subId); - /** + /** * Return true if the device is in emergency sms mode, false otherwise. */ - boolean isInEmergencySmsMode(); + boolean isInEmergencySmsMode(); /** * Return the modem radio power state for slot index. @@ -2133,9 +2122,14 @@ interface ITelephony { void notifyOtaEmergencyNumberDbInstalled(); /** - * Override the file partition name for testing OTA emergency number database. + * Override a customized file partition name for OTA emergency number database. + */ + void updateOtaEmergencyNumberDbFilePath(in ParcelFileDescriptor otaParcelFileDescriptor); + + /** + * Reset file partition to default for OTA emergency number database. */ - void updateTestOtaEmergencyNumberDbFilePath(String otaFilePath); + void resetOtaEmergencyNumberDbFilePath(); /** * Enable or disable a logical modem stack associated with the slotIndex. @@ -2201,13 +2195,17 @@ interface ITelephony { boolean isApnMetered(int apnType, int subId); + oneway void setSystemSelectionChannels(in List<RadioAccessSpecifier> specifiers, + int subId, IBooleanConsumer resultCallback); + boolean isMvnoMatched(int subId, int mvnoType, String mvnoMatchData); /** * Enqueue a pending sms Consumer, which will answer with the user specified selection for an * outgoing SmsManager operation. */ - oneway void enqueueSmsPickResult(String callingPackage, IIntegerConsumer subIdResult); + oneway void enqueueSmsPickResult(String callingPackage, String callingAttributeTag, + IIntegerConsumer subIdResult); /** * Returns the MMS user agent. diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java index 7ec22698edb4..6eea88f4c103 100644 --- a/telephony/java/com/android/internal/telephony/PhoneConstants.java +++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java @@ -16,6 +16,7 @@ package com.android.internal.telephony; import android.compat.annotation.UnsupportedAppUsage; +import android.telephony.data.ApnSetting; /** * @hide @@ -103,9 +104,6 @@ public class PhoneConstants { public static final String DATA_APN_TYPE_KEY = "apnType"; public static final String DATA_APN_KEY = "apn"; - public static final String PHONE_IN_ECM_STATE = "phoneinECMState"; - public static final String PHONE_IN_EMERGENCY_CALL = "phoneInEmergencyCall"; - /** * Return codes for supplyPinReturnResult and * supplyPukReturnResult APIs @@ -131,32 +129,32 @@ public class PhoneConstants { * APN_TYPE_ALL is a special type to indicate that this APN entry can * service all data connections. */ - public static final String APN_TYPE_ALL = "*"; + public static final String APN_TYPE_ALL = ApnSetting.TYPE_ALL_STRING; /** APN type for default data traffic */ - public static final String APN_TYPE_DEFAULT = "default"; + public static final String APN_TYPE_DEFAULT = ApnSetting.TYPE_DEFAULT_STRING; /** APN type for MMS traffic */ - public static final String APN_TYPE_MMS = "mms"; + public static final String APN_TYPE_MMS = ApnSetting.TYPE_MMS_STRING; /** APN type for SUPL assisted GPS */ - public static final String APN_TYPE_SUPL = "supl"; + public static final String APN_TYPE_SUPL = ApnSetting.TYPE_SUPL_STRING; /** APN type for DUN traffic */ - public static final String APN_TYPE_DUN = "dun"; + public static final String APN_TYPE_DUN = ApnSetting.TYPE_DUN_STRING; /** APN type for HiPri traffic */ - public static final String APN_TYPE_HIPRI = "hipri"; + public static final String APN_TYPE_HIPRI = ApnSetting.TYPE_HIPRI_STRING; /** APN type for FOTA */ - public static final String APN_TYPE_FOTA = "fota"; + public static final String APN_TYPE_FOTA = ApnSetting.TYPE_FOTA_STRING; /** APN type for IMS */ - public static final String APN_TYPE_IMS = "ims"; + public static final String APN_TYPE_IMS = ApnSetting.TYPE_IMS_STRING; /** APN type for CBS */ - public static final String APN_TYPE_CBS = "cbs"; + public static final String APN_TYPE_CBS = ApnSetting.TYPE_CBS_STRING; /** APN type for IA Initial Attach APN */ - public static final String APN_TYPE_IA = "ia"; + public static final String APN_TYPE_IA = ApnSetting.TYPE_IA_STRING; /** APN type for Emergency PDN. This is not an IA apn, but is used * for access to carrier services in an emergency call situation. */ - public static final String APN_TYPE_EMERGENCY = "emergency"; + public static final String APN_TYPE_EMERGENCY = ApnSetting.TYPE_EMERGENCY_STRING; /** APN type for Mission Critical Services */ - public static final String APN_TYPE_MCX = "mcx"; + public static final String APN_TYPE_MCX = ApnSetting.TYPE_MCX_STRING; /** APN type for XCAP */ - public static final String APN_TYPE_XCAP = "xcap"; + public static final String APN_TYPE_XCAP = ApnSetting.TYPE_XCAP_STRING; /** Array of all APN types */ public static final String[] APN_TYPES = {APN_TYPE_DEFAULT, APN_TYPE_MMS, diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java index 0e0a22eecd28..6fdc13e6a31b 100644 --- a/telephony/java/com/android/internal/telephony/RILConstants.java +++ b/telephony/java/com/android/internal/telephony/RILConstants.java @@ -491,6 +491,8 @@ public interface RILConstants { int RIL_REQUEST_SWITCH_DUAL_SIM_CONFIG = 207; int RIL_REQUEST_ENABLE_UICC_APPLICATIONS = 208; int RIL_REQUEST_GET_UICC_APPLICATIONS_ENABLEMENT = 209; + int RIL_REQUEST_SET_SYSTEM_SELECTION_CHANNELS = 210; + int RIL_REQUEST_GET_BARRING_INFO = 211; /* Responses begin */ int RIL_RESPONSE_ACKNOWLEDGEMENT = 800; @@ -556,4 +558,5 @@ public interface RILConstants { int RIL_UNSOL_EMERGENCY_NUMBER_LIST = 1102; int RIL_UNSOL_UICC_APPLICATIONS_ENABLEMENT_CHANGED = 1103; int RIL_UNSOL_REGISTRATION_FAILED = 1104; + int RIL_UNSOL_BARRING_INFO_CHANGED = 1105; } diff --git a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java index 6ed0be24a0f1..74eb51df76dc 100644 --- a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java +++ b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java @@ -18,6 +18,7 @@ package com.android.internal.telephony.cdma; import android.compat.annotation.UnsupportedAppUsage; import android.content.res.Resources; +import android.os.Build; import android.sysprop.TelephonyProperties; import android.telephony.PhoneNumberUtils; import android.telephony.SmsCbLocation; @@ -156,7 +157,8 @@ public class SmsMessage extends SmsMessageBase { * * @hide */ - @UnsupportedAppUsage + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q, publicAlternatives = "Use {@link " + + "android.telephony.SmsMessage} API instead") public static SmsMessage createFromEfRecord(int index, byte[] data) { try { SmsMessage msg = new SmsMessage(); diff --git a/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java b/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java index 54205cd32bf4..122f0851cf37 100644 --- a/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java +++ b/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java @@ -27,6 +27,7 @@ import static com.android.internal.telephony.SmsConstants.MessageClass; import android.compat.annotation.UnsupportedAppUsage; import android.content.res.Resources; +import android.os.Build; import android.telephony.PhoneNumberUtils; import android.text.TextUtils; @@ -179,7 +180,8 @@ public class SmsMessage extends SmsMessageBase { * * @hide */ - @UnsupportedAppUsage + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q, publicAlternatives = "Use {@link " + + "android.telephony.SmsMessage} API instead") public static SmsMessage createFromEfRecord(int index, byte[] data) { try { SmsMessage msg = new SmsMessage(); |