Type Allocation Code & Manufacturer Code
- Addition of getTypeAllocationCodeForSlot & getManufacturerCodeForSlot
to com.android.phone.PhoneInterfaceManager.
- The Type Allocation Code is the first eight characters of the IMEI.
The Type Allocation Code identifies a particular GSM device model.
- The Manufacturer Code is the first eight characters of the MEID.
The Manufacturer Code identifies the manufacturer of a CDMA device.
- The reasoning behind adding getTypeAllocationCodeForSlot is to be
able to obtain the Type Allocation Code without requiring the
READ_PHONE_STATE permission. Currently in order to obtain the
Type Allocation Code a substring operation must be performed on
getImeiForSlot which is protected by the READ_PHONE_STATE permission.
- The reasoning behind adding getManufacturerCodeForSlot is to be
able to obtain the Manufacturer Code without requiring the
READ_PHONE_STATE permission. Currently in order to obtain the
Manufacturer Code a substring operation must be performed on
getMeidForSlot which is protected by the READ_PHONE_STATE permission.
- The reasoning that these additional methods do not require the
READ_PHONE_STATE permission is that neither the Type Allocation
Code nor the Manufacturer Code can identify a unique device.
The Type Allocation Code and the Manufacturer Code are analogous
to other device information such as device model or device
screen dimensions.
Test: cts-tradefed run cts -m CtsTelephonyTestCases
Test: runtest.py --path frameworks/opt/telephony/tests/telephonytests
Bug: 74613795
Change-Id: I9a37cd57f74a353ff8407ac3b4253101d548a3fe
Signed-off-by: David Kelly <dkelly@afilias.info>
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index bda90a5..0026311 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -219,6 +219,9 @@
private NetworkScanRequestTracker mNetworkScanRequestTracker;
+ private static final int TYPE_ALLOCATION_CODE_LENGTH = 8;
+ private static final int MANUFACTURER_CODE_LENGTH = 8;
+
/**
* A request object to use for transmitting data to an ICC.
*/
@@ -1835,6 +1838,17 @@
}
@Override
+ public String getTypeAllocationCodeForSlot(int slotIndex) {
+ Phone phone = PhoneFactory.getPhone(slotIndex);
+ String tac = null;
+ if (phone != null) {
+ String imei = phone.getImei();
+ tac = imei == null ? null : imei.substring(0, TYPE_ALLOCATION_CODE_LENGTH);
+ }
+ return tac;
+ }
+
+ @Override
public String getMeidForSlot(int slotIndex, String callingPackage) {
Phone phone = PhoneFactory.getPhone(slotIndex);
if (phone == null) {
@@ -1849,6 +1863,17 @@
}
@Override
+ public String getManufacturerCodeForSlot(int slotIndex) {
+ Phone phone = PhoneFactory.getPhone(slotIndex);
+ String manufacturerCode = null;
+ if (phone != null) {
+ String meid = phone.getMeid();
+ manufacturerCode = meid == null ? null : meid.substring(0, MANUFACTURER_CODE_LENGTH);
+ }
+ return manufacturerCode;
+ }
+
+ @Override
public String getDeviceSoftwareVersionForSlot(int slotIndex, String callingPackage) {
Phone phone = PhoneFactory.getPhone(slotIndex);
if (phone == null) {