cmsdk: cmhw: Add UniqueDeviceId support
It's sometimes useful to know what physical device you're using. CMHW SerialNumber and an "ro.serialno" property already exists, but are not guaranteed to be unique. Different OEM may use overlapping numbering schemes, and sometimes placeholder like "012345ABCDE" are used. Attempt to work around these shortcomings by defining a new UniqueDeviceId class that provides a globally unique device ID that is both deterministic for a given device and designed not to overlap with IDs of any other devices. Change-Id: I3f426972558394ba8e78261273ac8521aa603327
This commit is contained in:
committed by
Gerrit Code Review
parent
ee703e74fa
commit
eb82dbf050
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2015, The CyanogenMod Project
|
||||
* Copyright (c) 2015-2016, The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -118,6 +118,16 @@ public class CMHardwareTest extends TestActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean uniqueDeviceIdSupported() {
|
||||
if (mHardwareManager.isSupported(CMHardwareManager.FEATURE_UNIQUE_DEVICE_ID)) {
|
||||
return true;
|
||||
} else {
|
||||
Toast.makeText(CMHardwareTest.this, "Unique device ID not supported",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean displayModesSupported() {
|
||||
if (mHardwareManager.isSupported(CMHardwareManager.FEATURE_DISPLAY_MODES)) {
|
||||
return true;
|
||||
@@ -312,6 +322,16 @@ public class CMHardwareTest extends TestActivity {
|
||||
}
|
||||
}
|
||||
},
|
||||
new Test("Test Get Unique Device ID") {
|
||||
@Override
|
||||
protected void run() {
|
||||
if (uniqueDeviceIdSupported()) {
|
||||
Toast.makeText(CMHardwareTest.this, "Unique Device ID " +
|
||||
mHardwareManager.getUniqueDeviceId(),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
},
|
||||
new Test("Test Get Display Modes") {
|
||||
@Override
|
||||
protected void run() {
|
||||
|
||||
Reference in New Issue
Block a user