carriersettings-extractor: Modify for usage in AOSP

* We already have all the needed protos, just symlink them

Change-Id: Iebdebcad0cecf3a8baf6a9fcc5590e707aacd585
This commit is contained in:
Chirayu Desai 2021-12-03 14:49:12 +05:30
parent 1805c001a7
commit 052b596895
7 changed files with 48 additions and 146 deletions

View File

@ -1,9 +1,3 @@
apns-full-conf.xml
carrier_list.pb
CarrierSettings/*.pb
tmp*/
vendor.xml
__pycache__/
*.py[cod]
*$py.class

View File

@ -1,4 +1,4 @@
TARGETS := carriersettings_pb2.py vendor/carrierId_pb2.py vendor/carrierId.proto
TARGETS := carriersettings_pb2.py carrierId_pb2.py
.PHONY: all clean
all: $(TARGETS)
@ -7,8 +7,3 @@ clean:
%_pb2.py: %.proto
protoc --python_out=. $<
vendor/carrierId.proto:
wget -qO- \
https://android.googlesource.com/platform/frameworks/opt/telephony/+/refs/heads/master/proto/src/carrierId.proto?format=TEXT | \
base64 --decode > $@

View File

@ -0,0 +1 @@
../../../frameworks/opt/telephony/proto/src/carrierId.proto

View File

