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:
Matt Wagantall
2016-02-02 11:32:18 -08:00
committed by Gerrit Code Review
parent ee703e74fa
commit eb82dbf050
6 changed files with 66 additions and 3 deletions

View File

@@ -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,
@@ -699,6 +704,19 @@ public final class CMHardwareManager {
return null;
}
/**
* @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.

View File

@@ -56,4 +56,6 @@ interface ICMHardwareService {
boolean registerThermalListener(IThermalListenerCallback callback);
boolean unRegisterThermalListener(IThermalListenerCallback callback);
boolean isSunlightEnhancementSelfManaged();
String getUniqueDeviceId();
}