[Telephony Mainline] Move carrier id proto to TelephonyProvider
Bug: 144879240
Test: make
Change-Id: Ifaa47037bfc1381d478e4bb643a0601c6963e040
Merged-In: I4f9cf0d7d899fdfe64858d0ca19cbe350516a8fd
diff --git a/Android.bp b/Android.bp
index eabd567..c7ecd27 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,9 +1,9 @@
android_app {
name: "TelephonyProvider",
privileged: true,
- srcs: ["src/**/*.java"],
+ srcs: ["src/**/*.java", "proto/**/*.proto"],
platform_apis: true,
certificate: "platform",
libs: ["telephony-common"],
- static_libs: ["android-common"],
+ static_libs: ["android-common", "telephonyprovider-protos"],
}
diff --git a/proto/Android.bp b/proto/Android.bp
new file mode 100644
index 0000000..4420263
--- /dev/null
+++ b/proto/Android.bp
@@ -0,0 +1,29 @@
+// 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.
+
+java_library_static {
+ name: "telephonyprovider-protos",
+ proto: {
+ type: "nano",
+ output_params: [
+ "store_unknown_fields=true",
+ "enum_style=java",
+ ],
+ },
+ srcs: ["src/**/*.proto"],
+ sdk_version: "core_platform",
+ jarjar_rules: "jarjar-rules.txt",
+ // Pin java_version until jarjar is certified to support later versions. http://b/72703434
+ java_version: "1.8",
+}
diff --git a/proto/jarjar-rules.txt b/proto/jarjar-rules.txt
new file mode 100644
index 0000000..e6275e9
--- /dev/null
+++ b/proto/jarjar-rules.txt
@@ -0,0 +1 @@
+rule com.google.protobuf.nano.** com.android.providers.telephony.protobuf.nano.@1
diff --git a/proto/src/carrierId.proto b/proto/src/carrierId.proto
new file mode 100644
index 0000000..0ba48c1
--- /dev/null
+++ b/proto/src/carrierId.proto
@@ -0,0 +1,91 @@
+//
+// 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.
+//
+
+syntax = "proto2";
+
+package carrierIdentification;
+
+option java_package = "com.android.providers.telephony";
+option java_outer_classname = "CarrierIdProto";
+
+// A complete list of carriers
+message CarrierList {
+ // A collection of carriers. one entry for one carrier.
+ repeated CarrierId carrier_id = 1;
+ // Version number of current carrier list
+ optional int32 version = 2;
+};
+
+// CarrierId is the unique representation of a carrier in CID table.
+message CarrierId {
+ // [Optional] A unique canonical number designated to a carrier.
+ optional int32 canonical_id = 1;
+
+ // [Optional] A user-friendly carrier name (not localized).
+ optional string carrier_name = 2;
+
+ // [Optional] Carrier attributes to match a carrier. At least one value is required.
+ repeated CarrierAttribute carrier_attribute = 3;
+
+ // [Optional] A unique canonical number to represent its parent carrier. The parent-child
+ // relationship can be used to differentiate a single carrier by different networks,
+ // by prepaid v.s. postpaid or even by 4G v.s. 3G plan.
+ optional int32 parent_canonical_id = 4;
+};
+
+// Attributes used to match a carrier.
+// For each field within this message:
+// - if not set, the attribute is ignored;
+// - if set, the device must have one of the specified values to match.
+// Match is based on AND between any field that is set and OR for values within a repeated field.
+message CarrierAttribute {
+ // [Optional] The MCC and MNC that map to this carrier. At least one value is required.
+ repeated string mccmnc_tuple = 1;
+
+ // [Optional] Prefix of IMSI (International Mobile Subscriber Identity) in
+ // decimal format. Some digits can be replaced with "x" symbols matching any digit.
+ // Sample values: 20404794, 21670xx2xxx.
+ repeated string imsi_prefix_xpattern = 2;
+
+ // [Optional] The Service Provider Name. Read from subscription EF_SPN.
+ // Sample values: C Spire, LeclercMobile
+ repeated string spn = 3;
+
+ // [Optional] PLMN network name. Read from subscription EF_PNN.
+ // Sample values:
+ repeated string plmn = 4;
+
+ // [Optional] Group Identifier Level1 for a GSM phone. Read from subscription EF_GID1.
+ // Sample values: 6D, BAE0000000000000
+ repeated string gid1 = 5;
+
+ // [Optional] Group Identifier Level2 for a GSM phone. Read from subscription EF_GID2.
+ // Sample values: 6D, BAE0000000000000
+ repeated string gid2 = 6;
+
+ // [Optional] The Access Point Name, corresponding to "apn" field returned by
+ // "content://telephony/carriers/preferapn" on device.
+ // Sample values: fast.t-mobile.com, internet
+ repeated string preferred_apn = 7;
+
+ // [Optional] Prefix of Integrated Circuit Card Identifier. Read from subscription EF_ICCID.
+ // Sample values: 894430, 894410
+ repeated string iccid_prefix = 8;
+
+ // [Optional] Carrier Privilege Access Rule in hex string.
+ // Sample values: 61ed377e85d386a8dfee6b864bd85b0bfaa5af88
+ repeated string privilege_access_rule = 9;
+};
diff --git a/src/com/android/providers/telephony/CarrierIdProvider.java b/src/com/android/providers/telephony/CarrierIdProvider.java
index 44f053d..97037b8 100644
--- a/src/com/android/providers/telephony/CarrierIdProvider.java
+++ b/src/com/android/providers/telephony/CarrierIdProvider.java
@@ -41,7 +41,7 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.SubscriptionController;
-import com.android.internal.telephony.nano.CarrierIdProto;
+import com.android.providers.telephony.nano.CarrierIdProto;
import java.io.ByteArrayOutputStream;
import java.io.File;