Question

I get the serial no from

Class<?> c = Class.forName("android.os.SystemProperties");           
Method get = c.getMethod("get", String.class, String.class );       
String serialNo = (String) (get.invoke(c, "ro.serialno", ""));  

But what is the max. length of the ro.serialno?

From the doc: http://developer.android.com/reference/android/os/Build.html

Seems it is missing?

Was it helpful?

Solution 2

As shown in the source code, I would say 103.

The variable name is PROP_VALUE_MAX

If you are talking about the lenght of the variable name, then look for PROP_NAME_MAX which its length is 31.

Source.

OTHER TIPS

Rely on the cts suite, the ro.serialno should be following this pattern:

Pattern SERIAL_NUMBER_PATTERN = Pattern.compile("^([0-9A-Za-z]{6,20})$");

In BuildTest.java, line 159 at time of writing: https://android.googlesource.com/platform/cts/+/master/tests/tests/os/src/android/os/cts/BuildTest.java#159

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top