resolved conflicts for merge of 4be36106 to lmp-mr1-dev-plus-aosp
Change-Id: If504710a618d8c3adf85297d5fd2909558ed57a3
diff --git a/Android.mk b/Android.mk
index dd61dc1..fc644b5 100644
--- a/Android.mk
+++ b/Android.mk
@@ -61,6 +61,7 @@
LOCAL_SHARED_LIBRARIES := $(common_shared_libraries)
LOCAL_STATIC_LIBRARIES := $(common_static_libraries)
LOCAL_MODULE_TAGS := eng tests
+LOCAL_CFLAGS := -Werror -Wall -Wno-missing-field-initializers
LOCAL_CXX_STL := libc++
include $(BUILD_STATIC_LIBRARY)
@@ -75,7 +76,8 @@
$(common_src_files)
LOCAL_C_INCLUDES := $(common_c_includes)
-LOCAL_CFLAGS := -Werror=format
+
+LOCAL_CFLAGS := -Werror -Wall -Wno-missing-field-initializers
ifeq ($(TARGET_HW_DISK_ENCRYPTION),true)
LOCAL_C_INCLUDES += $(TARGET_CRYPTFS_HW_PATH)
@@ -96,5 +98,6 @@
LOCAL_SRC_FILES:= vdc.c
LOCAL_MODULE:= vdc
LOCAL_SHARED_LIBRARIES := libcutils
+LOCAL_CFLAGS := -Werror -Wall -Wno-missing-field-initializers
include $(BUILD_EXECUTABLE)
diff --git a/CheckBattery.cpp b/CheckBattery.cpp
index 21d426b..6390d02 100644
--- a/CheckBattery.cpp
+++ b/CheckBattery.cpp
@@ -22,68 +22,6 @@
using namespace android;
-namespace
-{
- // How often to check battery in seconds
- const int CHECK_PERIOD = 30;
-
- // How charged should the battery be (percent) to start encrypting
- const int START_THRESHOLD = 10;
-
- // How charged should the battery be (percent) to continue encrypting
- const int CONTINUE_THRESHOLD = 5;
-
- const String16 serviceName("batteryproperties");
-
- sp<IBinder> bs;
- sp<IBatteryPropertiesRegistrar> interface;
-
- bool singletonInitialized = false;
- time_t last_checked = {0};
- int last_result = 100;
-
- int is_battery_ok(int threshold)
- {
- time_t now = time(NULL);
- if (now == -1 || difftime(now, last_checked) < 5) {
- goto finish;
- }
- last_checked = now;
-
- if (!singletonInitialized) {
- bs = defaultServiceManager()->checkService(serviceName);
- if (bs == NULL) {
- SLOGE("No batteryproperties service!");
- goto finish;
- }
-
- interface = interface_cast<IBatteryPropertiesRegistrar>(bs);
- if (interface == NULL) {
- SLOGE("No IBatteryPropertiesRegistrar interface");
- goto finish;
- }
-
- singletonInitialized = true;
- }
-
- {
- BatteryProperty val;
- status_t status = interface
- ->getProperty(android::BATTERY_PROP_CAPACITY, &val);
- if (status == NO_ERROR) {
- SLOGD("Capacity is %d", (int)val.valueInt64);
- last_result = val.valueInt64;
- } else {
- SLOGE("Failed to get battery charge");
- last_result = 100;
- }
- }
-
- finish:
- return last_result >= threshold;
- }
-}
-
extern "C"
{
int is_battery_ok_to_start()
diff --git a/CommandListener.cpp b/CommandListener.cpp
index f135a01..df4c627 100644
--- a/CommandListener.cpp
+++ b/CommandListener.cpp
@@ -216,7 +216,6 @@
if (!rc) {
cli->sendMsg(ResponseCode::CommandOkay, "volume operation succeeded", false);
} else {
- int erno = errno;
rc = ResponseCode::convertFromErrno();
cli->sendMsg(rc, "volume operation failed", true);
}
diff --git a/Devmapper.cpp b/Devmapper.cpp
index 700e538..703902f 100644
--- a/Devmapper.cpp
+++ b/Devmapper.cpp
@@ -296,7 +296,7 @@
void *Devmapper::_align(void *ptr, unsigned int a)
{
- register unsigned long agn = --a;
+ unsigned long agn = --a;
return (void *) (((unsigned long) ptr + agn) & ~agn);
}
diff --git a/Ext4.cpp b/Ext4.cpp
index dc31fd0..f5a964a 100644
--- a/Ext4.cpp
+++ b/Ext4.cpp
@@ -112,7 +112,6 @@
}
int Ext4::format(const char *fsPath, unsigned int numSectors, const char *mountpoint) {
- int fd;
const char *args[7];
int rc;
int status;
diff --git a/Fat.cpp b/Fat.cpp
index cd4ea5f..6ac1f8a 100644
--- a/Fat.cpp
+++ b/Fat.cpp
@@ -50,7 +50,6 @@
extern "C" int mount(const char *, const char *, const char *, unsigned long, const void *);
int Fat::check(const char *fsPath) {
- bool rw = true;
if (access(FSCK_MSDOS_PATH, X_OK)) {
SLOGW("Skipping fs checks\n");
return 0;
@@ -170,7 +169,6 @@
}
int Fat::format(const char *fsPath, unsigned int numSectors, bool wipe) {
- int fd;
const char *args[11];
int rc;
int status;
diff --git a/Process.cpp b/Process.cpp
index 08be28e..b675436 100644
--- a/Process.cpp
+++ b/Process.cpp
@@ -191,7 +191,6 @@
}
while ((de = readdir(dir))) {
- int killed = 0;
int pid = getPid(de->d_name);
char name[PATH_MAX];
diff --git a/Volume.cpp b/Volume.cpp
index bfad29d..75cc4c1 100644
--- a/Volume.cpp
+++ b/Volume.cpp
@@ -332,7 +332,7 @@
int Volume::mountVol() {
dev_t deviceNodes[4];
- int n, i, rc = 0;
+ int n, i;
char errmsg[255];
int flags = getFlags();
@@ -454,7 +454,6 @@
}
errno = 0;
- int gid;
if (Fat::doMount(devicePath, getMountpoint(), false, false, false,
AID_MEDIA_RW, AID_MEDIA_RW, 0007, true)) {
@@ -549,8 +548,6 @@
}
int Volume::unmountVol(bool force, bool revert) {
- int i, rc;
-
int flags = getFlags();
bool providesAsec = (flags & VOL_PROVIDES_ASEC) != 0;
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index 14f1509..0409ce8 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -238,7 +238,9 @@
}
void VolumeManager::handleBlockEvent(NetlinkEvent *evt) {
+#ifdef NETLINK_DEBUG
const char *devpath = evt->findParam("DEVPATH");
+#endif
/* Lookup a volume to handle this device */
VolumeCollection::iterator it;
@@ -1216,8 +1218,6 @@
int VolumeManager::findAsec(const char *id, char *asecPath, size_t asecPathLen,
const char **directory) const {
- int dirfd, fd;
- const int idLen = strlen(id);
char *asecName;
if (!isLegalAsecId(id)) {
@@ -1297,7 +1297,7 @@
char dmDevice[255];
bool cleanupDm = false;
- int fd;
+
unsigned int nr_sec = 0;
struct asec_superblock sb;
diff --git a/cryptfs.c b/cryptfs.c
index 62fdf70..7770f72 100644
--- a/cryptfs.c
+++ b/cryptfs.c
@@ -479,7 +479,7 @@
static int put_crypt_ftr_and_key(struct crypt_mnt_ftr *crypt_ftr)
{
int fd;
- unsigned int nr_sec, cnt;
+ unsigned int cnt;
/* starting_off is set to the SEEK_SET offset
* where the crypto structure starts
*/
@@ -618,7 +618,7 @@
static int get_crypt_ftr_and_key(struct crypt_mnt_ftr *crypt_ftr)
{
int fd;
- unsigned int nr_sec, cnt;
+ unsigned int cnt;
off64_t starting_off;
int rc = -1;
char *fname = NULL;
@@ -811,7 +811,6 @@
char *fname;
off64_t write_offset;
off64_t erase_offset;
- int found = 0;
int fd;
int ret;
@@ -1036,7 +1035,6 @@
char buffer[DM_CRYPT_BUF_SIZE];
struct dm_ioctl *io;
struct dm_target_versions *v;
- int i;
io = (struct dm_ioctl *) buffer;
@@ -1072,13 +1070,9 @@
char *real_blk_name, char *crypto_blk_name, const char *name)
{
char buffer[DM_CRYPT_BUF_SIZE];
- char master_key_ascii[129]; /* Large enough to hold 512 bit key and null */
- char *crypt_params;
struct dm_ioctl *io;
- struct dm_target_spec *tgt;
unsigned int minor;
int fd=0;
- int i;
int retval = -1;
int version[3];
char *extra_params;
@@ -1435,8 +1429,6 @@
struct crypt_mnt_ftr *crypt_ftr) {
int fd;
unsigned char key_buf[KEY_LEN_BYTES];
- EVP_CIPHER_CTX e_ctx;
- int encrypted_len, final_len;
/* Get some random bits for a key */
fd = open("/dev/urandom", O_RDONLY);
@@ -1562,13 +1554,8 @@
/* returns < 0 on failure */
static int cryptfs_restart_internal(int restart_main)
{
- char fs_type[32];
- char real_blkdev[MAXPATHLEN];
char crypto_blkdev[MAXPATHLEN];
- char fs_options[256];
- unsigned long mnt_flags;
- struct stat statbuf;
- int rc = -1, i;
+ int rc = -1;
static int restart_successful = 0;
/* Validate that it's OK to call this routine */
@@ -1749,8 +1736,6 @@
char tmp_mount_point[64];
unsigned int orig_failed_decrypt_count;
int rc;
- kdf_func kdf;
- void *kdf_params;
int use_keymaster = 0;
int upgrade = 0;
unsigned char* intermediate_key = 0;
@@ -1904,7 +1889,8 @@
char real_blkdev[MAXPATHLEN], crypto_blkdev[MAXPATHLEN];
struct crypt_mnt_ftr sd_crypt_ftr;
struct stat statbuf;
- int nr_sec, fd;
+ unsigned int nr_sec;
+ int fd;
sprintf(real_blkdev, "/dev/block/vold/%d:%d", major, minor);
@@ -2578,7 +2564,6 @@
off64_t tot_size,
off64_t previously_encrypted_upto)
{
- u32 i;
struct encryptGroupsData data;
struct f2fs_info *f2fs_info = NULL;
int rc = ENABLE_INPLACE_ERR_OTHER;
@@ -2872,7 +2857,7 @@
int previously_encrypted_upto)
{
off64_t cur_encryption_done=0, tot_encryption_size=0;
- int i, rc = -1;
+ int rc = -1;
if (!is_battery_ok_to_start()) {
SLOGW("Not starting encryption due to low battery");
@@ -2927,7 +2912,7 @@
char crypto_blkdev[MAXPATHLEN], real_blkdev[MAXPATHLEN];
unsigned long nr_sec;
unsigned char decrypted_master_key[KEY_LEN_BYTES];
- int rc=-1, fd, i, ret;
+ int rc=-1, fd, i;
struct crypt_mnt_ftr crypt_ftr;
struct crypt_persist_data *pdata;
char encrypted_state[PROPERTY_VALUE_MAX];
@@ -3315,7 +3300,6 @@
int cryptfs_changepw(int crypt_type, const char *newpw)
{
struct crypt_mnt_ftr crypt_ftr;
- unsigned char decrypted_master_key[KEY_LEN_BYTES];
/* This is only allowed after we've successfully decrypted the master key */
if (!master_key_saved) {
@@ -3541,7 +3525,6 @@
int cryptfs_getfield(const char *fieldname, char *value, int len)
{
char temp_value[PROPERTY_VALUE_MAX];
- char real_blkdev[MAXPATHLEN];
/* CRYPTO_GETFIELD_OK is success,
* CRYPTO_GETFIELD_ERROR_NO_FIELD is value not set,
* CRYPTO_GETFIELD_ERROR_BUF_TOO_SMALL is buffer (as given by len) too small,
@@ -3602,9 +3585,6 @@
/* Set the value of the specified field. */
int cryptfs_setfield(const char *fieldname, const char *value)
{
- struct crypt_persist_data stored_pdata;
- struct crypt_persist_data *pdata_p;
- struct crypt_mnt_ftr crypt_ftr;
char encrypted_state[PROPERTY_VALUE_MAX];
/* 0 is success, negative values are error */
int rc = CRYPTO_SETFIELD_ERROR_OTHER;