am 9a2f2ef1: am 419c27b9: Do not reset out_get_presentation_position() to 0 on standby
* commit '9a2f2ef14f6655cb4f71edca2553bbad3cc62795':
Do not reset out_get_presentation_position() to 0 on standby
diff --git a/include/hardware/boot_control.h b/include/hardware/boot_control.h
new file mode 100644
index 0000000..62d6918
--- /dev/null
+++ b/include/hardware/boot_control.h
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2015 The Android Open Source 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 ANDROID_INCLUDE_HARDWARE_BOOT_CONTROL_H
+#define ANDROID_INCLUDE_HARDWARE_BOOT_CONTROL_H
+
+#include <hardware/hardware.h>
+
+__BEGIN_DECLS
+
+#define BOOT_CONTROL_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1)
+
+/**
+ * The id of this module
+ */
+#define BOOT_CONTROL_HARDWARE_MODULE_ID "bootctrl"
+
+/*
+ * The Boot Control HAL is designed to allow for managing sets of redundant
+ * partitions, called slots, that can be booted from independantly. Slots
+ * are sets of partitions whose names differ only by a given suffix.
+ * They are identified here by a 0 indexed number, and associated with their
+ * suffix, which can be appended to the base name for any particular partition
+ * to find the one associated with that slot. The bootloader must pass the suffix
+ * of the currently active slot either through a kernel command line property at
+ * androidboot.slot_suffix, or the device tree at /firmware/android/slot_suffix.
+ * The primary use of this set up is to allow for background updates while the
+ * device is running, and to provide a fallback in the event that the update fails.
+ */
+
+
+/**
+ * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM
+ * and the fields of this data structure must begin with hw_module_t
+ * followed by module specific information.
+ */
+typedef struct boot_control_module {
+ struct hw_module_t common;
+
+ /*
+ * (*init)() perform any initialization tasks needed for the HAL.
+ * This is called only once.
+ */
+ void (*init)(struct boot_control_module *module);
+
+ /*
+ * (*getNumberSlots)() returns the number of available slots.
+ * For instance, a system with a single set of partitions would return
+ * 1, a system with A/B would return 2, A/B/C -> 3...
+ */
+ unsigned (*getNumberSlots)(struct boot_control_module *module);
+
+ /*
+ * (*getCurrentSlot)() returns the value letting the system know
+ * whether the current slot is A or B. The meaning of A and B is
+ * left up to the implementer. It is assumed that if the current slot
+ * is A, then the block devices underlying B can be accessed directly
+ * without any risk of corruption.
+ * The returned value is always guaranteed to be strictly less than the
+ * value returned by getNumberSlots. Slots start at 0 and
+ * finish at getNumberSlots() - 1
+ */
+ unsigned (*getCurrentSlot)(struct boot_control_module *module);
+
+ /*
+ * (*markBootSuccessful)() marks the current slot
+ * as having booted successfully
+ *
+ * Returns 0 on success, -errno on error.
+ */
+ int (*markBootSuccessful)(struct boot_control_module *module);
+
+ /*
+ * (*setActiveBootSlot)() marks the slot passed in parameter as
+ * the active boot slot (see getCurrentSlot for an explanation
+ * of the "slot" parameter). This overrides any previous call to
+ * setSlotAsUnbootable.
+ * Returns 0 on success, -errno on error.
+ */
+ int (*setActiveBootSlot)(struct boot_control_module *module, unsigned slot);
+
+ /*
+ * (*setSlotAsUnbootable)() marks the slot passed in parameter as
+ * an unbootable. This can be used while updating the contents of the slot's
+ * partitions, so that the system will not attempt to boot a known bad set up.
+ * Returns 0 on success, -errno on error.
+ */
+ int (*setSlotAsUnbootable)(struct boot_control_module *module, unsigned slot);
+
+ /*
+ * (*isSlotBootable)() returns if the slot passed in parameter has
+ * booted successfully in the past.
+ * Returns 1 if the slot has booted successfully, 0 if it has not,
+ * and -errno on error.
+ */
+ int (*isSlotBootable)(struct boot_control_module *module, unsigned slot);
+
+ /*
+ * (*getSuffix)() returns the string suffix used by partitions that
+ * correspond to the slot number passed in parameter. The returned string
+ * is expected to be statically allocated and not need to be freed.
+ * Returns NULL if slot does not match an existing slot.
+ */
+ const char* (*getSuffix)(struct boot_control_module *module, unsigned slot);
+
+ void* reserved[32];
+} boot_control_module_t;
+
+
+__END_DECLS
+
+#endif // ANDROID_INCLUDE_HARDWARE_BOOT_CONTROL_H
diff --git a/modules/gralloc/framebuffer.cpp b/modules/gralloc/framebuffer.cpp
index 486e27a..eadcdaa 100644
--- a/modules/gralloc/framebuffer.cpp
+++ b/modules/gralloc/framebuffer.cpp
@@ -33,7 +33,7 @@
#include <cutils/log.h>
#include <cutils/atomic.h>
-#if HAVE_ANDROID_OS
+#ifdef __ANDROID__
#include <linux/fb.h>
#endif
diff --git a/modules/sensors/Android.mk b/modules/sensors/Android.mk
index 445f69e..94d100b 100644
--- a/modules/sensors/Android.mk
+++ b/modules/sensors/Android.mk
@@ -20,9 +20,9 @@
include $(CLEAR_VARS)
-LOCAL_MODULE := sensors.$(TARGET_DEVICE)
+LOCAL_MODULE := sensors.$(TARGET_BOARD_PLATFORM)
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
+LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_CFLAGS := -DLOG_TAG=\"MultiHal\"
diff --git a/modules/sensors/multihal.cpp b/modules/sensors/multihal.cpp
index d26d168..8330ff3 100644
--- a/modules/sensors/multihal.cpp
+++ b/modules/sensors/multihal.cpp
@@ -27,6 +27,8 @@
#include <cutils/log.h>
#include <vector>
+#include <string>
+#include <fstream>
#include <map>
#include <string>
@@ -38,8 +40,6 @@
#include <stdlib.h>
static const char* CONFIG_FILENAME = "/system/etc/sensors/hals.conf";
-static const char* LEGAL_SUBHAL_PATH_PREFIX = "/system/lib/hw/";
-static const char* LEGAL_SUBHAL_ALTERNATE_PATH_PREFIX = "/system/vendor/lib/";
static const int MAX_CONF_LINE_LENGTH = 1024;
static pthread_mutex_t init_modules_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -465,39 +465,19 @@
* Adds valid paths from the config file to the vector passed in.
* The vector must not be null.
*/
-static void get_so_paths(std::vector<char*> *so_paths) {
- FILE *conf_file = fopen(CONFIG_FILENAME, "r");
- if (conf_file == NULL) {
+static void get_so_paths(std::vector<std::string> *so_paths) {
+ std::string line;
+ std::ifstream conf_file(CONFIG_FILENAME);
+
+ if(!conf_file) {
ALOGW("No multihal config file found at %s", CONFIG_FILENAME);
return;
}
ALOGV("Multihal config file found at %s", CONFIG_FILENAME);
- char *line = NULL;
- size_t len = 0;
- int line_count = 0;
- while (getline(&line, &len, conf_file) != -1) {
- // overwrite trailing eoln with null char
- char* pch = strchr(line, '\n');
- if (pch != NULL) {
- *pch = '\0';
- }
- ALOGV("config file line #%d: '%s'", ++line_count, line);
- char *real_path = realpath(line, NULL);
- if (starts_with(real_path, LEGAL_SUBHAL_PATH_PREFIX) ||
- starts_with(real_path, LEGAL_SUBHAL_ALTERNATE_PATH_PREFIX)) {
- ALOGV("accepting valid path '%s'", real_path);
- char* compact_line = new char[strlen(real_path) + 1];
- strcpy(compact_line, real_path);
- so_paths->push_back(compact_line);
- } else {
- ALOGW("rejecting path '%s' because it does not start with '%s' or '%s'",
- real_path, LEGAL_SUBHAL_PATH_PREFIX, LEGAL_SUBHAL_ALTERNATE_PATH_PREFIX);
- }
- free(real_path);
+ while (std::getline(conf_file, line)) {
+ ALOGV("config file line: '%s'", line.c_str());
+ so_paths->push_back(line);
}
- free(line);
- fclose(conf_file);
- ALOGV("hals.conf contained %d lines", line_count);
}
/*
@@ -510,15 +490,15 @@
pthread_mutex_unlock(&init_modules_mutex);
return;
}
- std::vector<char*> *so_paths = new std::vector<char*>();
+ std::vector<std::string> *so_paths = new std::vector<std::string>();
get_so_paths(so_paths);
// dlopen the module files and cache their module symbols in sub_hw_modules
sub_hw_modules = new std::vector<hw_module_t *>();
dlerror(); // clear any old errors
const char* sym = HAL_MODULE_INFO_SYM_AS_STR;
- for (std::vector<char*>::iterator it = so_paths->begin(); it != so_paths->end(); it++) {
- char* path = *it;
+ for (std::vector<std::string>::iterator it = so_paths->begin(); it != so_paths->end(); it++) {
+ const char* path = it->c_str();
void* lib_handle = dlopen(path, RTLD_LAZY);
if (lib_handle == NULL) {
ALOGW("dlerror(): %s", dlerror());
diff --git a/tests/camera2/ForkedTests.cpp b/tests/camera2/ForkedTests.cpp
index 315233e..39599da 100644
--- a/tests/camera2/ForkedTests.cpp
+++ b/tests/camera2/ForkedTests.cpp
@@ -16,6 +16,8 @@
#include <gtest/gtest.h>
+#include <stdlib.h>
+
#include "TestExtensions.h"
namespace android {
@@ -37,9 +39,7 @@
// intentionally fail
TEST_F(DISABLED_ForkedTest, FailCrash) {
TEST_EXTENSION_FORKING_INIT;
-
- //intentionally crash
- *(int*)0 = 0xDEADBEEF;
+ abort();
}
TEST_F(DISABLED_ForkedTest, SucceedNormal) {