aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Wagantall <mwagantall@cyngn.com>2016-02-02 11:32:18 -0800
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-02-02 16:37:59 -0800
commiteb82dbf050b17bbac2fd54cdeed3029b78778abb (patch)
tree99620920a0581fb70a7cacb4ed965fc59490573a /src
parentee703e74fa0d674b485688d25040a31474913b15 (diff)
downloadvendor_cmsdk-eb82dbf050b17bbac2fd54cdeed3029b78778abb.zip
vendor_cmsdk-eb82dbf050b17bbac2fd54cdeed3029b78778abb.tar.gz
vendor_cmsdk-eb82dbf050b17bbac2fd54cdeed3029b78778abb.tar.bz2
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
Diffstat (limited to 'src')
-rw-r--r--src/java/cyanogenmod/hardware/CMHardwareManager.java20
-rw-r--r--src/java/cyanogenmod/hardware/ICMHardwareService.aidl2
2 files changed, 21 insertions, 1 deletions
diff --git a/src/java/cyanogenmod/hardware/CMHardwareManager.java b/src/java/cyanogenmod/hardware/CMHardwareManager.java
index 4425873..7d97df6 100644
--- a/src/java/cyanogenmod/hardware/CMHardwareManager.java
+++ b/src/java/cyanogenmod/hardware/CMHardwareManager.java
@@ -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.
@@ -124,6 +124,11 @@ public final class CMHardwareManager {
*/
public static final int FEATURE_THERMAL_MONITOR = 0x8000;
+ /**
+ * Unique device ID
+ */
+ public static final int FEATURE_UNIQUE_DEVICE_ID = 0x10000;
+
private static final List<Integer> BOOLEAN_FEATURES = Arrays.asList(
FEATURE_ADAPTIVE_BACKLIGHT,
FEATURE_COLOR_ENHANCEMENT,
@@ -700,6 +705,19 @@ public final class CMHardwareManager {
}
/**
+ * @return an id that's both unique and deterministic for the device
+ */
+ public String getUniqueDeviceId() {
+ try {
+ if (checkService()) {
+ return sService.getUniqueDeviceId();
+ }
+ } catch (RemoteException e) {
+ }
+ return null;
+ }
+
+ /**
* @return true if adaptive backlight should be enabled when sunlight enhancement
* is enabled.
*/
diff --git a/src/java/cyanogenmod/hardware/ICMHardwareService.aidl b/src/java/cyanogenmod/hardware/ICMHardwareService.aidl
index 54dd152..a1ae65b 100644
--- a/src/java/cyanogenmod/hardware/ICMHardwareService.aidl
+++ b/src/java/cyanogenmod/hardware/ICMHardwareService.aidl
@@ -56,4 +56,6 @@ interface ICMHardwareService {
boolean registerThermalListener(IThermalListenerCallback callback);
boolean unRegisterThermalListener(IThermalListenerCallback callback);
boolean isSunlightEnhancementSelfManaged();
+
+ String getUniqueDeviceId();
}