lineagehw: Remove unique device ID feature

Change-Id: I99aae7716e1b54e5ee2b6cb59ca75573126ffec4
This commit is contained in:
Michael Bestas
2018-01-23 20:11:08 +02:00
parent a0e29562a2
commit d85907768c
5 changed files with 0 additions and 131 deletions

View File

@@ -426,7 +426,6 @@ package lineageos.hardware {
method public int getSupportedFeatures();
method public int getThermalState();
method public lineageos.hardware.TouchscreenGesture[] getTouchscreenGestures();
method public java.lang.String getUniqueDeviceId();
method public int getVibratorDefaultIntensity();
method public int getVibratorIntensity();
method public int getVibratorMaxIntensity();
@@ -469,7 +468,6 @@ package lineageos.hardware {
field public static final int FEATURE_THERMAL_MONITOR = 32768; // 0x8000
field public static final int FEATURE_TOUCHSCREEN_GESTURES = 524288; // 0x80000
field public static final int FEATURE_TOUCH_HOVERING = 2048; // 0x800
field public static final int FEATURE_UNIQUE_DEVICE_ID = 65536; // 0x10000
field public static final int FEATURE_VIBRATOR = 1024; // 0x400
}

View File

@@ -60,7 +60,6 @@ import org.lineageos.hardware.ThermalMonitor;
import org.lineageos.hardware.ThermalUpdateCallback;
import org.lineageos.hardware.TouchscreenGestures;
import org.lineageos.hardware.TouchscreenHovering;
import org.lineageos.hardware.UniqueDeviceId;
import org.lineageos.hardware.VibratorHW;
/** @hide */
@@ -98,7 +97,6 @@ public class LineageHardwareService extends LineageSystemService implements Ther
public long getLtoDownloadInterval();
public String getSerialNumber();
public String getUniqueDeviceId();
public boolean requireAdaptiveBacklightForSunlightEnhancement();
public boolean isSunlightEnhancementSelfManaged();
@@ -160,8 +158,6 @@ public class LineageHardwareService extends LineageSystemService implements Ther
mSupportedFeatures |= LineageHardwareManager.FEATURE_PERSISTENT_STORAGE;
if (ThermalMonitor.isSupported())
mSupportedFeatures |= LineageHardwareManager.FEATURE_THERMAL_MONITOR;
if (UniqueDeviceId.isSupported())
mSupportedFeatures |= LineageHardwareManager.FEATURE_UNIQUE_DEVICE_ID;
if (ColorBalance.isSupported())
mSupportedFeatures |= LineageHardwareManager.FEATURE_COLOR_BALANCE;
if (PictureAdjustment.isSupported())
@@ -326,10 +322,6 @@ public class LineageHardwareService extends LineageSystemService implements Ther
return SerialNumber.getSerialNumber();
}
public String getUniqueDeviceId() {
return UniqueDeviceId.getUniqueDeviceId();
}
public boolean requireAdaptiveBacklightForSunlightEnhancement() {
return SunlightEnhancement.isAdaptiveBacklightRequired();
}
@@ -638,17 +630,6 @@ public class LineageHardwareService extends LineageSystemService implements Ther
return mLineageHwImpl.getSerialNumber();
}
@Override
public String getUniqueDeviceId() {
mContext.enforceCallingOrSelfPermission(
lineageos.platform.Manifest.permission.HARDWARE_ABSTRACTION_ACCESS, null);
if (!isSupported(LineageHardwareManager.FEATURE_UNIQUE_DEVICE_ID)) {
Log.e(TAG, "Unique device ID is not supported");
return null;
}
return mLineageHwImpl.getUniqueDeviceId();
}
@Override
public boolean requireAdaptiveBacklightForSunlightEnhancement() {
mContext.enforceCallingOrSelfPermission(

View File

@@ -60,8 +60,6 @@ interface ILineageHardwareService {
boolean unRegisterThermalListener(IThermalListenerCallback callback);
boolean isSunlightEnhancementSelfManaged();
String getUniqueDeviceId();
int getColorBalanceMin();
int getColorBalanceMax();
int getColorBalance();

View File

@@ -155,12 +155,6 @@ public final class LineageHardwareManager {
@VisibleForTesting
public static final int FEATURE_THERMAL_MONITOR = 0x8000;
/**
* Unique device ID
*/
@VisibleForTesting
public static final int FEATURE_UNIQUE_DEVICE_ID = 0x10000;
/**
* Color balance
*/
@@ -790,19 +784,6 @@ public final class LineageHardwareManager {
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

@@ -1,89 +0,0 @@
/**
* Copyright (c) 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.lineageos.tests.hardware.unit;
import android.os.Build;
import android.os.SystemProperties;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
import android.text.TextUtils;
import lineageos.hardware.LineageHardwareManager;
public class UniqueDeviceIDTest extends AndroidTestCase {
private static final String TAG = UniqueDeviceIDTest.class.getSimpleName();
private static final int MINIMUM_LENGTH = 3;
private LineageHardwareManager mLineageHardwareManager;
//TODO: Use the TYPE declaration from LineageHardwareManager public interface in future
private static final int TYPE_MMC0_CID = 0;
@Override
protected void setUp() throws Exception {
super.setUp();
mLineageHardwareManager = LineageHardwareManager.getInstance(mContext);
}
@SmallTest
public void testGetSerialNumber() {
final int feature = LineageHardwareManager.FEATURE_SERIAL_NUMBER;
if (mLineageHardwareManager.isSupported(feature)) {
String notExpectedSerialNo = SystemProperties.get("ro.serialno");
String actualSerialNo = mLineageHardwareManager.getSerialNumber();
assertNotNull(actualSerialNo);
assertNotSame(notExpectedSerialNo, actualSerialNo);
}
}
@SmallTest
public void testGetUniqueDeviceId() {
final int feature = LineageHardwareManager.FEATURE_UNIQUE_DEVICE_ID;
assertFeatureEnabledOnRetail(feature);
if (mLineageHardwareManager.isSupported(feature)) {
String uniqueDeviceId = mLineageHardwareManager.getUniqueDeviceId();
//FIXME: This is based off the default implementation in cyngn/hw, make more robust
assertNotNull(uniqueDeviceId);
assertTrue(uniqueDeviceId.length() >= MINIMUM_LENGTH);
assertTrue(isValidHexNumberAndType(uniqueDeviceId.substring(0, 3)));
}
}
private void assertFeatureEnabledOnRetail(int feature) {
if (TextUtils.equals(Build.TYPE, "user")) {
assertTrue(mLineageHardwareManager.isSupported(feature));
}
}
private static boolean isValidHexNumberAndType(String target) {
try {
long value = Long.parseLong(target, 16);
return isValidType((int) value);
}
catch (NumberFormatException ex) {
return false;
}
}
private static boolean isValidType(int value) {
switch (value) {
case TYPE_MMC0_CID:
return true;
default:
return false;
}
}
}