sm8450-common: Add hals.conf to load sensors.xiaomi to odm and move notifier to subdir
Change-Id: I9e16531e60fa6a0122330ee352cddd0840feb39c
This commit is contained in:
37
sensors/sensor-notifier/include/SensorNotifier.h
Normal file
37
sensors/sensor-notifier/include/SensorNotifier.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <android/frameworks/sensorservice/1.0/ISensorManager.h>
|
||||
#include <thread>
|
||||
|
||||
using android::sp;
|
||||
using android::frameworks::sensorservice::V1_0::IEventQueue;
|
||||
using android::frameworks::sensorservice::V1_0::IEventQueueCallback;
|
||||
using android::frameworks::sensorservice::V1_0::ISensorManager;
|
||||
using android::frameworks::sensorservice::V1_0::Result;
|
||||
|
||||
class SensorNotifier {
|
||||
public:
|
||||
SensorNotifier(sp<ISensorManager> manager);
|
||||
virtual ~SensorNotifier();
|
||||
|
||||
void activate();
|
||||
void deactivate();
|
||||
|
||||
protected:
|
||||
Result initializeSensorQueue(std::string typeAsString, bool wakeup, sp<IEventQueueCallback>);
|
||||
virtual void notify() = 0;
|
||||
|
||||
sp<IEventQueue> mQueue;
|
||||
int32_t mSensorHandle = -1;
|
||||
bool mActive = false;
|
||||
|
||||
private:
|
||||
sp<ISensorManager> mManager;
|
||||
std::thread mThread;
|
||||
};
|
20
sensors/sensor-notifier/include/SensorNotifierExt.h
Normal file
20
sensors/sensor-notifier/include/SensorNotifierExt.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <android/frameworks/sensorservice/1.0/ISensorManager.h>
|
||||
|
||||
#include "SensorNotifier.h"
|
||||
|
||||
using android::sp;
|
||||
using android::frameworks::sensorservice::V1_0::ISensorManager;
|
||||
|
||||
class SensorNotifierExt {
|
||||
public:
|
||||
SensorNotifierExt(sp<ISensorManager> manager);
|
||||
std::vector<std::unique_ptr<SensorNotifier>> mNotifiers;
|
||||
};
|
12
sensors/sensor-notifier/include/SensorNotifierUtils.h
Normal file
12
sensors/sensor-notifier/include/SensorNotifierUtils.h
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <display/drm/mi_disp.h>
|
||||
|
||||
bool readBool(int fd);
|
||||
disp_event_resp* parseDispEvent(int fd);
|
46
sensors/sensor-notifier/include/SscCalApi.h
Normal file
46
sensors/sensor-notifier/include/SscCalApi.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
enum notify_t {
|
||||
BRIGHTNESS = 17,
|
||||
DC_STATE = 18,
|
||||
DISPLAY_FREQUENCY = 20,
|
||||
REPORT_VALUE = 201,
|
||||
POWER_STATE = 202,
|
||||
};
|
||||
|
||||
struct _oem_msg {
|
||||
uint32_t sensorType;
|
||||
notify_t notifyType;
|
||||
float unknown1;
|
||||
float unknown2;
|
||||
float notifyTypeFloat;
|
||||
float value;
|
||||
float unused[10];
|
||||
};
|
||||
|
||||
typedef void (*init_current_sensors_t)(bool debug);
|
||||
typedef void (*process_msg_t)(_oem_msg* msg);
|
||||
|
||||
class SscCalApiWrapper {
|
||||
public:
|
||||
static SscCalApiWrapper& getInstance();
|
||||
|
||||
void initCurrentSensors(bool debug);
|
||||
void processMsg(_oem_msg* msg);
|
||||
|
||||
private:
|
||||
SscCalApiWrapper();
|
||||
~SscCalApiWrapper();
|
||||
|
||||
void* mSscCalApiHandle;
|
||||
process_msg_t process_msg;
|
||||
init_current_sensors_t init_current_sensors;
|
||||
};
|
Reference in New Issue
Block a user