aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRygebin <kaankulahli2@gmail.com>2017-04-19 16:17:25 +0000
committerRygebin <kaankulahli2@gmail.com>2017-04-19 21:16:49 +0000
commit3cd78d654e37457b8303568fb86b095b48fce16d (patch)
tree4a5e35b75302fbf4ab426e4e699d1a26d60385a7
parent1140e7daa6e4e207eca58ec3379937ce6a9ced81 (diff)
Revert shamrock: healthd: Add libhealthd extension library
-rw-r--r--BoardConfig.mk2
-rw-r--r--charger/images/battery_fail.pngbin1368 -> 0 bytes
-rw-r--r--charger/images/battery_scale.pngbin463 -> 0 bytes
-rw-r--r--device.mk4
-rw-r--r--healthd/Android.mk8
-rw-r--r--healthd/healthd.h176
-rw-r--r--healthd/healthd_board_msm.cpp157
7 files changed, 0 insertions, 347 deletions
diff --git a/BoardConfig.mk b/BoardConfig.mk
index a84880d..702a72a 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -51,8 +51,6 @@ TARGET_USES_MEDIA_EXTENSIONS := true
# Charger
WITH_CM_CHARGER := false
BOARD_CHARGER_DISABLE_INIT_BLANK := true
-BOARD_HAL_STATIC_LIBRARIES += libhealthd.msm8952
-BOARD_HEALTHD_CUSTOM_CHARGER_RES := $(DEVICE_PATH)/charger/images
# Cryption
TARGET_KEYMASTER_WAIT_FOR_QSEE := true
diff --git a/charger/images/battery_fail.png b/charger/images/battery_fail.png
deleted file mode 100644
index aded88a..0000000
--- a/charger/images/battery_fail.png
+++ /dev/null
Binary files differ
diff --git a/charger/images/battery_scale.png b/charger/images/battery_scale.png
deleted file mode 100644
index 2ae8f0f..0000000
--- a/charger/images/battery_scale.png
+++ /dev/null
Binary files differ
diff --git a/device.mk b/device.mk
index 41582b8..39b3270 100644
--- a/device.mk
+++ b/device.mk
@@ -92,10 +92,6 @@ PRODUCT_PACKAGES += \
libmm-qcamera \
Camera2
-# Charger
-PRODUCT_PACKAGES += \
- charger_res_images
-
# Display
PRODUCT_PACKAGES += \
copybit.msm8952 \
diff --git a/healthd/Android.mk b/healthd/Android.mk
deleted file mode 100644
index bab15b4..0000000
--- a/healthd/Android.mk
+++ /dev/null
@@ -1,8 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := healthd_board_msm.cpp
-LOCAL_MODULE := libhealthd.$(TARGET_BOARD_PLATFORM)
-LOCAL_CFLAGS := -Werror
-LOCAL_C_INCLUDES := system/core/healthd bootable/recovery
-include $(BUILD_STATIC_LIBRARY)
diff --git a/healthd/healthd.h b/healthd/healthd.h
deleted file mode 100644
index 1f0d28c..0000000
--- a/healthd/healthd.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- * 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.
- */
-
-#ifndef _HEALTHD_H_
-#define _HEALTHD_H_
-
-#include <batteryservice/BatteryService.h>
-#include <sys/types.h>
-#include <utils/Errors.h>
-#include <utils/String8.h>
-
-// periodic_chores_interval_fast, periodic_chores_interval_slow: intervals at
-// which healthd wakes up to poll health state and perform periodic chores,
-// in units of seconds:
-//
-// periodic_chores_interval_fast is used while the device is not in
-// suspend, or in suspend and connected to a charger (to watch for battery
-// overheat due to charging). The default value is 60 (1 minute). Value
-// -1 turns off periodic chores (and wakeups) in these conditions.
-//
-// periodic_chores_interval_slow is used when the device is in suspend and
-// not connected to a charger (to watch for a battery drained to zero
-// remaining capacity). The default value is 600 (10 minutes). Value -1
-// tuns off periodic chores (and wakeups) in these conditions.
-//
-// power_supply sysfs attribute file paths. Set these to specific paths
-// to use for the associated battery parameters. healthd will search for
-// appropriate power_supply attribute files to use for any paths left empty:
-//
-// batteryStatusPath: charging status (POWER_SUPPLY_PROP_STATUS)
-// batteryHealthPath: battery health (POWER_SUPPLY_PROP_HEALTH)
-// batteryPresentPath: battery present (POWER_SUPPLY_PROP_PRESENT)
-// batteryCapacityPath: remaining capacity (POWER_SUPPLY_PROP_CAPACITY)
-// batteryVoltagePath: battery voltage (POWER_SUPPLY_PROP_VOLTAGE_NOW)
-// batteryTemperaturePath: battery temperature (POWER_SUPPLY_PROP_TEMP)
-// batteryTechnologyPath: battery technology (POWER_SUPPLY_PROP_TECHNOLOGY)
-// batteryCurrentNowPath: battery current (POWER_SUPPLY_PROP_CURRENT_NOW)
-// batteryCurrentAvgPath: battery average (POWER_SUPPLY_PROP_CURRENT_AVG)
-// batteryChargeCounterPath: battery accumulated charge
-// (POWER_SUPPLY_PROP_CHARGE_COUNTER)
-//
-// dockBatteryStatusPath: dock charging status (POWER_SUPPLY_PROP_STATUS)
-// dockBatteryHealthPath: dock battery health (POWER_SUPPLY_PROP_HEALTH)
-// dockBatteryPresentPath: dock battery present (POWER_SUPPLY_PROP_PRESENT)
-// dockBatteryCapacityPath: remaining dock capacity (POWER_SUPPLY_PROP_CAPACITY)
-// dockBatteryVoltagePath: dock battery voltage (POWER_SUPPLY_PROP_VOLTAGE_NOW)
-// dockBatteryTemperaturePath: dock battery temperature (POWER_SUPPLY_PROP_TEMP)
-// dockBatteryTechnologyPath: dock battery technology (POWER_SUPPLY_PROP_TECHNOLOGY)
-// dockBatteryCurrentNowPath: dock battery current (POWER_SUPPLY_PROP_CURRENT_NOW)
-// dockBatteryCurrentAvgPath: dock battery average (POWER_SUPPLY_PROP_CURRENT_AVG)
-// dockBatteryChargeCounterPath: dock battery accumulated charge
-// (POWER_SUPPLY_PROP_CHARGE_COUNTER)
-//
-// The dockBatterySupported property indicates whether a dock battery is supported
-// by the device, and whether this module should fetch dock battery values.
-// Defaults is to false.
-
-struct healthd_config {
- int periodic_chores_interval_fast;
- int periodic_chores_interval_slow;
-
- android::String8 batteryStatusPath;
- android::String8 batteryHealthPath;
- android::String8 batteryPresentPath;
- android::String8 batteryCapacityPath;
- android::String8 batteryVoltagePath;
- android::String8 batteryTemperaturePath;
- android::String8 batteryTechnologyPath;
- android::String8 batteryCurrentNowPath;
- android::String8 batteryCurrentAvgPath;
- android::String8 batteryChargeCounterPath;
- android::String8 batteryFullChargePath;
- android::String8 batteryCycleCountPath;
-
- int (*energyCounter)(int64_t *);
- int boot_min_cap;
- bool (*screen_on)(android::BatteryProperties *props);
-
- bool dockBatterySupported;
- android::String8 dockBatteryStatusPath;
- android::String8 dockBatteryHealthPath;
- android::String8 dockBatteryPresentPath;
- android::String8 dockBatteryCapacityPath;
- android::String8 dockBatteryVoltagePath;
- android::String8 dockBatteryTemperaturePath;
- android::String8 dockBatteryTechnologyPath;
- android::String8 dockBatteryCurrentNowPath;
- android::String8 dockBatteryCurrentAvgPath;
- android::String8 dockBatteryChargeCounterPath;
-
- int (*dockEnergyCounter)(int64_t *);
-};
-
-// Global helper functions
-
-int healthd_register_event(int fd, void (*handler)(uint32_t));
-void healthd_battery_update();
-android::status_t healthd_get_property(int id,
- struct android::BatteryProperty *val);
-android::status_t healthd_get_dock_property(int id,
- struct android::BatteryProperty *val);
-void healthd_dump_battery_state(int fd);
-
-struct healthd_mode_ops {
- void (*init)(struct healthd_config *config);
- int (*preparetowait)(void);
- void (*heartbeat)(void);
- void (*battery_update)(struct android::BatteryProperties *props);
-};
-
-extern struct healthd_mode_ops *healthd_mode_ops;
-
-// Charger mode
-
-void healthd_mode_charger_init(struct healthd_config *config);
-int healthd_mode_charger_preparetowait(void);
-void healthd_mode_charger_heartbeat(void);
-void healthd_mode_charger_battery_update(
- struct android::BatteryProperties *props);
-
-// The following are implemented in libhealthd_board to handle board-specific
-// behavior.
-//
-// healthd_board_init() is called at startup time to modify healthd's
-// configuration according to board-specific requirements. config
-// points to the healthd configuration values described above. To use default
-// values, this function can simply return without modifying the fields of the
-// config parameter.
-
-void healthd_board_init(struct healthd_config *config);
-
-// Process updated battery property values. This function is called when
-// the kernel sends updated battery status via a uevent from the power_supply
-// subsystem, or when updated values are polled by healthd, as for periodic
-// poll of battery state.
-//
-// props are the battery properties read from the kernel. These values may
-// be modified in this call, prior to sending the modified values to the
-// Android runtime.
-//
-// Return 0 to indicate the usual kernel log battery status heartbeat message
-// is to be logged, or non-zero to prevent logging this information.
-
-int healthd_board_battery_update(struct android::BatteryProperties *props);
-
-//This API is called to turn on/off the display backlight incase it can't be
-//handle correcty in the display driver by calling gr_fg_blank();
-void healthd_board_mode_charger_set_backlight(bool en);
-
-//This API is called to update the battery/charging status by using the user
-//noticeable method other then the animation, such as: LEDs
-void healthd_board_mode_charger_battery_update(struct android::BatteryProperties *batt_prop);
-
-//This API is used to handle some board specific charger mode initialization,
-//such as: checking the charging is enabled or not.
-void healthd_board_mode_charger_init(void);
-
-//This API is called in the draw_battery() function to draw more infomation
-//about the battery on the animation, such as the SoC (State of Charge).
-void healthd_board_mode_charger_draw_battery(struct android::BatteryProperties *batt_prop);
-
-#endif /* _HEALTHD_H_ */
diff --git a/healthd/healthd_board_msm.cpp b/healthd/healthd_board_msm.cpp
deleted file mode 100644
index a7e9da1..0000000
--- a/healthd/healthd_board_msm.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- *Copyright (c) 2015, The Linux Foundation. All rights reserved.
- *
- *Redistribution and use in source and binary forms, with or without
- *modification, are permitted provided that the following conditions are
- *met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of The Linux Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- *THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- *WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- *ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- *BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- *WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- *OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- *IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <dirent.h>
-#include <errno.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <cutils/klog.h>
-#include <batteryservice/BatteryService.h>
-#include <cutils/android_reboot.h>
-#include <healthd.h>
-#include "minui/minui.h"
-
-#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
-
-#define BACKLIGHT_PATH "/sys/class/leds/lcd-backlight/brightness"
-
-#define CHARGING_ENABLED_PATH "/sys/class/power_supply/battery/charging_enabled"
-#define CHARGER_TYPE_PATH "/sys/class/power_supply/usb/type"
-
-#define LOGE(x...) do { KLOG_ERROR("charger", x); } while (0)
-#define LOGW(x...) do { KLOG_WARNING("charger", x); } while (0)
-#define LOGV(x...) do { KLOG_DEBUG("charger", x); } while (0)
-
-static int write_file_int(char const* path, int value)
-{
- int fd;
- char buffer[20];
- int rc = -1, bytes;
-
- fd = open(path, O_WRONLY);
- if (fd >= 0) {
- bytes = snprintf(buffer, sizeof(buffer), "%d\n", value);
- rc = write(fd, buffer, bytes);
- close(fd);
- }
-
- return rc > 0 ? 0 : -1;
-}
-
-#define STR_LEN 8
-void healthd_board_mode_charger_draw_battery(
- struct android::BatteryProperties *batt_prop)
-{
- char cap_str[STR_LEN];
- int x, y;
- int str_len_px;
- static int char_height = -1, char_width = -1;
-
- if (char_height == -1 && char_width == -1)
- gr_font_size(&char_width, &char_height);
- snprintf(cap_str, (STR_LEN - 1), "%d%%", batt_prop->batteryLevel);
- str_len_px = gr_measure(cap_str);
- x = (gr_fb_width() - str_len_px) / 2;
- y = (gr_fb_height() + char_height) / 2;
- gr_color(0xa4, 0xc6, 0x39, 255);
- gr_text(x, y, cap_str, 0);
-}
-
-void healthd_board_mode_charger_battery_update(struct android::BatteryProperties*)
-{
-
-}
-
-#define BACKLIGHT_ON_LEVEL 100
-#define BACKLIGHT_OFF_LEVEL 0
-void healthd_board_mode_charger_set_backlight(bool en)
-{
- int fd;
- char buffer[10];
-
- if (access(BACKLIGHT_PATH, R_OK | W_OK) != 0)
- {
- LOGW("Backlight control not support\n");
- return;
- }
-
- memset(buffer, '\0', sizeof(buffer));
- fd = open(BACKLIGHT_PATH, O_RDWR);
- if (fd < 0) {
- LOGE("Could not open backlight node : %s\n", strerror(errno));
- goto cleanup;
- }
- LOGV("set backlight status to %d\n", en);
- if (en)
- snprintf(buffer, sizeof(buffer), "%d\n", BACKLIGHT_ON_LEVEL);
- else
- snprintf(buffer, sizeof(buffer), "%d\n", BACKLIGHT_OFF_LEVEL);
-
- if (write(fd, buffer,strlen(buffer)) < 0) {
- LOGE("Could not write to backlight node : %s\n", strerror(errno));
- goto cleanup;
- }
-cleanup:
- if (fd >= 0)
- close(fd);
-}
-
-void healthd_board_mode_charger_init()
-{
- int ret;
- char buff[8] = "\0";
- int charging_enabled = 0;
- int fd;
-
- /* check the charging is enabled or not */
- fd = open(CHARGING_ENABLED_PATH, O_RDONLY);
- if (fd < 0)
- return;
- ret = read(fd, buff, sizeof(buff));
- close(fd);
- if (ret > 0 && sscanf(buff, "%d\n", &charging_enabled)) {
- /* if charging is disabled, reboot and exit power off charging */
- if (charging_enabled)
- return;
- LOGW("android charging is disabled, exit!\n");
- android_reboot(ANDROID_RB_RESTART, 0, 0);
- }
-}
-
-void healthd_board_init(struct healthd_config*)
-{
- // use defaults
-}
-
-int healthd_board_battery_update(struct android::BatteryProperties*)
-{
- // return 0 to log periodic polled battery status to kernel log
- return 1;
-}