summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
Diffstat (limited to 'cmds')
-rw-r--r--cmds/atrace/atrace.cpp1
-rw-r--r--cmds/dumpsys/dumpsys.cpp12
-rw-r--r--cmds/flatland/Main.cpp80
-rw-r--r--cmds/installd/commands.c103
-rw-r--r--cmds/installd/installd.c4
-rw-r--r--cmds/rawbu/backup.cpp6
-rw-r--r--cmds/service/service.cpp17
7 files changed, 177 insertions, 46 deletions
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index 1911839..6d6f77e 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -82,6 +82,7 @@ static const TracingCategory k_categories[] = {
{ "hal", "Hardware Modules", ATRACE_TAG_HAL, { } },
{ "res", "Resource Loading", ATRACE_TAG_RESOURCES, { } },
{ "dalvik", "Dalvik VM", ATRACE_TAG_DALVIK, { } },
+ { "rs", "RenderScript", ATRACE_TAG_RS, { } },
{ "sched", "CPU Scheduling", 0, {
{ REQ, "/sys/kernel/debug/tracing/events/sched/sched_switch/enable" },
{ REQ, "/sys/kernel/debug/tracing/events/sched/sched_wakeup/enable" },
diff --git a/cmds/dumpsys/dumpsys.cpp b/cmds/dumpsys/dumpsys.cpp
index c9fcc00..ce8993d 100644
--- a/cmds/dumpsys/dumpsys.cpp
+++ b/cmds/dumpsys/dumpsys.cpp
@@ -9,7 +9,7 @@
#include <binder/Parcel.h>
#include <binder/ProcessState.h>
#include <binder/IServiceManager.h>
-#include <utils/TextOutput.h>
+#include <binder/TextOutput.h>
#include <utils/Vector.h>
#include <getopt.h>
@@ -39,7 +39,11 @@ int main(int argc, char* const argv[])
Vector<String16> services;
Vector<String16> args;
- if (argc == 1) {
+ bool showListOnly = false;
+ if ((argc == 2) && (strcmp(argv[1], "-l") == 0)) {
+ showListOnly = true;
+ }
+ if ((argc == 1) || showListOnly) {
services = sm->listServices();
services.sort(sort_func);
args.add(String16("-a"));
@@ -64,6 +68,10 @@ int main(int argc, char* const argv[])
}
}
+ if (showListOnly) {
+ return 0;
+ }
+
for (size_t i=0; i<N; i++) {
sp<IBinder> service = sm->checkService(services[i]);
if (service != NULL) {
diff --git a/cmds/flatland/Main.cpp b/cmds/flatland/Main.cpp
index 99715d3..d6ac3d2 100644
--- a/cmds/flatland/Main.cpp
+++ b/cmds/flatland/Main.cpp
@@ -56,7 +56,7 @@ struct BenchmarkDesc {
static const BenchmarkDesc benchmarks[] = {
{ "16:10 Single Static Window",
- 2560, 1600, { 800, 1600, 2400 },
+ 2560, 1600, { 800, 1200, 1600, 2400 },
{
{ // Window
0, staticGradient, opaque,
@@ -73,8 +73,26 @@ static const BenchmarkDesc benchmarks[] = {
},
},
+ { "3:2 Single Static Window",
+ 2048, 1536, { 1536 },
+ {
+ { // Window
+ 0, staticGradient, opaque,
+ 0, 50, 2048, 1440,
+ },
+ { // Status bar
+ 0, staticGradient, opaque,
+ 0, 0, 2048, 50,
+ },
+ { // Navigation bar
+ 0, staticGradient, opaque,
+ 0, 1440, 2048, 96,
+ },
+ },
+ },
+
{ "16:10 App -> Home Transition",
- 2560, 1600, { 800, 1600, 2400 },
+ 2560, 1600, { 800, 1200, 1600, 2400 },
{
{ // Wallpaper
0, staticGradient, opaque,
@@ -99,8 +117,34 @@ static const BenchmarkDesc benchmarks[] = {
},
},
+ { "3:2 App -> Home Transition",
+ 2048, 1536, { 1536 },
+ {
+ { // Wallpaper
+ 0, staticGradient, opaque,
+ 0, 50, 2048, 1440,
+ },
+ { // Launcher
+ 0, staticGradient, blend,
+ 0, 50, 2048, 1440,
+ },
+ { // Outgoing activity
+ 0, staticGradient, blendShrink,
+ 20, 70, 2048, 1400,
+ },
+ { // Status bar
+ 0, staticGradient, opaque,
+ 0, 0, 2048, 50,
+ },
+ { // Navigation bar
+ 0, staticGradient, opaque,
+ 0, 1440, 2048, 96,
+ },
+ },
+ },
+
{ "16:10 SurfaceView -> Home Transition",
- 2560, 1600, { 800, 1600, 2400 },
+ 2560, 1600, { 800, 1200, 1600, 2400 },
{
{ // Wallpaper
0, staticGradient, opaque,
@@ -128,6 +172,36 @@ static const BenchmarkDesc benchmarks[] = {
},
},
},
+
+ { "3:2 SurfaceView -> Home Transition",
+ 2048, 1536, { 1536 },
+ {
+ { // Wallpaper
+ 0, staticGradient, opaque,
+ 0, 50, 2048, 1440,
+ },
+ { // Launcher
+ 0, staticGradient, blend,
+ 0, 50, 2048, 1440,
+ },
+ { // Outgoing SurfaceView
+ 0, staticGradient, blendShrink,
+ 20, 70, 2048, 1400,
+ },
+ { // Outgoing activity
+ 0, staticGradient, blendShrink,
+ 20, 70, 2048, 1400,
+ },
+ { // Status bar
+ 0, staticGradient, opaque,
+ 0, 0, 2048, 50,
+ },
+ { // Navigation bar
+ 0, staticGradient, opaque,
+ 0, 1440, 2048, 96,
+ },
+ },
+ },
};
static const ShaderDesc shaders[] = {
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index 8e14a2c..131e03f 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -540,7 +540,6 @@ done:
}
-/* a simpler version of dexOptGenerateCacheFileName() */
int create_cache_path(char path[PKG_PATH_MAX], const char *src)
{
char *tmp;
@@ -580,7 +579,7 @@ int create_cache_path(char path[PKG_PATH_MAX], const char *src)
}
static void run_dexopt(int zip_fd, int odex_fd, const char* input_file_name,
- const char* dexopt_flags)
+ const char* output_file_name, const char* dexopt_flags)
{
static const char* DEX_OPT_BIN = "/system/bin/dexopt";
static const int MAX_INT_LEN = 12; // '-'+10dig+'\0' -OR- 0x+8dig
@@ -590,11 +589,35 @@ static void run_dexopt(int zip_fd, int odex_fd, const char* input_file_name,
sprintf(zip_num, "%d", zip_fd);
sprintf(odex_num, "%d", odex_fd);
+ ALOGV("Running %s in=%s out=%s\n", DEX_OPT_BIN, input_file_name, output_file_name);
execl(DEX_OPT_BIN, DEX_OPT_BIN, "--zip", zip_num, odex_num, input_file_name,
dexopt_flags, (char*) NULL);
ALOGE("execl(%s) failed: %s\n", DEX_OPT_BIN, strerror(errno));
}
+static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
+ const char* output_file_name, const char* dexopt_flags)
+{
+ static const char* DEX2OAT_BIN = "/system/bin/dex2oat";
+ static const int MAX_INT_LEN = 12; // '-'+10dig+'\0' -OR- 0x+8dig
+ char zip_fd_arg[strlen("--zip-fd=") + MAX_INT_LEN];
+ char zip_location_arg[strlen("--zip-location=") + PKG_PATH_MAX];
+ char oat_fd_arg[strlen("--oat-fd=") + MAX_INT_LEN];
+ char oat_location_arg[strlen("--oat-name=") + PKG_PATH_MAX];
+
+ sprintf(zip_fd_arg, "--zip-fd=%d", zip_fd);
+ sprintf(zip_location_arg, "--zip-location=%s", input_file_name);
+ sprintf(oat_fd_arg, "--oat-fd=%d", oat_fd);
+ sprintf(oat_location_arg, "--oat-location=%s", output_file_name);
+
+ ALOGV("Running %s in=%s out=%s\n", DEX2OAT_BIN, input_file_name, output_file_name);
+ execl(DEX2OAT_BIN, DEX2OAT_BIN,
+ zip_fd_arg, zip_location_arg,
+ oat_fd_arg, oat_location_arg,
+ (char*) NULL);
+ ALOGE("execl(%s) failed: %s\n", DEX2OAT_BIN, strerror(errno));
+}
+
static int wait_dexopt(pid_t pid, const char* apk_path)
{
int status;
@@ -631,31 +654,33 @@ int dexopt(const char *apk_path, uid_t uid, int is_public)
{
struct utimbuf ut;
struct stat apk_stat, dex_stat;
- char dex_path[PKG_PATH_MAX];
+ char out_path[PKG_PATH_MAX];
char dexopt_flags[PROPERTY_VALUE_MAX];
+ char dalvik_vm_lib[PROPERTY_VALUE_MAX];
char *end;
- int res, zip_fd=-1, odex_fd=-1;
+ int res, zip_fd=-1, out_fd=-1;
- /* Before anything else: is there a .odex file? If so, we have
- * pre-optimized the apk and there is nothing to do here.
- */
if (strlen(apk_path) >= (PKG_PATH_MAX - 8)) {
return -1;
}
/* platform-specific flags affecting optimization and verification */
property_get("dalvik.vm.dexopt-flags", dexopt_flags, "");
+ ALOGV("dalvik.vm.dexopt_flags=%s\n", dexopt_flags);
- strcpy(dex_path, apk_path);
- end = strrchr(dex_path, '.');
- if (end != NULL) {
- strcpy(end, ".odex");
- if (stat(dex_path, &dex_stat) == 0) {
- return 0;
- }
+ /* The command to run depend ones the value of dalvik.vm.lib */
+ property_get("dalvik.vm.lib", dalvik_vm_lib, "libdvm.so");
+ ALOGV("dalvik.vm.lib=%s\n", dalvik_vm_lib);
+
+ /* Before anything else: is there a .odex file? If so, we have
+ * precompiled the apk and there is nothing to do here.
+ */
+ sprintf(out_path, "%s%s", apk_path, ".odex");
+ if (stat(out_path, &dex_stat) == 0) {
+ return 0;
}
- if (create_cache_path(dex_path, apk_path)) {
+ if (create_cache_path(out_path, apk_path)) {
return -1;
}
@@ -664,24 +689,24 @@ int dexopt(const char *apk_path, uid_t uid, int is_public)
zip_fd = open(apk_path, O_RDONLY, 0);
if (zip_fd < 0) {
- ALOGE("dexopt cannot open '%s' for input\n", apk_path);
+ ALOGE("installd cannot open '%s' for input during dexopt\n", apk_path);
return -1;
}
- unlink(dex_path);
- odex_fd = open(dex_path, O_RDWR | O_CREAT | O_EXCL, 0644);
- if (odex_fd < 0) {
- ALOGE("dexopt cannot open '%s' for output\n", dex_path);
+ unlink(out_path);
+ out_fd = open(out_path, O_RDWR | O_CREAT | O_EXCL, 0644);
+ if (out_fd < 0) {
+ ALOGE("installd cannot open '%s' for output during dexopt\n", out_path);
goto fail;
}
- if (fchmod(odex_fd,
+ if (fchmod(out_fd,
S_IRUSR|S_IWUSR|S_IRGRP |
(is_public ? S_IROTH : 0)) < 0) {
- ALOGE("dexopt cannot chmod '%s'\n", dex_path);
+ ALOGE("installd cannot chmod '%s' during dexopt\n", out_path);
goto fail;
}
- if (fchown(odex_fd, AID_SYSTEM, uid) < 0) {
- ALOGE("dexopt cannot chown '%s'\n", dex_path);
+ if (fchown(out_fd, AID_SYSTEM, uid) < 0) {
+ ALOGE("installd cannot chown '%s' during dexopt\n", out_path);
goto fail;
}
@@ -692,11 +717,11 @@ int dexopt(const char *apk_path, uid_t uid, int is_public)
if (pid == 0) {
/* child -- drop privileges before continuing */
if (setgid(uid) != 0) {
- ALOGE("setgid(%d) failed during dexopt\n", uid);
+ ALOGE("setgid(%d) failed in installd during dexopt\n", uid);
exit(64);
}
if (setuid(uid) != 0) {
- ALOGE("setuid(%d) during dexopt\n", uid);
+ ALOGE("setuid(%d) failed in installd during dexopt\n", uid);
exit(65);
}
// drop capabilities
@@ -709,33 +734,39 @@ int dexopt(const char *apk_path, uid_t uid, int is_public)
ALOGE("capset failed: %s\n", strerror(errno));
exit(66);
}
- if (flock(odex_fd, LOCK_EX | LOCK_NB) != 0) {
- ALOGE("flock(%s) failed: %s\n", dex_path, strerror(errno));
+ if (flock(out_fd, LOCK_EX | LOCK_NB) != 0) {
+ ALOGE("flock(%s) failed: %s\n", out_path, strerror(errno));
exit(67);
}
- run_dexopt(zip_fd, odex_fd, apk_path, dexopt_flags);
+ if (strncmp(dalvik_vm_lib, "libdvm", 6) == 0) {
+ run_dexopt(zip_fd, out_fd, apk_path, out_path, dexopt_flags);
+ } else if (strncmp(dalvik_vm_lib, "libart", 6) == 0) {
+ run_dex2oat(zip_fd, out_fd, apk_path, out_path, dexopt_flags);
+ } else {
+ exit(69); /* Unexpected dalvik.vm.lib value */
+ }
exit(68); /* only get here on exec failure */
} else {
res = wait_dexopt(pid, apk_path);
if (res != 0) {
- ALOGE("dexopt failed on '%s' res = %d\n", dex_path, res);
+ ALOGE("dexopt in='%s' out='%s' res=%d\n", apk_path, out_path, res);
goto fail;
}
}
ut.actime = apk_stat.st_atime;
ut.modtime = apk_stat.st_mtime;
- utime(dex_path, &ut);
-
- close(odex_fd);
+ utime(out_path, &ut);
+
+ close(out_fd);
close(zip_fd);
return 0;
fail:
- if (odex_fd >= 0) {
- close(odex_fd);
- unlink(dex_path);
+ if (out_fd >= 0) {
+ close(out_fd);
+ unlink(out_path);
}
if (zip_fd >= 0) {
close(zip_fd);
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index c918633..87f900a 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -198,7 +198,7 @@ static int execute(int s, char cmd[BUFFER_MAX])
unsigned short count;
int ret = -1;
-// ALOGI("execute('%s')\n", cmd);
+ // ALOGI("execute('%s')\n", cmd);
/* default reply is "" */
reply[0] = 0;
@@ -240,7 +240,7 @@ done:
if (n > BUFFER_MAX) n = BUFFER_MAX;
count = n;
-// ALOGI("reply: '%s'\n", cmd);
+ // ALOGI("reply: '%s'\n", cmd);
if (writex(s, &count, sizeof(count))) return -1;
if (writex(s, cmd, count)) return -1;
return 0;
diff --git a/cmds/rawbu/backup.cpp b/cmds/rawbu/backup.cpp
index 70e7b57..ff6719f 100644
--- a/cmds/rawbu/backup.cpp
+++ b/cmds/rawbu/backup.cpp
@@ -639,6 +639,12 @@ static void show_help(const char *cmd)
fprintf(stderr, "options include:\n"
" -h Show this help text.\n"
" -a Backup all files.\n");
+ fprintf(stderr, "\n backup-file-path Defaults to /sdcard/backup.dat .\n"
+ " On devices that emulate the sdcard, you will need to\n"
+ " explicitly specify the directory it is mapped to,\n"
+ " to avoid recursive backup or deletion of the backup file\n"
+ " during restore.\n\n"
+ " Eg. /data/media/0/backup.dat\n");
fprintf(stderr, "\nThe %s command allows you to perform low-level\n"
"backup and restore of the /data partition. This is\n"
"where all user data is kept, allowing for a fairly\n"
diff --git a/cmds/service/service.cpp b/cmds/service/service.cpp
index 32db83b..97fc47c 100644
--- a/cmds/service/service.cpp
+++ b/cmds/service/service.cpp
@@ -1,12 +1,23 @@
/*
- * Command line access to services.
+ * Copyright 2013 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.
*/
-
+
#include <binder/Parcel.h>
#include <binder/ProcessState.h>
#include <binder/IServiceManager.h>
-#include <utils/TextOutput.h>
+#include <binder/TextOutput.h>
#include <getopt.h>
#include <stdlib.h>