From 7141ea6c529439b9c17116552a0c1cd07bb7f76b Mon Sep 17 00:00:00 2001 From: DidntRead Date: Tue, 1 May 2018 19:07:19 +0300 Subject: [PATCH] remove some useless files --- fingerprint/Android.mk | 33 --- fingerprint/FingerprintWrapper.cpp | 229 ------------------ .../lineageos/hardware/AdaptiveBacklight.java | 60 ----- .../hardware/DisplayColorCalibration.java | 148 ----------- .../hardware/HighTouchSensitivity.java | 58 ----- .../hardware/SunlightEnhancement.java | 82 ------- .../hardware/TouchscreenGestures.java | 99 -------- .../lineageos/hardware/UniqueDeviceId.java | 68 ------ setup-makefiles.sh | 74 ------ usb/Android.bp | 17 -- usb/Android.mk | 22 ++ 11 files changed, 22 insertions(+), 868 deletions(-) delete mode 100644 fingerprint/Android.mk delete mode 100644 fingerprint/FingerprintWrapper.cpp delete mode 100644 lineagehw/org/lineageos/hardware/AdaptiveBacklight.java delete mode 100644 lineagehw/org/lineageos/hardware/DisplayColorCalibration.java delete mode 100644 lineagehw/org/lineageos/hardware/HighTouchSensitivity.java delete mode 100644 lineagehw/org/lineageos/hardware/SunlightEnhancement.java delete mode 100644 lineagehw/org/lineageos/hardware/TouchscreenGestures.java delete mode 100644 lineagehw/org/lineageos/hardware/UniqueDeviceId.java delete mode 100644 setup-makefiles.sh delete mode 100644 usb/Android.bp create mode 100644 usb/Android.mk diff --git a/fingerprint/Android.mk b/fingerprint/Android.mk deleted file mode 100644 index c218353..0000000 --- a/fingerprint/Android.mk +++ /dev/null @@ -1,33 +0,0 @@ -# -# Copyright (C) 2017 The LineageOS 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. -# - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - FingerprintWrapper.cpp - -LOCAL_SHARED_LIBRARIES := \ - libhardware liblog - -LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_PROPRIETARY_MODULE := true -LOCAL_MODULE := fingerprint.mt6753 -LOCAL_MODULE_TAGS := optional - -include $(BUILD_SHARED_LIBRARY) - diff --git a/fingerprint/FingerprintWrapper.cpp b/fingerprint/FingerprintWrapper.cpp deleted file mode 100644 index c9ca090..0000000 --- a/fingerprint/FingerprintWrapper.cpp +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (C) 2017, The LineageOS 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. - */ - -//#define LOG_NDEBUG 0 -#define LOG_TAG "FingerprintWrapper" - -#include - -#include -#include -#include - -typedef struct { - fingerprint_device_t base; - union { - fingerprint_device_t *device; - hw_device_t *hw_device; - } vendor; -} device_t; - -static android::Mutex vendor_mutex; - -static union { - const fingerprint_module_t *module; - const hw_module_t *hw_module; -} vendor; - -static bool ensure_vendor_module_is_loaded(void) -{ - android::Mutex::Autolock lock(vendor_mutex); - - if (!vendor.module) { - int rv = hw_get_module_by_class("fingerprint", "vendor", &vendor.hw_module); - if (rv) { - ALOGE("failed to open vendor module, error %d", rv); - vendor.module = NULL; - } else { - ALOGI("loaded vendor module: %s version %x", vendor.module->common.name, - vendor.module->common.module_api_version); - } - } - - return vendor.module != NULL; -} - -static int set_notify(struct fingerprint_device *dev, fingerprint_notify_t notify) -{ - device_t *device = (device_t *) dev; - - return device->vendor.device->set_notify(device->vendor.device, notify); -} - -static uint64_t pre_enroll(struct fingerprint_device *dev) -{ - device_t *device = (device_t *) dev; - - return device->vendor.device->pre_enroll(device->vendor.device); -} - -static int enroll(struct fingerprint_device *dev, const hw_auth_token_t *hat, uint32_t gid, - uint32_t timeout_sec) -{ - device_t *device = (device_t *) dev; - - return device->vendor.device->enroll(device->vendor.device, hat, gid, timeout_sec); -} - -static int post_enroll(struct fingerprint_device *dev) -{ - device_t *device = (device_t *) dev; - - return device->vendor.device->post_enroll(device->vendor.device); -} - -static uint64_t get_authenticator_id(struct fingerprint_device *dev) -{ - device_t *device = (device_t *) dev; - - return device->vendor.device->get_authenticator_id(device->vendor.device); -} - -static int cancel(struct fingerprint_device *dev) -{ - device_t *device = (device_t *) dev; - - return device->vendor.device->cancel(device->vendor.device); -} - -#define MAX_FINGERPRINTS 100 - -typedef int (*enumerate_2_0)(struct fingerprint_device *dev, fingerprint_finger_id_t *results, - uint32_t *max_size); - -static int enumerate_pre_2_1(struct fingerprint_device *dev) -{ - device_t *device = (device_t *) dev; - fingerprint_finger_id_t results[MAX_FINGERPRINTS]; - uint32_t n = MAX_FINGERPRINTS; - enumerate_2_0 enumerate = (enumerate_2_0) device->vendor.device->enumerate; - int rv = enumerate(device->vendor.device, results, &n); - - if (rv == 0) { - uint32_t i; - fingerprint_msg_t msg; - - msg.type = FINGERPRINT_TEMPLATE_ENUMERATING; - for (i = 0; i < n; i++) { - msg.data.enumerated.finger = results[i]; - msg.data.enumerated.remaining_templates = n - i - 1; - device->base.notify(&msg); - } - } - - return rv; -} - -static int enumerate(struct fingerprint_device *dev) -{ - device_t *device = (device_t *) dev; - - return device->vendor.device->enumerate(device->vendor.device); -} - -static int remove(struct fingerprint_device *dev, uint32_t gid, uint32_t fid) -{ - device_t *device = (device_t *) dev; - - return device->vendor.device->remove(device->vendor.device, gid, fid); -} - -static int set_active_group(struct fingerprint_device *dev, uint32_t gid, const char *store_path) -{ - device_t *device = (device_t *) dev; - - return device->vendor.device->set_active_group(device->vendor.device, gid, store_path); -} - -static int authenticate(struct fingerprint_device *dev, uint64_t operation_id, uint32_t gid) -{ - device_t *device = (device_t *) dev; - - return device->vendor.device->authenticate(device->vendor.device, operation_id, gid); -} - -static int device_close(hw_device_t *hw_device) -{ - device_t *device = (device_t *) hw_device; - int rv = device->base.common.close(device->vendor.hw_device); - free(device); - return rv; -} - -static int device_open(const hw_module_t *module, const char *name, hw_device_t **device_out) -{ - int rv; - device_t *device; - - if (!ensure_vendor_module_is_loaded()) { - return -EINVAL; - } - - device = (device_t *) calloc(sizeof(*device), 1); - if (!device) { - ALOGE("%s: Failed to allocate memory", __func__); - return -ENOMEM; - } - - rv = vendor.module->common.methods->open(vendor.hw_module, name, &device->vendor.hw_device); - if (rv) { - ALOGE("%s: failed to open, error %d\n", __func__, rv); - free(device); - return rv; - } - - device->base.common.tag = HARDWARE_DEVICE_TAG; - device->base.common.version = FINGERPRINT_MODULE_API_VERSION_2_1; - device->base.common.module = (hw_module_t *) module; - device->base.common.close = device_close; - - device->base.set_notify = set_notify; - device->base.pre_enroll = pre_enroll; - device->base.enroll = enroll; - device->base.post_enroll = post_enroll; - device->base.get_authenticator_id = get_authenticator_id; - device->base.cancel = cancel; - if (vendor.module->common.module_api_version >= FINGERPRINT_MODULE_API_VERSION_2_1) { - device->base.enumerate = enumerate; - } else { - device->base.enumerate = enumerate_pre_2_1; - } - device->base.remove = remove; - device->base.set_active_group = set_active_group; - device->base.authenticate = authenticate; - - *device_out = (hw_device_t *) device; - return 0; -} - -static struct hw_module_methods_t module_methods = { - .open = device_open -}; - -fingerprint_module_t HAL_MODULE_INFO_SYM = { - .common = { - .tag = HARDWARE_MODULE_TAG, - .module_api_version = FINGERPRINT_MODULE_API_VERSION_2_1, - .hal_api_version = HARDWARE_HAL_API_VERSION, - .id = FINGERPRINT_HARDWARE_MODULE_ID, - .name = "Lineage Fingerprint Wrapper", - .author = "The LineageOS Project", - .methods = &module_methods, - .dso = NULL, /* remove compilation warnings */ - .reserved = {0}, /* remove compilation warnings */ - }, -}; - diff --git a/lineagehw/org/lineageos/hardware/AdaptiveBacklight.java b/lineagehw/org/lineageos/hardware/AdaptiveBacklight.java deleted file mode 100644 index e3498c4..0000000 --- a/lineagehw/org/lineageos/hardware/AdaptiveBacklight.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2013 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.hardware; - -import org.lineageos.internal.util.FileUtils; - -/** - * Adaptive backlight support (this refers to technologies like NVIDIA SmartDimmer, - * QCOM CABL or Samsung CABC). - */ -public class AdaptiveBacklight { - - private static String FILE_CABC = "/sys/class/graphics/fb0/cabc"; - - /** - * Whether device supports an adaptive backlight technology. - * - * @return boolean Supported devices must return always true - */ - public static boolean isSupported() { - return FileUtils.isFileWritable(FILE_CABC); - } - - /** - * This method return the current activation status of the adaptive backlight technology. - * - * @return boolean Must be false when adaptive backlight is not supported or not activated, or - * the operation failed while reading the status; true in any other case. - */ - public static boolean isEnabled() { - return FileUtils.readOneLine(FILE_CABC).equals("1"); - } - - /** - * This method allows to setup adaptive backlight technology status. - * - * @param status The new adaptive backlight status - * @return boolean Must be false if adaptive backlight is not supported or the operation - * failed; true in any other case. - */ - public static boolean setEnabled(boolean status) { - return FileUtils.writeLine(FILE_CABC, (status ? "1" : "0")); - } - -} - diff --git a/lineagehw/org/lineageos/hardware/DisplayColorCalibration.java b/lineagehw/org/lineageos/hardware/DisplayColorCalibration.java deleted file mode 100644 index 4026db7..0000000 --- a/lineagehw/org/lineageos/hardware/DisplayColorCalibration.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (C) 2014 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.hardware; - -import android.os.IBinder; -import android.os.Parcel; -import android.os.RemoteException; -import android.os.ServiceManager; -import android.os.SystemProperties; -import android.util.Slog; - -import org.lineageos.internal.util.FileUtils; - -public class DisplayColorCalibration { - - private static final String TAG = "DisplayColorCalibration"; - - private static final String COLOR_FILE = "/sys/class/graphics/fb0/rgb"; - - private static final boolean sUseGPUMode; - - private static final int MIN = 20; - private static final int MAX = 255; - - private static final int[] sCurColors = new int[] { MAX, MAX, MAX }; - - static { - // We can also support GPU transform using RenderEngine. This is not - // preferred though, as it has a high power cost. - sUseGPUMode = !FileUtils.isFileWritable(COLOR_FILE) || - SystemProperties.getBoolean("debug.livedisplay.force_gpu", false); - } - - public static boolean isSupported() { - return true; - } - - public static int getMaxValue() { - return MAX; - } - - public static int getMinValue() { - return MIN; - } - - public static int getDefValue() { - return getMaxValue(); - } - - public static String getCurColors() { - if (!sUseGPUMode) { - return FileUtils.readOneLine(COLOR_FILE); - } - - return String.format("%d %d %d", sCurColors[0], - sCurColors[1], sCurColors[2]); - } - - public static boolean setColors(String colors) { - if (!sUseGPUMode) { - return FileUtils.writeLine(COLOR_FILE, colors); - } - - float[] mat = toColorMatrix(colors); - - // set to null if identity - if (mat == null || - (mat[0] == 1.0f && mat[5] == 1.0f && - mat[10] == 1.0f && mat[15] == 1.0f)) { - return setColorTransform(null); - } - return setColorTransform(mat); - } - - private static float[] toColorMatrix(String rgbString) { - String[] adj = rgbString == null ? null : rgbString.split(" "); - - if (adj == null || adj.length != 3) { - return null; - } - - float[] mat = new float[16]; - - // sanity check - for (int i = 0; i < 3; i++) { - int v = Integer.parseInt(adj[i]); - - if (v >= MAX) { - v = MAX; - } else if (v < MIN) { - v = MIN; - } - - mat[i * 5] = (float)v / (float)MAX; - sCurColors[i] = v; - } - - mat[15] = 1.0f; - return mat; - } - - /** - * Sets the surface flinger's color transformation as a 4x4 matrix. If the - * matrix is null, color transformations are disabled. - * - * @param m the float array that holds the transformation matrix, or null to - * disable transformation - */ - private static boolean setColorTransform(float[] m) { - try { - final IBinder flinger = ServiceManager.getService("SurfaceFlinger"); - if (flinger != null) { - final Parcel data = Parcel.obtain(); - data.writeInterfaceToken("android.ui.ISurfaceComposer"); - if (m != null) { - data.writeInt(1); - for (int i = 0; i < 16; i++) { - data.writeFloat(m[i]); - } - } else { - data.writeInt(0); - } - flinger.transact(1030, data, null, 0); - data.recycle(); - } - } catch (RemoteException ex) { - Slog.e(TAG, "Failed to set color transform", ex); - return false; - } - return true; - } - -} - diff --git a/lineagehw/org/lineageos/hardware/HighTouchSensitivity.java b/lineagehw/org/lineageos/hardware/HighTouchSensitivity.java deleted file mode 100644 index 55ccec0..0000000 --- a/lineagehw/org/lineageos/hardware/HighTouchSensitivity.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2013 Xiao-Long Chen - * - * 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.hardware; - -import org.lineageos.internal.util.FileUtils; - -/** - * Glove mode / high touch sensitivity - */ -public class HighTouchSensitivity { - - private static String GLOVEMODE_PATH = "/sys/lenovo_tp_gestures/tpd_glove_status"; - - /** - * Whether device supports high touch sensitivity. - * - * @return boolean Supported devices must return always true - */ - public static boolean isSupported() { - return FileUtils.isFileWritable(GLOVEMODE_PATH); - } - - /** - * This method return the current activation status of high touch sensitivity - * - * @return boolean Must be false if high touch sensitivity is not supported or not activated, - * or the operation failed while reading the status; true in any other case. - */ - public static boolean isEnabled() { - return FileUtils.readOneLine(GLOVEMODE_PATH).equals("1"); - } - - /** - * This method allows to setup high touch sensitivity status. - * - * @param status The new high touch sensitivity status - * @return boolean Must be false if high touch sensitivity is not supported or the operation - * failed; true in any other case. - */ - public static boolean setEnabled(boolean status) { - return FileUtils.writeLine(GLOVEMODE_PATH, (status ? "1" : "0")); - } - -} diff --git a/lineagehw/org/lineageos/hardware/SunlightEnhancement.java b/lineagehw/org/lineageos/hardware/SunlightEnhancement.java deleted file mode 100644 index cec469c..0000000 --- a/lineagehw/org/lineageos/hardware/SunlightEnhancement.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2014 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.hardware; - -import org.lineageos.internal.util.FileUtils; - -/** - * Sunlight Readability Enhancement support, aka Facemelt Mode. - * - * Brightens up the screen via image processing or other tricks when - * under aggressive lighting conditions. Usually depends on CABC - * support. - */ -public class SunlightEnhancement { - - private static String FILE_SLE = "/sys/class/graphics/fb0/sle"; - - /** - * Whether device supports SRE - * - * @return boolean Supported devices must return always true - */ - public static boolean isSupported() { - return FileUtils.isFileWritable(FILE_SLE); - } - - /** - * This method return the current activation status of SRE - * - * @return boolean Must be false when SRE is not supported or not activated, or - * the operation failed while reading the status; true in any other case. - */ - public static boolean isEnabled() { - return FileUtils.readOneLine(FILE_SLE).equals("1"); - } - - /** - * This method allows to setup SRE. - * - * @param status The new SRE status - * @return boolean Must be false if SRE is not supported or the operation - * failed; true in any other case. - */ - public static boolean setEnabled(boolean status) { - return FileUtils.writeLine(FILE_SLE, (status ? "1" : "0")); - } - - /** - * Whether adaptive backlight (CABL / CABC) is required to be enabled - * - * @return boolean False if adaptive backlight is not a dependency - */ - public static boolean isAdaptiveBacklightRequired() { return false; } - - /** - * Set this to true if the implementation is self-managed and does - * it's own ambient sensing. In this case, setEnabled is assumed - * to toggle the feature on or off, but not activate it. If set - * to false, LiveDisplay will call setEnabled when the ambient lux - * threshold is crossed. - * - * @return true if this enhancement is self-managed - */ - public static boolean isSelfManaged() { - return false; - } -} - diff --git a/lineagehw/org/lineageos/hardware/TouchscreenGestures.java b/lineagehw/org/lineageos/hardware/TouchscreenGestures.java deleted file mode 100644 index 854e2e2..0000000 --- a/lineagehw/org/lineageos/hardware/TouchscreenGestures.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2016 The CyanogenMod Project - * 2017 The LineageOS 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.hardware; - -import org.lineageos.internal.util.FileUtils; -import lineageos.hardware.TouchscreenGesture; - -/** - * Touchscreen gestures API - * - * A device may implement several touchscreen gestures for use while - * the display is turned off, such as drawing alphabets and shapes. - * These gestures can be interpreted by userspace to activate certain - * actions and launch certain apps, such as to skip music tracks, - * to turn on the flashlight, or to launch the camera app. - * - * This *should always* be supported by the hardware directly. - * A lot of recent touch controllers have a firmware option for this. - * - * This API provides support for enumerating the gestures - * supported by the touchscreen. - */ -public class TouchscreenGestures { - - private static final String[] GESTURE_PATHS = { - "/sys/lenovo_tp_gestures/letter_v_enable", - "/sys/lenovo_tp_gestures/letter_z_enable", - "/sys/lenovo_tp_gestures/letter_c_enable", - "/sys/lenovo_tp_gestures/letter_e_enable", - "/sys/lenovo_tp_gestures/letter_s_enable", - "/sys/lenovo_tp_gestures/letter_w_enable", - }; - - private static final TouchscreenGesture[] TOUCHSCREEN_GESTURES = { - new TouchscreenGesture(0, "Letter V", 263), - new TouchscreenGesture(1, "Letter Z", 264), - new TouchscreenGesture(2, "Letter C", 265), - new TouchscreenGesture(3, "Letter E", 266), - new TouchscreenGesture(4, "Letter S", 267), - new TouchscreenGesture(5, "Letter W", 268), - }; - - /** - * Whether device supports touchscreen gestures - * - * @return boolean Supported devices must return always true - */ - public static boolean isSupported() { - for (String path : GESTURE_PATHS) { - if (!FileUtils.isFileWritable(path) || !FileUtils.isFileReadable(path)) { - return false; - } - } - return true; - } - - /* - * Get the list of available gestures. A mode has an integer - * identifier and a string name. - * - * It is the responsibility of the upper layers to - * map the name to a human-readable format or perform translation. - * - * @return TouchscreenGesture[] An array of the touchscreen gestures - * available on a device - */ - public static TouchscreenGesture[] getAvailableGestures() { - return TOUCHSCREEN_GESTURES; - } - - /** - * This method allows to set the activation status of a gesture - * - * @param gesture The gesture to be activated - * state The new activation status of the gesture - * - * @return boolean Must be false if gesture is not supported - * or the operation failed; true in any other case. - */ - public static boolean setGestureEnabled( - final TouchscreenGesture gesture, final boolean state) { - final String stateStr = state ? "1" : "0"; - return FileUtils.writeLine(GESTURE_PATHS[gesture.id], stateStr); - } -} diff --git a/lineagehw/org/lineageos/hardware/UniqueDeviceId.java b/lineagehw/org/lineageos/hardware/UniqueDeviceId.java deleted file mode 100644 index d8a02b2..0000000 --- a/lineagehw/org/lineageos/hardware/UniqueDeviceId.java +++ /dev/null @@ -1,68 +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.hardware; - - -import org.lineageos.internal.util.FileUtils; -/** - * Generate a unique but deterministic ID for this hardware, based on unchangeable - * hardware serial numbers. - */ -public class UniqueDeviceId { - private static final int TYPE_MMC0_CID = 0; - - private static String sUniqueId = null; - - /** - * Whether device supports reporting a unique device id. - * - * @return boolean Supported devices must return always true - */ - public static boolean isSupported() { - return getUniqueDeviceIdInternal() != null; - } - - /** - * This method retreives a unique ID for the device. - * - * @return String The unique device ID - */ - public static String getUniqueDeviceId() { - return getUniqueDeviceIdInternal(); - } - - private static String getUniqueDeviceIdInternal() { - if (sUniqueId != null) { - return sUniqueId; - } - - String sMmcType = FileUtils.readOneLine("/sys/block/mmcblk0/device/type"); - String sCid = FileUtils.readOneLine("/sys/block/mmcblk0/device/cid"); - if ("MMC".equals(sMmcType) && sCid != null) { - sCid = sCid.trim(); - if (sCid.length() == 32) { - sUniqueId = String.format("%03x00000%32s", TYPE_MMC0_CID, sCid); - return sUniqueId; - } - } - - /* Any additional types should be added here. */ - - return null; -} -} - diff --git a/setup-makefiles.sh b/setup-makefiles.sh deleted file mode 100644 index 1630ea9..0000000 --- a/setup-makefiles.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -VENDOR=lenovo -DEVICE=A7010a48 -OUTDIR=vendor/$VENDOR/$DEVICE -MAKEFILE=../../../$OUTDIR/$DEVICE-vendor-blobs.mk - -(cat << EOF) > $MAKEFILE -# Copyright (C) 2015 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. - -# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh - -PRODUCT_COPY_FILES += \\ -EOF - -LINEEND=" \\" -COUNT=`cat proprietary-blobs.txt | grep -v ^# | grep -v ^$ | wc -l | awk {'print $1'}` -for FILE in `cat proprietary-blobs.txt | grep -v ^# | grep -v ^$`; do -COUNT=`expr $COUNT - 1` - if [ $COUNT = "0" ]; then -LINEEND="" - fi -echo " $OUTDIR/proprietary/$FILE:system/$FILE$LINEEND" >> $MAKEFILE -done - -(cat << EOF) > ../../../$OUTDIR/$DEVICE-vendor.mk -# Copyright (C) 2015 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. - -# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh - -\$(call inherit-product, vendor/$VENDOR/$DEVICE/$DEVICE-vendor-blobs.mk) -EOF - -(cat << EOF) > ../../../$OUTDIR/BoardConfigVendor.mk -# Copyright (C) 2015 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. - -# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh -EOF diff --git a/usb/Android.bp b/usb/Android.bp deleted file mode 100644 index 4631a5f..0000000 --- a/usb/Android.bp +++ /dev/null @@ -1,17 +0,0 @@ -cc_binary { - name: "android.hardware.usb@1.0-service.mtk", - relative_install_path: "hw", - init_rc: ["android.hardware.usb@1.0-service.mtk.rc"], - srcs: ["service.cpp", "Usb.cpp"], - shared_libs: [ - "libcutils", - "libhidlbase", - "libhidltransport", - "liblog", - "libhwbinder", - "libutils", - "libhardware", - "android.hardware.usb@1.0", - ], - proprietary: true, -} diff --git a/usb/Android.mk b/usb/Android.mk new file mode 100644 index 0000000..ad4802b --- /dev/null +++ b/usb/Android.mk @@ -0,0 +1,22 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) +LOCAL_MODULE_RELATIVE_PATH := hw +LOCAL_PROPRIETARY_MODULE := true +LOCAL_MODULE := android.hardware.usb@1.0-service.mtk +LOCAL_INIT_RC := android.hardware.usb@1.0-service.mtk.rc +LOCAL_SRC_FILES := \ + service.cpp \ + Usb.cpp + +LOCAL_SHARED_LIBRARIES := \ + libcutils \ + libhidlbase \ + libhidltransport \ + liblog \ + libutils \ + libhwbinder \ + libhardware \ + android.hardware.usb@1.0 \ + +include $(BUILD_EXECUTABLE) -- GitLab