am afcbb78d: Check Build.SERIAL for Non-telephony Devices
Merge commit 'afcbb78d5d182046c97b0370bec3259d8d4530c5' into gingerbread-plus-aosp
* commit 'afcbb78d5d182046c97b0370bec3259d8d4530c5':
Check Build.SERIAL for Non-telephony Devices
diff --git a/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java b/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
index ece6328..deed336 100644
--- a/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
@@ -24,6 +24,7 @@
import android.content.Context;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
+import android.os.Build;
import android.os.Looper;
import android.os.cts.TestThread;
import android.telephony.CellLocation;
@@ -295,6 +296,7 @@
case TelephonyManager.PHONE_TYPE_NONE:
assertNull(deviceId);
+ assertSerialNumber();
assertMacAddressReported();
break;
@@ -391,6 +393,15 @@
Pattern.matches(meidPattern, deviceId));
}
+ private void assertSerialNumber() {
+ assertNotNull("Non-telephony devices must have a Build.SERIAL number.",
+ Build.SERIAL);
+ assertTrue("Hardware id must be no longer than 20 characters.",
+ Build.SERIAL.length() <= 20);
+ assertTrue("Hardware id must be alphanumeric.",
+ Pattern.matches("[0-9A-Za-z]+", Build.SERIAL));
+ }
+
private void assertMacAddressReported() {
String macAddress = getMacAddress();
String macPattern = "([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}";