Do not merge. Return null id for Non-phone device.

For non-phone device, i.e. tablet doesn't have voice capability,

getDeviceId returns null while getPhoneType returns PHONE_TYPE_NONE.

This behavior is suggested by developer scheme

http://android-developers.blogspot.com/2011/03/identifying-app-installations.html

and enforced by CTS testGetDeviceId.

bug:4464907
Change-Id: Iaa3832b7323a50deccd438cb884c8e776a7a9640
This commit is contained in:
John Wang
2011-06-07 15:37:09 -07:00
parent 25bd8abce9
commit cea03df201

View File

@@ -192,6 +192,10 @@ public class TelephonyManager {
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
*/
public String getDeviceId() {
if (!isVoiceCapable()) {
return null;
}
try {
return getSubscriberInfo().getDeviceId();
} catch (RemoteException ex) {