diff --git a/core/api/current.txt b/core/api/current.txt index 04207145673fa..60fa2ffd1693e 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -43102,18 +43102,11 @@ package android.telephony.data { public final class TrafficDescriptor implements android.os.Parcelable { method public int describeContents(); method @Nullable public String getDataNetworkName(); - method @Nullable public String getOsAppId(); + method @Nullable public byte[] getOsAppId(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator CREATOR; } - public static final class TrafficDescriptor.Builder { - ctor public TrafficDescriptor.Builder(); - method @NonNull public android.telephony.data.TrafficDescriptor build(); - method @NonNull public android.telephony.data.TrafficDescriptor.Builder setDataNetworkName(@NonNull String); - method @NonNull public android.telephony.data.TrafficDescriptor.Builder setOsAppId(@NonNull String); - } - public final class UrspRule implements android.os.Parcelable { method public int describeContents(); method @IntRange(from=0x0, to=0xff) public int getPrecedence(); diff --git a/telephony/java/android/telephony/data/TrafficDescriptor.java b/telephony/java/android/telephony/data/TrafficDescriptor.java index d813bc58fe6f4..f400a5e39704b 100644 --- a/telephony/java/android/telephony/data/TrafficDescriptor.java +++ b/telephony/java/android/telephony/data/TrafficDescriptor.java @@ -21,6 +21,7 @@ import android.annotation.Nullable; import android.os.Parcel; import android.os.Parcelable; +import java.util.Arrays; import java.util.Objects; /** @@ -31,11 +32,11 @@ import java.util.Objects; */ public final class TrafficDescriptor implements Parcelable { private final String mDnn; - private final String mOsAppId; + private final byte[] mOsAppId; private TrafficDescriptor(@NonNull Parcel in) { mDnn = in.readString(); - mOsAppId = in.readString(); + mOsAppId = in.createByteArray(); } /** @@ -45,14 +46,15 @@ public final class TrafficDescriptor implements Parcelable { * * @hide */ - public TrafficDescriptor(String dnn, String osAppId) { + public TrafficDescriptor(String dnn, byte[] osAppId) { mDnn = dnn; mOsAppId = osAppId; } /** * DNN stands for Data Network Name and represents an APN as defined in 3GPP TS 23.003. - * @return the DNN of this traffic descriptor. + * @return the DNN of this traffic descriptor if one is included by the network, null + * otherwise. */ public @Nullable String getDataNetworkName() { return mDnn; @@ -60,10 +62,11 @@ public final class TrafficDescriptor implements Parcelable { /** * OsAppId is the app id as defined in 3GPP TS 24.526 Section 5.2, and it identifies a traffic - * category. - * @return the OS App ID of this traffic descriptor. + * category. It includes the OS Id component of the field as defined in the specs. + * @return the OS App ID of this traffic descriptor if one is included by the network, null + * otherwise. */ - public @Nullable String getOsAppId() { + public @Nullable byte[] getOsAppId() { return mOsAppId; } @@ -80,7 +83,7 @@ public final class TrafficDescriptor implements Parcelable { @Override public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeString(mDnn); - dest.writeString(mOsAppId); + dest.writeByteArray(mOsAppId); } public static final @NonNull Parcelable.Creator CREATOR = @@ -101,7 +104,7 @@ public final class TrafficDescriptor implements Parcelable { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TrafficDescriptor that = (TrafficDescriptor) o; - return Objects.equals(mDnn, that.mDnn) && Objects.equals(mOsAppId, that.mOsAppId); + return Objects.equals(mDnn, that.mDnn) && Arrays.equals(mOsAppId, that.mOsAppId); } @Override @@ -121,10 +124,12 @@ public final class TrafficDescriptor implements Parcelable { * .setDnn("") * .build(); * + * + * @hide */ public static final class Builder { private String mDnn = null; - private String mOsAppId = null; + private byte[] mOsAppId = null; /** * Default constructor for Builder. @@ -144,12 +149,12 @@ public final class TrafficDescriptor implements Parcelable { } /** - * Set the OS App ID. + * Set the OS App ID (including OS Id as defind in the specs). * * @return The same instance of the builder. */ @NonNull - public Builder setOsAppId(@NonNull String osAppId) { + public Builder setOsAppId(@NonNull byte[] osAppId) { this.mOsAppId = osAppId; return this; } diff --git a/telephony/java/android/telephony/data/UrspRule.java b/telephony/java/android/telephony/data/UrspRule.java index e2c47fd86b4bf..fbe199975b00b 100644 --- a/telephony/java/android/telephony/data/UrspRule.java +++ b/telephony/java/android/telephony/data/UrspRule.java @@ -84,8 +84,8 @@ public final class UrspRule implements Parcelable { android.hardware.radio.V1_6.TrafficDescriptor td) { String dnn = td.dnn.getDiscriminator() == OptionalDnn.hidl_discriminator.noinit ? null : td.dnn.value(); - String osAppId = td.osAppId.getDiscriminator() == OptionalOsAppId.hidl_discriminator.noinit - ? null : new String(arrayListToPrimitiveArray(td.osAppId.value().osAppId)); + byte[] osAppId = td.osAppId.getDiscriminator() == OptionalOsAppId.hidl_discriminator.noinit + ? null : arrayListToPrimitiveArray(td.osAppId.value().osAppId); TrafficDescriptor.Builder builder = new TrafficDescriptor.Builder(); if (dnn != null) { builder.setDataNetworkName(dnn);