Merge "Convert several libraries to soong."
diff --git a/ext4_utils/ext4_crypt_init_extensions.cpp b/ext4_utils/ext4_crypt_init_extensions.cpp
index ddbbd9a..e219d2f 100644
--- a/ext4_utils/ext4_crypt_init_extensions.cpp
+++ b/ext4_utils/ext4_crypt_init_extensions.cpp
@@ -28,7 +28,6 @@
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
-#include <cutils/klog.h>
#include <cutils/properties.h>
#include <cutils/sockets.h>
#include <logwrap/logwrap.h>
@@ -123,7 +122,7 @@
LOG(ERROR) << "Cannot read mode";
}
- KLOG_INFO(TAG, "Setting policy on %s\n", dir);
+ LOG(INFO) << "Setting policy on " << dir;
int result = e4crypt_policy_ensure(dir, policy.c_str(), policy.length(),
contents_encryption_mode.c_str());
if (result) {
diff --git a/ext4_utils/include/ext4_utils/make_ext4fs.h b/ext4_utils/include/ext4_utils/make_ext4fs.h
index 4498e62..c558b87 100644
--- a/ext4_utils/include/ext4_utils/make_ext4fs.h
+++ b/ext4_utils/include/ext4_utils/make_ext4fs.h
@@ -25,6 +25,10 @@
int make_ext4fs(const char *filename, long long len,
const char *mountpoint, struct selabel_handle *sehnd);
+int make_ext4fs_directory_align(const char *filename, long long len,
+ const char *mountpoint, struct selabel_handle *sehnd,
+ const char *directory, unsigned eraseblk,
+ unsigned logicalblk);
int make_ext4fs_directory(const char *filename, long long len,
const char *mountpoint, struct selabel_handle *sehnd,
const char *directory);
diff --git a/ext4_utils/make_ext4fs.c b/ext4_utils/make_ext4fs.c
index b59000d..ec093f8 100644
--- a/ext4_utils/make_ext4fs.c
+++ b/ext4_utils/make_ext4fs.c
@@ -447,6 +447,33 @@
return make_ext4fs_directory(filename, len, mountpoint, sehnd, NULL);
}
+int make_ext4fs_directory_align(const char *filename, long long len,
+ const char *mountpoint, struct selabel_handle *sehnd,
+ const char *directory, unsigned eraseblk,
+ unsigned logicalblk)
+{
+ int fd;
+ int status;
+
+ reset_ext4fs_info();
+ info.len = len;
+ info.flash_erase_block_size = eraseblk;
+ info.flash_logical_block_size = logicalblk;
+
+ fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
+ if (fd < 0) {
+ error_errno("open");
+ return EXIT_FAILURE;
+ }
+
+ status = make_ext4fs_internal(fd, directory, NULL, mountpoint, NULL,
+ 0, 0, 0, 1, 0,
+ sehnd, 0, -1, NULL, NULL, NULL);
+ close(fd);
+
+ return status;
+}
+
int make_ext4fs_directory(const char *filename, long long len,
const char *mountpoint, struct selabel_handle *sehnd,
const char *directory)
diff --git a/simpleperf/.gitignore b/simpleperf/.gitignore
new file mode 100644
index 0000000..7e99e36
--- /dev/null
+++ b/simpleperf/.gitignore
@@ -0,0 +1 @@
+*.pyc
\ No newline at end of file
diff --git a/simpleperf/scripts/app_profiler.config b/simpleperf/scripts/app_profiler.config
index f3aebde..4b61edb 100644
--- a/simpleperf/scripts/app_profiler.config
+++ b/simpleperf/scripts/app_profiler.config
@@ -34,16 +34,18 @@
recompile_app = True
-# Set to true if we want to restart the app before profiling. Otherwise, set to False.
-restart_app = True
+# If launch_activity is specified, we use `am start -n [app_package_name]/[launch_activity]` to start the app.
+launch_activity = '.MainActivity'
+
+# If launch_activity is not set, and launch_inst_test is, we launch an instrumentation test:
+# `am instrument -e class [launch_inst_test] [app_package_name]/android.support.test.runner.AndroidJUnitRunner`
+# Generally, will be of the form 'com.example.MyTestClass#myTestMethod'
+launch_inst_test = ''
-if recompile_app and not restart_app:
- raise Exception('[restart_app] is needed for [recompile_app] to take effect.')
-
-
-# We use `am start -n [app_package_name]/[main_activity]` to start the app.
-main_activity = '.MainActivity'
+if recompile_app and not launch_activity and not launch_inst_test:
+ raise Exception('one of [launch_activity or launch_inst_test] is'
+ + 'needed for [recompile_app] to take effect.')
# Profiling record options that will be passed directly to `simpleperf record` command on device.
@@ -66,4 +68,4 @@
# binary_cache_dir is used to cache binaries pulled from device. To report precisely, we pull each
# binary hit by perf.data on host.
-binary_cache_dir = "binary_cache"
\ No newline at end of file
+binary_cache_dir = "binary_cache"
diff --git a/simpleperf/scripts/app_profiler.py b/simpleperf/scripts/app_profiler.py
index e681ecd..a47f1aa 100644
--- a/simpleperf/scripts/app_profiler.py
+++ b/simpleperf/scripts/app_profiler.py
@@ -45,7 +45,7 @@
def __init__(self, config):
# check config variables
config_names = ['app_package_name', 'native_lib_dir', 'apk_file_path',
- 'recompile_app', 'restart_app', 'main_activity',
+ 'recompile_app', 'launch_activity', 'launch_inst_test',
'record_options', 'perf_data_path', 'adb_path', 'readelf_path',
'binary_cache_dir']
for name in config_names:
@@ -147,20 +147,30 @@
def _restart_app(self):
- if not self.config['restart_app']:
+ if not self.config['launch_activity'] and not self.config['launch_inst_test']:
return
+
pid = self._find_app_process()
if pid is not None:
self.run_in_app_dir(['kill', '-9', str(pid)])
time.sleep(1)
- activity = self.config['app_package_name'] + '/' + self.config['main_activity']
- result = self.adb.run(['shell', 'am', 'start', '-n', activity])
- if not result:
- log_fatal("Can't start activity %s" % activity)
+
+ if self.config['launch_activity']:
+ activity = self.config['app_package_name'] + '/' + self.config['launch_activity']
+ result = self.adb.run(['shell', 'am', 'start', '-n', activity])
+ if not result:
+ log_fatal("Can't start activity %s" % activity)
+ else:
+ runner = self.config['app_package_name'] + '/android.support.test.runner.AndroidJUnitRunner'
+ result = self.adb.run(['shell', 'am', 'instrument', '-e', 'class',
+ self.config['launch_inst_test'], runner])
+ if not result:
+ log_fatal("Can't start instrumentation test %s" % self.config['launch_inst_test'])
+
for i in range(10):
pid = self._find_app_process()
if pid is not None:
- return pid
+ return
time.sleep(1)
log_info('Wait for the app process for %d seconds' % (i + 1))
log_fatal("Can't find the app process")
@@ -289,4 +299,4 @@
args = parser.parse_args()
config = load_config(args.config)
profiler = AppProfiler(config)
- profiler.profile()
\ No newline at end of file
+ profiler.profile()
diff --git a/slideshow/Android.mk b/slideshow/Android.mk
index 8c782c3..f5d85a2 100644
--- a/slideshow/Android.mk
+++ b/slideshow/Android.mk
@@ -11,6 +11,5 @@
LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
LOCAL_CFLAGS := -D__STDC_LIMIT_MACROS -Werror
-LOCAL_C_INCLUDES := bootable/recovery
LOCAL_STATIC_LIBRARIES := libminui libpng libz libutils libstdc++ libcutils liblog libm libc
include $(BUILD_EXECUTABLE)
diff --git a/slideshow/slideshow.cpp b/slideshow/slideshow.cpp
index 15824f8..d3e9f83 100644
--- a/slideshow/slideshow.cpp
+++ b/slideshow/slideshow.cpp
@@ -19,19 +19,21 @@
#include <limits.h>
#include <time.h>
#include <linux/input.h>
+
+#include <functional>
+
#include <cutils/klog.h>
+#include <minui/minui.h>
#include <utils/SystemClock.h>
-#include "minui/minui.h"
#define NEXT_TIMEOUT_MS 5000
#define LAST_TIMEOUT_MS 30000
#define LOGE(x...) do { KLOG_ERROR("slideshow", x); } while (0)
-static int input_cb(int fd, unsigned int epevents, void *data)
+static int input_cb(int fd, unsigned int epevents, int *key_code)
{
struct input_event ev;
- int *key_code = (int *)data;
*key_code = -1;
@@ -108,7 +110,8 @@
return usage();
}
- if (gr_init() == -1 || ev_init(input_cb, &key_code) == -1) {
+ if (gr_init() == -1 || ev_init(std::bind(&input_cb, std::placeholders::_1,
+ std::placeholders::_2, &key_code)) == -1) {
LOGE("failed to initialize minui\n");
return EXIT_FAILURE;
}