@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: vendor/carrierId.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
# source: carrierId.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
@ -15,11 +14,12 @@ _sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='vendor/carrierId.proto',
name='carrierId.proto',
package='carrierIdentification',
syntax='proto2',
serialized_options=_b('\n\036com.android.internal.telephonyB\016CarrierIdProto'),
serialized_pb=_b('\n\x16vendor/carrierId.proto\x12\x15\x63\x61rrierIdentification\"T\n\x0b\x43\x61rrierList\x12\x34\n\ncarrier_id\x18\x01 \x03(\x0b\x32 .carrierIdentification.CarrierId\x12\x0f\n\x07version\x18\x02 \x01(\x05\"\x98\x01\n\tCarrierId\x12\x14\n\x0c\x63\x61nonical_id\x18\x01 \x01(\x05\x12\x14\n\x0c\x63\x61rrier_name\x18\x02 \x01(\t\x12\x42\n\x11\x63\x61rrier_attribute\x18\x03 \x03(\x0b\x32\'.carrierIdentification.CarrierAttribute\x12\x1b\n\x13parent_canonical_id\x18\x04 \x01(\x05\"\xc9\x01\n\x10\x43\x61rrierAttribute\x12\x14\n\x0cmccmnc_tuple\x18\x01 \x03(\t\x12\x1c\n\x14imsi_prefix_xpattern\x18\x02 \x03(\t\x12\x0b\n\x03spn\x18\x03 \x03(\t\x12\x0c\n\x04plmn\x18\x04 \x03(\t\x12\x0c\n\x04gid1\x18\x05 \x03(\t\x12\x0c\n\x04gid2\x18\x06 \x03(\t\x12\x15\n\rpreferred_apn\x18\x07 \x03(\t\x12\x14\n\x0ciccid_prefix\x18\x08 \x03(\t\x12\x1d\n\x15privilege_access_rule\x18\t \x03(\tB0\n\x1e\x63om.android.internal.telephonyB\x0e\x43\x61rrierIdProto')
serialized_options=b'\n\036com.android.internal.telephonyB\016CarrierIdProto',
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\x0f\x63\x61rrierId.proto\x12\x15\x63\x61rrierIdentification\"T\n\x0b\x43\x61rrierList\x12\x34\n\ncarrier_id\x18\x01 \x03(\x0b\x32 .carrierIdentification.CarrierId\x12\x0f\n\x07version\x18\x02 \x01(\x05\"\x98\x01\n\tCarrierId\x12\x14\n\x0c\x63\x61nonical_id\x18\x01 \x01(\x05\x12\x14\n\x0c\x63\x61rrier_name\x18\x02 \x01(\t\x12\x42\n\x11\x63\x61rrier_attribute\x18\x03 \x03(\x0b\x32\'.carrierIdentification.CarrierAttribute\x12\x1b\n\x13parent_canonical_id\x18\x04 \x01(\x05\"\xc9\x01\n\x10\x43\x61rrierAttribute\x12\x14\n\x0cmccmnc_tuple\x18\x01 \x03(\t\x12\x1c\n\x14imsi_prefix_xpattern\x18\x02 \x03(\t\x12\x0b\n\x03spn\x18\x03 \x03(\t\x12\x0c\n\x04plmn\x18\x04 \x03(\t\x12\x0c\n\x04gid1\x18\x05 \x03(\t\x12\x0c\n\x04gid2\x18\x06 \x03(\t\x12\x15\n\rpreferred_apn\x18\x07 \x03(\t\x12\x14\n\x0ciccid_prefix\x18\x08 \x03(\t\x12\x1d\n\x15privilege_access_rule\x18\t \x03(\tB0\n\x1e\x63om.android.internal.telephonyB\x0e\x43\x61rrierIdProto'
)
@ -31,6 +31,7 @@ _CARRIERLIST = _descriptor.Descriptor(
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='carrier_id', full_name='carrierIdentification.CarrierList.carrier_id', index=0,
@ -38,14 +39,14 @@ _CARRIERLIST = _descriptor.Descriptor(
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='version', full_name='carrierIdentification.CarrierList.version', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
@ -58,8 +59,8 @@ _CARRIERLIST = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=49,
serialized_end=133,
serialized_start=42,
serialized_end=126,
)
@ -69,6 +70,7 @@ _CARRIERID = _descriptor.Descriptor(
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='canonical_id', full_name='carrierIdentification.CarrierId.canonical_id', index=0,
@ -76,28 +78,28 @@ _CARRIERID = _descriptor.Descriptor(
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='carrier_name', full_name='carrierIdentification.CarrierId.carrier_name', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='carrier_attribute', full_name='carrierIdentification.CarrierId.carrier_attribute', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='parent_canonical_id', full_name='carrierIdentification.CarrierId.parent_canonical_id', index=3,
number=4, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
@ -110,8 +112,8 @@ _CARRIERID = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=136,
serialized_end=288,
serialized_start=129,
serialized_end=281,
)
@ -121,6 +123,7 @@ _CARRIERATTRIBUTE = _descriptor.Descriptor(
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='mccmnc_tuple', full_name='carrierIdentification.CarrierAttribute.mccmnc_tuple', index=0,
@ -128,63 +131,63 @@ _CARRIERATTRIBUTE = _descriptor.Descriptor(
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='imsi_prefix_xpattern', full_name='carrierIdentification.CarrierAttribute.imsi_prefix_xpattern', index=1,
number=2, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='spn', full_name='carrierIdentification.CarrierAttribute.spn', index=2,
number=3, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='plmn', full_name='carrierIdentification.CarrierAttribute.plmn', index=3,
number=4, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='gid1', full_name='carrierIdentification.CarrierAttribute.gid1', index=4,
number=5, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='gid2', full_name='carrierIdentification.CarrierAttribute.gid2', index=5,
number=6, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='preferred_apn', full_name='carrierIdentification.CarrierAttribute.preferred_apn', index=6,
number=7, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='iccid_prefix', full_name='carrierIdentification.CarrierAttribute.iccid_prefix', index=7,
number=8, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='privilege_access_rule', full_name='carrierIdentification.CarrierAttribute.privilege_access_rule', index=8,
number=9, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
@ -197,8 +200,8 @@ _CARRIERATTRIBUTE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=291,
serialized_end=492,
serialized_start=284,
serialized_end=485,
)
_CARRIERLIST.fields_by_name['carrier_id'].message_type = _CARRIERID
@ -208,25 +211,25 @@ DESCRIPTOR.message_types_by_name['CarrierId'] = _CARRIERID
DESCRIPTOR.message_types_by_name['CarrierAttribute'] = _CARRIERATTRIBUTE
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
CarrierList = _reflection.GeneratedProtocolMessageType('CarrierList', (_message.Message,), dict(
DESCRIPTOR = _CARRIERLIST,
__module__ = 'vendor.carrierId_pb2'
CarrierList = _reflection.GeneratedProtocolMessageType('CarrierList', (_message.Message,), {
'DESCRIPTOR' : _CARRIERLIST,
'__module__' : 'carrierId_pb2'
# @@protoc_insertion_point(class_scope:carrierIdentification.CarrierList)
))
})
_sym_db.RegisterMessage(CarrierList)
CarrierId = _reflection.GeneratedProtocolMessageType('CarrierId', (_message.Message,), dict(
DESCRIPTOR = _CARRIERID,
__module__ = 'vendor.carrierId_pb2'
CarrierId = _reflection.GeneratedProtocolMessageType('CarrierId', (_message.Message,), {
'DESCRIPTOR' : _CARRIERID,
'__module__' : 'carrierId_pb2'
# @@protoc_insertion_point(class_scope:carrierIdentification.CarrierId)
))
})
_sym_db.RegisterMessage(CarrierId)
CarrierAttribute = _reflection.GeneratedProtocolMessageType('CarrierAttribute', (_message.Message,), dict(
DESCRIPTOR = _CARRIERATTRIBUTE,
__module__ = 'vendor.carrierId_pb2'
CarrierAttribute = _reflection.GeneratedProtocolMessageType('CarrierAttribute', (_message.Message,), {
'DESCRIPTOR' : _CARRIERATTRIBUTE,
'__module__' : 'carrierId_pb2'
# @@protoc_insertion_point(class_scope:carrierIdentification.CarrierAttribute)
))
})
_sym_db.RegisterMessage(CarrierAttribute)

View File

@ -0,0 +1 @@
../../../packages/providers/TelephonyProvider/assets/latest_carrier_id/carrier_list.pb

View File

@ -10,7 +10,7 @@ from xml.sax.saxutils import escape, quoteattr
from carriersettings_pb2 import CarrierList, CarrierSettings, \
MultiCarrierSettings
from vendor.carrierId_pb2 import CarrierList as CarrierIdList
from carrierId_pb2 import CarrierList as CarrierIdList
pb_path = sys.argv[1]

View File

@ -1,92 +0,0 @@
//
// 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
//
// 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.internal.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;
};