diff options
author | Steven Laver <lavers@google.com> | 2020-02-13 20:29:13 -0800 |
---|---|---|
committer | Steven Laver <lavers@google.com> | 2020-02-13 20:29:13 -0800 |
commit | d28a4f6b38dbab44128b4319f665dd65c3e4ec2c (patch) | |
tree | 680912fe833379242ee026450323ed4f34a6c64b /telephony/java | |
parent | 029ad4fa703b5dcb74e8c4c272617464a9ba5fc8 (diff) | |
parent | 852c9950280d93875c529e4cae8396d94176f66e (diff) |
Merge RP1A.200204.001
Change-Id: I1e6c199dbee77379f84675965391c839eae04961
Diffstat (limited to 'telephony/java')
150 files changed, 1853 insertions, 7175 deletions
diff --git a/telephony/java/android/service/carrier/CarrierIdentifier.java b/telephony/java/android/service/carrier/CarrierIdentifier.java index 211ab0907505..c6b9ea200382 100644 --- a/telephony/java/android/service/carrier/CarrierIdentifier.java +++ b/telephony/java/android/service/carrier/CarrierIdentifier.java @@ -20,10 +20,10 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Parcel; import android.os.Parcelable; -import com.android.telephony.Rlog; import android.telephony.TelephonyManager; import com.android.internal.telephony.uicc.IccUtils; +import com.android.telephony.Rlog; import java.util.Objects; diff --git a/telephony/java/android/service/euicc/EuiccService.java b/telephony/java/android/service/euicc/EuiccService.java index ef11f469d9a0..93155865c166 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,65 @@ 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(@Nullable String subjectCode, + @Nullable String reasonCode) + throws NumberFormatException, IllegalArgumentException, UnsupportedOperationException { + 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/RcsEventDescriptor.aidl b/telephony/java/android/service/euicc/IEuiccServiceDumpResultCallback.aidl index ab1c55ec984f..ea55ebbadd88 100644 --- a/telephony/java/android/telephony/ims/RcsEventDescriptor.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 RcsEventDescriptor; +/** @hide */ +oneway interface IEuiccServiceDumpResultCallback { + void onComplete(in String logs); +}
\ No newline at end of file diff --git a/telephony/java/android/telephony/Annotation.java b/telephony/java/android/telephony/Annotation.java index 9e6dfef0608b..d2a5905f7a99 100644 --- a/telephony/java/android/telephony/Annotation.java +++ b/telephony/java/android/telephony/Annotation.java @@ -1,6 +1,7 @@ package android.telephony; import android.annotation.IntDef; +import android.provider.Telephony; import android.telecom.Connection; import android.telephony.data.ApnSetting; @@ -598,6 +599,48 @@ 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 = { @@ -609,4 +652,13 @@ public class Annotation { }) @Retention(RetentionPolicy.SOURCE) public @interface UiccAppType{} + + /** @hide */ + @IntDef({ + Telephony.Carriers.SKIP_464XLAT_DEFAULT, + Telephony.Carriers.SKIP_464XLAT_DISABLE, + Telephony.Carriers.SKIP_464XLAT_ENABLE, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface Skip464XlatStatus {} } diff --git a/telephony/java/android/telephony/AnomalyReporter.java b/telephony/java/android/telephony/AnomalyReporter.java index 097041f672ac..ffdb23f98fb8 100644 --- a/telephony/java/android/telephony/AnomalyReporter.java +++ b/telephony/java/android/telephony/AnomalyReporter.java @@ -16,8 +16,6 @@ package android.telephony; -import com.android.telephony.Rlog; - import android.annotation.NonNull; import android.annotation.RequiresPermission; import android.content.Context; @@ -27,6 +25,7 @@ import android.content.pm.ResolveInfo; import android.os.ParcelUuid; import com.android.internal.util.IndentingPrintWriter; +import com.android.telephony.Rlog; import java.io.FileDescriptor; import java.io.PrintWriter; diff --git a/telephony/java/android/telephony/BarringInfo.java b/telephony/java/android/telephony/BarringInfo.java index 5419c3c3d5c4..9baa66fcd87e 100644 --- a/telephony/java/android/telephony/BarringInfo.java +++ b/telephony/java/android/telephony/BarringInfo.java @@ -238,6 +238,12 @@ public final class BarringInfo implements Parcelable { } } + 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 @@ -298,17 +304,6 @@ public final class BarringInfo implements Parcelable { } /** - * Return whether a service is currently barred based on the BarringInfo - * - * @param service the service to be checked. - * @return true if the service is currently being barred, otherwise false - */ - public boolean isServiceBarred(@BarringServiceType int service) { - BarringServiceInfo bsi = mBarringServiceInfos.get(service); - return bsi != null && (bsi.isBarred()); - } - - /** * Get the BarringServiceInfo for a specified service. * * @return a BarringServiceInfo struct describing the current barring status for a service @@ -319,9 +314,8 @@ public final class BarringInfo implements Parcelable { // 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 : new BarringServiceInfo( - mBarringServiceInfos.size() > 0 ? BarringServiceInfo.BARRING_TYPE_NONE : - BarringServiceInfo.BARRING_TYPE_UNKNOWN); + return (bsi != null) ? bsi : mBarringServiceInfos.size() > 0 + ? BARRING_SERVICE_INFO_UNBARRED : BARRING_SERVICE_INFO_UNKNOWN; } /** @hide */ diff --git a/telephony/java/android/telephony/CallAttributes.java b/telephony/java/android/telephony/CallAttributes.java index cd830adf23b0..0c258f4b6435 100644 --- a/telephony/java/android/telephony/CallAttributes.java +++ b/telephony/java/android/telephony/CallAttributes.java @@ -21,8 +21,8 @@ import android.annotation.Nullable; import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; - import android.telephony.Annotation.NetworkType; + import java.util.Objects; /** @@ -130,14 +130,14 @@ public final class CallAttributes implements Parcelable { /** * {@link Parcelable#describeContents} */ - public @Parcelable.ContentsFlags int describeContents() { + public int describeContents() { return 0; } /** * {@link Parcelable#writeToParcel} */ - public void writeToParcel(Parcel dest, @Parcelable.WriteFlags int flags) { + public void writeToParcel(Parcel dest, int flags) { dest.writeParcelable(mPreciseCallState, flags); dest.writeInt(mNetworkType); dest.writeParcelable(mCallQuality, flags); diff --git a/telephony/java/android/telephony/ims/RcsMessageSnippet.aidl b/telephony/java/android/telephony/CallForwardingInfo.aidl index 99b8eb704e00..2019e07d4bda 100644 --- a/telephony/java/android/telephony/ims/RcsMessageSnippet.aidl +++ b/telephony/java/android/telephony/CallForwardingInfo.aidl @@ -1,6 +1,5 @@ /* - * - * 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. @@ -15,6 +14,6 @@ * limitations under the License. */ -package android.telephony.ims; +package android.telephony; -parcelable RcsMessageSnippet; +parcelable CallForwardingInfo;
\ No newline at end of file diff --git a/telephony/java/android/telephony/CallForwardingInfo.java b/telephony/java/android/telephony/CallForwardingInfo.java new file mode 100644 index 000000000000..1dd7539420ac --- /dev/null +++ b/telephony/java/android/telephony/CallForwardingInfo.java @@ -0,0 +1,308 @@ +/* + * 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.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.util.Objects; + +/** + * Defines the call forwarding information. + * @hide + */ +@SystemApi +public final class CallForwardingInfo implements Parcelable { + private static final String TAG = "CallForwardingInfo"; + + /** + * Indicates the call forwarding status is inactive. + * + * @hide + */ + @SystemApi + public static final int STATUS_INACTIVE = 0; + + /** + * Indicates the call forwarding status is active. + * + * @hide + */ + @SystemApi + public static final int STATUS_ACTIVE = 1; + + /** + * Indicates the call forwarding could not be enabled because the recipient is not on + * Fixed Dialing Number (FDN) list. + * + * @hide + */ + @SystemApi + public static final int STATUS_FDN_CHECK_FAILURE = 2; + + /** + * Indicates the call forwarding status is with an unknown error. + * + * @hide + */ + @SystemApi + public static final int STATUS_UNKNOWN_ERROR = 3; + + /** + * Indicates the call forwarding is not supported (e.g. called via CDMA). + * + * @hide + */ + @SystemApi + public static final int STATUS_NOT_SUPPORTED = 4; + + /** + * Indicates the call forwarding reason is "unconditional". + * Reference: 3GPP TS 27.007 version 10.3.0 Release 10 - 7.11 Call forwarding number + * and conditions +CCFC + * @hide + */ + @SystemApi + public static final int REASON_UNCONDITIONAL = 0; + + /** + * Indicates the call forwarding status is "busy". + * Reference: 3GPP TS 27.007 version 10.3.0 Release 10 - 7.11 Call forwarding number + * and conditions +CCFC + * @hide + */ + @SystemApi + public static final int REASON_BUSY = 1; + + /** + * Indicates the call forwarding reason is "no reply". + * Reference: 3GPP TS 27.007 version 10.3.0 Release 10 - 7.11 Call forwarding number + * and conditions +CCFC + * @hide + */ + @SystemApi + public static final int REASON_NO_REPLY = 2; + + /** + * Indicates the call forwarding reason is "not reachable". + * Reference: 3GPP TS 27.007 version 10.3.0 Release 10 - 7.11 Call forwarding number + * and conditions +CCFC + * @hide + */ + @SystemApi + public static final int REASON_NOT_REACHABLE = 3; + + /** + * Indicates the call forwarding reason is "all", for setting all call forwarding reasons + * simultaneously (unconditional, busy, no reply, and not reachable). + * Reference: 3GPP TS 27.007 version 10.3.0 Release 10 - 7.11 Call forwarding number + * and conditions +CCFC + * @hide + */ + @SystemApi + public static final int REASON_ALL = 4; + + /** + * Indicates the call forwarding reason is "all_conditional", for setting all conditional call + * forwarding reasons simultaneously (busy, no reply, and not reachable). + * Reference: 3GPP TS 27.007 version 10.3.0 Release 10 - 7.11 Call forwarding number + * and conditions +CCFC + * @hide + */ + @SystemApi + public static final int REASON_ALL_CONDITIONAL = 5; + + /** + * The call forwarding status. + */ + private @CallForwardingStatus 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; + + /** + * The phone number to 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 String mNumber; + + /** + * Gets the timeout (in seconds) before the forwarding is attempted. + */ + private int mTimeSeconds; + + /** + * Construct a CallForwardingInfo. + * + * @param status the call forwarding status + * @param reason the call forwarding reason + * @param number the phone number to which calls will be forwarded + * @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; + mReason = reason; + mNumber = number; + mTimeSeconds = timeSeconds; + } + + /** + * Returns the call forwarding status. + * + * @return the call forwarding status. + * + * @hide + */ + @SystemApi + public @CallForwardingStatus int getStatus() { + return mStatus; + } + + /** + * Returns the call forwarding reason. The call forwarding reason indicates the condition + * under which calls will be forwarded. For example, {@link #REASON_NO_REPLY} indicates + * that calls will be forward to {@link #getNumber()} when the user fails to answer the call. + * + * @return the call forwarding reason. + * + * @hide + */ + @SystemApi + public @CallForwardingReason int getReason() { + return mReason; + } + + /** + * Returns the phone number to which calls will be forwarded. + * + * @return the number calls will be forwarded to, or {@code null} if call forwarding + * is being disabled. + * + * @hide + */ + @SystemApi + @Nullable + public String getNumber() { + return mNumber; + } + + /** + * Gets the timeout (in seconds) before the forwarding is attempted. For example, + * if {@link #REASON_NO_REPLY} is the call forwarding reason, the device will wait this + * duration of time before forwarding the call to {@link #getNumber()}. + * + * Reference: 3GPP TS 27.007 version 10.3.0 Release 10 + * 7.11 Call forwarding number and conditions +CCFC + * + * @return the timeout (in seconds) before the forwarding is attempted. + * + * @hide + */ + @SystemApi + @SuppressLint("MethodNameUnits") + public int getTimeoutSeconds() { + return mTimeSeconds; + } + + @Override + public int describeContents() { + return 0; + } + + /** + * @hide + */ + @Override + public void writeToParcel(Parcel out, int flags) { + out.writeString(mNumber); + out.writeInt(mStatus); + out.writeInt(mReason); + out.writeInt(mTimeSeconds); + } + + private CallForwardingInfo(Parcel in) { + mNumber = in.readString(); + mStatus = in.readInt(); + mReason = in.readInt(); + mTimeSeconds = in.readInt(); + } + + /** + * @hide + */ + @Override + public boolean equals(Object o) { + if (this == o) return true; + + if (!(o instanceof CallForwardingInfo)) { + return false; + } + + CallForwardingInfo other = (CallForwardingInfo) o; + return mStatus == other.mStatus + && mNumber == other.mNumber + && mReason == other.mReason + && mTimeSeconds == other.mTimeSeconds; + } + + /** + * @hide + */ + @Override + public int hashCode() { + return Objects.hash(mStatus, mNumber, mReason, mTimeSeconds); + } + + public static final @NonNull Parcelable.Creator<CallForwardingInfo> CREATOR = + new Parcelable.Creator<CallForwardingInfo>() { + @Override + public CallForwardingInfo createFromParcel(Parcel in) { + return new CallForwardingInfo(in); + } + + @Override + public CallForwardingInfo[] newArray(int size) { + return new CallForwardingInfo[size]; + } + }; + + /** + * @hide + */ + @Override + public String toString() { + return "[CallForwardingInfo: status=" + mStatus + + ", reason= " + mReason + + ", timeSec= " + mTimeSeconds + " seconds" + + ", number=" + Rlog.pii(TAG, mNumber) + "]"; + } +} diff --git a/telephony/java/android/telephony/CallQuality.java b/telephony/java/android/telephony/CallQuality.java index 1e1cdba70ad0..428a515844e6 100644 --- a/telephony/java/android/telephony/CallQuality.java +++ b/telephony/java/android/telephony/CallQuality.java @@ -400,14 +400,14 @@ public final class CallQuality implements Parcelable { /** * {@link Parcelable#describeContents} */ - public @Parcelable.ContentsFlags int describeContents() { + public int describeContents() { return 0; } /** * {@link Parcelable#writeToParcel} */ - public void writeToParcel(Parcel dest, @Parcelable.WriteFlags int flags) { + public void writeToParcel(Parcel dest, int flags) { dest.writeInt(mDownlinkCallQualityLevel); dest.writeInt(mUplinkCallQualityLevel); dest.writeInt(mCallDuration); diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index d7900baa2b33..ed9db6586dcf 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -1100,6 +1100,14 @@ public class CarrierConfigManager { public static final String KEY_IGNORE_RTT_MODE_SETTING_BOOL = "ignore_rtt_mode_setting_bool"; + + /** + * Determines whether adhoc conference calls are supported by a carrier. When {@code true}, + * adhoc conference calling is supported, {@code false otherwise}. + */ + public static final String KEY_SUPPORT_ADHOC_CONFERENCE_CALLS_BOOL = + "support_adhoc_conference_calls_bool"; + /** * Determines whether conference calls are supported by a carrier. When {@code true}, * conference calling is supported, {@code false otherwise}. @@ -1466,6 +1474,50 @@ public class CarrierConfigManager { "apn_settings_default_apn_types_string_array"; /** + * Configs used for APN setup. + */ + public static final class Apn { + /** Prefix of all Apn.KEY_* constants. */ + public static final String KEY_PREFIX = "apn."; + + /** IPv4 internet protocol */ + public static final String PROTOCOL_IPV4 = "IP"; + /** IPv6 internet protocol */ + public static final String PROTOCOL_IPV6 = "IPV6"; + /** IPv4 or IPv6 internet protocol */ + public static final String PROTOCOL_IPV4V6 = "IPV4V6"; + + /** + * Default value of APN protocol field if not specified by user when adding/modifying + * an APN. + * + * Available options are: {@link #PROTOCOL_IPV4}, {@link #PROTOCOL_IPV6}, + * {@link #PROTOCOL_IPV4V6} + */ + public static final String KEY_SETTINGS_DEFAULT_PROTOCOL_STRING = + KEY_PREFIX + "settings_default_protocol_string"; + + /** + * Default value of APN roaming protocol field if not specified by user when + * adding/modifying an APN. + * + * Available options are: {@link #PROTOCOL_IPV4}, {@link #PROTOCOL_IPV6}, + * {@link #PROTOCOL_IPV4V6} + */ + public static final String KEY_SETTINGS_DEFAULT_ROAMING_PROTOCOL_STRING = + KEY_PREFIX + "settings_default_roaming_protocol_string"; + + private Apn() {} + + private static PersistableBundle getDefaults() { + PersistableBundle defaults = new PersistableBundle(); + defaults.putString(KEY_SETTINGS_DEFAULT_PROTOCOL_STRING, ""); + defaults.putString(KEY_SETTINGS_DEFAULT_ROAMING_PROTOCOL_STRING, ""); + return defaults; + } + } + + /** * Boolean indicating if intent for emergency call state changes should be broadcast * @hide */ @@ -2999,7 +3051,6 @@ public class CarrierConfigManager { /** * Controls hysteresis time in milli seconds for which OpportunisticNetworkService * will wait before switching data from opportunistic network to primary network. - * @hide */ public static final String KEY_OPPORTUNISTIC_NETWORK_DATA_SWITCH_EXIT_HYSTERESIS_TIME_LONG = "opportunistic_network_data_switch_exit_hysteresis_time_long"; @@ -3007,14 +3058,12 @@ public class CarrierConfigManager { /** * Controls whether to do ping test before switching data to opportunistic network. * This carrier config is used to disable this feature. - * @hide */ public static final String KEY_PING_TEST_BEFORE_DATA_SWITCH_BOOL = "ping_test_before_data_switch_bool"; /** * 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"; @@ -3023,7 +3072,6 @@ public class CarrierConfigManager { * 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 * This carrier config is used to disable this feature. - * @hide */ public static final String KEY_SWITCH_DATA_TO_PRIMARY_IF_PRIMARY_IS_OOS_BOOL = "switch_data_to_primary_if_primary_is_oos_bool"; @@ -3035,7 +3083,6 @@ public class CarrierConfigManager { * #KEY_OPPORTUNISTIC_NETWORK_EXIT_THRESHOLD_RSSNR_INT within * #KEY_OPPORTUNISTIC_NETWORK_PING_PONG_TIME_LONG of switching to opportunistic network, * it will be determined as ping pong situation by system app or 1st party app. - * @hide */ public static final String KEY_OPPORTUNISTIC_NETWORK_PING_PONG_TIME_LONG = "opportunistic_network_ping_pong_time_long"; @@ -3049,7 +3096,6 @@ public class CarrierConfigManager { * #KEY_OPPORTUNISTIC_NETWORK_PING_PONG_TIME_LONG. * If ping pong situation continuous #KEY_OPPORTUNISTIC_NETWORK_BACKOFF_TIME_LONG * will be added to previously determined hysteresis time. - * @hide */ public static final String KEY_OPPORTUNISTIC_NETWORK_BACKOFF_TIME_LONG = "opportunistic_network_backoff_time_long"; @@ -3061,7 +3107,6 @@ public class CarrierConfigManager { * continuous ping pong situation or not as described in * #KEY_OPPORTUNISTIC_NETWORK_PING_PONG_TIME_LONG and * #KEY_OPPORTUNISTIC_NETWORK_BACKOFF_TIME_LONG. - * @hide */ public static final String KEY_OPPORTUNISTIC_NETWORK_MAX_BACKOFF_TIME_LONG = "opportunistic_network_max_backoff_time_long"; @@ -3108,7 +3153,6 @@ public class CarrierConfigManager { * validation result, this value defines customized value of how long we wait for validation * success before we fail and revoke the switch. * Time out is in milliseconds. - * @hide */ public static final String KEY_DATA_SWITCH_VALIDATION_TIMEOUT_LONG = "data_switch_validation_timeout_long"; @@ -3452,6 +3496,14 @@ public class CarrierConfigManager { "prevent_clir_activation_and_deactivation_code_bool"; /** + * Flag specifying whether to show forwarded number on call-in-progress screen. + * When true, forwarded number is shown. + * When false, forwarded number is not shown. + */ + public static final String KEY_SHOW_FORWARDED_NUMBER_BOOL = + "show_forwarded_number_bool"; + + /** * Configs used for epdg tunnel bring up. * * @see <a href="https://tools.ietf.org/html/rfc7296">RFC 7296, Internet Key Exchange @@ -3937,6 +3989,8 @@ public class CarrierConfigManager { sDefaults.putStringArray(KEY_READ_ONLY_APN_TYPES_STRING_ARRAY, new String[] {"dun"}); sDefaults.putStringArray(KEY_READ_ONLY_APN_FIELDS_STRING_ARRAY, null); sDefaults.putStringArray(KEY_APN_SETTINGS_DEFAULT_APN_TYPES_STRING_ARRAY, null); + sDefaults.putAll(Apn.getDefaults()); + sDefaults.putBoolean(KEY_BROADCAST_EMERGENCY_CALL_STATE_CHANGES_BOOL, false); sDefaults.putBoolean(KEY_ALWAYS_SHOW_EMERGENCY_ALERT_ONOFF_BOOL, false); sDefaults.putStringArray(KEY_CARRIER_DATA_CALL_RETRY_CONFIG_STRINGS, new String[]{ @@ -3983,6 +4037,7 @@ public class CarrierConfigManager { sDefaults.putBoolean(KEY_CALL_FORWARDING_MAP_NON_NUMBER_TO_VOICEMAIL_BOOL, false); sDefaults.putBoolean(KEY_IGNORE_RTT_MODE_SETTING_BOOL, false); sDefaults.putInt(KEY_CDMA_3WAYCALL_FLASH_DELAY_INT , 0); + sDefaults.putBoolean(KEY_SUPPORT_ADHOC_CONFERENCE_CALLS_BOOL, false); sDefaults.putBoolean(KEY_SUPPORT_CONFERENCE_CALL_BOOL, true); sDefaults.putBoolean(KEY_SUPPORT_IMS_CONFERENCE_CALL_BOOL, true); sDefaults.putBoolean(KEY_SUPPORT_MANAGE_IMS_CONFERENCE_CALL_BOOL, true); @@ -4211,26 +4266,26 @@ public class CarrierConfigManager { sDefaults.putIntArray(KEY_5G_NR_SSRSRP_THRESHOLDS_INT_ARRAY, // Boundaries: [-140 dB, -44 dB] new int[] { - -125, /* SIGNAL_STRENGTH_POOR */ - -115, /* SIGNAL_STRENGTH_MODERATE */ - -105, /* SIGNAL_STRENGTH_GOOD */ - -95, /* SIGNAL_STRENGTH_GREAT */ + -110, /* SIGNAL_STRENGTH_POOR */ + -90, /* SIGNAL_STRENGTH_MODERATE */ + -80, /* SIGNAL_STRENGTH_GOOD */ + -65, /* SIGNAL_STRENGTH_GREAT */ }); sDefaults.putIntArray(KEY_5G_NR_SSRSRQ_THRESHOLDS_INT_ARRAY, // Boundaries: [-20 dB, -3 dB] new int[] { - -14, /* SIGNAL_STRENGTH_POOR */ - -12, /* SIGNAL_STRENGTH_MODERATE */ - -10, /* SIGNAL_STRENGTH_GOOD */ - -8 /* SIGNAL_STRENGTH_GREAT */ + -16, /* SIGNAL_STRENGTH_POOR */ + -11, /* SIGNAL_STRENGTH_MODERATE */ + -9, /* SIGNAL_STRENGTH_GOOD */ + -7 /* SIGNAL_STRENGTH_GREAT */ }); sDefaults.putIntArray(KEY_5G_NR_SSSINR_THRESHOLDS_INT_ARRAY, // Boundaries: [-23 dB, 40 dB] new int[] { - -8, /* SIGNAL_STRENGTH_POOR */ - 0, /* SIGNAL_STRENGTH_MODERATE */ - 8, /* SIGNAL_STRENGTH_GOOD */ - 16 /* SIGNAL_STRENGTH_GREAT */ + -5, /* SIGNAL_STRENGTH_POOR */ + 5, /* SIGNAL_STRENGTH_MODERATE */ + 15, /* SIGNAL_STRENGTH_GOOD */ + 30 /* SIGNAL_STRENGTH_GREAT */ }); sDefaults.putInt(KEY_PARAMETERS_USE_FOR_5G_NR_SIGNAL_BAR_INT, CellSignalStrengthNr.USE_SSRSRP); @@ -4309,6 +4364,7 @@ public class CarrierConfigManager { // Default wifi configurations. sDefaults.putAll(Wifi.getDefaults()); sDefaults.putBoolean(ENABLE_EAP_METHOD_PREFIX_BOOL, false); + sDefaults.putBoolean(KEY_SHOW_FORWARDED_NUMBER_BOOL, false); sDefaults.putAll(Iwlan.getDefaults()); } diff --git a/telephony/java/android/telephony/CbGeoUtils.java b/telephony/java/android/telephony/CbGeoUtils.java index 719ba8d98773..c0ae99e89cb3 100644 --- a/telephony/java/android/telephony/CbGeoUtils.java +++ b/telephony/java/android/telephony/CbGeoUtils.java @@ -16,13 +16,12 @@ package android.telephony; -import com.android.telephony.Rlog; - import android.annotation.NonNull; import android.annotation.SystemApi; import android.text.TextUtils; import com.android.internal.telephony.util.TelephonyUtils; +import com.android.telephony.Rlog; import java.util.ArrayList; import java.util.List; diff --git a/telephony/java/android/telephony/CellBroadcastService.java b/telephony/java/android/telephony/CellBroadcastService.java index 09e22aa4eb24..ac775b391e94 100644 --- a/telephony/java/android/telephony/CellBroadcastService.java +++ b/telephony/java/android/telephony/CellBroadcastService.java @@ -20,6 +20,7 @@ import android.annotation.CallSuper; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; +import android.annotation.WorkerThread; import android.app.Service; import android.content.Intent; import android.os.Bundle; @@ -102,6 +103,17 @@ public abstract class CellBroadcastService extends Service { @NonNull String originatingAddress, @NonNull Consumer<Bundle> callback); /** + * Get broadcasted area information. + * + * @param slotIndex the index of the slot which received the area information. + * + * @return The area information string sent from the network. This is usually the human readable + * string shown in Setting app's SIM status page. + */ + @WorkerThread + public abstract @NonNull CharSequence getCellBroadcastAreaInfo(int slotIndex); + + /** * If overriding this method, call through to the super method for any unknown actions. * {@inheritDoc} */ @@ -162,5 +174,17 @@ public abstract class CellBroadcastService extends Service { CellBroadcastService.this.onCdmaScpMessage(slotIndex, smsCbProgramData, originatingAddress, consumer); } + + /** + * Get broadcasted area information + * + * @param slotIndex the index of the slot which received the message + * + * @return The area information + */ + @Override + public @NonNull CharSequence getCellBroadcastAreaInfo(int slotIndex) { + return CellBroadcastService.this.getCellBroadcastAreaInfo(slotIndex); + } } } diff --git a/telephony/java/android/telephony/CellIdentity.java b/telephony/java/android/telephony/CellIdentity.java index 3f0aeb54f132..0c2f1f325793 100644 --- a/telephony/java/android/telephony/CellIdentity.java +++ b/telephony/java/android/telephony/CellIdentity.java @@ -69,8 +69,8 @@ public abstract class CellIdentity implements Parcelable { protected String mAlphaShort; /** @hide */ - protected CellIdentity(String tag, int type, String mcc, String mnc, String alphal, - String alphas) { + protected CellIdentity(@Nullable String tag, int type, @Nullable String mcc, + @Nullable String mnc, @Nullable String alphal, @Nullable String alphas) { mTag = tag; mType = type; diff --git a/telephony/java/android/telephony/CellIdentityCdma.java b/telephony/java/android/telephony/CellIdentityCdma.java index 1a6bf33cec71..e220b07d703a 100644 --- a/telephony/java/android/telephony/CellIdentityCdma.java +++ b/telephony/java/android/telephony/CellIdentityCdma.java @@ -17,6 +17,7 @@ package android.telephony; import android.annotation.NonNull; +import android.annotation.Nullable; import android.os.Parcel; import android.telephony.cdma.CdmaCellLocation; @@ -90,8 +91,8 @@ public final class CellIdentityCdma extends CellIdentity { * * @hide */ - public CellIdentityCdma( - int nid, int sid, int bid, int lon, int lat, String alphal, String alphas) { + public CellIdentityCdma(int nid, int sid, int bid, int lon, int lat, + @Nullable String alphal, @Nullable String alphas) { super(TAG, CellInfo.TYPE_CDMA, null, null, alphal, alphas); mNetworkId = inRangeOrUnavailable(nid, 0, NETWORK_ID_MAX); mSystemId = inRangeOrUnavailable(sid, 0, SYSTEM_ID_MAX); @@ -108,22 +109,22 @@ public final class CellIdentityCdma extends CellIdentity { } /** @hide */ - public CellIdentityCdma(android.hardware.radio.V1_0.CellIdentityCdma cid) { + public CellIdentityCdma(@NonNull android.hardware.radio.V1_0.CellIdentityCdma cid) { this(cid.networkId, cid.systemId, cid.baseStationId, cid.longitude, cid.latitude, "", ""); } /** @hide */ - public CellIdentityCdma(android.hardware.radio.V1_2.CellIdentityCdma cid) { + public CellIdentityCdma(@NonNull android.hardware.radio.V1_2.CellIdentityCdma cid) { this(cid.base.networkId, cid.base.systemId, cid.base.baseStationId, cid.base.longitude, cid.base.latitude, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort); } - private CellIdentityCdma(CellIdentityCdma cid) { + private CellIdentityCdma(@NonNull CellIdentityCdma cid) { this(cid.mNetworkId, cid.mSystemId, cid.mBasestationId, cid.mLongitude, cid.mLatitude, cid.mAlphaLong, cid.mAlphaShort); } - CellIdentityCdma copy() { + @NonNull CellIdentityCdma copy() { return new CellIdentityCdma(this); } diff --git a/telephony/java/android/telephony/CellIdentityGsm.java b/telephony/java/android/telephony/CellIdentityGsm.java index dc73cbf735b0..9f2537c7ed10 100644 --- a/telephony/java/android/telephony/CellIdentityGsm.java +++ b/telephony/java/android/telephony/CellIdentityGsm.java @@ -23,6 +23,7 @@ import android.os.Parcel; import android.telephony.gsm.GsmCellLocation; import android.text.TextUtils; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -78,26 +79,31 @@ public final class CellIdentityGsm extends CellIdentity { * * @hide */ - public CellIdentityGsm(int lac, int cid, int arfcn, int bsic, String mccStr, - String mncStr, String alphal, String alphas, - List<String> additionalPlmns) { + 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) { 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 = additionalPlmns; + mAdditionalPlmns = new ArrayList<>(additionalPlmns.size()); + for (String plmn : additionalPlmns) { + if (isValidPlmn(plmn)) { + mAdditionalPlmns.add(plmn); + } + } } /** @hide */ - public CellIdentityGsm(android.hardware.radio.V1_0.CellIdentityGsm cid) { + 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()); } /** @hide */ - public CellIdentityGsm(android.hardware.radio.V1_2.CellIdentityGsm cid) { + public CellIdentityGsm(@NonNull android.hardware.radio.V1_2.CellIdentityGsm cid) { 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, @@ -105,7 +111,7 @@ public final class CellIdentityGsm extends CellIdentity { } /** @hide */ - public CellIdentityGsm(android.hardware.radio.V1_5.CellIdentityGsm cid) { + public CellIdentityGsm(@NonNull android.hardware.radio.V1_5.CellIdentityGsm cid) { this(cid.base.base.lac, cid.base.base.cid, cid.base.base.arfcn, cid.base.base.bsic == (byte) 0xFF ? CellInfo.UNAVAILABLE : cid.base.base.bsic, cid.base.base.mcc, @@ -113,12 +119,12 @@ public final class CellIdentityGsm extends CellIdentity { cid.base.operatorNames.alphaShort, cid.additionalPlmns); } - private CellIdentityGsm(CellIdentityGsm cid) { + private CellIdentityGsm(@NonNull CellIdentityGsm cid) { this(cid.mLac, cid.mCid, cid.mArfcn, cid.mBsic, cid.mMccStr, cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort, cid.mAdditionalPlmns); } - CellIdentityGsm copy() { + @NonNull CellIdentityGsm copy() { return new CellIdentityGsm(this); } diff --git a/telephony/java/android/telephony/CellIdentityLte.java b/telephony/java/android/telephony/CellIdentityLte.java index 560c895d7b27..a194ae35216c 100644 --- a/telephony/java/android/telephony/CellIdentityLte.java +++ b/telephony/java/android/telephony/CellIdentityLte.java @@ -24,6 +24,7 @@ import android.os.Parcel; import android.telephony.gsm.GsmCellLocation; import android.text.TextUtils; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -104,34 +105,40 @@ public final class CellIdentityLte extends CellIdentity { * * @hide */ - public CellIdentityLte(int ci, int pci, int tac, int earfcn, int bandwidth, String mccStr, - String mncStr, String alphal, String alphas, List<String> additionalPlmns, - ClosedSubscriberGroupInfo csgInfo) { + 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, + @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); mBandwidth = inRangeOrUnavailable(bandwidth, 0, MAX_BANDWIDTH); - mAdditionalPlmns = additionalPlmns; + mAdditionalPlmns = new ArrayList<>(additionalPlmns.size()); + for (String plmn : additionalPlmns) { + if (isValidPlmn(plmn)) { + mAdditionalPlmns.add(plmn); + } + } mCsgInfo = csgInfo; } /** @hide */ - public CellIdentityLte(android.hardware.radio.V1_0.CellIdentityLte cid) { + 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); } /** @hide */ - public CellIdentityLte(android.hardware.radio.V1_2.CellIdentityLte cid) { + 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); } /** @hide */ - public CellIdentityLte(android.hardware.radio.V1_5.CellIdentityLte cid) { + 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, @@ -139,7 +146,7 @@ public final class CellIdentityLte extends CellIdentity { ? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo()) : null); } - private CellIdentityLte(CellIdentityLte cid) { + private CellIdentityLte(@NonNull CellIdentityLte cid) { this(cid.mCi, cid.mPci, cid.mTac, cid.mEarfcn, cid.mBandwidth, cid.mMccStr, cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort, cid.mAdditionalPlmns, cid.mCsgInfo); } @@ -152,7 +159,7 @@ public final class CellIdentityLte extends CellIdentity { mMccStr, mMncStr, mAlphaLong, mAlphaShort, mAdditionalPlmns, null); } - CellIdentityLte copy() { + @NonNull CellIdentityLte copy() { return new CellIdentityLte(this); } @@ -209,6 +216,19 @@ public final class CellIdentityLte extends CellIdentity { } /** + * Get bands of the cell + * + * Reference: 3GPP TS 36.101 section 5.5 + * + * @return List of band number or empty list if not available. + */ + @NonNull + public List<Integer> getBands() { + // Todo: Add actual support + return Collections.emptyList(); + } + + /** * @return Cell bandwidth in kHz, * {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable. */ diff --git a/telephony/java/android/telephony/CellIdentityNr.java b/telephony/java/android/telephony/CellIdentityNr.java index 165d7682e328..0f821777928d 100644 --- a/telephony/java/android/telephony/CellIdentityNr.java +++ b/telephony/java/android/telephony/CellIdentityNr.java @@ -23,6 +23,7 @@ import android.os.Parcel; import android.telephony.AccessNetworkConstants.NgranBands.NgranBand; import android.telephony.gsm.GsmCellLocation; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -42,7 +43,7 @@ public final class CellIdentityNr extends CellIdentity { private final int mPci; private final int mTac; private final long mNci; - private final int mBand; + private final List<Integer> mBands; // a list of additional PLMN-IDs reported for this cell private final List<String> mAdditionalPlmns; @@ -63,7 +64,7 @@ public final class CellIdentityNr extends CellIdentity { * @param pci Physical Cell Id in range [0, 1007]. * @param tac 16-bit Tracking Area Code. * @param nrArfcn NR Absolute Radio Frequency Channel Number, in range [0, 3279165]. - * @param band Band number defined in 3GPP TS 38.101-1 and TS 38.101-2. + * @param bands Bands used by the cell. Band number defined in 3GPP TS 38.101-1 and TS 38.101-2. * @param mccStr 3-digit Mobile Country Code in string format. * @param mncStr 2 or 3-digit Mobile Network Code in string format. * @param nci The 36-bit NR Cell Identity in range [0, 68719476735]. @@ -73,28 +74,34 @@ public final class CellIdentityNr extends CellIdentity { * * @hide */ - public CellIdentityNr(int pci, int tac, int nrArfcn, @NgranBand int band, String mccStr, - String mncStr, long nci, String alphal, String alphas, List<String> additionalPlmns) { + public CellIdentityNr(int pci, int tac, int nrArfcn, @NgranBand List<Integer> bands, + @Nullable String mccStr, @Nullable String mncStr, long nci, + @Nullable String alphal, @Nullable String alphas, + @NonNull List<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); - mBand = inRangeOrUnavailable(band, AccessNetworkConstants.NgranBands.BAND_1, - AccessNetworkConstants.NgranBands.BAND_261); + mBands = new ArrayList<>(bands); mNci = inRangeOrUnavailable(nci, 0, MAX_NCI); - mAdditionalPlmns = additionalPlmns; + mAdditionalPlmns = new ArrayList<>(additionalPlmns.size()); + for (String plmn : additionalPlmns) { + if (isValidPlmn(plmn)) { + mAdditionalPlmns.add(plmn); + } + } } /** @hide */ - public CellIdentityNr(android.hardware.radio.V1_4.CellIdentityNr cid) { - this(cid.pci, cid.tac, cid.nrarfcn, 0, cid.mcc, cid.mnc, cid.nci, + 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, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort, Collections.emptyList()); } /** @hide */ - public CellIdentityNr(android.hardware.radio.V1_5.CellIdentityNr cid) { - this(cid.base.pci, cid.base.tac, cid.base.nrarfcn, cid.band, cid.base.mcc, cid.base.mnc, + 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, cid.base.operatorNames.alphaShort, cid.additionalPlmns); } @@ -103,7 +110,7 @@ public final class CellIdentityNr extends CellIdentity { @Override public @NonNull CellIdentityNr sanitizeLocationInfo() { return new CellIdentityNr(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, mNrArfcn, - mBand, mMccStr, mMncStr, CellInfo.UNAVAILABLE, mAlphaLong, mAlphaShort, + mBands, mMccStr, mMncStr, CellInfo.UNAVAILABLE, mAlphaLong, mAlphaShort, mAdditionalPlmns); } @@ -120,7 +127,7 @@ public final class CellIdentityNr extends CellIdentity { @Override public int hashCode() { return Objects.hash(super.hashCode(), mPci, mTac, - mNrArfcn, mBand, mNci, mAdditionalPlmns.hashCode()); + mNrArfcn, mBands.hashCode(), mNci, mAdditionalPlmns.hashCode()); } @Override @@ -131,7 +138,7 @@ public final class CellIdentityNr extends CellIdentity { CellIdentityNr o = (CellIdentityNr) other; return super.equals(o) && mPci == o.mPci && mTac == o.mTac && mNrArfcn == o.mNrArfcn - && mBand == o.mBand && mNci == o.mNci + && mBands.equals(o.mBands) && mNci == o.mNci && mAdditionalPlmns.equals(o.mAdditionalPlmns); } @@ -159,16 +166,17 @@ public final class CellIdentityNr extends CellIdentity { } /** - * Get band of the cell + * Get bands of the cell * * Reference: TS 38.101-1 table 5.2-1 * Reference: TS 38.101-2 table 5.2-1 * - * @return band number or {@link CellInfo@UNAVAILABLE} if not available. + * @return List of band number or empty list if not available. */ @NgranBand - public int getBand() { - return mBand; + @NonNull + public List<Integer> getBands() { + return Collections.unmodifiableList(mBands); } /** @@ -216,7 +224,7 @@ public final class CellIdentityNr extends CellIdentity { */ @NonNull public List<String> getAdditionalPlmns() { - return mAdditionalPlmns; + return Collections.unmodifiableList(mAdditionalPlmns); } @Override @@ -225,7 +233,7 @@ public final class CellIdentityNr extends CellIdentity { .append(" mPci = ").append(mPci) .append(" mTac = ").append(mTac) .append(" mNrArfcn = ").append(mNrArfcn) - .append(" mBand = ").append(mBand) + .append(" mBands = ").append(mBands) .append(" mMcc = ").append(mMccStr) .append(" mMnc = ").append(mMncStr) .append(" mNci = ").append(mNci) @@ -242,7 +250,7 @@ public final class CellIdentityNr extends CellIdentity { dest.writeInt(mPci); dest.writeInt(mTac); dest.writeInt(mNrArfcn); - dest.writeInt(mBand); + dest.writeList(mBands); dest.writeLong(mNci); dest.writeList(mAdditionalPlmns); } @@ -253,7 +261,7 @@ public final class CellIdentityNr extends CellIdentity { mPci = in.readInt(); mTac = in.readInt(); mNrArfcn = in.readInt(); - mBand = in.readInt(); + mBands = in.readArrayList(null); mNci = in.readLong(); mAdditionalPlmns = in.readArrayList(null); } diff --git a/telephony/java/android/telephony/CellIdentityTdscdma.java b/telephony/java/android/telephony/CellIdentityTdscdma.java index 2ff351c17e9a..531487a313d9 100644 --- a/telephony/java/android/telephony/CellIdentityTdscdma.java +++ b/telephony/java/android/telephony/CellIdentityTdscdma.java @@ -21,6 +21,7 @@ import android.annotation.Nullable; import android.os.Parcel; import android.telephony.gsm.GsmCellLocation; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -82,39 +83,44 @@ public final class CellIdentityTdscdma extends CellIdentity { * * @hide */ - public CellIdentityTdscdma(String mcc, String mnc, int lac, int cid, int cpid, int uarfcn, - String alphal, String alphas, @NonNull List<String> additionalPlmns, - ClosedSubscriberGroupInfo csgInfo) { + 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) { 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 = additionalPlmns; + mAdditionalPlmns = new ArrayList<>(additionalPlmns.size()); + for (String plmn : additionalPlmns) { + if (isValidPlmn(plmn)) { + mAdditionalPlmns.add(plmn); + } + } mCsgInfo = csgInfo; } - private CellIdentityTdscdma(CellIdentityTdscdma cid) { + private CellIdentityTdscdma(@NonNull CellIdentityTdscdma cid) { this(cid.mMccStr, cid.mMncStr, cid.mLac, cid.mCid, cid.mCpid, cid.mUarfcn, cid.mAlphaLong, cid.mAlphaShort, cid.mAdditionalPlmns, cid.mCsgInfo); } /** @hide */ - public CellIdentityTdscdma(android.hardware.radio.V1_0.CellIdentityTdscdma cid) { + public CellIdentityTdscdma(@NonNull android.hardware.radio.V1_0.CellIdentityTdscdma cid) { this(cid.mcc, cid.mnc, cid.lac, cid.cid, cid.cpid, CellInfo.UNAVAILABLE, "", "", Collections.emptyList(), null); } /** @hide */ - public CellIdentityTdscdma(android.hardware.radio.V1_2.CellIdentityTdscdma cid) { + public CellIdentityTdscdma(@NonNull android.hardware.radio.V1_2.CellIdentityTdscdma cid) { this(cid.base.mcc, cid.base.mnc, cid.base.lac, cid.base.cid, cid.base.cpid, cid.uarfcn, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort, Collections.emptyList(), null); } /** @hide */ - public CellIdentityTdscdma(android.hardware.radio.V1_5.CellIdentityTdscdma cid) { + public CellIdentityTdscdma(@NonNull android.hardware.radio.V1_5.CellIdentityTdscdma cid) { this(cid.base.base.mcc, cid.base.base.mnc, cid.base.base.lac, cid.base.base.cid, cid.base.base.cpid, cid.base.uarfcn, cid.base.operatorNames.alphaLong, cid.base.operatorNames.alphaShort, @@ -130,7 +136,7 @@ public final class CellIdentityTdscdma extends CellIdentity { mAdditionalPlmns, null); } - CellIdentityTdscdma copy() { + @NonNull CellIdentityTdscdma copy() { return new CellIdentityTdscdma(this); } diff --git a/telephony/java/android/telephony/CellIdentityWcdma.java b/telephony/java/android/telephony/CellIdentityWcdma.java index 9be42a17677b..15e491b66575 100644 --- a/telephony/java/android/telephony/CellIdentityWcdma.java +++ b/telephony/java/android/telephony/CellIdentityWcdma.java @@ -23,6 +23,7 @@ import android.os.Parcel; import android.telephony.gsm.GsmCellLocation; import android.text.TextUtils; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -83,34 +84,38 @@ public final class CellIdentityWcdma extends CellIdentity { * * @hide */ - public CellIdentityWcdma (int lac, int cid, int psc, int uarfcn, - String mccStr, String mncStr, String alphal, String alphas, - @NonNull List<String> additionalPlmns, - @Nullable ClosedSubscriberGroupInfo csgInfo) { + 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) { 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 = additionalPlmns; + mAdditionalPlmns = new ArrayList<>(additionalPlmns.size()); + for (String plmn : additionalPlmns) { + if (isValidPlmn(plmn)) { + mAdditionalPlmns.add(plmn); + } + } mCsgInfo = csgInfo; } /** @hide */ - public CellIdentityWcdma(android.hardware.radio.V1_0.CellIdentityWcdma cid) { + 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); } /** @hide */ - public CellIdentityWcdma(android.hardware.radio.V1_2.CellIdentityWcdma cid) { + 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); } /** @hide */ - public CellIdentityWcdma(android.hardware.radio.V1_5.CellIdentityWcdma cid) { + public CellIdentityWcdma(@NonNull android.hardware.radio.V1_5.CellIdentityWcdma cid) { this(cid.base.base.lac, cid.base.base.cid, cid.base.base.psc, cid.base.base.uarfcn, cid.base.base.mcc, cid.base.base.mnc, cid.base.operatorNames.alphaLong, cid.base.operatorNames.alphaShort, cid.additionalPlmns, @@ -118,7 +123,7 @@ public final class CellIdentityWcdma extends CellIdentity { ? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo()) : null); } - private CellIdentityWcdma(CellIdentityWcdma cid) { + private CellIdentityWcdma(@NonNull CellIdentityWcdma cid) { this(cid.mLac, cid.mCid, cid.mPsc, cid.mUarfcn, cid.mMccStr, cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort, cid.mAdditionalPlmns, cid.mCsgInfo); } @@ -131,7 +136,7 @@ public final class CellIdentityWcdma extends CellIdentity { mAlphaLong, mAlphaShort, mAdditionalPlmns, null); } - CellIdentityWcdma copy() { + @NonNull CellIdentityWcdma copy() { return new CellIdentityWcdma(this); } diff --git a/telephony/java/android/telephony/CellInfoCdma.java b/telephony/java/android/telephony/CellInfoCdma.java index acb21f450243..0edb4a4eed9b 100644 --- a/telephony/java/android/telephony/CellInfoCdma.java +++ b/telephony/java/android/telephony/CellInfoCdma.java @@ -16,14 +16,14 @@ package android.telephony; -import com.android.telephony.Rlog; - import android.annotation.NonNull; import android.compat.annotation.UnsupportedAppUsage; import android.os.Build; import android.os.Parcel; import android.os.Parcelable; +import com.android.telephony.Rlog; + /** * A {@link CellInfo} representing a CDMA cell that provides identity and measurement info. */ diff --git a/telephony/java/android/telephony/CellInfoGsm.java b/telephony/java/android/telephony/CellInfoGsm.java index 79a9d44f36a2..2dddd3f935cd 100644 --- a/telephony/java/android/telephony/CellInfoGsm.java +++ b/telephony/java/android/telephony/CellInfoGsm.java @@ -16,13 +16,13 @@ package android.telephony; -import com.android.telephony.Rlog; - import android.annotation.NonNull; import android.compat.annotation.UnsupportedAppUsage; import android.os.Parcel; import android.os.Parcelable; +import com.android.telephony.Rlog; + /** * A {@link CellInfo} representing a GSM cell that provides identity and measurement info. */ diff --git a/telephony/java/android/telephony/CellInfoLte.java b/telephony/java/android/telephony/CellInfoLte.java index fed3ebf4af03..a57c7cd136db 100644 --- a/telephony/java/android/telephony/CellInfoLte.java +++ b/telephony/java/android/telephony/CellInfoLte.java @@ -16,14 +16,14 @@ package android.telephony; -import com.android.telephony.Rlog; - import android.annotation.NonNull; import android.compat.annotation.UnsupportedAppUsage; import android.os.Build; import android.os.Parcel; import android.os.Parcelable; +import com.android.telephony.Rlog; + import java.util.Objects; /** diff --git a/telephony/java/android/telephony/CellInfoTdscdma.java b/telephony/java/android/telephony/CellInfoTdscdma.java index 58ff8c9558d9..d2cc9c6ce422 100644 --- a/telephony/java/android/telephony/CellInfoTdscdma.java +++ b/telephony/java/android/telephony/CellInfoTdscdma.java @@ -16,12 +16,12 @@ package android.telephony; -import com.android.telephony.Rlog; - import android.annotation.NonNull; import android.os.Parcel; import android.os.Parcelable; +import com.android.telephony.Rlog; + import java.util.Objects; /** diff --git a/telephony/java/android/telephony/CellInfoWcdma.java b/telephony/java/android/telephony/CellInfoWcdma.java index 33f6a555414c..3f792d17b8ef 100644 --- a/telephony/java/android/telephony/CellInfoWcdma.java +++ b/telephony/java/android/telephony/CellInfoWcdma.java @@ -18,6 +18,7 @@ package android.telephony; import android.os.Parcel; import android.os.Parcelable; + import com.android.telephony.Rlog; import java.util.Objects; diff --git a/telephony/java/android/telephony/CellSignalStrengthCdma.java b/telephony/java/android/telephony/CellSignalStrengthCdma.java index cab3b0cd3c47..1c92705b9422 100644 --- a/telephony/java/android/telephony/CellSignalStrengthCdma.java +++ b/telephony/java/android/telephony/CellSignalStrengthCdma.java @@ -20,6 +20,7 @@ import android.annotation.IntRange; import android.os.Parcel; import android.os.Parcelable; import android.os.PersistableBundle; + import com.android.telephony.Rlog; import java.util.Objects; diff --git a/telephony/java/android/telephony/CellSignalStrengthGsm.java b/telephony/java/android/telephony/CellSignalStrengthGsm.java index 28052aa93486..76d2df918423 100644 --- a/telephony/java/android/telephony/CellSignalStrengthGsm.java +++ b/telephony/java/android/telephony/CellSignalStrengthGsm.java @@ -16,8 +16,6 @@ package android.telephony; -import com.android.telephony.Rlog; - import android.annotation.IntRange; import android.compat.annotation.UnsupportedAppUsage; import android.os.Build; @@ -25,6 +23,8 @@ import android.os.Parcel; import android.os.Parcelable; import android.os.PersistableBundle; +import com.android.telephony.Rlog; + import java.util.Objects; /** diff --git a/telephony/java/android/telephony/CellSignalStrengthLte.java b/telephony/java/android/telephony/CellSignalStrengthLte.java index 2ef2a52977ff..6d6eaa4677f0 100644 --- a/telephony/java/android/telephony/CellSignalStrengthLte.java +++ b/telephony/java/android/telephony/CellSignalStrengthLte.java @@ -16,14 +16,14 @@ package android.telephony; -import com.android.telephony.Rlog; - import android.annotation.IntRange; import android.compat.annotation.UnsupportedAppUsage; import android.os.Parcel; import android.os.Parcelable; import android.os.PersistableBundle; +import com.android.telephony.Rlog; + import java.util.Arrays; import java.util.Objects; diff --git a/telephony/java/android/telephony/CellSignalStrengthNr.java b/telephony/java/android/telephony/CellSignalStrengthNr.java index 4d67bcf536cf..e3d03a38b6b0 100644 --- a/telephony/java/android/telephony/CellSignalStrengthNr.java +++ b/telephony/java/android/telephony/CellSignalStrengthNr.java @@ -16,14 +16,14 @@ package android.telephony; -import com.android.telephony.Rlog; - import android.annotation.IntDef; import android.annotation.IntRange; import android.os.Parcel; import android.os.Parcelable; import android.os.PersistableBundle; +import com.android.telephony.Rlog; + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Arrays; @@ -45,28 +45,28 @@ public final class CellSignalStrengthNr extends CellSignalStrength implements Pa // Lifted from Default carrier configs and max range of SSRSRP // Boundaries: [-140 dB, -44 dB] private int[] mSsRsrpThresholds = new int[] { - -125, /* SIGNAL_STRENGTH_POOR */ - -115, /* SIGNAL_STRENGTH_MODERATE */ - -105, /* SIGNAL_STRENGTH_GOOD */ - -95, /* SIGNAL_STRENGTH_GREAT */ + -110, /* SIGNAL_STRENGTH_POOR */ + -90, /* SIGNAL_STRENGTH_MODERATE */ + -80, /* SIGNAL_STRENGTH_GOOD */ + -65, /* SIGNAL_STRENGTH_GREAT */ }; // Lifted from Default carrier configs and max range of SSRSRQ // Boundaries: [-20 dB, -3 dB] private int[] mSsRsrqThresholds = new int[] { - -14, /* SIGNAL_STRENGTH_POOR */ - -12, /* SIGNAL_STRENGTH_MODERATE */ - -10, /* SIGNAL_STRENGTH_GOOD */ - -8 /* SIGNAL_STRENGTH_GREAT */ + -16, /* SIGNAL_STRENGTH_POOR */ + -11, /* SIGNAL_STRENGTH_MODERATE */ + -9, /* SIGNAL_STRENGTH_GOOD */ + -7 /* SIGNAL_STRENGTH_GREAT */ }; // Lifted from Default carrier configs and max range of SSSINR // Boundaries: [-23 dB, 40 dB] private int[] mSsSinrThresholds = new int[] { - -8, /* SIGNAL_STRENGTH_POOR */ - 0, /* SIGNAL_STRENGTH_MODERATE */ - 8, /* SIGNAL_STRENGTH_GOOD */ - 16 /* SIGNAL_STRENGTH_GREAT */ + -5, /* SIGNAL_STRENGTH_POOR */ + 5, /* SIGNAL_STRENGTH_MODERATE */ + 15, /* SIGNAL_STRENGTH_GOOD */ + 30 /* SIGNAL_STRENGTH_GREAT */ }; /** diff --git a/telephony/java/android/telephony/CellSignalStrengthTdscdma.java b/telephony/java/android/telephony/CellSignalStrengthTdscdma.java index 3bd9d5810136..e96f200280b6 100644 --- a/telephony/java/android/telephony/CellSignalStrengthTdscdma.java +++ b/telephony/java/android/telephony/CellSignalStrengthTdscdma.java @@ -16,14 +16,14 @@ package android.telephony; -import com.android.telephony.Rlog; - import android.annotation.IntRange; import android.annotation.NonNull; import android.os.Parcel; import android.os.Parcelable; import android.os.PersistableBundle; +import com.android.telephony.Rlog; + import java.util.Objects; /** diff --git a/telephony/java/android/telephony/CellSignalStrengthWcdma.java b/telephony/java/android/telephony/CellSignalStrengthWcdma.java index 535e9520074d..8b14b7490679 100644 --- a/telephony/java/android/telephony/CellSignalStrengthWcdma.java +++ b/telephony/java/android/telephony/CellSignalStrengthWcdma.java @@ -16,8 +16,6 @@ package android.telephony; -import com.android.telephony.Rlog; - import android.annotation.IntRange; import android.annotation.StringDef; import android.compat.annotation.UnsupportedAppUsage; @@ -26,6 +24,8 @@ import android.os.Parcelable; import android.os.PersistableBundle; import android.text.TextUtils; +import com.android.telephony.Rlog; + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Objects; diff --git a/telephony/java/android/telephony/ICellBroadcastService.aidl b/telephony/java/android/telephony/ICellBroadcastService.aidl index 11263d99cb8f..4f20ed67fda4 100644 --- a/telephony/java/android/telephony/ICellBroadcastService.aidl +++ b/telephony/java/android/telephony/ICellBroadcastService.aidl @@ -36,4 +36,7 @@ interface ICellBroadcastService { /** @see android.telephony.CellBroadcastService#onCdmaScpMessage */ oneway void handleCdmaScpMessage(int slotId, in List<CdmaSmsCbProgramData> programData, String originatingAddress, in RemoteCallback callback); + + /** @see android.telephony.CellBroadcastService#getCellBroadcastAreaInfo */ + CharSequence getCellBroadcastAreaInfo(int slotIndex); } diff --git a/telephony/java/android/telephony/ImsManager.java b/telephony/java/android/telephony/ImsManager.java index 9b4292f42172..704e5aa78188 100644 --- a/telephony/java/android/telephony/ImsManager.java +++ b/telephony/java/android/telephony/ImsManager.java @@ -27,11 +27,7 @@ import android.telephony.SubscriptionManager; /** * Provides access to information about Telephony IMS services on the device. - * - * @hide */ -@SystemApi -@TestApi @SystemService(Context.TELEPHONY_IMS_SERVICE) public class ImsManager { @@ -45,7 +41,10 @@ public class ImsManager { * <p class="note"> * Carrier applications may listen to this broadcast to be notified of possible IMS provisioning * issues. + * @hide */ + @SystemApi + @TestApi // Moved from TelephonyIntents, need to keep backwards compatibility with OEM apps that have // this value hard-coded in BroadcastReceiver. @SuppressLint("ActionValue") @@ -104,7 +103,10 @@ 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 aebe78031ba2..1ba21f29df11 100644 --- a/telephony/java/android/telephony/ModemActivityInfo.java +++ b/telephony/java/android/telephony/ModemActivityInfo.java @@ -17,7 +17,6 @@ package android.telephony; import android.annotation.NonNull; -import android.annotation.Nullable; import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; @@ -60,7 +59,7 @@ public final class ModemActivityInfo implements Parcelable { private int mRxTimeMs; public ModemActivityInfo(long timestamp, int sleepTimeMs, int idleTimeMs, - @Nullable int[] txTimeMs, int rxTimeMs) { + @NonNull int[] txTimeMs, int rxTimeMs) { mTimestamp = timestamp; mSleepTimeMs = sleepTimeMs; mIdleTimeMs = idleTimeMs; @@ -69,13 +68,10 @@ public final class ModemActivityInfo implements Parcelable { } /** helper API to populate tx power range for each bucket **/ - private void populateTransmitPowerRange(@Nullable int[] transmitPowerMs) { + private void populateTransmitPowerRange(@NonNull int[] transmitPowerMs) { int i = 0; - if (transmitPowerMs != null) { - for ( ; i < Math.min(transmitPowerMs.length, TX_POWER_LEVELS); i++) { - mTransmitPowerInfo.add(i, - new TransmitPower(TX_POWER_RANGES[i], transmitPowerMs[i])); - } + 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++) { @@ -98,7 +94,7 @@ public final class ModemActivityInfo implements Parcelable { return 0; } - public static final @NonNull Parcelable.Creator<ModemActivityInfo> CREATOR = + public static final @android.annotation.NonNull Parcelable.Creator<ModemActivityInfo> CREATOR = new Parcelable.Creator<ModemActivityInfo>() { public ModemActivityInfo createFromParcel(Parcel in) { long timestamp = in.readLong(); @@ -153,7 +149,7 @@ public final class ModemActivityInfo implements Parcelable { } /** @hide */ - public void setTransmitTimeMillis(@Nullable int[] txTimeMs) { + public void setTransmitTimeMillis(int[] txTimeMs) { populateTransmitPowerRange(txTimeMs); } diff --git a/telephony/java/android/telephony/ModemInfo.java b/telephony/java/android/telephony/ModemInfo.java deleted file mode 100644 index c0833af954d8..000000000000 --- a/telephony/java/android/telephony/ModemInfo.java +++ /dev/null @@ -1,109 +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; - -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..f9de47d7677d 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 == null) ? "" : 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,13 +287,13 @@ 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); @@ -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; } /** @@ -395,6 +403,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 an empty string. + * + * <p>See 3GPP TS 23.122 for further information about the Registered PLMN. + * + * @return the registered PLMN-ID or an empty string. + */ + @NonNull public String getRegisteredPlmn() { + return mRplmn; + } + + /** * @return {@code true} if registered on roaming network, {@code false} otherwise. */ public boolean isRoaming() { @@ -590,6 +614,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 +622,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 +645,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 +667,7 @@ public final class NetworkRegistrationInfo implements Parcelable { dest.writeParcelable(mVoiceSpecificInfo, 0); dest.writeParcelable(mDataSpecificInfo, 0); dest.writeInt(mNrState); + dest.writeString(mRplmn); } /** @@ -741,6 +768,9 @@ public final class NetworkRegistrationInfo implements Parcelable { @Nullable private CellIdentity mCellIdentity; + @NonNull + private String mRplmn = ""; + /** * Default constructor for Builder. */ @@ -855,6 +885,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 == null) ? "" : rplmn; + return this; + } + + /** * Build the NetworkRegistrationInfo. * @return the NetworkRegistrationInfo object. * @hide @@ -863,7 +905,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/NetworkScan.java b/telephony/java/android/telephony/NetworkScan.java index a6dedf761636..adf31ed45c9a 100644 --- a/telephony/java/android/telephony/NetworkScan.java +++ b/telephony/java/android/telephony/NetworkScan.java @@ -16,12 +16,11 @@ package android.telephony; -import com.android.telephony.Rlog; - import android.annotation.IntDef; import android.os.RemoteException; import com.android.internal.telephony.ITelephony; +import com.android.telephony.Rlog; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/telephony/java/android/telephony/NetworkService.java b/telephony/java/android/telephony/NetworkService.java index 844289ce75d4..87d94bfda662 100644 --- a/telephony/java/android/telephony/NetworkService.java +++ b/telephony/java/android/telephony/NetworkService.java @@ -16,8 +16,6 @@ package android.telephony; -import com.android.telephony.Rlog; - import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SdkConstant; @@ -34,6 +32,7 @@ import android.telephony.NetworkRegistrationInfo.Domain; import android.util.SparseArray; import com.android.internal.annotations.VisibleForTesting; +import com.android.telephony.Rlog; import java.util.ArrayList; import java.util.List; diff --git a/telephony/java/android/telephony/NetworkServiceCallback.java b/telephony/java/android/telephony/NetworkServiceCallback.java index 214ab41ae4f2..e8e73ee86f58 100644 --- a/telephony/java/android/telephony/NetworkServiceCallback.java +++ b/telephony/java/android/telephony/NetworkServiceCallback.java @@ -16,14 +16,14 @@ package android.telephony; -import com.android.telephony.Rlog; - import android.annotation.IntDef; import android.annotation.Nullable; import android.annotation.SystemApi; import android.os.RemoteException; import android.telephony.NetworkService.NetworkServiceProvider; +import com.android.telephony.Rlog; + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/telephony/java/android/telephony/PhoneCapability.java b/telephony/java/android/telephony/PhoneCapability.java index 90244b3df350..a53792802d92 100644 --- a/telephony/java/android/telephony/PhoneCapability.java +++ b/telephony/java/android/telephony/PhoneCapability.java @@ -25,7 +25,7 @@ import android.telephony.AccessNetworkConstants.AccessNetworkType; import android.telephony.AccessNetworkConstants.RadioAccessNetworkType; import android.telephony.TelephonyManager.NetworkTypeBitMask; -import com.android.internal.util.CollectionUtils; +import com.android.internal.telephony.util.TelephonyUtils; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -181,13 +181,13 @@ public final class PhoneCapability implements Parcelable { this.mEutranUeCategoryUl = eutranUeCategoryUl; this.mPsDataConnectionLingerTimeMillis = psDataConnectionLingerTimeMillis; this.mSupportedRats = supportedRats; - this.mGeranBands = CollectionUtils.emptyIfNull(geranBands); - this.mUtranBands = CollectionUtils.emptyIfNull(utranBands); - this.mEutranBands = CollectionUtils.emptyIfNull(eutranBands); - this.mNgranBands = CollectionUtils.emptyIfNull(ngranBands); - this.mLogicalModemUuids = CollectionUtils.emptyIfNull(logicalModemUuids); - this.mSimSlotCapabilities = CollectionUtils.emptyIfNull(simSlotCapabilities); - this.mConcurrentFeaturesSupport = CollectionUtils.emptyIfNull(concurrentFeaturesSupport); + 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) { @@ -429,14 +429,14 @@ public final class PhoneCapability implements Parcelable { /** * {@link Parcelable#describeContents} */ - public @Parcelable.ContentsFlags int describeContents() { + public int describeContents() { return 0; } /** * {@link Parcelable#writeToParcel} */ - public void writeToParcel(@NonNull Parcel dest, @Parcelable.WriteFlags int flags) { + public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeInt(mUtranUeCategoryDl); dest.writeInt(mUtranUeCategoryUl); dest.writeInt(mEutranUeCategoryDl); diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java index 0074772a221d..ec9940836afe 100644 --- a/telephony/java/android/telephony/PhoneNumberUtils.java +++ b/telephony/java/android/telephony/PhoneNumberUtils.java @@ -16,8 +16,6 @@ package android.telephony; -import com.android.telephony.Rlog; - import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; @@ -45,6 +43,7 @@ import com.android.i18n.phonenumbers.NumberParseException; import com.android.i18n.phonenumbers.PhoneNumberUtil; import com.android.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat; import com.android.i18n.phonenumbers.Phonenumber.PhoneNumber; +import com.android.telephony.Rlog; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/telephony/java/android/telephony/PreciseDataConnectionState.java b/telephony/java/android/telephony/PreciseDataConnectionState.java index 094b8b0d1631..54c22ae282fb 100644 --- a/telephony/java/android/telephony/PreciseDataConnectionState.java +++ b/telephony/java/android/telephony/PreciseDataConnectionState.java @@ -135,11 +135,12 @@ public final class PreciseDataConnectionState implements Parcelable { } /** - * To check the SDK version for {@code PreciseDataConnectionState#getDataConnectionState}. + * Used for checking if the SDK version for + * {@code PreciseDataConnectionState#getDataConnectionState} is above Q. */ @ChangeId @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.Q) - private static final long GET_DATA_CONNECTION_STATE_CODE_CHANGE = 147600208L; + private static final long GET_DATA_CONNECTION_STATE_R_VERSION = 148535736L; /** * Returns the state of data connection that supported the apn types returned by @@ -152,7 +153,7 @@ public final class PreciseDataConnectionState implements Parcelable { @SystemApi public @DataState int getDataConnectionState() { if (mState == TelephonyManager.DATA_DISCONNECTING - && !Compatibility.isChangeEnabled(GET_DATA_CONNECTION_STATE_CODE_CHANGE)) { + && !Compatibility.isChangeEnabled(GET_DATA_CONNECTION_STATE_R_VERSION)) { return TelephonyManager.DATA_CONNECTED; } diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index 156cb72bef5d..3026363c8bcc 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; @@ -1292,7 +1300,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); } @@ -1310,7 +1318,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); @@ -1924,6 +1932,8 @@ public class ServiceState implements Parcelable { /** * Get the network registration state for the transport type and network domain. + * If multiple domains are in the input bitmask, only the first one from + * networkRegistrationInfo.getDomain() will be returned. * * @param domain The network {@link NetworkRegistrationInfo.Domain domain} * @param transportType The transport type @@ -2071,11 +2081,18 @@ public class ServiceState implements Parcelable { public boolean isIwlanPreferred() { return mIsIwlanPreferred; } - /** - * @return {@code true}Returns True whenever the modem is searching for service. - * To check both CS and PS domain - */ + /** + * This indicates whether the device is searching for service. + * + * This API reports the modem searching status for + * {@link AccessNetworkConstants#TRANSPORT_TYPE_WWAN} (cellular) service in either + * {@link NetworkRegistrationInfo#DOMAIN_CS} or {@link NetworkRegistrationInfo#DOMAIN_PS}. + * This API will not report searching status for + * {@link AccessNetworkConstants#TRANSPORT_TYPE_WLAN}. + * + * @return {@code true} whenever the modem is searching for service. + */ public boolean isSearching() { NetworkRegistrationInfo psRegState = getNetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); diff --git a/telephony/java/android/telephony/SimSlotCapability.java b/telephony/java/android/telephony/SimSlotCapability.java index 3d38d0429908..b4fef46725a4 100644 --- a/telephony/java/android/telephony/SimSlotCapability.java +++ b/telephony/java/android/telephony/SimSlotCapability.java @@ -105,14 +105,14 @@ public final class SimSlotCapability implements Parcelable { /** * {@link Parcelable#describeContents} */ - public @ContentsFlags int describeContents() { + public int describeContents() { return 0; } /** * {@link Parcelable#writeToParcel} */ - public void writeToParcel(@NonNull Parcel dest, @WriteFlags int flags) { + public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeInt(mPhysicalSlotIndex); dest.writeInt(mSlotType); } diff --git a/telephony/java/android/telephony/SmsCbMessage.java b/telephony/java/android/telephony/SmsCbMessage.java index 3c6709415281..c0dfec9a1172 100644 --- a/telephony/java/android/telephony/SmsCbMessage.java +++ b/telephony/java/android/telephony/SmsCbMessage.java @@ -177,6 +177,9 @@ public final class SmsCbMessage implements Parcelable { @Nullable private final String mLanguage; + /** The 8-bit data coding scheme defined in 3GPP TS 23.038 section 4. */ + private final int mDataCodingScheme; + /** Message body, as a String. */ @Nullable private final String mBody; @@ -220,7 +223,7 @@ public final class SmsCbMessage implements Parcelable { @Nullable SmsCbCmasInfo cmasWarningInfo, int slotIndex, int subId) { this(messageFormat, geographicalScope, serialNumber, location, serviceCategory, language, - body, priority, etwsWarningInfo, cmasWarningInfo, 0 /* maximumWaitingTime */, + 0, body, priority, etwsWarningInfo, cmasWarningInfo, 0 /* maximumWaitingTime */, null /* geometries */, System.currentTimeMillis(), slotIndex, subId); } @@ -230,8 +233,8 @@ public final class SmsCbMessage implements Parcelable { */ public SmsCbMessage(int messageFormat, int geographicalScope, int serialNumber, @NonNull SmsCbLocation location, int serviceCategory, - @Nullable String language, @Nullable String body, int priority, - @Nullable SmsCbEtwsInfo etwsWarningInfo, + @Nullable String language, int dataCodingScheme, @Nullable String body, + int priority, @Nullable SmsCbEtwsInfo etwsWarningInfo, @Nullable SmsCbCmasInfo cmasWarningInfo, int maximumWaitTimeSec, @Nullable List<Geometry> geometries, long receivedTimeMillis, int slotIndex, int subId) { @@ -241,6 +244,7 @@ public final class SmsCbMessage implements Parcelable { mLocation = location; mServiceCategory = serviceCategory; mLanguage = language; + mDataCodingScheme = dataCodingScheme; mBody = body; mPriority = priority; mEtwsWarningInfo = etwsWarningInfo; @@ -263,6 +267,7 @@ public final class SmsCbMessage implements Parcelable { mLocation = new SmsCbLocation(in); mServiceCategory = in.readInt(); mLanguage = in.readString(); + mDataCodingScheme = in.readInt(); mBody = in.readString(); mPriority = in.readInt(); int type = in.readInt(); @@ -305,6 +310,7 @@ public final class SmsCbMessage implements Parcelable { mLocation.writeToParcel(dest, flags); dest.writeInt(mServiceCategory); dest.writeString(mLanguage); + dest.writeInt(mDataCodingScheme); dest.writeString(mBody); dest.writeInt(mPriority); if (mEtwsWarningInfo != null) { @@ -398,6 +404,15 @@ public final class SmsCbMessage implements Parcelable { } /** + * Get data coding scheme of the message + * + * @return The 8-bit data coding scheme defined in 3GPP TS 23.038 section 4. + */ + public int getDataCodingScheme() { + return mDataCodingScheme; + } + + /** * Get the body of this message, or null if no body available * * @return Body, or null @@ -718,7 +733,7 @@ public final class SmsCbMessage implements Parcelable { cursor.getColumnIndexOrThrow(CellBroadcasts.MAXIMUM_WAIT_TIME)); return new SmsCbMessage(format, geoScope, serialNum, location, category, - language, body, priority, etwsInfo, cmasInfo, maximumWaitTimeSec, geometries, + language, 0, body, priority, etwsInfo, cmasInfo, maximumWaitTimeSec, geometries, receivedTimeMillis, slotIndex, subId); } diff --git a/telephony/java/android/telephony/SmsManager.java b/telephony/java/android/telephony/SmsManager.java index a272c7dccece..1b2a3646acde 100644 --- a/telephony/java/android/telephony/SmsManager.java +++ b/telephony/java/android/telephony/SmsManager.java @@ -2548,7 +2548,7 @@ public final class SmsManager { MmsManager m = (MmsManager) context.getSystemService(Context.MMS_SERVICE); if (m != null) { m.sendMultimediaMessage(getSubscriptionId(), contentUri, locationUrl, configOverrides, - sentIntent); + sentIntent, 0L /* messageId */); } } @@ -2586,7 +2586,7 @@ public final class SmsManager { MmsManager m = (MmsManager) context.getSystemService(Context.MMS_SERVICE); if (m != null) { m.downloadMultimediaMessage(getSubscriptionId(), locationUrl, contentUri, - configOverrides, downloadedIntent); + configOverrides, downloadedIntent, 0L /* messageId */); } } diff --git a/telephony/java/android/telephony/SmsMessage.java b/telephony/java/android/telephony/SmsMessage.java index 7a30f143a3a4..6d82e51c14af 100644 --- a/telephony/java/android/telephony/SmsMessage.java +++ b/telephony/java/android/telephony/SmsMessage.java @@ -16,8 +16,6 @@ package android.telephony; -import com.android.telephony.Rlog; - import static android.telephony.TelephonyManager.PHONE_TYPE_CDMA; import android.Manifest; @@ -40,13 +38,13 @@ import com.android.internal.telephony.SmsHeader; import com.android.internal.telephony.SmsMessageBase; import com.android.internal.telephony.SmsMessageBase.SubmitPduBase; import com.android.internal.telephony.cdma.sms.UserData; +import com.android.telephony.Rlog; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.Arrays; - /** * A Short Message Service message. * @see android.provider.Telephony.Sms.Intents#getMessagesFromIntent diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java index c24eeb74f6cd..832771daa409 100644 --- a/telephony/java/android/telephony/SubscriptionInfo.java +++ b/telephony/java/android/telephony/SubscriptionInfo.java @@ -16,8 +16,6 @@ package android.telephony; -import com.android.telephony.Rlog; - import android.annotation.Nullable; import android.annotation.SystemApi; import android.compat.annotation.UnsupportedAppUsage; @@ -40,6 +38,7 @@ import android.util.DisplayMetrics; import android.util.Log; import com.android.internal.telephony.util.TelephonyUtils; +import com.android.telephony.Rlog; import java.util.ArrayList; import java.util.Arrays; diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index 63a85fa2845c..97f50fd314b8 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -33,7 +33,6 @@ import android.annotation.SuppressAutoDoc; import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.TestApi; -import android.app.BroadcastOptions; import android.app.PendingIntent; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; @@ -43,7 +42,6 @@ import android.content.pm.PackageManager; import android.content.res.Configuration; import android.content.res.Resources; import android.database.ContentObserver; -import android.net.INetworkPolicyManager; import android.net.NetworkCapabilities; import android.net.NetworkPolicyManager; import android.net.Uri; @@ -57,7 +55,6 @@ import android.os.RemoteException; import android.provider.Telephony.SimInfo; import android.telephony.euicc.EuiccManager; import android.telephony.ims.ImsMmTelManager; -import android.util.DisplayMetrics; import android.util.Log; import android.util.Pair; @@ -79,7 +76,6 @@ import java.util.Locale; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executor; -import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import java.util.stream.Collectors; @@ -515,13 +511,6 @@ public class SubscriptionManager { 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; - - /** * TelephonyProvider column name for whether a subscription is embedded (that is, present on an * eSIM). * <p>Type: INTEGER (int), 1 for embedded or 0 for non-embedded. @@ -677,6 +666,13 @@ public class SubscriptionManager { public static final String WFC_IMS_ROAMING_ENABLED = SimInfo.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; + + /** * TelephonyProvider column name for whether a subscription is opportunistic, that is, * whether the network it connects to is limited in functionality or coverage. * For example, CBRS. @@ -881,7 +877,6 @@ public class SubscriptionManager { public static final String EXTRA_SLOT_INDEX = "android.telephony.extra.SLOT_INDEX"; private final Context mContext; - private volatile INetworkPolicyManager mNetworkPolicy; // Cache of Resource that has been created in getResourcesForSubId. Key is a Pair containing // the Context and subId. @@ -973,17 +968,6 @@ public class SubscriptionManager { .getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE); } - private INetworkPolicyManager getINetworkPolicyManager() { - if (mNetworkPolicy == null) { - mNetworkPolicy = INetworkPolicyManager.Stub.asInterface( - TelephonyFrameworkInitializer - .getTelephonyServiceManager() - .getNetworkPolicyServiceRegisterer() - .get()); - } - return mNetworkPolicy; - } - /** * Register for changes to the list of active {@link SubscriptionInfo} records or to the * individual records themselves. When a change occurs the onSubscriptionsChanged method of @@ -2515,23 +2499,24 @@ public class SubscriptionManager { final SubscriptionInfo subInfo = SubscriptionManager.from(context).getActiveSubscriptionInfo(subId); - Configuration config = context.getResources().getConfiguration(); - Configuration newConfig = new Configuration(); - newConfig.setTo(config); + Configuration overrideConfig = new Configuration(); if (subInfo != null) { - newConfig.mcc = subInfo.getMcc(); - newConfig.mnc = subInfo.getMnc(); - if (newConfig.mnc == 0) newConfig.mnc = Configuration.MNC_ZERO; + overrideConfig.mcc = subInfo.getMcc(); + overrideConfig.mnc = subInfo.getMnc(); + if (overrideConfig.mnc == 0) overrideConfig.mnc = Configuration.MNC_ZERO; } if (useRootLocale) { - newConfig.setLocale(Locale.ROOT); + overrideConfig.setLocale(Locale.ROOT); } - DisplayMetrics metrics = context.getResources().getDisplayMetrics(); - DisplayMetrics newMetrics = new DisplayMetrics(); - newMetrics.setTo(metrics); - Resources res = new Resources(context.getResources().getAssets(), newMetrics, newConfig); + // Create new context with new configuration so that we can avoid modifying the passed in + // context. + // Note that if the original context configuration changes, the resources here will also + // change for all values except those overridden by newConfig (e.g. if the device has an + // orientation change). + Context newContext = context.createConfigurationContext(overrideConfig); + Resources res = newContext.getResources(); if (cacheKey != null) { // Save the newly created Resources in the resource cache. @@ -2626,15 +2611,6 @@ public class SubscriptionManager { plans.toArray(new SubscriptionPlan[plans.size()]), mContext.getOpPackageName()); } - /** @hide */ - private String getSubscriptionPlansOwner(int subId) { - try { - return getINetworkPolicyManager().getSubscriptionPlansOwner(subId); - } catch (RemoteException e) { - throw e.rethrowFromSystemServer(); - } - } - /** * Temporarily override the billing relationship plan between a carrier and * a specific subscriber to be considered unmetered. This will be reflected @@ -2698,89 +2674,6 @@ public class SubscriptionManager { } /** - * Create an {@link Intent} that can be launched towards the carrier app - * that is currently defining the billing relationship plan through - * {@link #setSubscriptionPlans(int, List)}. - * - * @return ready to launch Intent targeted towards the carrier app, or - * {@code null} if no carrier app is defined, or if the defined - * carrier app provides no management activity. - * @hide - */ - public @Nullable Intent createManageSubscriptionIntent(int subId) { - // Bail if no owner - final String owner = getSubscriptionPlansOwner(subId); - if (owner == null) return null; - - // Bail if no plans - final List<SubscriptionPlan> plans = getSubscriptionPlans(subId); - if (plans.isEmpty()) return null; - - final Intent intent = new Intent(ACTION_MANAGE_SUBSCRIPTION_PLANS); - intent.setPackage(owner); - intent.putExtra(EXTRA_SUBSCRIPTION_INDEX, subId); - - // Bail if not implemented - if (mContext.getPackageManager().queryIntentActivities(intent, - PackageManager.MATCH_DEFAULT_ONLY).isEmpty()) { - return null; - } - - return intent; - } - - /** @hide */ - private @Nullable Intent createRefreshSubscriptionIntent(int subId) { - // Bail if no owner - final String owner = getSubscriptionPlansOwner(subId); - if (owner == null) return null; - - // Bail if no plans - final List<SubscriptionPlan> plans = getSubscriptionPlans(subId); - if (plans.isEmpty()) return null; - - final Intent intent = new Intent(ACTION_REFRESH_SUBSCRIPTION_PLANS); - intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); - intent.setPackage(owner); - intent.putExtra(EXTRA_SUBSCRIPTION_INDEX, subId); - - // Bail if not implemented - if (mContext.getPackageManager().queryBroadcastReceivers(intent, 0).isEmpty()) { - return null; - } - - return intent; - } - - /** - * Check if there is a carrier app that is currently defining the billing - * relationship plan through {@link #setSubscriptionPlans(int, List)} that - * supports refreshing of subscription plans. - * - * @hide - */ - public boolean isSubscriptionPlansRefreshSupported(int subId) { - return createRefreshSubscriptionIntent(subId) != null; - } - - /** - * Request that the carrier app that is currently defining the billing - * relationship plan through {@link #setSubscriptionPlans(int, List)} - * refresh its subscription plans. - * <p> - * If the app is able to successfully update the plans, you'll expect to - * receive the {@link #ACTION_SUBSCRIPTION_PLANS_CHANGED} broadcast. - * - * @hide - */ - public void requestSubscriptionPlansRefresh(int subId) { - final Intent intent = createRefreshSubscriptionIntent(subId); - final BroadcastOptions options = BroadcastOptions.makeBasic(); - options.setTemporaryAppWhitelistDuration(TimeUnit.MINUTES.toMillis(1)); - mContext.sendBroadcast(intent, null, options.toBundle()); - } - - /** * Checks whether the app with the given context is authorized to manage the given subscription * according to its metadata. * diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 5675fcc3abf0..549b04d38459 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -69,7 +69,9 @@ 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.NetworkType; import android.telephony.Annotation.RadioPowerState; import android.telephony.Annotation.SimActivationState; @@ -99,7 +101,6 @@ import com.android.internal.telephony.IOns; import com.android.internal.telephony.IPhoneSubInfo; import com.android.internal.telephony.ISetOpportunisticDataCallback; import com.android.internal.telephony.ITelephony; -import com.android.internal.telephony.ITelephonyRegistry; import com.android.internal.telephony.IUpdateAvailableNetworksCallback; import com.android.internal.telephony.OperatorInfo; import com.android.internal.telephony.PhoneConstants; @@ -1244,6 +1245,80 @@ public class TelephonyManager { public static final String EXTRA_SUBSCRIPTION_ID = "android.telephony.extra.SUBSCRIPTION_ID"; /** + * Broadcast Action: The Service Provider string(s) have been updated. Activities or + * services that use these strings should update their display. + * + * <p>The intent will have the following extra values: + * <dl> + * <dt>{@link #EXTRA_SHOW_PLMN}</dt> + * <dd>Boolean that indicates whether the PLMN should be shown.</dd> + * <dt>{@link #EXTRA_PLMN}</dt> + * <dd>The operator name of the registered network, as a string.</dd> + * <dt>{@link #EXTRA_SHOW_SPN}</dt> + * <dd>Boolean that indicates whether the SPN should be shown.</dd> + * <dt>{@link #EXTRA_SPN}</dt> + * <dd>The service provider name, as a string.</dd> + * <dt>{@link #EXTRA_DATA_SPN}</dt> + * <dd>The service provider name for data service, as a string.</dd> + * </dl> + * + * Note that {@link #EXTRA_SHOW_PLMN} may indicate that {@link #EXTRA_PLMN} should be displayed, + * even though the value for {@link #EXTRA_PLMN} is null. This can happen, for example, if the + * phone has not registered to a network yet. In this case the receiver may substitute an + * appropriate placeholder string (eg, "No service"). + * + * It is recommended to display {@link #EXTRA_PLMN} before / above {@link #EXTRA_SPN} if + * both are displayed. + * + * <p>Note: this is a protected intent that can only be sent by the system. + * @hide + */ + @SystemApi + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_SERVICE_PROVIDERS_UPDATED = + "android.telephony.action.SERVICE_PROVIDERS_UPDATED"; + + /** + * String intent extra to be used with {@link ACTION_SERVICE_PROVIDERS_UPDATED} to indicate + * whether the PLMN should be shown. + * @hide + */ + @SystemApi + public static final String EXTRA_SHOW_PLMN = "android.telephony.extra.SHOW_PLMN"; + + /** + * String intent extra to be used with {@link ACTION_SERVICE_PROVIDERS_UPDATED} to indicate + * the operator name of the registered network. + * @hide + */ + @SystemApi + public static final String EXTRA_PLMN = "android.telephony.extra.PLMN"; + + /** + * String intent extra to be used with {@link ACTION_SERVICE_PROVIDERS_UPDATED} to indicate + * whether the PLMN should be shown. + * @hide + */ + @SystemApi + public static final String EXTRA_SHOW_SPN = "android.telephony.extra.SHOW_SPN"; + + /** + * String intent extra to be used with {@link ACTION_SERVICE_PROVIDERS_UPDATED} to indicate + * the service provider name. + * @hide + */ + @SystemApi + public static final String EXTRA_SPN = "android.telephony.extra.SPN"; + + /** + * String intent extra to be used with {@link ACTION_SERVICE_PROVIDERS_UPDATED} to indicate + * the service provider name for data service. + * @hide + */ + @SystemApi + public static final String EXTRA_DATA_SPN = "android.telephony.extra.DATA_SPN"; + + /** * Broadcast intent action indicating that when data stall recovery is attempted by Telephony, * intended for report every data stall recovery step attempted. * @@ -2710,7 +2785,7 @@ public class TelephonyManager { @UnsupportedAppUsage public boolean isNetworkRoaming(int subId) { int phoneId = SubscriptionManager.getPhoneId(subId); - return getTelephonyProperty(subId, TelephonyProperties.operator_is_roaming(), false); + return getTelephonyProperty(phoneId, TelephonyProperties.operator_is_roaming(), false); } /** @@ -5493,11 +5568,11 @@ public class TelephonyManager { public static final int DATA_DISCONNECTING = 4; /** - * To check the SDK version for {@link TelephonyManager#getDataState}. + * Used for checking if the SDK version for {@link TelephonyManager#getDataState} is above Q. */ @ChangeId @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.Q) - private static final long GET_DATA_STATE_CODE_CHANGE = 147600208L; + private static final long GET_DATA_STATE_R_VERSION = 148534348L; /** * Returns a constant indicating the current data connection state @@ -5517,7 +5592,7 @@ public class TelephonyManager { int state = telephony.getDataStateForSubId( getSubId(SubscriptionManager.getActiveDataSubscriptionId())); if (state == TelephonyManager.DATA_DISCONNECTING - && !Compatibility.isChangeEnabled(GET_DATA_STATE_CODE_CHANGE)) { + && !Compatibility.isChangeEnabled(GET_DATA_STATE_R_VERSION)) { return TelephonyManager.DATA_CONNECTED; } @@ -5556,14 +5631,6 @@ public class TelephonyManager { .getTelephonyServiceManager().getTelephonyServiceRegisterer().get()); } - private ITelephonyRegistry getTelephonyRegistry() { - return ITelephonyRegistry.Stub.asInterface( - TelephonyFrameworkInitializer - .getTelephonyServiceManager() - .getTelephonyRegistryServiceRegisterer() - .get()); - } - private IOns getIOns() { return IOns.Stub.asInterface( TelephonyFrameworkInitializer @@ -5579,13 +5646,6 @@ public class TelephonyManager { // /** - * To check the SDK version for {@link TelephonyManager#listen}. - */ - @ChangeId - @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.P) - private static final long LISTEN_CODE_CHANGE = 147600208L; - - /** * Registers a listener object to receive notification of changes * in specified telephony states. * <p> @@ -5617,29 +5677,15 @@ public class TelephonyManager { */ public void listen(PhoneStateListener listener, int events) { if (mContext == null) return; - try { - boolean notifyNow = (getITelephony() != null); - ITelephonyRegistry registry = getTelephonyRegistry(); - if (registry != null) { - // subId from PhoneStateListener is deprecated Q on forward, use the subId from - // TelephonyManager instance. keep using subId from PhoneStateListener for pre-Q. - int subId = mSubId; - if (Compatibility.isChangeEnabled(LISTEN_CODE_CHANGE)) { - // since mSubId in PhoneStateListener is deprecated from Q on forward, this is - // the only place to set mSubId and its for "informational" only. - // TODO: remove this once we completely get rid of mSubId in PhoneStateListener - listener.mSubId = (events == PhoneStateListener.LISTEN_NONE) - ? SubscriptionManager.INVALID_SUBSCRIPTION_ID : subId; - } else if (listener.mSubId != null) { - subId = listener.mSubId; - } - registry.listenForSubscriber(subId, getOpPackageName(), getFeatureId(), - listener.callback, events, notifyNow); - } else { - Rlog.w(TAG, "telephony registry not ready."); - } - } catch (RemoteException ex) { - // system process dead + boolean notifyNow = (getITelephony() != null); + TelephonyRegistryManager telephonyRegistry = + (TelephonyRegistryManager) + mContext.getSystemService(Context.TELEPHONY_REGISTRY_SERVICE); + if (telephonyRegistry != null) { + telephonyRegistry.listenForSubscriber(mSubId, getOpPackageName(), getFeatureId(), + listener, events, notifyNow); + } else { + Rlog.w(TAG, "telephony registry not ready."); } } @@ -5655,7 +5701,7 @@ public class TelephonyManager { @NonNull public CdmaEriInformation getCdmaEriInformation() { return new CdmaEriInformation( - getCdmaEriIconMode(getSubId()), getCdmaEriIconIndex(getSubId())); + getCdmaEriIconIndex(getSubId()), getCdmaEriIconMode(getSubId())); } /** @@ -7291,6 +7337,30 @@ public class TelephonyManager { } } + + /** + * Resets the {@link android.telephony.ims.ImsService} associated with the specified sim slot. + * Used by diagnostic apps to force the IMS stack to be disabled and re-enabled in an effort to + * recover from scenarios where the {@link android.telephony.ims.ImsService} gets in to a bad + * state. + * + * @param slotIndex the sim slot to reset the IMS stack on. + * @hide */ + @SystemApi + @WorkerThread + @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + public void resetIms(int slotIndex) { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + telephony.resetIms(slotIndex); + } + } catch (RemoteException e) { + Rlog.e(TAG, "toggleImsOnOff, RemoteException: " + + e.getMessage()); + } + } + /** * Enables IMS for the framework. This will trigger IMS registration and ImsFeature capability * status updates, if not already enabled. @@ -8027,6 +8097,30 @@ public class TelephonyManager { } /** + * Get the PLMN chosen for Manual Network Selection if active. + * Return empty string if in automatic selection. + * + * <p>Requires Permission: {@link android.Manifest.permission#READ_PRECISE_PHONE_STATE + * READ_PRECISE_PHONE_STATE} or that the calling app has carrier privileges + * (see {@link #hasCarrierPrivileges}) + * + * @return manually selected network info on success or empty string on failure + */ + @SuppressAutoDoc // No support carrier privileges (b/72967236). + @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) + public @NonNull String getManualNetworkSelectionPlmn() { + try { + ITelephony telephony = getITelephony(); + if (telephony != null && isManualNetworkSelectionAllowed()) { + return telephony.getManualNetworkSelectionPlmn(getSubId()); + } + } catch (RemoteException ex) { + Rlog.e(TAG, "getManualNetworkSelectionPlmn RemoteException", ex); + } + return ""; + } + + /** * Query Telephony to see if there has recently been an emergency SMS sent to the network by the * user and we are still within the time interval after the emergency SMS was sent that we are * considered in Emergency SMS mode. @@ -11079,15 +11173,18 @@ public class TelephonyManager { /** * Checks if manual network selection is allowed. * + * <p>Requires Permission: {@link android.Manifest.permission#READ_PRECISE_PHONE_STATE + * READ_PRECISE_PHONE_STATE} or that the calling app has carrier privileges + * (see {@link #hasCarrierPrivileges}) + * * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}. * * @return {@code true} if manual network selection is allowed, otherwise return {@code false}. - * - * @hide */ - @SystemApi - @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @SuppressAutoDoc // No support carrier privileges (b/72967236). + @RequiresPermission(anyOf = {android.Manifest.permission.READ_PRECISE_PHONE_STATE, + android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE}) public boolean isManualNetworkSelectionAllowed() { try { ITelephony telephony = getITelephony(); @@ -12657,6 +12754,191 @@ public class TelephonyManager { } /** + * Gets the voice call forwarding info {@link CallForwardingInfo}, given the call forward + * reason. + * + * @param callForwardingReason the call forwarding reasons + * + * @throws IllegalArgumentException if callForwardingReason is not any of + * {@link CallForwardingInfo.REASON_UNCONDITIONAL}, {@link CallForwardingInfo.REASON_BUSY}, + * {@link CallForwardingInfo.REASON_NO_REPLY}, {@link CallForwardingInfo.REASON_NOT_REACHABLE}, + * {@link CallForwardingInfo.REASON_ALL}, {@link CallForwardingInfo.REASON_ALL_CONDITIONAL} + * + * @return {@link CallForwardingInfo} with the status {@link CallForwardingInfo#STATUS_ACTIVE} + * or {@link CallForwardingInfo#STATUS_INACTIVE} and the target phone number to forward calls + * to, if it's available. Otherwise, it will return a {@link CallForwardingInfo} with status + * {@link CallForwardingInfo#STATUS_UNKNOWN_ERROR}, + * {@link CallForwardingInfo#STATUS_NOT_SUPPORTED}, + * or {@link CallForwardingInfo#STATUS_FDN_CHECK_FAILURE} depending on the situation. + * + * @hide + */ + @SystemApi + @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @NonNull + public CallForwardingInfo getCallForwarding(@CallForwardingReason int callForwardingReason) { + if (callForwardingReason < CallForwardingInfo.REASON_UNCONDITIONAL + || callForwardingReason > CallForwardingInfo.REASON_ALL_CONDITIONAL) { + throw new IllegalArgumentException("callForwardingReason is out of range"); + } + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.getCallForwarding(getSubId(), callForwardingReason); + } + } catch (RemoteException ex) { + Rlog.e(TAG, "getCallForwarding RemoteException", ex); + } catch (NullPointerException ex) { + Rlog.e(TAG, "getCallForwarding NPE", ex); + } + return new CallForwardingInfo( + CallForwardingInfo.STATUS_UNKNOWN_ERROR, 0 /* reason */, null /* number */, + 0 /* timeout */); + } + + /** + * Sets the voice call forwarding info including status (enable/disable), call forwarding + * reason, the number to forward, and the timeout before the forwarding is attempted. + * + * @param callForwardingInfo {@link CallForwardingInfo} to setup the call forwarding. + * Enabling if {@link CallForwardingInfo#getStatus()} returns + * {@link CallForwardingInfo#STATUS_ACTIVE}; Disabling if + * {@link CallForwardingInfo#getStatus()} returns {@link CallForwardingInfo#STATUS_INACTIVE}. + * + * @throws IllegalArgumentException if any of the following for parameter callForwardingInfo: + * 0) it is {@code null}. + * 1) {@link CallForwardingInfo#getStatus()} returns neither + * {@link CallForwardingInfo#STATUS_ACTIVE} nor {@link CallForwardingInfo#STATUS_INACTIVE}. + * 2) {@link CallForwardingInfo#getReason()} is not any of + * {@link CallForwardingInfo.REASON_UNCONDITIONAL}, {@link CallForwardingInfo.REASON_BUSY}, + * {@link CallForwardingInfo.REASON_NO_REPLY}, {@link CallForwardingInfo.REASON_NOT_REACHABLE}, + * {@link CallForwardingInfo.REASON_ALL}, {@link CallForwardingInfo.REASON_ALL_CONDITIONAL} + * 3) {@link CallForwardingInfo#getNumber()} returns {@code null}. + * 4) {@link CallForwardingInfo#getTimeoutSeconds()} doesn't return a positive value. + * + * @return {@code true} to indicate it was set successfully; {@code false} otherwise. + * + * @hide + */ + @SystemApi + @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + public boolean setCallForwarding(@NonNull CallForwardingInfo callForwardingInfo) { + if (callForwardingInfo == null) { + throw new IllegalArgumentException("callForwardingInfo is null"); + } + int callForwardingStatus = callForwardingInfo.getStatus(); + if (callForwardingStatus != CallForwardingInfo.STATUS_ACTIVE + && callForwardingStatus != CallForwardingInfo.STATUS_INACTIVE) { + throw new IllegalArgumentException( + "callForwardingStatus is neither active nor inactive"); + } + int callForwardingReason = callForwardingInfo.getReason(); + if (callForwardingReason < CallForwardingInfo.REASON_UNCONDITIONAL + || callForwardingReason > CallForwardingInfo.REASON_ALL_CONDITIONAL) { + throw new IllegalArgumentException("callForwardingReason is out of range"); + } + if (callForwardingInfo.getNumber() == null) { + throw new IllegalArgumentException("callForwarding number is null"); + } + if (callForwardingInfo.getTimeoutSeconds() <= 0) { + throw new IllegalArgumentException("callForwarding timeout isn't positive"); + } + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.setCallForwarding(getSubId(), callForwardingInfo); + } + } catch (RemoteException ex) { + Rlog.e(TAG, "setCallForwarding RemoteException", ex); + } catch (NullPointerException ex) { + Rlog.e(TAG, "setCallForwarding NPE", ex); + } + return false; + } + + /** + * Indicates the call waiting status is active. + * + * @hide + */ + @SystemApi + public static final int CALL_WAITING_STATUS_ACTIVE = 1; + + /** + * Indicates the call waiting status is inactive. + * + * @hide + */ + @SystemApi + public static final int CALL_WAITING_STATUS_INACTIVE = 2; + + /** + * Indicates the call waiting status is with an unknown error. + * + * @hide + */ + @SystemApi + public static final int CALL_WAITING_STATUS_UNKNOWN_ERROR = 3; + + /** + * Indicates the call waiting is not supported (e.g. called via CDMA). + * + * @hide + */ + @SystemApi + public static final int CALL_WAITING_STATUS_NOT_SUPPORTED = 4; + + /** + * 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. + * + * @return the status of call waiting function. + * @hide + */ + @SystemApi + @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + public @CallWaitingStatus int getCallWaitingStatus() { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.getCallWaitingStatus(getSubId()); + } + } catch (RemoteException ex) { + Rlog.e(TAG, "getCallWaitingStatus RemoteException", ex); + } catch (NullPointerException ex) { + Rlog.e(TAG, "getCallWaitingStatus NPE", ex); + } + return CALL_WAITING_STATUS_UNKNOWN_ERROR; + } + + /** + * Sets the status for 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. + * + * @param isEnable {@code true} to enable; {@code false} to disable. + * @return {@code true} to indicate it was set successfully; {@code false} otherwise. + * + * @hide + */ + @SystemApi + @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + public boolean setCallWaitingStatus(boolean isEnable) { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.setCallWaitingStatus(getSubId(), isEnable); + } + } catch (RemoteException ex) { + Rlog.e(TAG, "setCallWaitingStatus RemoteException", ex); + } catch (NullPointerException ex) { + Rlog.e(TAG, "setCallWaitingStatus NPE", ex); + } + return false; + } + + /** * Set allowing mobile data during voice call. This is used for allowing data on the non-default * data SIM. When a voice call is placed on the non-default data SIM on DSDS devices, users will * not be able to use mobile data. By calling this API, data will be temporarily enabled on the diff --git a/telephony/java/android/telephony/TelephonyScanManager.java b/telephony/java/android/telephony/TelephonyScanManager.java index a1d40e85fb10..cdff651c9c3d 100644 --- a/telephony/java/android/telephony/TelephonyScanManager.java +++ b/telephony/java/android/telephony/TelephonyScanManager.java @@ -16,8 +16,6 @@ package android.telephony; -import com.android.telephony.Rlog; - import static com.android.internal.util.Preconditions.checkNotNull; import android.annotation.Nullable; @@ -33,6 +31,7 @@ import android.os.RemoteException; import android.util.SparseArray; import com.android.internal.telephony.ITelephony; +import com.android.telephony.Rlog; import java.util.Arrays; import java.util.List; diff --git a/telephony/java/android/telephony/UiccAccessRule.java b/telephony/java/android/telephony/UiccAccessRule.java index 81a09c645070..3e948fc75d00 100644 --- a/telephony/java/android/telephony/UiccAccessRule.java +++ b/telephony/java/android/telephony/UiccAccessRule.java @@ -15,8 +15,6 @@ */ package android.telephony; -import com.android.telephony.Rlog; - import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; @@ -28,6 +26,7 @@ import android.os.Parcelable; import android.text.TextUtils; import com.android.internal.telephony.uicc.IccUtils; +import com.android.telephony.Rlog; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/telephony/java/android/telephony/VoLteServiceState.java b/telephony/java/android/telephony/VoLteServiceState.java index d4a27d925208..27187e68d5cc 100644 --- a/telephony/java/android/telephony/VoLteServiceState.java +++ b/telephony/java/android/telephony/VoLteServiceState.java @@ -16,14 +16,14 @@ package android.telephony; -import com.android.telephony.Rlog; - import android.compat.annotation.UnsupportedAppUsage; import android.os.Build; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; +import com.android.telephony.Rlog; + /** * Contains LTE network state related information. * @deprecated Only contains SRVCC state, which isn't specific to LTE handovers. For SRVCC diff --git a/telephony/java/android/telephony/data/ApnSetting.java b/telephony/java/android/telephony/data/ApnSetting.java index 50e93f041a04..cf00303df7b2 100644 --- a/telephony/java/android/telephony/data/ApnSetting.java +++ b/telephony/java/android/telephony/data/ApnSetting.java @@ -27,6 +27,7 @@ import android.os.Parcel; import android.os.Parcelable; import android.provider.Telephony; import android.provider.Telephony.Carriers; +import android.telephony.Annotation; import android.telephony.Annotation.ApnType; import android.telephony.Annotation.NetworkType; import android.telephony.ServiceState; @@ -744,7 +745,7 @@ public class ApnSetting implements Parcelable { * @return SKIP_464XLAT_DEFAULT, SKIP_464XLAT_DISABLE or SKIP_464XLAT_ENABLE * @hide */ - @Carriers.Skip464XlatStatus + @Annotation.Skip464XlatStatus public int getSkip464Xlat() { return mSkip464Xlat; } @@ -2061,10 +2062,10 @@ public class ApnSetting implements Parcelable { /** * Sets skip464xlat flag for this APN. * - * @param skip464xlat skip464xlat for this APN + * @param skip464xlat skip464xlat for this APN. * @hide */ - public Builder setSkip464Xlat(@Carriers.Skip464XlatStatus int skip464xlat) { + public Builder setSkip464Xlat(@Annotation.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 bff12b624ae8..6c4e7ce51ebf 100644 --- a/telephony/java/android/telephony/data/DataService.java +++ b/telephony/java/android/telephony/data/DataService.java @@ -31,10 +31,10 @@ import android.os.Looper; import android.os.Message; import android.os.RemoteException; import android.telephony.AccessNetworkConstants; -import com.android.telephony.Rlog; import android.util.SparseArray; import com.android.internal.annotations.VisibleForTesting; +import com.android.telephony.Rlog; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/telephony/java/android/telephony/data/DataServiceCallback.java b/telephony/java/android/telephony/data/DataServiceCallback.java index d33d3f9a5eee..72b68e4645c9 100644 --- a/telephony/java/android/telephony/data/DataServiceCallback.java +++ b/telephony/java/android/telephony/data/DataServiceCallback.java @@ -22,9 +22,10 @@ import android.annotation.Nullable; import android.annotation.SystemApi; import android.net.LinkProperties; import android.os.RemoteException; -import com.android.telephony.Rlog; import android.telephony.data.DataService.DataServiceProvider; +import com.android.telephony.Rlog; + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.List; diff --git a/telephony/java/android/telephony/data/QualifiedNetworksService.java b/telephony/java/android/telephony/data/QualifiedNetworksService.java index 8220b16500de..05971c4d2e70 100644 --- a/telephony/java/android/telephony/data/QualifiedNetworksService.java +++ b/telephony/java/android/telephony/data/QualifiedNetworksService.java @@ -28,10 +28,10 @@ import android.os.Message; import android.os.RemoteException; import android.telephony.AccessNetworkConstants.AccessNetworkType; import android.telephony.Annotation.ApnType; -import com.android.telephony.Rlog; import android.util.SparseArray; import com.android.internal.annotations.VisibleForTesting; +import com.android.telephony.Rlog; import java.util.List; diff --git a/telephony/java/android/telephony/emergency/EmergencyNumber.java b/telephony/java/android/telephony/emergency/EmergencyNumber.java index cd3fc953f9d2..d9d5c14735ea 100644 --- a/telephony/java/android/telephony/emergency/EmergencyNumber.java +++ b/telephony/java/android/telephony/emergency/EmergencyNumber.java @@ -25,6 +25,7 @@ import android.os.Parcel; import android.os.Parcelable; import android.telephony.CarrierConfigManager; import android.telephony.PhoneNumberUtils; + import com.android.telephony.Rlog; import java.lang.annotation.Retention; diff --git a/telephony/java/android/telephony/euicc/EuiccManager.java b/telephony/java/android/telephony/euicc/EuiccManager.java index d5a48df149f1..7488a1aec0e5 100644 --- a/telephony/java/android/telephony/euicc/EuiccManager.java +++ b/telephony/java/android/telephony/euicc/EuiccManager.java @@ -38,6 +38,9 @@ import com.android.internal.telephony.euicc.IEuiccController; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; /** * EuiccManager is the application interface to eUICCs, or eSIMs/embedded SIMs. @@ -246,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. */ @@ -491,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; @@ -939,6 +1251,138 @@ public class EuiccManager { } /** + * Sets the supported countries for eUICC. + * + * <p>Requires that the calling app has the + * {@code android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission. + * + * <p>The supported country list will be replaced by {@code supportedCountries}. For how we + * determine whether a country is supported please check {@link #isSupportedCountry}. + * + * @param supportedCountries is a list of strings contains country ISO codes in uppercase. + * @hide + */ + @SystemApi + @RequiresPermission(Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) + public void setSupportedCountries(@NonNull List<String> supportedCountries) { + if (!isEnabled()) { + return; + } + try { + getIEuiccController().setSupportedCountries( + true /* isSupported */, + supportedCountries.stream() + .map(String::toUpperCase).collect(Collectors.toList())); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * Sets the unsupported countries for eUICC. + * + * <p>Requires that the calling app has the + * {@code android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission. + * + * <p>The unsupported country list will be replaced by {@code unsupportedCountries}. For how we + * determine whether a country is supported please check {@link #isSupportedCountry}. + * + * @param unsupportedCountries is a list of strings contains country ISO codes in uppercase. + * @hide + */ + @SystemApi + @RequiresPermission(Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) + public void setUnsupportedCountries(@NonNull List<String> unsupportedCountries) { + if (!isEnabled()) { + return; + } + try { + getIEuiccController().setSupportedCountries( + false /* isSupported */, + unsupportedCountries.stream() + .map(String::toUpperCase).collect(Collectors.toList())); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * Gets the supported countries for eUICC. + * + * <p>Requires that the calling app has the + * {@code android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission. + * + * @return list of strings contains country ISO codes in uppercase. + * @hide + */ + @SystemApi + @RequiresPermission(Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) + @NonNull + public List<String> getSupportedCountries() { + if (!isEnabled()) { + return Collections.emptyList(); + } + try { + return getIEuiccController().getSupportedCountries(true /* isSupported */); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * Gets the unsupported countries for eUICC. + * + * <p>Requires that the calling app has the + * {@code android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission. + * + * @return list of strings contains country ISO codes in uppercase. + * @hide + */ + @SystemApi + @RequiresPermission(Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) + @NonNull + public List<String> getUnsupportedCountries() { + if (!isEnabled()) { + return Collections.emptyList(); + } + try { + return getIEuiccController().getSupportedCountries(false /* isSupported */); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * Returns whether the given country supports eUICC. + * + * <p>Supported country list has a higher prority than unsupported country list. If the + * supported country list is not empty, {@code countryIso} will be considered as supported when + * it exists in the supported country list. Otherwise {@code countryIso} is not supported. If + * the supported country list is empty, {@code countryIso} will be considered as supported if it + * does not exist in the unsupported country list. Otherwise {@code countryIso} is not + * supported. If both supported and unsupported country lists are empty, then all countries are + * consider be supported. For how to set supported and unsupported country list, please check + * {@link #setSupportedCountries} and {@link #setUnsupportedCountries}. + * + * @param countryIso should be the ISO-3166 country code is provided in uppercase 2 character + * format. + * @return whether the given country supports eUICC or not. + * @hide + */ + @SystemApi + @RequiresPermission(Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) + public boolean isSupportedCountry(@NonNull String countryIso) { + if (!isEnabled()) { + return false; + } + try { + return getIEuiccController().isSupportedCountry(countryIso.toUpperCase()); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** * Refreshes the cardId if its uninitialized, and returns whether we should continue the * operation. * <p> diff --git a/telephony/java/android/telephony/ims/ImsCallProfile.java b/telephony/java/android/telephony/ims/ImsCallProfile.java index 6a15528667b0..4d3dbad07354 100644 --- a/telephony/java/android/telephony/ims/ImsCallProfile.java +++ b/telephony/java/android/telephony/ims/ImsCallProfile.java @@ -333,6 +333,14 @@ public final class ImsCallProfile implements Parcelable { @Deprecated public static final String EXTRA_CALL_RAT_TYPE_ALT = "callRadioTech"; + /** + * String extra property containing forwarded numbers associated with the current connection + * for an IMS call. The value is string array, and it can include multiple numbers, and + * the array values are expected E164 (e.g. +1 (650) 253-0000) format. + */ + public static final String EXTRA_FORWARDED_NUMBER = + "android.telephony.ims.extra.FORWARDED_NUMBER"; + /** @hide */ public int mServiceType; /** @hide */ diff --git a/telephony/java/android/telephony/ims/ImsConferenceState.java b/telephony/java/android/telephony/ims/ImsConferenceState.java index abfee61930ed..21bef001efae 100644 --- a/telephony/java/android/telephony/ims/ImsConferenceState.java +++ b/telephony/java/android/telephony/ims/ImsConferenceState.java @@ -24,8 +24,8 @@ import android.os.Parcel; import android.os.Parcelable; import android.telecom.Call; import android.telecom.Connection; + import com.android.telephony.Rlog; -import android.util.Log; import java.util.HashMap; import java.util.Iterator; diff --git a/telephony/java/android/telephony/ims/ImsException.java b/telephony/java/android/telephony/ims/ImsException.java index cb3f0f92625e..643f452d2e75 100644 --- a/telephony/java/android/telephony/ims/ImsException.java +++ b/telephony/java/android/telephony/ims/ImsException.java @@ -61,7 +61,6 @@ public final class ImsException extends Exception { * This is a configuration error and there should be no retry. The subscription used for this * operation is either invalid or has become inactive. The active subscriptions can be queried * with {@link SubscriptionManager#getActiveSubscriptionInfoList()}. - * @hide */ public static final int CODE_ERROR_INVALID_SUBSCRIPTION = 3; diff --git a/telephony/java/android/telephony/ims/ImsExternalCallState.java b/telephony/java/android/telephony/ims/ImsExternalCallState.java index 136a83e2eec9..7d73165d4540 100644 --- a/telephony/java/android/telephony/ims/ImsExternalCallState.java +++ b/telephony/java/android/telephony/ims/ImsExternalCallState.java @@ -24,6 +24,7 @@ import android.annotation.TestApi; import android.net.Uri; import android.os.Parcel; import android.os.Parcelable; + import com.android.telephony.Rlog; import java.lang.annotation.Retention; diff --git a/telephony/java/android/telephony/ims/ImsMmTelManager.java b/telephony/java/android/telephony/ims/ImsMmTelManager.java index 5fdef8307d42..3341fa74d672 100644 --- a/telephony/java/android/telephony/ims/ImsMmTelManager.java +++ b/telephony/java/android/telephony/ims/ImsMmTelManager.java @@ -56,7 +56,8 @@ import java.util.function.Consumer; * registration and MmTel capability status callbacks, as well as query/modify user settings for the * associated subscription. * - * @see #createForSubscriptionId(int) + * Use {@link android.telephony.ims.ImsManager#getImsMmTelManager(int)} to get an instance of this + * manager. */ public class ImsMmTelManager implements RegistrationManager { @@ -228,8 +229,13 @@ public class ImsMmTelManager implements RegistrationManager { * (see {@link android.telephony.TelephonyManager#hasCarrierPrivileges}). * * @throws IllegalArgumentException if the subscription is invalid. - * + * @deprecated Use {@link android.telephony.ims.ImsManager#getImsMmTelManager(int)} to get an + * instance of this class. + * @hide */ + @SystemApi + @TestApi + @Deprecated @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(anyOf = { android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, @@ -245,7 +251,7 @@ public class ImsMmTelManager implements RegistrationManager { } /** - * Only visible for testing, use {@link #createForSubscriptionId(int)} instead. + * Only visible for testing, use {@link ImsManager#getImsMmTelManager(int)} instead. * @hide */ @VisibleForTesting @@ -255,7 +261,7 @@ public class ImsMmTelManager implements RegistrationManager { /** * Registers a {@link RegistrationCallback} with the system, which will provide registration - * updates for the subscription specified in {@link #createForSubscriptionId(int)}. Use + * updates for the subscription specified in {@link ImsManager#getImsMmTelManager(int)}. Use * {@link SubscriptionManager.OnSubscriptionsChangedListener} to listen to Subscription changed * events and call {@link #unregisterImsRegistrationCallback(RegistrationCallback)} to clean up. * @@ -453,7 +459,7 @@ public class ImsMmTelManager implements RegistrationManager { /** * Registers a {@link CapabilityCallback} with the system, which will provide MmTel service * availability updates for the subscription specified in - * {@link #createForSubscriptionId(int)}. The method {@see #isAvailable(int, int)} + * {@link ImsManager#getImsMmTelManager(int)}. The method {@see #isAvailable(int, int)} * can also be used to query this information at any time. * * Use {@link SubscriptionManager.OnSubscriptionsChangedListener} to listen to diff --git a/telephony/java/android/telephony/ims/ImsService.java b/telephony/java/android/telephony/ims/ImsService.java index 62bc2ae44573..2b3072eefe2e 100644 --- a/telephony/java/android/telephony/ims/ImsService.java +++ b/telephony/java/android/telephony/ims/ImsService.java @@ -60,9 +60,10 @@ import com.android.internal.annotations.VisibleForTesting; * The telephony framework will then bind to the ImsService you have defined in your manifest * if you are either: * 1) Defined as the default ImsService for the device in the device overlay using - * "config_ims_package". + * "config_ims_mmtel_package" or "config_ims_rcs_package". * 2) Defined as a Carrier Provided ImsService in the Carrier Configuration using - * {@link CarrierConfigManager#KEY_CONFIG_IMS_PACKAGE_OVERRIDE_STRING}. + * {@link CarrierConfigManager#KEY_CONFIG_IMS_MMTEL_PACKAGE_OVERRIDE_STRING} or + * {@link CarrierConfigManager#KEY_CONFIG_IMS_RCS_PACKAGE_OVERRIDE_STRING}. * * There are two ways to define to the platform which {@link ImsFeature}s this {@link ImsService} * supports, dynamic or static definitions. diff --git a/telephony/java/android/telephony/ims/ImsSsData.java b/telephony/java/android/telephony/ims/ImsSsData.java index 2d2e63812fad..70bf0c57366d 100644 --- a/telephony/java/android/telephony/ims/ImsSsData.java +++ b/telephony/java/android/telephony/ims/ImsSsData.java @@ -22,6 +22,7 @@ import android.annotation.SystemApi; import android.annotation.TestApi; import android.os.Parcel; import android.os.Parcelable; + import com.android.telephony.Rlog; import java.lang.annotation.Retention; 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/RcsContactUceCapability.java b/telephony/java/android/telephony/ims/RcsContactUceCapability.java index 3e2903fa6f47..57b9b7a30f8c 100644 --- a/telephony/java/android/telephony/ims/RcsContactUceCapability.java +++ b/telephony/java/android/telephony/ims/RcsContactUceCapability.java @@ -16,10 +16,11 @@ package android.telephony.ims; -import android.annotation.IntDef; +import android.annotation.LongDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; +import android.annotation.TestApi; import android.net.Uri; import android.os.Parcel; import android.os.Parcelable; @@ -37,6 +38,7 @@ import java.util.Map; * @hide */ @SystemApi +@TestApi public final class RcsContactUceCapability implements Parcelable { /** Supports 1-to-1 chat */ @@ -99,11 +101,16 @@ public final class RcsContactUceCapability implements Parcelable { public static final int CAPABILITY_CHAT_BOT_ROLE = (1 << 27); /** Supports the unidirectional plug-ins framework. */ public static final int CAPABILITY_PLUG_IN = (1 << 28); + /** Supports standalone Chatbot communication. */ + public static final int CAPABILITY_STANDALONE_CHAT_BOT = (1 << 29); + /** Supports MMTEL based call composer. */ + public static final int CAPABILITY_MMTEL_CALL_COMPOSER = (1 << 30); + /** @hide*/ @Retention(RetentionPolicy.SOURCE) - @IntDef(prefix = "CAPABILITY_", flag = true, value = { + @LongDef(prefix = "CAPABILITY_", flag = true, value = { CAPABILITY_CHAT_STANDALONE, CAPABILITY_CHAT_SESSION, CAPABILITY_CHAT_SESSION_STORE_FORWARD, @@ -132,7 +139,9 @@ public final class RcsContactUceCapability implements Parcelable { CAPABILITY_SHARED_SKETCH, CAPABILITY_CHAT_BOT, CAPABILITY_CHAT_BOT_ROLE, - CAPABILITY_PLUG_IN + CAPABILITY_PLUG_IN, + CAPABILITY_STANDALONE_CHAT_BOT, + CAPABILITY_MMTEL_CALL_COMPOSER }) public @interface CapabilityFlag {} @@ -159,11 +168,11 @@ public final class RcsContactUceCapability implements Parcelable { * @param type The capability to map to a service URI that is different from the contact's * URI. */ - public @NonNull Builder add(@CapabilityFlag int type, @NonNull Uri serviceUri) { + public @NonNull Builder add(@CapabilityFlag long type, @NonNull Uri serviceUri) { mCapabilities.mCapabilities |= type; // Put each of these capabilities into the map separately. - for (int shift = 0; shift < Integer.SIZE; shift++) { - int cap = type & (1 << shift); + for (long shift = 0; shift < Integer.SIZE; shift++) { + long cap = type & (1 << shift); if (cap != 0) { mCapabilities.mServiceMap.put(cap, serviceUri); // remove that capability from the field. @@ -181,7 +190,7 @@ public final class RcsContactUceCapability implements Parcelable { * Add a UCE capability flag that this contact supports. * @param type the capability that the contact supports. */ - public @NonNull Builder add(@CapabilityFlag int type) { + public @NonNull Builder add(@CapabilityFlag long type) { mCapabilities.mCapabilities |= type; return this; } @@ -207,7 +216,7 @@ public final class RcsContactUceCapability implements Parcelable { private final Uri mContactUri; private long mCapabilities; private List<String> mExtensionTags = new ArrayList<>(); - private Map<Integer, Uri> mServiceMap = new HashMap<>(); + private Map<Long, Uri> mServiceMap = new HashMap<>(); /** * Use {@link Builder} to build an instance of this interface. @@ -225,7 +234,7 @@ public final class RcsContactUceCapability implements Parcelable { // read mServiceMap as key,value pair int mapSize = in.readInt(); for (int i = 0; i < mapSize; i++) { - mServiceMap.put(in.readInt(), in.readParcelable(Uri.class.getClassLoader())); + mServiceMap.put(in.readLong(), in.readParcelable(Uri.class.getClassLoader())); } } @@ -250,8 +259,8 @@ public final class RcsContactUceCapability implements Parcelable { // write mServiceMap as key,value pairs int mapSize = mServiceMap.keySet().size(); out.writeInt(mapSize); - for (int key : mServiceMap.keySet()) { - out.writeInt(key); + for (long key : mServiceMap.keySet()) { + out.writeLong(key); out.writeParcelable(mServiceMap.get(key), 0); } } @@ -266,7 +275,7 @@ public final class RcsContactUceCapability implements Parcelable { * @param type The capability flag to query. * @return true if the capability flag specified is set, false otherwise. */ - public boolean isCapable(@CapabilityFlag int type) { + public boolean isCapable(@CapabilityFlag long type) { return (mCapabilities & type) > 0; } @@ -290,13 +299,13 @@ public final class RcsContactUceCapability implements Parcelable { * <p> * This will typically be the contact {@link Uri} available via {@link #getContactUri()} unless * a different service {@link Uri} was associated with this capability using - * {@link Builder#add(int, Uri)}. + * {@link Builder#add(long, Uri)}. * * @return a String containing the {@link Uri} associated with the service tag or * {@code null} if this capability is not set as capable. - * @see #isCapable(int) + * @see #isCapable(long) */ - public @Nullable Uri getServiceUri(@CapabilityFlag int type) { + public @Nullable Uri getServiceUri(@CapabilityFlag long type) { Uri result = mServiceMap.getOrDefault(type, null); // If the capability is capable, but does not have a service URI associated, use the default // contact URI. diff --git a/telephony/java/android/telephony/ims/RcsControllerCall.java b/telephony/java/android/telephony/ims/RcsControllerCall.java deleted file mode 100644 index 1e93437a5a94..000000000000 --- a/telephony/java/android/telephony/ims/RcsControllerCall.java +++ /dev/null @@ -1,69 +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.telephony.TelephonyFrameworkInitializer; -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( - TelephonyFrameworkInitializer - .getTelephonyServiceManager() - .getTelephonyRcsMessageServiceRegisterer() - .get()); - 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.aidl b/telephony/java/android/telephony/ims/RcsEventQueryParams.aidl deleted file mode 100644 index f18c4dfd2dcd..000000000000 --- a/telephony/java/android/telephony/ims/RcsEventQueryParams.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 RcsEventQueryParams; 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.aidl b/telephony/java/android/telephony/ims/RcsEventQueryResultDescriptor.aidl deleted file mode 100644 index 0beaaab4f639..000000000000 --- a/telephony/java/android/telephony/ims/RcsEventQueryResultDescriptor.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 RcsEventQueryResultDescriptor; 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 2e3f59a13670..72a00ce052da 100644 --- a/telephony/java/android/telephony/ims/RcsUceAdapter.java +++ b/telephony/java/android/telephony/ims/RcsUceAdapter.java @@ -21,6 +21,8 @@ import android.annotation.CallbackExecutor; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.RequiresPermission; +import android.annotation.SystemApi; +import android.annotation.TestApi; import android.net.Uri; import android.os.Binder; import android.os.IBinder; @@ -28,6 +30,7 @@ import android.os.RemoteException; import android.telephony.TelephonyFrameworkInitializer; import android.telephony.ims.aidl.IImsRcsController; import android.telephony.ims.aidl.IRcsUceControllerCallback; +import android.telephony.ims.feature.RcsFeature; import android.util.Log; import java.lang.annotation.Retention; @@ -41,6 +44,8 @@ import java.util.concurrent.Executor; * @see ImsRcsManager#getUceAdapter() for information on creating an instance of this class. * @hide */ +@SystemApi +@TestApi public class RcsUceAdapter { private static final String TAG = "RcsUceAdapter"; @@ -196,6 +201,7 @@ public class RcsUceAdapter { /** * Not to be instantiated directly, use * {@link ImsRcsManager#getUceAdapter()} to instantiate this manager class. + * @hide */ RcsUceAdapter(int subId) { mSubId = subId; @@ -221,7 +227,7 @@ public class RcsUceAdapter { * becomes inactive. See {@link ImsException#getCode()} for more information on the error codes. */ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) - public void requestCapabilities(@CallbackExecutor Executor executor, + public void requestCapabilities(@NonNull @CallbackExecutor Executor executor, @NonNull List<Uri> contactNumbers, @NonNull CapabilitiesCallback c) throws ImsException { if (c == null) { @@ -305,7 +311,7 @@ public class RcsUceAdapter { * for the associated subscription. * * @return true if the user’s setting for UCE is enabled, false otherwise. If false, - * {@link ImsRcsManager#isCapable(int)} will return false for + * {@link ImsRcsManager#isCapable(int, int)} will return false for * {@link RcsFeature.RcsImsCapabilities#CAPABILITY_TYPE_OPTIONS_UCE} and * {@link RcsFeature.RcsImsCapabilities#CAPABILITY_TYPE_PRESENCE_UCE} * @see #setUceSettingEnabled(boolean) 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/feature/MmTelFeature.java b/telephony/java/android/telephony/ims/feature/MmTelFeature.java index 0d5a979e5894..7ff8735d7b73 100644 --- a/telephony/java/android/telephony/ims/feature/MmTelFeature.java +++ b/telephony/java/android/telephony/ims/feature/MmTelFeature.java @@ -259,10 +259,7 @@ public class MmTelFeature extends ImsFeature { super(capabilities); } - /** - * @hide - */ - @SystemApi @TestApi + /** @hide */ @IntDef(flag = true, value = { CAPABILITY_TYPE_VOICE, @@ -325,7 +322,6 @@ public class MmTelFeature extends ImsFeature { */ @NonNull @Override - @SystemApi @TestApi public String toString() { StringBuilder builder = new StringBuilder("MmTel Capabilities - ["); builder.append("Voice: "); @@ -397,10 +393,7 @@ public class MmTelFeature extends ImsFeature { @SystemApi @TestApi public static final int PROCESS_CALL_CSFB = 1; - /** - * @hide - */ - @SystemApi @TestApi + /** @hide */ @IntDef(flag = true, value = { PROCESS_CALL_IMS, @@ -514,7 +507,7 @@ public class MmTelFeature extends ImsFeature { * @param callProfile The {@link ImsCallProfile} IMS call profile with details. * This can be null if no call information is available for the rejected call. * @param reason The {@link ImsReasonInfo} call rejection reason. - * * @hide + * @hide */ @SystemApi @TestApi public final void notifyRejectedCall(@NonNull ImsCallProfile callProfile, diff --git a/telephony/java/android/telephony/ims/feature/RcsFeature.java b/telephony/java/android/telephony/ims/feature/RcsFeature.java index 884a0bc7c06e..8e67621b2ea3 100644 --- a/telephony/java/android/telephony/ims/feature/RcsFeature.java +++ b/telephony/java/android/telephony/ims/feature/RcsFeature.java @@ -349,9 +349,8 @@ public class RcsFeature extends ImsFeature { * * @return An instance of {@link RcsSipOptionsImplBase} that implements SIP options exchange if * it is supported by the device. - * @hide */ - public RcsSipOptionsImplBase getOptionsExchangeImpl() { + public @NonNull RcsSipOptionsImplBase getOptionsExchangeImpl() { // Base Implementation, override to implement functionality return new RcsSipOptionsImplBase(); } @@ -365,9 +364,8 @@ public class RcsFeature extends ImsFeature { * * @return An instance of {@link RcsPresenceExchangeImplBase} that implements presence * exchange if it is supported by the device. - * @hide */ - public RcsPresenceExchangeImplBase getPresenceExchangeImpl() { + public @NonNull RcsPresenceExchangeImplBase getPresenceExchangeImpl() { // Base Implementation, override to implement functionality. return new RcsPresenceExchangeImplBase(); } diff --git a/telephony/java/android/telephony/ims/stub/ImsCallSessionImplBase.java b/telephony/java/android/telephony/ims/stub/ImsCallSessionImplBase.java index f4367da4a4dc..e8f69ea64a22 100644 --- a/telephony/java/android/telephony/ims/stub/ImsCallSessionImplBase.java +++ b/telephony/java/android/telephony/ims/stub/ImsCallSessionImplBase.java @@ -410,6 +410,13 @@ public class ImsCallSessionImplBase implements AutoCloseable { * Rejects an incoming call or session update. * * @param reason reason code to reject an incoming call, defined in {@link ImsReasonInfo}. + * The {@link android.telecom.InCallService} (dialer app) can use the + * {@link android.telecom.Call#reject(int)} API to reject a call while specifying + * a user-indicated reason for rejecting the call. + * Normal call declines ({@link android.telecom.Call#REJECT_REASON_DECLINED}) will + * map to {@link ImsReasonInfo#CODE_USER_DECLINE}. + * Unwanted calls ({@link android.telecom.Call#REJECT_REASON_UNWANTED}) will map + * to {@link ImsReasonInfo#CODE_SIP_USER_MARKED_UNWANTED}. * {@link ImsCallSession.Listener#callSessionStartFailed} */ public void reject(int reason) { diff --git a/telephony/java/android/telephony/ims/stub/ImsUtImplBase.java b/telephony/java/android/telephony/ims/stub/ImsUtImplBase.java index 4120dc892033..822961ee90f1 100644 --- a/telephony/java/android/telephony/ims/stub/ImsUtImplBase.java +++ b/telephony/java/android/telephony/ims/stub/ImsUtImplBase.java @@ -17,6 +17,8 @@ package android.telephony.ims.stub; import android.annotation.IntDef; +import android.annotation.NonNull; +import android.annotation.Nullable; import android.annotation.SystemApi; import android.annotation.TestApi; import android.os.Bundle; @@ -212,6 +214,13 @@ public class ImsUtImplBase { return ImsUtImplBase.this.updateCallBarringForServiceClass( cbType, action, barrList, serviceClass); } + + @Override + public int updateCallBarringWithPassword(int cbType, int action, String[] barrList, + int serviceClass, String password) throws RemoteException { + return ImsUtImplBase.this.updateCallBarringWithPassword( + cbType, action, barrList, serviceClass, password); + } }; /** @@ -342,6 +351,14 @@ public class ImsUtImplBase { } /** + * Updates the configuration of the call barring for specified service class with password. + */ + public int updateCallBarringWithPassword(int cbType, int action, @Nullable String[] barrList, + int serviceClass, @NonNull String password) { + return -1; + } + + /** * Updates the configuration of the call forward. */ public int updateCallForward(int action, int condition, String number, int serviceClass, diff --git a/telephony/java/android/telephony/ims/stub/RcsCapabilityExchange.java b/telephony/java/android/telephony/ims/stub/RcsCapabilityExchange.java index fda295a27111..a24af2f74e27 100644 --- a/telephony/java/android/telephony/ims/stub/RcsCapabilityExchange.java +++ b/telephony/java/android/telephony/ims/stub/RcsCapabilityExchange.java @@ -17,6 +17,8 @@ package android.telephony.ims.stub; import android.annotation.IntDef; +import android.annotation.SystemApi; +import android.annotation.TestApi; import android.os.RemoteException; import android.telephony.ims.ImsException; import android.telephony.ims.aidl.IRcsFeatureListener; @@ -32,6 +34,8 @@ import java.lang.annotation.RetentionPolicy; * * @hide */ +@SystemApi +@TestApi public class RcsCapabilityExchange { /** Service is unknown. */ diff --git a/telephony/java/android/telephony/ims/stub/RcsPresenceExchangeImplBase.java b/telephony/java/android/telephony/ims/stub/RcsPresenceExchangeImplBase.java index bb034489a296..f200ea2af2bc 100644 --- a/telephony/java/android/telephony/ims/stub/RcsPresenceExchangeImplBase.java +++ b/telephony/java/android/telephony/ims/stub/RcsPresenceExchangeImplBase.java @@ -18,6 +18,8 @@ package android.telephony.ims.stub; import android.annotation.IntDef; import android.annotation.NonNull; +import android.annotation.SystemApi; +import android.annotation.TestApi; import android.net.Uri; import android.os.RemoteException; import android.telephony.ims.ImsException; @@ -37,6 +39,8 @@ import java.util.List; * * @hide */ +@SystemApi +@TestApi public class RcsPresenceExchangeImplBase extends RcsCapabilityExchange { private static final String LOG_TAG = "RcsPresenceExchangeIB"; diff --git a/telephony/java/android/telephony/ims/stub/RcsSipOptionsImplBase.java b/telephony/java/android/telephony/ims/stub/RcsSipOptionsImplBase.java index 1c68fc08529e..355c4dde75d8 100644 --- a/telephony/java/android/telephony/ims/stub/RcsSipOptionsImplBase.java +++ b/telephony/java/android/telephony/ims/stub/RcsSipOptionsImplBase.java @@ -19,6 +19,8 @@ package android.telephony.ims.stub; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; +import android.annotation.SystemApi; +import android.annotation.TestApi; import android.net.Uri; import android.os.RemoteException; import android.telephony.ims.ImsException; @@ -35,6 +37,8 @@ import java.lang.annotation.RetentionPolicy; * * @hide */ +@SystemApi +@TestApi public class RcsSipOptionsImplBase extends RcsCapabilityExchange { private static final String LOG_TAG = "RcsSipOptionsImplBase"; @@ -69,6 +73,11 @@ public class RcsSipOptionsImplBase extends RcsCapabilityExchange { */ public static final int RESPONSE_DOES_NOT_EXIST_ANYWHERE = 4; + /** + * Indicates that the remote user responded with a 400 BAD REQUEST response. + */ + public static final int RESPONSE_BAD_REQUEST = 5; + /** @hide*/ @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = "RESPONSE_", value = { @@ -77,7 +86,8 @@ public class RcsSipOptionsImplBase extends RcsCapabilityExchange { RESPONSE_TEMPORARILY_UNAVAILABLE, RESPONSE_REQUEST_TIMEOUT, RESPONSE_NOT_FOUND, - RESPONSE_DOES_NOT_EXIST_ANYWHERE + RESPONSE_DOES_NOT_EXIST_ANYWHERE, + RESPONSE_BAD_REQUEST }) public @interface SipResponseCode {} @@ -188,7 +198,6 @@ public class RcsSipOptionsImplBase extends RcsCapabilityExchange { * @param reason A non-null String containing the reason associated with the SIP code. * @param operationToken The token provided by the framework when * {@link #onRemoteCapabilityRequest(Uri, RcsContactUceCapability, int)} was called. - * */ public void respondToCapabilityRequestWithError(@NonNull Uri contactUri, @SipResponseCode int code, @NonNull String reason, int operationToken) { diff --git a/telephony/java/com/android/ims/ImsConfig.java b/telephony/java/com/android/ims/ImsConfig.java index a3e8484e6276..e9751b88ede9 100644 --- a/telephony/java/com/android/ims/ImsConfig.java +++ b/telephony/java/com/android/ims/ImsConfig.java @@ -19,13 +19,13 @@ package com.android.ims; import android.os.Handler; import android.os.Looper; import android.os.RemoteException; -import com.android.telephony.Rlog; import android.telephony.ims.ImsReasonInfo; import android.telephony.ims.ProvisioningManager; import android.telephony.ims.aidl.IImsConfig; import android.telephony.ims.aidl.IImsConfigCallback; import com.android.internal.telephony.util.HandlerExecutor; +import com.android.telephony.Rlog; import java.util.concurrent.Executor; diff --git a/telephony/java/com/android/ims/ImsUtInterface.java b/telephony/java/com/android/ims/ImsUtInterface.java index c565348445c9..a101cbe0f3b2 100644 --- a/telephony/java/com/android/ims/ImsUtInterface.java +++ b/telephony/java/com/android/ims/ImsUtInterface.java @@ -172,6 +172,12 @@ public interface ImsUtInterface { String[] barrList, int serviceClass); /** + * Modifies the configuration of the call barring for specified service class with password. + */ + public void updateCallBarring(int cbType, int action, Message result, + String[] barrList, int serviceClass, String password); + + /** * Modifies the configuration of the call forward. */ public void updateCallForward(int action, int condition, String number, diff --git a/telephony/java/com/android/ims/internal/IImsUt.aidl b/telephony/java/com/android/ims/internal/IImsUt.aidl index ca10b2d1a345..51729b78b0b8 100644 --- a/telephony/java/com/android/ims/internal/IImsUt.aidl +++ b/telephony/java/com/android/ims/internal/IImsUt.aidl @@ -124,6 +124,12 @@ interface IImsUt { int serviceClass); /** + * Updates the configuration of the call barring for specified service class with password. + */ + int updateCallBarringWithPassword(int cbType, int action, in String[] barrList, + int serviceClass, String password); + + /** * Retrieves the configuration of the call forward for specified service class. * Returns an integer value to indicate the requestId of the UT request. * -1 is returned if the "condition" is invalid for the queryCallForward, diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 0bc6640a8331..beb3c8cac41e 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -29,6 +29,7 @@ import android.net.Uri; import android.service.carrier.CarrierIdentifier; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; +import android.telephony.CallForwardingInfo; import android.telephony.CarrierRestrictionRules; import android.telephony.CellIdentity; import android.telephony.CellInfo; @@ -831,6 +832,11 @@ interface ITelephony { void disableIms(int slotId); /** + * Toggle framework IMS disables and enables. + */ + void resetIms(int slotIndex); + + /** * Get IImsMmTelFeature binder from ImsResolver that corresponds to the subId and MMTel feature * as well as registering the MmTelFeature for callbacks using the IImsServiceFeatureCallback * interface. @@ -1628,6 +1634,79 @@ interface ITelephony { NetworkStats getVtDataUsage(int subId, boolean perUidStats); /** + * Gets the voice call forwarding info {@link CallForwardingInfo}, given the call forward + * reason. + * + * @param callForwardingReason the call forwarding reasons which are the bitwise-OR combination + * of the following constants: + * <ol> + * <li>{@link CallForwardingInfo#REASON_BUSY} </li> + * <li>{@link CallForwardingInfo#REASON_NO_REPLY} </li> + * <li>{@link CallForwardingInfo#REASON_NOT_REACHABLE} </li> + * </ol> + * + * @throws IllegalArgumentException if callForwardingReason is not a bitwise-OR combination + * of {@link CallForwardingInfo.REASON_BUSY}, {@link CallForwardingInfo.REASON_BUSY}, + * {@link CallForwardingInfo.REASON_NOT_REACHABLE} + * + * @return {@link CallForwardingInfo} with the status {@link CallForwardingInfo#STATUS_ACTIVE} + * or {@link CallForwardingInfo#STATUS_INACTIVE} and the target phone number to forward calls + * to, if it's available. Otherwise, it will return a {@link CallForwardingInfo} with status + * {@link CallForwardingInfo#STATUS_NOT_SUPPORTED} or + * {@link CallForwardingInfo#STATUS_FDN_CHECK_FAILURE} depending on the situation. + * + * @hide + */ + CallForwardingInfo getCallForwarding(int subId, int callForwardingReason); + + /** + * Sets the voice call forwarding info including status (enable/disable), call forwarding + * reason, the number to forward, and the timeout before the forwarding is attempted. + * + * @param callForwardingInfo {@link CallForwardingInfo} to setup the call forwarding. + * Enabling if {@link CallForwardingInfo#getStatus()} returns + * {@link CallForwardingInfo#STATUS_ACTIVE}; Disabling if + * {@link CallForwardingInfo#getStatus()} returns {@link CallForwardingInfo#STATUS_INACTIVE}. + * + * @throws IllegalArgumentException if any of the following: + * 0) callForwardingInfo is null. + * 1) {@link CallForwardingInfo#getStatus()} for callForwardingInfo returns neither + * {@link CallForwardingInfo#STATUS_ACTIVE} nor {@link CallForwardingInfo#STATUS_INACTIVE}. + * 2) {@link CallForwardingInfo#getReason()} for callForwardingInfo doesn't return the + * bitwise-OR combination of {@link CallForwardingInfo.REASON_BUSY}, + * {@link CallForwardingInfo.REASON_BUSY}, {@link CallForwardingInfo.REASON_NOT_REACHABLE} + * 3) {@link CallForwardingInfo#getNumber()} for callForwardingInfo returns null. + * 4) {@link CallForwardingInfo#getTimeout()} for callForwardingInfo returns nagetive value. + * + * @return {@code true} to indicate it was set successfully; {@code false} otherwise. + * + * @hide + */ + boolean setCallForwarding(int subId, in CallForwardingInfo callForwardingInfo); + + /** + * 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. + * + * @return the status of call waiting function. + * @hide + */ + int getCallWaitingStatus(int subId); + + /** + * Sets the status for 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. + * + * @param isEnable {@code true} to enable; {@code false} to disable. + * @return {@code true} to indicate it was set successfully; {@code false} otherwise. + * + * @hide + */ + boolean setCallWaitingStatus(int subId, boolean isEnable); + + /** * Policy control of data connection. Usually used when data limit is passed. * @param enabled True if enabling the data, otherwise disabling. * @param subId Subscription index @@ -2197,4 +2276,13 @@ interface ITelephony { * This is safe to call from any thread, with any window manager locks held or not. */ oneway void userActivity(); + + /** + * Get the user manual network selection. + * Return empty string if in automatic selection. + * + * @param subId the id of the subscription + * @return operatorinfo on success + */ + String getManualNetworkSelectionPlmn(int subId); } diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java index 0db86d6054b3..9ac8cb136c6b 100644 --- a/telephony/java/com/android/internal/telephony/RILConstants.java +++ b/telephony/java/com/android/internal/telephony/RILConstants.java @@ -480,6 +480,7 @@ public interface RILConstants { int RIL_REQUEST_STOP_KEEPALIVE = 145; int RIL_REQUEST_ENABLE_MODEM = 146; int RIL_REQUEST_GET_MODEM_STATUS = 147; + int RIL_REQUEST_CDMA_SEND_SMS_EXPECT_MORE = 148; /* The following requests are not defined in RIL.h */ int RIL_REQUEST_HAL_NON_RIL_BASE = 200; diff --git a/telephony/java/com/android/internal/telephony/Sms7BitEncodingTranslator.java b/telephony/java/com/android/internal/telephony/Sms7BitEncodingTranslator.java index 8e86ff788a08..3bd8cdd23df3 100644 --- a/telephony/java/com/android/internal/telephony/Sms7BitEncodingTranslator.java +++ b/telephony/java/com/android/internal/telephony/Sms7BitEncodingTranslator.java @@ -19,12 +19,12 @@ package com.android.internal.telephony; import android.compat.annotation.UnsupportedAppUsage; import android.content.res.Resources; import android.content.res.XmlResourceParser; -import com.android.telephony.Rlog; import android.util.SparseIntArray; import com.android.internal.telephony.cdma.sms.UserData; import com.android.internal.telephony.util.TelephonyUtils; import com.android.internal.telephony.util.XmlUtils; +import com.android.telephony.Rlog; public class Sms7BitEncodingTranslator { private static final String TAG = "Sms7BitEncodingTranslator"; diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java index 45f1b8542a6f..999406f29ad8 100644 --- a/telephony/java/com/android/internal/telephony/TelephonyIntents.java +++ b/telephony/java/com/android/internal/telephony/TelephonyIntents.java @@ -212,37 +212,6 @@ public class TelephonyIntents { public static final String SECRET_CODE_ACTION = "android.provider.Telephony.SECRET_CODE"; /** - * Broadcast Action: The Service Provider string(s) have been updated. Activities or - * services that use these strings should update their display. - * The intent will have the following extra values:</p> - * - * <dl> - * <dt>showPlmn</dt><dd>Boolean that indicates whether the PLMN should be shown.</dd> - * <dt>plmn</dt><dd>The operator name of the registered network, as a string.</dd> - * <dt>showSpn</dt><dd>Boolean that indicates whether the SPN should be shown.</dd> - * <dt>spn</dt><dd>The service provider name, as a string.</dd> - * </dl> - * - * Note that <em>showPlmn</em> may indicate that <em>plmn</em> should be displayed, even - * though the value for <em>plmn</em> is null. This can happen, for example, if the phone - * has not registered to a network yet. In this case the receiver may substitute an - * appropriate placeholder string (eg, "No service"). - * - * It is recommended to display <em>plmn</em> before / above <em>spn</em> if - * both are displayed. - * - * <p>Note: this is a protected intent that can only be sent by the system. - */ - public static final String SPN_STRINGS_UPDATED_ACTION = - "android.provider.Telephony.SPN_STRINGS_UPDATED"; - - public static final String EXTRA_SHOW_PLMN = "showPlmn"; - public static final String EXTRA_PLMN = "plmn"; - public static final String EXTRA_SHOW_SPN = "showSpn"; - public static final String EXTRA_SPN = "spn"; - public static final String EXTRA_DATA_SPN = "spnData"; - - /** * <p>Broadcast Action: It indicates one column of a subinfo record has been changed * <p class="note">This is a protected intent that can only be sent * by the system. @@ -348,18 +317,10 @@ public class TelephonyIntents { "com.android.internal.telephony.ACTION_LINE1_NUMBER_ERROR_DETECTED"; /** - * Broadcast action to notify radio bug. - * - * Requires the READ_PRIVILEGED_PHONE_STATE permission. - * - * @hide + * Broadcast sent when a user activity is detected. */ - public static final String ACTION_REPORT_RADIO_BUG = - "com.android.internal.telephony.ACTION_REPORT_RADIO_BUG"; - - // ACTION_REPORT_RADIO_BUG extra keys - public static final String EXTRA_SLOT_ID = "slotId"; - public static final String EXTRA_RADIO_BUG_TYPE = "radioBugType"; + public static final String ACTION_USER_ACTIVITY_NOTIFICATION = + "android.intent.action.USER_ACTIVITY_NOTIFICATION"; /** * Used when Presence app sends Dial intent with specific schema diff --git a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java index d0c8024c56fe..6ed0be24a0f1 100755 --- a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java +++ b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java @@ -20,7 +20,6 @@ import android.compat.annotation.UnsupportedAppUsage; import android.content.res.Resources; import android.sysprop.TelephonyProperties; import android.telephony.PhoneNumberUtils; -import com.android.telephony.Rlog; import android.telephony.SmsCbLocation; import android.telephony.SmsCbMessage; import android.telephony.cdma.CdmaSmsCbProgramData; @@ -41,6 +40,7 @@ import com.android.internal.telephony.cdma.sms.UserData; import com.android.internal.telephony.uicc.IccUtils; import com.android.internal.util.BitwiseInputStream; import com.android.internal.util.HexDump; +import com.android.telephony.Rlog; import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; diff --git a/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java b/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java index 6ad6dd119f50..6dc1e0e2c8e4 100644 --- a/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java +++ b/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java @@ -18,7 +18,6 @@ package com.android.internal.telephony.cdma.sms; import android.compat.annotation.UnsupportedAppUsage; import android.content.res.Resources; -import com.android.telephony.Rlog; import android.telephony.SmsCbCmasInfo; import android.telephony.cdma.CdmaSmsCbProgramData; import android.telephony.cdma.CdmaSmsCbProgramResults; @@ -31,6 +30,7 @@ import com.android.internal.telephony.SmsMessageBase; import com.android.internal.telephony.uicc.IccUtils; import com.android.internal.util.BitwiseInputStream; import com.android.internal.util.BitwiseOutputStream; +import com.android.telephony.Rlog; import java.io.ByteArrayOutputStream; import java.time.Instant; diff --git a/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl b/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl index 7422863d862c..35e8a12e898a 100644 --- a/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl +++ b/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl @@ -21,6 +21,7 @@ import android.content.Intent; import android.os.Bundle; import android.telephony.euicc.DownloadableSubscription; import android.telephony.euicc.EuiccInfo; +import java.util.List; /** @hide */ interface IEuiccController { @@ -47,4 +48,7 @@ interface IEuiccController { oneway void eraseSubscriptionsWithOptions( int cardId, int options, in PendingIntent callbackIntent); oneway void retainSubscriptionsForFactoryReset(int cardId, in PendingIntent callbackIntent); + void setSupportedCountries(boolean isSupported, in List<String> countriesList); + List<String> getSupportedCountries(boolean isSupported); + boolean isSupportedCountry(String countryIso); } diff --git a/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java b/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java index c91ea696ec29..08580012ad17 100644 --- a/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java +++ b/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java @@ -28,7 +28,6 @@ import static com.android.internal.telephony.SmsConstants.MessageClass; import android.compat.annotation.UnsupportedAppUsage; import android.content.res.Resources; import android.telephony.PhoneNumberUtils; -import com.android.telephony.Rlog; import android.text.TextUtils; import com.android.internal.telephony.EncodeException; @@ -38,6 +37,7 @@ import com.android.internal.telephony.Sms7BitEncodingTranslator; import com.android.internal.telephony.SmsHeader; import com.android.internal.telephony.SmsMessageBase; import com.android.internal.telephony.uicc.IccUtils; +import com.android.telephony.Rlog; import java.io.ByteArrayOutputStream; import java.io.UnsupportedEncodingException; diff --git a/telephony/java/com/android/internal/telephony/uicc/IccUtils.java b/telephony/java/com/android/internal/telephony/uicc/IccUtils.java index 8e61a3d93d3a..81a43cf559fc 100644 --- a/telephony/java/com/android/internal/telephony/uicc/IccUtils.java +++ b/telephony/java/com/android/internal/telephony/uicc/IccUtils.java @@ -21,11 +21,11 @@ import android.content.res.Resources; import android.content.res.Resources.NotFoundException; import android.graphics.Bitmap; import android.graphics.Color; -import com.android.telephony.Rlog; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.EncodeException; import com.android.internal.telephony.GsmAlphabet; +import com.android.telephony.Rlog; import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; |