diff options
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/app_process/Android.mk | 17 | ||||
-rw-r--r-- | cmds/app_process/sigchain_proxy.cpp | 17 | ||||
-rw-r--r-- | cmds/bootanimation/BootAnimation.cpp | 5 | ||||
-rw-r--r-- | cmds/screencap/screencap.cpp | 21 |
4 files changed, 28 insertions, 32 deletions
diff --git a/cmds/app_process/Android.mk b/cmds/app_process/Android.mk index 1ca14a6..397a7d1 100644 --- a/cmds/app_process/Android.mk +++ b/cmds/app_process/Android.mk @@ -2,15 +2,10 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -# TODO: Trying to link libsigchain as a static library prevents -# static linker from exporting necessary symbols. So as a workaround -# we use sigchain.o LOCAL_SRC_FILES:= \ - app_main.cpp \ - sigchain_proxy.cpp + app_main.cpp LOCAL_LDFLAGS := -Wl,--version-script,art/sigchainlib/version-script.txt -Wl,--export-dynamic -LOCAL_CPPFLAGS := -std=c++11 -Iart LOCAL_SHARED_LIBRARIES := \ libdl \ @@ -20,6 +15,8 @@ LOCAL_SHARED_LIBRARIES := \ libbinder \ libandroid_runtime +LOCAL_WHOLE_STATIC_LIBRARIES := libsigchain + LOCAL_MODULE:= app_process LOCAL_MULTILIB := both LOCAL_MODULE_STEM_32 := app_process32 @@ -36,10 +33,8 @@ ifeq ($(TARGET_ARCH),arm) include $(CLEAR_VARS) -# see comment above (~l5) LOCAL_SRC_FILES:= \ - app_main.cpp \ - sigchain_proxy.cpp + app_main.cpp LOCAL_SHARED_LIBRARIES := \ libcutils \ @@ -48,8 +43,10 @@ LOCAL_SHARED_LIBRARIES := \ libbinder \ libandroid_runtime +LOCAL_WHOLE_STATIC_LIBRARIES := libsigchain + LOCAL_LDFLAGS := -ldl -Wl,--version-script,art/sigchainlib/version-script.txt -Wl,--export-dynamic -LOCAL_CPPFLAGS := -std=c++11 -Iart +LOCAL_CPPFLAGS := -std=c++11 LOCAL_MODULE := app_process__asan LOCAL_MODULE_TAGS := eng diff --git a/cmds/app_process/sigchain_proxy.cpp b/cmds/app_process/sigchain_proxy.cpp deleted file mode 100644 index bb7a678..0000000 --- a/cmds/app_process/sigchain_proxy.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (C) 2014 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 "sigchainlib/sigchain.cc" diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index b2474f2..167014e 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -23,6 +23,7 @@ #include <fcntl.h> #include <utils/misc.h> #include <signal.h> +#include <time.h> #include <cutils/properties.h> @@ -57,10 +58,6 @@ #define SYSTEM_ENCRYPTED_BOOTANIMATION_FILE "/system/media/bootanimation-encrypted.zip" #define EXIT_PROP_NAME "service.bootanim.exit" -extern "C" int clock_nanosleep(clockid_t clock_id, int flags, - const struct timespec *request, - struct timespec *remain); - namespace android { static const int ANIM_ENTRY_NAME_MAX = 256; diff --git a/cmds/screencap/screencap.cpp b/cmds/screencap/screencap.cpp index 6b2a0e2..1ddbecb 100644 --- a/cmds/screencap/screencap.cpp +++ b/cmds/screencap/screencap.cpp @@ -18,6 +18,8 @@ #include <unistd.h> #include <stdio.h> #include <fcntl.h> +#include <stdlib.h> +#include <string.h> #include <linux/fb.h> #include <sys/ioctl.h> @@ -86,6 +88,21 @@ static status_t vinfoToPixelFormat(const fb_var_screeninfo& vinfo, return NO_ERROR; } +static status_t notifyMediaScanner(const char* fileName) { + String8 cmd("am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE -d file://"); + String8 fileUrl("\""); + fileUrl.append(fileName); + fileUrl.append("\""); + cmd.append(fileName); + cmd.append(" > /dev/null"); + int result = system(cmd.string()); + if (result < 0) { + fprintf(stderr, "Unable to broadcast intent for media scanner.\n"); + return UNKNOWN_ERROR; + } + return NO_ERROR; +} + int main(int argc, char** argv) { ProcessState::self()->startThreadPool(); @@ -112,10 +129,11 @@ int main(int argc, char** argv) argv += optind; int fd = -1; + const char* fn; if (argc == 0) { fd = dup(STDOUT_FILENO); } else if (argc == 1) { - const char* fn = argv[0]; + fn = argv[0]; fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC, 0664); if (fd == -1) { fprintf(stderr, "Error opening file: %s (%s)\n", fn, strerror(errno)); @@ -184,6 +202,7 @@ int main(int argc, char** argv) SkData* streamData = stream.copyToData(); write(fd, streamData->data(), streamData->size()); streamData->unref(); + notifyMediaScanner(fn); } else { write(fd, &w, 4); write(fd, &h, 4); |