diff options
Diffstat (limited to 'cmds')
96 files changed, 599 insertions, 1795 deletions
diff --git a/cmds/am/Android.bp b/cmds/am/Android.bp index bb16df1d159d..ed73d5596859 100644 --- a/cmds/am/Android.bp +++ b/cmds/am/Android.bp @@ -10,3 +10,16 @@ cc_library_host_static { export_proto_headers: true, }, } + +java_binary { + name: "am", + wrapper: "am", + srcs: [ + "src/**/*.java", + "proto/**/*.proto", + ], + proto: { + plugin: "javastream", + }, + static_libs: ["libprotobuf-java-lite"], +} diff --git a/cmds/am/Android.mk b/cmds/am/Android.mk deleted file mode 100644 index 9411c3203ab8..000000000000 --- a/cmds/am/Android.mk +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright 2008 The Android Open Source Project -# -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_SRC_FILES := \ - $(call all-java-files-under, src) \ - $(call all-proto-files-under, proto) -LOCAL_MODULE := am -LOCAL_PROTOC_OPTIMIZE_TYPE := stream -include $(BUILD_JAVA_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := am -LOCAL_SRC_FILES := am -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_MODULE_TAGS := optional -include $(BUILD_PREBUILT) diff --git a/cmds/app_process/Android.bp b/cmds/app_process/Android.bp new file mode 100644 index 000000000000..8be95e4659b4 --- /dev/null +++ b/cmds/app_process/Android.bp @@ -0,0 +1,63 @@ +cc_binary { + name: "app_process", + + srcs: ["app_main.cpp"], + + multilib: { + lib32: { + version_script: ":art_sigchain_version_script32.txt", + suffix: "32", + }, + lib64: { + version_script: ":art_sigchain_version_script64.txt", + suffix: "64", + }, + }, + + ldflags: ["-Wl,--export-dynamic"], + + shared_libs: [ + "libandroid_runtime", + "libbinder", + "libcutils", + "libdl", + "libhidlbase", + "liblog", + "libnativeloader", + "libutils", + + // This is a list of libraries that need to be included in order to avoid + // bad apps. This prevents a library from having a mismatch when resolving + // new/delete from an app shared library. + // See b/21032018 for more details. + "libwilhelm", + ], + + whole_static_libs: ["libsigchain"], + + compile_multilib: "both", + + cflags: [ + "-Wall", + "-Werror", + "-Wunused", + "-Wunreachable-code", + ], + + // If SANITIZE_LITE is revived this will need: + //product_variables: { + // sanitize_lite: { + // // In SANITIZE_LITE mode, we create the sanitized binary in a separate location (but reuse + // // the same module). Using the same module also works around an issue with make: binaries + // // that depend on sanitized libraries will be relinked, even if they set LOCAL_SANITIZE := never. + // // + // // Also pull in the asanwrapper helper. + // relative_install_path: "asan", + // required: ["asanwrapper"], + // }, + //}, + + // Create a symlink from app_process to app_process32 or 64 + // depending on the target configuration. + symlink_preferred_arch: true, +} diff --git a/cmds/app_process/Android.mk b/cmds/app_process/Android.mk deleted file mode 100644 index 570d74048e03..000000000000 --- a/cmds/app_process/Android.mk +++ /dev/null @@ -1,68 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -app_process_common_shared_libs := \ - libandroid_runtime \ - libbinder \ - libcutils \ - libdl \ - libhidlbase \ - liblog \ - libnativeloader \ - libutils \ - -# This is a list of libraries that need to be included in order to avoid -# bad apps. This prevents a library from having a mismatch when resolving -# new/delete from an app shared library. -# See b/21032018 for more details. -app_process_common_shared_libs += \ - libwilhelm \ - -app_process_common_static_libs := \ - libsigchain \ - -app_process_src_files := \ - app_main.cpp \ - -app_process_cflags := \ - -Wall -Werror -Wunused -Wunreachable-code - -app_process_ldflags_32 := \ - -Wl,--version-script,art/sigchainlib/version-script32.txt -Wl,--export-dynamic -app_process_ldflags_64 := \ - -Wl,--version-script,art/sigchainlib/version-script64.txt -Wl,--export-dynamic - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= $(app_process_src_files) - -LOCAL_LDFLAGS_32 := $(app_process_ldflags_32) -LOCAL_LDFLAGS_64 := $(app_process_ldflags_64) - -LOCAL_SHARED_LIBRARIES := $(app_process_common_shared_libs) - -LOCAL_WHOLE_STATIC_LIBRARIES := $(app_process_common_static_libs) - -LOCAL_MODULE:= app_process -LOCAL_MULTILIB := both -LOCAL_MODULE_STEM_32 := app_process32 -LOCAL_MODULE_STEM_64 := app_process64 - -LOCAL_CFLAGS += $(app_process_cflags) - -# In SANITIZE_LITE mode, we create the sanitized binary in a separate location (but reuse -# the same module). Using the same module also works around an issue with make: binaries -# that depend on sanitized libraries will be relinked, even if they set LOCAL_SANITIZE := never. -# -# Also pull in the asanwrapper helper. -ifeq ($(SANITIZE_LITE),true) -LOCAL_MODULE_PATH := $(TARGET_OUT_EXECUTABLES)/asan -LOCAL_REQUIRED_MODULES := asanwrapper -endif - -include $(BUILD_EXECUTABLE) - -# Create a symlink from app_process to app_process32 or 64 -# depending on the target configuration. -ifneq ($(SANITIZE_LITE),true) -include $(BUILD_SYSTEM)/executable_prefer_symlink.mk -endif diff --git a/cmds/appops/Android.bp b/cmds/appops/Android.bp new file mode 100644 index 000000000000..9f330fa3bb51 --- /dev/null +++ b/cmds/appops/Android.bp @@ -0,0 +1,6 @@ +// Copyright 2014 The Android Open Source Project + +sh_binary { + name: "appops", + src: "appops", +} diff --git a/cmds/appops/Android.mk b/cmds/appops/Android.mk deleted file mode 100644 index 6801ce9cd3af..000000000000 --- a/cmds/appops/Android.mk +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright 2014 The Android Open Source Project - -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_MODULE := appops -LOCAL_SRC_FILES := appops -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_MODULE_TAGS := optional -include $(BUILD_PREBUILT) diff --git a/cmds/appwidget/Android.bp b/cmds/appwidget/Android.bp new file mode 100644 index 000000000000..487d3e1fc25f --- /dev/null +++ b/cmds/appwidget/Android.bp @@ -0,0 +1,7 @@ +// Copyright 2014 The Android Open Source Project + +java_binary { + name: "appwidget", + wrapper: "appwidget", + srcs: ["**/*.java"], +} diff --git a/cmds/appwidget/Android.mk b/cmds/appwidget/Android.mk deleted file mode 100644 index 1fb258db6cb9..000000000000 --- a/cmds/appwidget/Android.mk +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2014 The Android Open Source Project - -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_SRC_FILES := $(call all-subdir-java-files) -LOCAL_MODULE := appwidget -include $(BUILD_JAVA_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := appwidget -LOCAL_SRC_FILES := appwidget -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_MODULE_TAGS := optional -include $(BUILD_PREBUILT) - diff --git a/cmds/appwidget/appwidget b/cmds/appwidget/appwidget index 26ab1730250f..cc70ca53d5dd 100755 --- a/cmds/appwidget/appwidget +++ b/cmds/appwidget/appwidget @@ -1,6 +1,3 @@ #!/system/bin/sh -# Script to start "appwidget" on the device, which has a very rudimentary shell. -base=/system -export CLASSPATH=$base/framework/appwidget.jar -exec app_process $base/bin com.android.commands.appwidget.AppWidget "$@" - +export CLASSPATH=/system/framework/appwidget.jar +exec app_process /system/bin com.android.commands.appwidget.AppWidget "$@" diff --git a/cmds/bmgr/bmgr b/cmds/bmgr/bmgr index 60b5833e7696..b068d10dcbcf 100755 --- a/cmds/bmgr/bmgr +++ b/cmds/bmgr/bmgr @@ -1,8 +1,3 @@ #!/system/bin/sh -# Script to start "bmgr" on the device, which has a very rudimentary -# shell. -# -base=/system -export CLASSPATH=$base/framework/bmgr.jar -exec app_process $base/bin com.android.commands.bmgr.Bmgr "$@" - +export CLASSPATH=/system/framework/bmgr.jar +exec app_process /system/bin com.android.commands.bmgr.Bmgr "$@" diff --git a/cmds/bootanimation/Android.bp b/cmds/bootanimation/Android.bp index 31bd612cc2c7..3e5877b05708 100644 --- a/cmds/bootanimation/Android.bp +++ b/cmds/bootanimation/Android.bp @@ -40,27 +40,6 @@ cc_binary { "audioplay.cpp", ], - product_variables: { - product_is_iot: { - shared_libs: [ - "libandroidthings", - "libandroidthings_protos", - "libchrome", - "libprotobuf-cpp-lite", - ], - static_libs: ["libjsoncpp"], - srcs: [ - "iot/iotbootanimation_main.cpp", - "iot/BootAction.cpp", - "iot/BootParameters.cpp", - ], - exclude_srcs: [ - "bootanimation_main.cpp", - "audioplay.cpp", - ], - }, - }, - init_rc: ["bootanim.rc"], } @@ -79,12 +58,5 @@ cc_library_shared { "libEGL", "libGLESv1_CM", "libgui", - "libtinyalsa", ], - - product_variables: { - product_is_iot: { - init_rc: ["iot/bootanim_iot.rc"], - }, - }, } diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index 30f4ad4c5c69..db384baff4d7 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -63,6 +63,10 @@ #include "BootAnimation.h" +#define ANIM_PATH_MAX 255 +#define STR(x) #x +#define STRTO(x) STR(x) + namespace android { static const char OEM_BOOTANIMATION_FILE[] = "/oem/media/bootanimation.zip"; @@ -96,7 +100,7 @@ static constexpr size_t FONT_NUM_ROWS = FONT_NUM_CHARS / FONT_NUM_COLS; static const int TEXT_CENTER_VALUE = INT_MAX; static const int TEXT_MISSING_VALUE = INT_MIN; static const char EXIT_PROP_NAME[] = "service.bootanim.exit"; -static const int ANIM_ENTRY_NAME_MAX = 256; +static const int ANIM_ENTRY_NAME_MAX = ANIM_PATH_MAX + 1; static constexpr size_t TEXT_POS_LEN_MAX = 16; // --------------------------------------------------------------------------- @@ -694,7 +698,7 @@ bool BootAnimation::parseAnimationDesc(Animation& animation) animation.width = width; animation.height = height; animation.fps = fps; - } else if (sscanf(l, " %c %d %d %s #%6s %16s %16s", + } else if (sscanf(l, " %c %d %d %" STRTO(ANIM_PATH_MAX) "s #%6s %16s %16s", &pathType, &count, &pause, path, color, clockPos1, clockPos2) >= 4) { //SLOGD("> type=%c, count=%d, pause=%d, path=%s, color=%s, clockPos1=%s, clockPos2=%s", // pathType, count, pause, path, color, clockPos1, clockPos2); diff --git a/cmds/bootanimation/iot/Android.bp b/cmds/bootanimation/iot/Android.bp deleted file mode 100644 index 1f248adcb9e1..000000000000 --- a/cmds/bootanimation/iot/Android.bp +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2018 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. -// - -// libbootanimation_iot_test -// =========================================================== -cc_test { - name: "libbootanimation_iot_test", - cflags: [ - "-Wall", - "-Werror", - "-Wunused", - "-Wunreachable-code", - ], - - shared_libs: [ - "libandroidthings", - "libandroidthings_protos", - "libbase", - "libchrome", - "liblog", - "libprotobuf-cpp-lite", - ], - - static_libs: ["libjsoncpp"], - - srcs: [ - "BootParameters.cpp", - "BootParameters_test.cpp", - ], - - enabled: false, - product_variables: { - product_is_iot: { - enabled: true, - }, - }, -} diff --git a/cmds/bootanimation/iot/BootAction.cpp b/cmds/bootanimation/iot/BootAction.cpp deleted file mode 100644 index 8b55147110bc..000000000000 --- a/cmds/bootanimation/iot/BootAction.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (C) 2017 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 "BootAction.h" - -#define LOG_TAG "BootAction" - -#include <dlfcn.h> - -#include <pio/peripheral_manager_client.h> -#include <utils/Log.h> - -namespace android { - -BootAction::~BootAction() { - if (mLibHandle != nullptr) { - dlclose(mLibHandle); - } -} - -bool BootAction::init(const std::string& libraryPath, - const std::unique_ptr<BootParameters>& bootParameters) { - APeripheralManagerClient* client = nullptr; - ALOGD("Connecting to peripheralmanager"); - // Wait for peripheral manager to come up. - while (client == nullptr) { - client = APeripheralManagerClient_new(); - if (client == nullptr) { - ALOGV("peripheralmanager is not up, sleeping before we check again."); - usleep(250000); - } - } - ALOGD("Peripheralmanager is up."); - APeripheralManagerClient_delete(client); - - - ALOGI("Loading boot action %s", libraryPath.c_str()); - mLibHandle = dlopen(libraryPath.c_str(), RTLD_NOW); - if (mLibHandle == nullptr) { - ALOGE("Unable to load library at %s :: %s", - libraryPath.c_str(), dlerror()); - return false; - } - - void* loaded = nullptr; - if (!loadSymbol("boot_action_init", &loaded) || loaded == nullptr) { - return false; - } - mLibInit = reinterpret_cast<libInit>(loaded); - - loaded = nullptr; - if (!loadSymbol("boot_action_shutdown", &loaded) || loaded == nullptr) { - return false; - } - mLibShutdown = reinterpret_cast<libShutdown>(loaded); - - // StartPart is considered optional, if it isn't exported by the library - // we will still call init and shutdown. - loaded = nullptr; - if (!loadSymbol("boot_action_start_part", &loaded) || loaded == nullptr) { - ALOGI("No boot_action_start_part found, action will not be told when " - "Animation parts change."); - } else { - mLibStartPart = reinterpret_cast<libStartPart>(loaded); - } - - // SilentBoot is considered optional, if it isn't exported by the library - // and the boot is silent, no method is called. - loaded = nullptr; - if (!loadSymbol("boot_action_silent_boot", &loaded) || loaded == nullptr) { - ALOGW("No boot_action_silent_boot found, boot action will not be " - "executed during a silent boot."); - } else { - mLibSilentBoot = reinterpret_cast<libInit>(loaded); - } - - bool result = true; - const auto& parameters = bootParameters->getParameters(); - if (bootParameters->isSilentBoot()) { - if (mLibSilentBoot != nullptr) { - ALOGD("Entering boot_action_silent_boot"); - result = mLibSilentBoot(parameters.data(), parameters.size()); - ALOGD("Returned from boot_action_silent_boot"); - } else { - ALOGW("Skipping missing boot_action_silent_boot"); - } - } else { - ALOGD("Entering boot_action_init"); - result = mLibInit(parameters.data(), parameters.size()); - ALOGD("Returned from boot_action_init"); - } - - return result; -} - -void BootAction::startPart(int partNumber, int playNumber) { - if (mLibStartPart == nullptr) return; - - ALOGD("Entering boot_action_start_part"); - mLibStartPart(partNumber, playNumber); - ALOGD("Returned from boot_action_start_part"); -} - -void BootAction::shutdown() { - ALOGD("Entering boot_action_shutdown"); - mLibShutdown(); - ALOGD("Returned from boot_action_shutdown"); -} - -bool BootAction::loadSymbol(const char* symbol, void** loaded) { - *loaded = dlsym(mLibHandle, symbol); - if (*loaded == nullptr) { - ALOGE("Unable to load symbol : %s :: %s", symbol, dlerror()); - return false; - } - return true; -} - -} // namespace android diff --git a/cmds/bootanimation/iot/BootAction.h b/cmds/bootanimation/iot/BootAction.h deleted file mode 100644 index 7119c35db0f9..000000000000 --- a/cmds/bootanimation/iot/BootAction.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2017 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 _BOOTANIMATION_BOOTACTION_H -#define _BOOTANIMATION_BOOTACTION_H - -#include <string> -#include <vector> - -#include "BootParameters.h" - -#include <boot_action/boot_action.h> // libandroidthings native API. -#include <utils/RefBase.h> - -namespace android { - -class BootAction : public RefBase { -public: - ~BootAction(); - - // libraryPath is a fully qualified path to the target .so library. - bool init(const std::string& libraryPath, - const std::unique_ptr<BootParameters>& bootParameters); - - // The animation is going to start playing partNumber for the playCount'th - // time, update the action as needed. - // This is run in the same thread as the boot animation, - // you must not block here. - void startPart(int partNumber, int playCount); - - // Shutdown the boot action, this will be called shortly before the - // process is shut down to allow time for cleanup. - void shutdown(); - -private: - typedef bool (*libInit)(const ABootActionParameter* parameters, - size_t numParameters); - typedef void (*libStartPart)(int partNumber, int playNumber); - typedef void (*libShutdown)(); - - bool loadSymbol(const char* symbol, void** loaded); - - void* mLibHandle = nullptr; - libInit mLibInit = nullptr; - libStartPart mLibStartPart = nullptr; - libShutdown mLibShutdown = nullptr; - - // Called only if the boot is silent. - libInit mLibSilentBoot = nullptr; -}; - -} // namespace android - - -#endif // _BOOTANIMATION_BOOTACTION_H diff --git a/cmds/bootanimation/iot/BootParameters.cpp b/cmds/bootanimation/iot/BootParameters.cpp deleted file mode 100644 index 30a9b2895c44..000000000000 --- a/cmds/bootanimation/iot/BootParameters.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (C) 2017 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 "BootParameters.h" - -#define LOG_TAG "BootParameters" - -#include <errno.h> -#include <fcntl.h> - -#include <android-base/file.h> -#include <json/json.h> -#include <utils/Log.h> - -using android::base::ReadFileToString; -using android::base::RemoveFileIfExists; -using android::base::WriteStringToFile; -using Json::ArrayIndex; -using Json::Reader; -using Json::Value; - -namespace android { - -namespace { - -// Keys for deprecated parameters. Devices that OTA from N to O and that used -// the hidden BootParameters API will store these in the JSON blob. To support -// the transition from N to O, these keys are mapped to the new parameters. -constexpr const char *kKeyLegacyVolume = "volume"; -constexpr const char *kKeyLegacyAnimationsDisabled = "boot_animation_disabled"; -constexpr const char *kKeyLegacyParamNames = "param_names"; -constexpr const char *kKeyLegacyParamValues = "param_values"; - -constexpr const char *kNextBootFile = "/data/misc/bootanimation/next_boot.proto"; -constexpr const char *kLastBootFile = "/data/misc/bootanimation/last_boot.proto"; - -constexpr const char *kLegacyNextBootFile = "/data/misc/bootanimation/next_boot.json"; -constexpr const char *kLegacyLastBootFile = "/data/misc/bootanimation/last_boot.json"; - -void removeLegacyFiles() { - std::string err; - if (!RemoveFileIfExists(kLegacyLastBootFile, &err)) { - ALOGW("Unable to delete %s: %s", kLegacyLastBootFile, err.c_str()); - } - - err.clear(); - if (!RemoveFileIfExists(kLegacyNextBootFile, &err)) { - ALOGW("Unable to delete %s: %s", kLegacyNextBootFile, err.c_str()); - } -} - -void createNextBootFile() { - errno = 0; - int fd = open(kNextBootFile, O_CREAT, DEFFILEMODE); - if (fd == -1) { - ALOGE("Unable to create next boot file: %s", strerror(errno)); - } else { - // Make next_boot.json writable to everyone so DeviceManagementService - // can save saved_parameters there. - if (fchmod(fd, DEFFILEMODE)) - ALOGE("Unable to set next boot file permissions: %s", strerror(errno)); - close(fd); - } -} - -} // namespace - -// Renames the 'next' boot file to the 'last' file and reads its contents. -bool BootParameters::swapAndLoadBootConfigContents(const char *lastBootFile, - const char *nextBootFile, - std::string *contents) { - if (!ReadFileToString(nextBootFile, contents)) { - RemoveFileIfExists(lastBootFile); - return false; - } - - errno = 0; - if (rename(nextBootFile, lastBootFile) && errno != ENOENT) - ALOGE("Unable to swap boot files: %s", strerror(errno)); - - return true; -} - -BootParameters::BootParameters() { - loadParameters(); -} - -// Saves the boot parameters state to disk so the framework can read it. -void BootParameters::storeParameters() { - errno = 0; - if (!WriteStringToFile(mProto.SerializeAsString(), kLastBootFile)) { - ALOGE("Failed to write boot parameters to %s: %s", kLastBootFile, strerror(errno)); - } - - // WriteStringToFile sets the file permissions to 0666, but these are not - // honored by the system. - errno = 0; - if (chmod(kLastBootFile, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) { - ALOGE("Failed to set permissions for %s: %s", kLastBootFile, strerror(errno)); - } -} - -// Load the boot parameters from disk, try the old location and format if the -// file does not exist. Note: -// - Parse errors result in defaults being used (a normal boot). -// - Legacy boot parameters default to a silent boot. -void BootParameters::loadParameters() { - // Precedence is given to the new file format (.proto). - std::string contents; - if (swapAndLoadBootConfigContents(kLastBootFile, kNextBootFile, &contents)) { - parseBootParameters(contents); - } else if (swapAndLoadBootConfigContents(kLegacyLastBootFile, kLegacyNextBootFile, &contents)) { - parseLegacyBootParameters(contents); - storeParameters(); - removeLegacyFiles(); - } - - createNextBootFile(); -} - -void BootParameters::parseBootParameters(const std::string &contents) { - if (!mProto.ParseFromString(contents)) { - ALOGW("Failed to parse parameters from %s", kLastBootFile); - return; - } - - loadStateFromProto(); -} - -// Parses the JSON in the proto. -void BootParameters::parseLegacyBootParameters(const std::string &contents) { - Value json; - if (!Reader().parse(contents, json)) { - ALOGW("Failed to parse parameters from %s", kLegacyLastBootFile); - return; - } - - int volume = 0; - bool bootAnimationDisabled = true; - - Value &jsonValue = json[kKeyLegacyVolume]; - if (jsonValue.isIntegral()) { - volume = jsonValue.asInt(); - } - - jsonValue = json[kKeyLegacyAnimationsDisabled]; - if (jsonValue.isIntegral()) { - bootAnimationDisabled = jsonValue.asInt() == 1; - } - - // Assume a silent boot unless all of the following are true - - // 1. The volume is neither 0 nor -1000 (the legacy default value). - // 2. The boot animations are explicitly enabled. - // Note: brightness was never used. - mProto.set_silent_boot((volume == 0) || (volume == -1000) || bootAnimationDisabled); - - Value &keys = json[kKeyLegacyParamNames]; - Value &values = json[kKeyLegacyParamValues]; - if (keys.isArray() && values.isArray() && (keys.size() == values.size())) { - for (ArrayIndex i = 0; i < keys.size(); ++i) { - auto &key = keys[i]; - auto &value = values[i]; - if (key.isString() && value.isString()) { - auto userParameter = mProto.add_user_parameter(); - userParameter->set_key(key.asString()); - userParameter->set_value(value.asString()); - } - } - } - - loadStateFromProto(); -} - -void BootParameters::loadStateFromProto() { - // A missing key returns a safe, default value. - // Ignore invalid or missing parameters. - mIsSilentBoot = mProto.silent_boot(); - - for (const auto ¶m : mProto.user_parameter()) { - mParameters.push_back({.key = param.key().c_str(), .value = param.value().c_str()}); - } -} - -} // namespace android diff --git a/cmds/bootanimation/iot/BootParameters.h b/cmds/bootanimation/iot/BootParameters.h deleted file mode 100644 index cbd1ca61cfc3..000000000000 --- a/cmds/bootanimation/iot/BootParameters.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2017 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 _BOOTANIMATION_BOOT_PARAMETERS_H_ -#define _BOOTANIMATION_BOOT_PARAMETERS_H_ - -#include <list> -#include <string> -#include <vector> - -#include <boot_action/boot_action.h> // libandroidthings native API. -#include <boot_parameters.pb.h> - -namespace android { - -// Provides access to the parameters set by DeviceManager.reboot(). -class BootParameters { -public: - // Constructor loads the parameters for this boot and swaps the param files - // to clear the parameters for next boot. - BootParameters(); - - // Returns whether or not this is a silent boot. - bool isSilentBoot() const { return mIsSilentBoot; } - - // Returns the additional boot parameters that were set on reboot. - const std::vector<ABootActionParameter>& getParameters() const { return mParameters; } - - // Exposed for testing. Sets the parameters to the serialized proto. - void parseBootParameters(const std::string &contents); - - // For devices that OTA from N to O. - // Exposed for testing. Sets the parameters to the raw JSON. - void parseLegacyBootParameters(const std::string &contents); - - // Exposed for testing. Loads the contents from |nextBootFile| and replaces - // |lastBootFile| with |nextBootFile|. - static bool swapAndLoadBootConfigContents(const char *lastBootFile, const char *nextBootFile, - std::string *contents); - - private: - void loadParameters(); - - // Replaces the legacy JSON blob with the updated version, allowing the - // framework to read it. - void storeParameters(); - - void loadStateFromProto(); - - bool mIsSilentBoot = false; - - std::vector<ABootActionParameter> mParameters; - - // Store the proto because mParameters makes a shallow copy. - android::things::proto::BootParameters mProto; -}; - -} // namespace android - - -#endif // _BOOTANIMATION_BOOT_PARAMETERS_H_ diff --git a/cmds/bootanimation/iot/BootParameters_test.cpp b/cmds/bootanimation/iot/BootParameters_test.cpp deleted file mode 100644 index d55bce6eecc3..000000000000 --- a/cmds/bootanimation/iot/BootParameters_test.cpp +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (C) 2018 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 "BootParameters.h" - -#include <sys/stat.h> -#include <sys/types.h> -#include <unistd.h> - -#include <android-base/file.h> -#include <android-base/test_utils.h> -#include <boot_parameters.pb.h> -#include <gtest/gtest.h> - -namespace android { - -namespace { - -TEST(BootParametersTest, TestNoBootParametersIsNotSilent) { - android::things::proto::BootParameters proto; - - BootParameters bootParameters = BootParameters(); - bootParameters.parseBootParameters(proto.SerializeAsString()); - - ASSERT_FALSE(bootParameters.isSilentBoot()); - ASSERT_EQ(0u, bootParameters.getParameters().size()); -} - -TEST(BootParametersTest, TestParseIsSilent) { - android::things::proto::BootParameters proto; - proto.set_silent_boot(true); - - BootParameters bootParameters = BootParameters(); - bootParameters.parseBootParameters(proto.SerializeAsString()); - - ASSERT_TRUE(bootParameters.isSilentBoot()); -} - -TEST(BootParametersTest, TestParseIsNotSilent) { - android::things::proto::BootParameters proto; - proto.set_silent_boot(false); - - BootParameters bootParameters = BootParameters(); - bootParameters.parseBootParameters(proto.SerializeAsString()); - - ASSERT_FALSE(bootParameters.isSilentBoot()); -} - -TEST(BootParametersTest, TestParseBootParameters) { - android::things::proto::BootParameters proto; - proto.set_silent_boot(false); - - auto userParameter = proto.add_user_parameter(); - userParameter->set_key("key1"); - userParameter->set_value("value1"); - - userParameter = proto.add_user_parameter(); - userParameter->set_key("key2"); - userParameter->set_value("value2"); - - BootParameters bootParameters = BootParameters(); - bootParameters.parseBootParameters(proto.SerializeAsString()); - - auto ¶meters = bootParameters.getParameters(); - ASSERT_EQ(2u, parameters.size()); - ASSERT_STREQ(parameters[0].key, "key1"); - ASSERT_STREQ(parameters[0].value, "value1"); - ASSERT_STREQ(parameters[1].key, "key2"); - ASSERT_STREQ(parameters[1].value, "value2"); -} - -TEST(BootParametersTest, TestParseLegacyDisableBootAnimationIsSilent) { - BootParameters bootParameters = BootParameters(); - bootParameters.parseLegacyBootParameters(R"( - { - "brightness":200, - "volume":100, - "boot_animation_disabled":1, - "param_names":[], - "param_values":[] - } - )"); - - ASSERT_TRUE(bootParameters.isSilentBoot()); -} - -TEST(BootParametersTest, TestParseLegacyZeroVolumeIsSilent) { - BootParameters bootParameters = BootParameters(); - bootParameters.parseLegacyBootParameters(R"( - { - "brightness":200, - "volume":0, - "boot_animation_disabled":0, - "param_names":[], - "param_values":[] - } - )"); - - ASSERT_TRUE(bootParameters.isSilentBoot()); -} - -TEST(BootParametersTest, TestParseLegacyDefaultVolumeIsSilent) { - BootParameters bootParameters = BootParameters(); - bootParameters.parseLegacyBootParameters(R"( - { - "brightness":200, - "volume":-1000, - "boot_animation_disabled":0, - "param_names":[], - "param_values":[] - } - )"); - - ASSERT_TRUE(bootParameters.isSilentBoot()); -} - -TEST(BootParametersTest, TestParseLegacyNotSilent) { - BootParameters bootParameters = BootParameters(); - bootParameters.parseLegacyBootParameters(R"( - { - "brightness":200, - "volume":500, - "boot_animation_disabled":0, - "param_names":[], - "param_values":[] - } - )"); - - ASSERT_FALSE(bootParameters.isSilentBoot()); -} - -TEST(BootParametersTest, TestParseLegacyParameters) { - BootParameters bootParameters = BootParameters(); - bootParameters.parseLegacyBootParameters(R"( - { - "brightness":200, - "volume":100, - "boot_animation_disabled":1, - "param_names":["key1", "key2"], - "param_values":["value1", "value2"] - } - )"); - - auto parameters = bootParameters.getParameters(); - ASSERT_EQ(2u, parameters.size()); - ASSERT_STREQ(parameters[0].key, "key1"); - ASSERT_STREQ(parameters[0].value, "value1"); - ASSERT_STREQ(parameters[1].key, "key2"); - ASSERT_STREQ(parameters[1].value, "value2"); -} - -TEST(BootParametersTest, TestParseLegacyZeroParameters) { - BootParameters bootParameters = BootParameters(); - bootParameters.parseLegacyBootParameters(R"( - { - "brightness":200, - "volume":100, - "boot_animation_disabled":1, - "param_names":[], - "param_values":[] - } - )"); - - ASSERT_EQ(0u, bootParameters.getParameters().size()); -} - -TEST(BootParametersTest, TestMalformedLegacyParametersAreSkipped) { - BootParameters bootParameters = BootParameters(); - bootParameters.parseLegacyBootParameters(R"( - { - "brightness":500, - "volume":500, - "boot_animation_disabled":0, - "param_names":["key1", "key2"], - "param_values":[1, "value2"] - } - )"); - - auto parameters = bootParameters.getParameters(); - ASSERT_EQ(1u, parameters.size()); - ASSERT_STREQ(parameters[0].key, "key2"); - ASSERT_STREQ(parameters[0].value, "value2"); -} - -TEST(BootParametersTest, TestLegacyUnequalParameterSizesAreSkipped) { - BootParameters bootParameters = BootParameters(); - bootParameters.parseLegacyBootParameters(R"( - { - "brightness":500, - "volume":500, - "boot_animation_disabled":0, - "param_names":["key1", "key2"], - "param_values":["value1"] - } - )"); - - ASSERT_EQ(0u, bootParameters.getParameters().size()); -} - -TEST(BootParametersTest, TestMissingLegacyBootParametersIsSilent) { - BootParameters bootParameters = BootParameters(); - bootParameters.parseLegacyBootParameters(R"( - { - "brightness":500 - } - )"); - - EXPECT_TRUE(bootParameters.isSilentBoot()); - ASSERT_EQ(0u, bootParameters.getParameters().size()); -} - -TEST(BootParametersTest, TestLastFileIsRemovedOnError) { - TemporaryFile lastFile; - TemporaryDir tempDir; - std::string nonExistentFilePath(std::string(tempDir.path) + "/nonexistent"); - std::string contents; - - BootParameters::swapAndLoadBootConfigContents(lastFile.path, nonExistentFilePath.c_str(), - &contents); - - struct stat buf; - ASSERT_EQ(-1, lstat(lastFile.path, &buf)); - ASSERT_TRUE(contents.empty()); -} - -TEST(BootParametersTest, TestNextFileIsRemovedLastFileExistsOnSuccess) { - TemporaryFile lastFile; - TemporaryFile nextFile; - - base::WriteStringToFile("foo", nextFile.path); - - std::string contents; - // Expected side effects: - // - |next_file| is moved to |last_file| - // - |contents| is the contents of |next_file| before being moved. - BootParameters::swapAndLoadBootConfigContents(lastFile.path, nextFile.path, &contents); - - struct stat buf; - ASSERT_EQ(0, lstat(lastFile.path, &buf)); - ASSERT_EQ(-1, lstat(nextFile.path, &buf)); - ASSERT_EQ(contents, "foo"); - - contents.clear(); - ASSERT_TRUE(base::ReadFileToString(lastFile.path, &contents)); - ASSERT_EQ(contents, "foo"); -} - -} // namespace - -} // namespace android diff --git a/cmds/bootanimation/iot/bootanim_iot.rc b/cmds/bootanimation/iot/bootanim_iot.rc deleted file mode 100644 index 2fc13364b53d..000000000000 --- a/cmds/bootanimation/iot/bootanim_iot.rc +++ /dev/null @@ -1,2 +0,0 @@ -on post-fs-data - mkdir /data/misc/bootanimation 0777 root root diff --git a/cmds/bootanimation/iot/iotbootanimation_main.cpp b/cmds/bootanimation/iot/iotbootanimation_main.cpp deleted file mode 100644 index ae3529796b9a..000000000000 --- a/cmds/bootanimation/iot/iotbootanimation_main.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (C) 2017 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. - */ - -#define LOG_TAG "IotBootAnimation" - -#include <base/files/file_util.h> -#include <binder/IPCThreadState.h> -#include <binder/IServiceManager.h> -#include <binder/ProcessState.h> -#include <cutils/properties.h> -#include <sys/resource.h> -#include <utils/Log.h> -#include <utils/threads.h> -#include <BootAnimation.h> - -#include "BootAction.h" -#include "BootAnimationUtil.h" -#include "BootParameters.h" - -using namespace android; - -// Create a typedef for readability. -typedef android::BootAnimation::Animation Animation; - -namespace { - -constexpr const char* kDefaultLibName = "libbootaction.so"; - -class BootActionAnimationCallbacks : public android::BootAnimation::Callbacks { -public: - BootActionAnimationCallbacks(std::unique_ptr<BootParameters> bootParameters) - : mBootParameters(std::move(bootParameters)) {} - - void init(const Vector<Animation::Part>&) override { - std::string library_path("/oem/lib/"); - - // This value is optionally provided by the user and will be written to - // /oem/oem.prop. - char property[PROP_VALUE_MAX] = {0}; - property_get("ro.oem.bootactions.lib", property, kDefaultLibName); - library_path += property; - - if (!::base::PathExists(::base::FilePath(library_path))) { - ALOGI("Skipping boot actions: %s does not exist", library_path.c_str()); - return; - } - - mBootAction = new BootAction(); - if (!mBootAction->init(library_path, mBootParameters)) { - mBootAction = nullptr; - } - }; - - void playPart(int partNumber, const Animation::Part&, int playNumber) override { - if (mBootAction != nullptr) { - mBootAction->startPart(partNumber, playNumber); - } - }; - - void shutdown() override { - if (mBootAction != nullptr) { - // If we have a bootaction we want to wait until we are actually - // told to shut down. If the animation exits early keep the action - // running. - char value[PROPERTY_VALUE_MAX] = {0}; - for (int exitRequested = 0; exitRequested == 0; ) { - property_get("service.bootanim.exit", value, "0"); - exitRequested = atoi(value); - - // Poll value at 10hz. - if (exitRequested == 0) { - usleep(100000); - } - } - - mBootAction->shutdown(); - // Give it two seconds to shut down. - sleep(2); - mBootAction = nullptr; - } - }; - -private: - std::unique_ptr<BootParameters> mBootParameters; - sp<BootAction> mBootAction = nullptr; -}; - -} // namespace - -int main() { - setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_DISPLAY); - - // Clear our params for next boot no matter what. - std::unique_ptr<BootParameters> bootParameters(new BootParameters()); - - if (bootAnimationDisabled()) { - ALOGI("boot animation disabled"); - return 0; - } - - waitForSurfaceFlinger(); - - sp<ProcessState> proc(ProcessState::self()); - ProcessState::self()->startThreadPool(); - - bool isSilentBoot = bootParameters->isSilentBoot(); - sp<BootActionAnimationCallbacks> callbacks = - new BootActionAnimationCallbacks(std::move(bootParameters)); - - // On silent boot, animations aren't displayed. - if (isSilentBoot) { - callbacks->init({}); - } else { - sp<BootAnimation> boot = new BootAnimation(callbacks); - } - - IPCThreadState::self()->joinThreadPool(); - return 0; -} diff --git a/cmds/bu/Android.bp b/cmds/bu/Android.bp new file mode 100644 index 000000000000..0866ee053107 --- /dev/null +++ b/cmds/bu/Android.bp @@ -0,0 +1,8 @@ +// Copyright 2011 The Android Open Source Project +// + +java_binary { + name: "bu", + wrapper: "bu", + srcs: ["**/*.java"], +} diff --git a/cmds/bu/Android.mk b/cmds/bu/Android.mk deleted file mode 100644 index 4fd5fecdd8b9..000000000000 --- a/cmds/bu/Android.mk +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright 2011 The Android Open Source Project -# -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := $(call all-subdir-java-files) -LOCAL_MODULE := bu -LOCAL_MODULE_TAGS := optional -include $(BUILD_JAVA_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := bu -LOCAL_SRC_FILES := bu -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_MODULE_TAGS := optional -include $(BUILD_PREBUILT) - - diff --git a/cmds/content/Android.bp b/cmds/content/Android.bp new file mode 100644 index 000000000000..96d14696d0a2 --- /dev/null +++ b/cmds/content/Android.bp @@ -0,0 +1,7 @@ +// Copyright 2012 The Android Open Source Project + +java_binary { + name: "content", + wrapper: "content", + srcs: ["**/*.java"], +} diff --git a/cmds/content/Android.mk b/cmds/content/Android.mk deleted file mode 100644 index 9302e2fc54db..000000000000 --- a/cmds/content/Android.mk +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2012 The Android Open Source Project - -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_SRC_FILES := $(call all-subdir-java-files) -LOCAL_MODULE := content -include $(BUILD_JAVA_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := content -LOCAL_SRC_FILES := content -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_MODULE_TAGS := optional -include $(BUILD_PREBUILT) diff --git a/cmds/content/content b/cmds/content/content index f1bfe1737c5a..91f2dfb16ac9 100755 --- a/cmds/content/content +++ b/cmds/content/content @@ -1,6 +1,3 @@ #!/system/bin/sh -# Script to start "content" on the device, which has a very rudimentary shell. -base=/system -export CLASSPATH=$base/framework/content.jar -exec app_process $base/bin com.android.commands.content.Content "$@" - +export CLASSPATH=/system/framework/content.jar +exec app_process /system/bin com.android.commands.content.Content "$@" diff --git a/cmds/dpm/Android.bp b/cmds/dpm/Android.bp new file mode 100644 index 000000000000..753121e6d886 --- /dev/null +++ b/cmds/dpm/Android.bp @@ -0,0 +1,8 @@ +// Copyright 2014 The Android Open Source Project +// + +java_binary { + name: "dpm", + wrapper: "dpm", + srcs: ["**/*.java"], +} diff --git a/cmds/dpm/Android.mk b/cmds/dpm/Android.mk deleted file mode 100644 index 9f5aee403f82..000000000000 --- a/cmds/dpm/Android.mk +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2014 The Android Open Source Project -# -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_SRC_FILES := $(call all-subdir-java-files) -LOCAL_MODULE := dpm -include $(BUILD_JAVA_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := dpm -LOCAL_SRC_FILES := dpm -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_MODULE_TAGS := optional -include $(BUILD_PREBUILT) diff --git a/cmds/hid/Android.bp b/cmds/hid/Android.bp index 2b7963aa9425..54c8bf3ef34c 100644 --- a/cmds/hid/Android.bp +++ b/cmds/hid/Android.bp @@ -1 +1,9 @@ -subdirs = ["jni"] +// Copyright 2015 The Android Open Source Project +// + +java_binary { + name: "hid", + wrapper: "hid", + srcs: ["**/*.java"], + required: ["libhidcommand_jni"], +} diff --git a/cmds/hid/Android.mk b/cmds/hid/Android.mk deleted file mode 100644 index 574834dea31d..000000000000 --- a/cmds/hid/Android.mk +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2015 The Android Open Source Project -# -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_SRC_FILES := $(call all-subdir-java-files) -LOCAL_MODULE := hid -LOCAL_JNI_SHARED_LIBRARIES := libhidcommand_jni -LOCAL_REQUIRED_MODULES := libhidcommand_jni -include $(BUILD_JAVA_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := hid -LOCAL_SRC_FILES := hid -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE_CLASS := EXECUTABLES -include $(BUILD_PREBUILT) - -include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/cmds/hid/hid b/cmds/hid/hid index 3931da1e2a85..43c76345c9e1 100755 --- a/cmds/hid/hid +++ b/cmds/hid/hid @@ -1,14 +1,9 @@ #!/system/bin/sh -# -# Script to start "hid" on the device, which has a very rudimentary -# shell. -# -base=/system -export CLASSPATH=$base/framework/hid.jar # Preload the native portion libhidcommand_jni.so to bypass the dependency # checks in the Java classloader, which prohibit dependencies that aren't # listed in system/core/rootdir/etc/public.libraries.android.txt. export LD_PRELOAD=libhidcommand_jni.so -exec app_process $base/bin com.android.commands.hid.Hid "$@" +export CLASSPATH=/system/framework/hid.jar +exec app_process /system/bin com.android.commands.hid.Hid "$@" diff --git a/cmds/idmap/scan.cpp b/cmds/idmap/scan.cpp index d69dd79555a1..847dda3df91f 100644 --- a/cmds/idmap/scan.cpp +++ b/cmds/idmap/scan.cpp @@ -9,7 +9,6 @@ #include <androidfw/ResourceTypes.h> #include <androidfw/StreamingZipInflater.h> #include <androidfw/ZipFileRO.h> -#include <cutils/jstring.h> #include <cutils/properties.h> #include <private/android_filesystem_config.h> // for AID_SYSTEM #include <utils/SortedVector.h> @@ -84,15 +83,9 @@ namespace { } bool check_property(String16 property, String16 value) { - const char *prop; - const char *val; - - prop = strndup16to8(property.string(), property.size()); char propBuf[PROPERTY_VALUE_MAX]; - property_get(prop, propBuf, NULL); - val = strndup16to8(value.string(), value.size()); - - return (strcmp(propBuf, val) == 0); + property_get(String8(property).c_str(), propBuf, NULL); + return String8(value) == propBuf; } int parse_overlay_tag(const ResXMLTree& parser, const char *target_package_name, diff --git a/cmds/idmap2/Android.bp b/cmds/idmap2/Android.bp index 18d56fa87cca..4c77ba402595 100644 --- a/cmds/idmap2/Android.bp +++ b/cmds/idmap2/Android.bp @@ -18,6 +18,7 @@ cc_defaults { tidy_checks: [ "modernize-*", "-modernize-avoid-c-arrays", + "-modernize-use-trailing-return-type", "android-*", "misc-*", "readability-*", @@ -68,6 +69,7 @@ cc_library { static_libs: [ "libandroidfw", "libbase", + "libcutils", "libutils", "libziparchive", ], @@ -120,6 +122,7 @@ cc_test { static_libs: [ "libandroidfw", "libbase", + "libcutils", "libidmap2", "liblog", "libutils", @@ -162,6 +165,7 @@ cc_binary { static_libs: [ "libandroidfw", "libbase", + "libcutils", "libidmap2", "liblog", "libutils", @@ -222,4 +226,5 @@ filegroup { srcs: [ "idmap2d/aidl/android/os/IIdmap2.aidl", ], + path: "idmap2d/aidl", } diff --git a/cmds/idmap2/idmap2/Scan.cpp b/cmds/idmap2/idmap2/Scan.cpp index cfac5f31e2e6..da8c06e5f74f 100644 --- a/cmds/idmap2/idmap2/Scan.cpp +++ b/cmds/idmap2/idmap2/Scan.cpp @@ -103,6 +103,7 @@ std::vector<std::string> PoliciesForPath(const std::string& apk_path) { {"/oem/", kPolicyOem}, {"/product/", kPolicyProduct}, {"/system/", kPolicySystem}, + {"/system_ext/", kPolicySystem}, {"/vendor/", kPolicyVendor}, }; @@ -175,6 +176,17 @@ Result<Unit> Scan(const std::vector<std::string>& args) { continue; } + // Note that conditional property enablement/exclusion only applies if + // the attribute is present. In its absence, all overlays are presumed enabled. + if (!overlay_info->requiredSystemPropertyName.empty() + && !overlay_info->requiredSystemPropertyValue.empty()) { + // if property set & equal to value, then include overlay - otherwise skip + if (android::base::GetProperty(overlay_info->requiredSystemPropertyName, "") + != overlay_info->requiredSystemPropertyValue) { + continue; + } + } + std::vector<std::string> fulfilled_policies; if (!override_policies.empty()) { fulfilled_policies = override_policies; diff --git a/cmds/idmap2/include/idmap2/ResourceUtils.h b/cmds/idmap2/include/idmap2/ResourceUtils.h index 8797a788dd1d..9a0c2abced5a 100644 --- a/cmds/idmap2/include/idmap2/ResourceUtils.h +++ b/cmds/idmap2/include/idmap2/ResourceUtils.h @@ -30,6 +30,8 @@ namespace android::idmap2::utils { struct OverlayManifestInfo { std::string target_package; // NOLINT(misc-non-private-member-variables-in-classes) std::string target_name; // NOLINT(misc-non-private-member-variables-in-classes) + std::string requiredSystemPropertyName; // NOLINT(misc-non-private-member-variables-in-classes) + std::string requiredSystemPropertyValue; // NOLINT(misc-non-private-member-variables-in-classes) bool is_static; // NOLINT(misc-non-private-member-variables-in-classes) int priority = -1; // NOLINT(misc-non-private-member-variables-in-classes) }; diff --git a/cmds/idmap2/libidmap2/ResourceUtils.cpp b/cmds/idmap2/libidmap2/ResourceUtils.cpp index 71ba3f0f1ac2..dce83e35978d 100644 --- a/cmds/idmap2/libidmap2/ResourceUtils.cpp +++ b/cmds/idmap2/libidmap2/ResourceUtils.cpp @@ -103,6 +103,16 @@ Result<OverlayManifestInfo> ExtractOverlayManifestInfo(const std::string& path, info.priority = std::stoi(iter->second); } + iter = tag->find("requiredSystemPropertyName"); + if (iter != tag->end()) { + info.requiredSystemPropertyName = iter->second; + } + + iter = tag->find("requiredSystemPropertyValue"); + if (iter != tag->end()) { + info.requiredSystemPropertyValue = iter->second; + } + return info; } diff --git a/cmds/idmap2/libidmap2/ZipFile.cpp b/cmds/idmap2/libidmap2/ZipFile.cpp index 812fd6eacbf9..4f5e3a45f183 100644 --- a/cmds/idmap2/libidmap2/ZipFile.cpp +++ b/cmds/idmap2/libidmap2/ZipFile.cpp @@ -45,7 +45,7 @@ ZipFile::~ZipFile() { std::unique_ptr<const MemoryChunk> ZipFile::Uncompress(const std::string& entryPath) const { ::ZipEntry entry; - int32_t status = ::FindEntry(handle_, ::ZipString(entryPath.c_str()), &entry); + int32_t status = ::FindEntry(handle_, entryPath, &entry); if (status != 0) { return nullptr; } @@ -59,7 +59,7 @@ std::unique_ptr<const MemoryChunk> ZipFile::Uncompress(const std::string& entryP Result<uint32_t> ZipFile::Crc(const std::string& entryPath) const { ::ZipEntry entry; - int32_t status = ::FindEntry(handle_, ::ZipString(entryPath.c_str()), &entry); + int32_t status = ::FindEntry(handle_, entryPath, &entry); if (status != 0) { return Error("failed to find zip entry %s", entryPath.c_str()); } diff --git a/cmds/idmap2/tests/FileUtilsTests.cpp b/cmds/idmap2/tests/FileUtilsTests.cpp index f4a306e41e32..f55acee029dc 100644 --- a/cmds/idmap2/tests/FileUtilsTests.cpp +++ b/cmds/idmap2/tests/FileUtilsTests.cpp @@ -15,6 +15,7 @@ */ #include <dirent.h> +#include <fcntl.h> #include <set> #include <string> @@ -69,7 +70,7 @@ TEST(FileUtilsTests, FindFilesFindApkFilesRecursive) { TEST(FileUtilsTests, ReadFile) { int pipefd[2]; - ASSERT_EQ(pipe(pipefd), 0); + ASSERT_EQ(pipe2(pipefd, O_CLOEXEC), 0); ASSERT_EQ(write(pipefd[1], "foobar", 6), 6); close(pipefd[1]); diff --git a/cmds/ime/Android.bp b/cmds/ime/Android.bp new file mode 100644 index 000000000000..76a16c81ca38 --- /dev/null +++ b/cmds/ime/Android.bp @@ -0,0 +1,7 @@ +// Copyright 2007 The Android Open Source Project +// + +sh_binary { + name: "ime", + src: "ime", +} diff --git a/cmds/ime/Android.mk b/cmds/ime/Android.mk deleted file mode 100644 index ca608e8c2c34..000000000000 --- a/cmds/ime/Android.mk +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright 2007 The Android Open Source Project -# -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_MODULE := ime -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_SRC_FILES := ime -include $(BUILD_PREBUILT) diff --git a/cmds/incident/main.cpp b/cmds/incident/main.cpp index dfb4f994b866..6c3d19715c2e 100644 --- a/cmds/incident/main.cpp +++ b/cmds/incident/main.cpp @@ -198,6 +198,26 @@ parse_receiver_arg(const string& arg, string* pkg, string* cls) } // ================================================================================ +static int +stream_output(const int read_fd, const int write_fd) { + while (true) { + uint8_t buf[4096]; + ssize_t amt = TEMP_FAILURE_RETRY(read(read_fd, buf, sizeof(buf))); + if (amt < 0) { + break; + } else if (amt == 0) { + break; + } + + ssize_t wamt = TEMP_FAILURE_RETRY(write(write_fd, buf, amt)); + if (wamt != amt) { + return errno; + } + } + return 0; +} + +// ================================================================================ static void usage(FILE* out) { @@ -208,11 +228,13 @@ usage(FILE* out) fprintf(out, "OPTIONS\n"); fprintf(out, " -l list available sections\n"); fprintf(out, " -p privacy spec, LOCAL, EXPLICIT or AUTOMATIC. Default AUTOMATIC.\n"); + fprintf(out, " -r REASON human readable description of why the report is taken.\n"); fprintf(out, "\n"); fprintf(out, "and one of these destinations:\n"); fprintf(out, " -b (default) print the report to stdout (in proto format)\n"); fprintf(out, " -d send the report into dropbox\n"); - fprintf(out, " -r REASON human readable description of why the report is taken.\n"); + fprintf(out, " -u print a full report to stdout for dumpstate to zip as a bug\n"); + fprintf(out, " report. SECTION is ignored. Should only be called by dumpstate.\n"); fprintf(out, " -s PKG/CLS send broadcast to the broadcast receiver.\n"); fprintf(out, "\n"); fprintf(out, " SECTION the field numbers of the incident report fields to include\n"); @@ -224,14 +246,14 @@ main(int argc, char** argv) { Status status; IncidentReportArgs args; - enum { DEST_UNSET, DEST_DROPBOX, DEST_STDOUT, DEST_BROADCAST } destination = DEST_UNSET; + enum { DEST_UNSET, DEST_DROPBOX, DEST_STDOUT, DEST_BROADCAST, DEST_DUMPSTATE } destination = DEST_UNSET; int privacyPolicy = PRIVACY_POLICY_AUTOMATIC; string reason; string receiverArg; // Parse the args int opt; - while ((opt = getopt(argc, argv, "bhdlp:r:s:")) != -1) { + while ((opt = getopt(argc, argv, "bhdlp:r:s:u")) != -1) { switch (opt) { case 'h': usage(stdout); @@ -253,6 +275,13 @@ main(int argc, char** argv) } destination = DEST_DROPBOX; break; + case 'u': + if (!(destination == DEST_UNSET || destination == DEST_DUMPSTATE)) { + usage(stderr); + return 1; + } + destination = DEST_DUMPSTATE; + break; case 'p': privacyPolicy = get_privacy_policy(optarg); break; @@ -355,21 +384,16 @@ main(int argc, char** argv) // Wait for the result and print out the data they send. //IPCThreadState::self()->joinThreadPool(); - - while (true) { - uint8_t buf[4096]; - ssize_t amt = TEMP_FAILURE_RETRY(read(fds[0], buf, sizeof(buf))); - if (amt < 0) { - break; - } else if (amt == 0) { - break; - } - - ssize_t wamt = TEMP_FAILURE_RETRY(write(STDOUT_FILENO, buf, amt)); - if (wamt != amt) { - return errno; - } + return stream_output(fds[0], STDOUT_FILENO); + } else if (destination == DEST_DUMPSTATE) { + // Call into the service + sp<StatusListener> listener(new StatusListener()); + status = service->reportIncidentToDumpstate(writeEnd, listener); + if (!status.isOk()) { + fprintf(stderr, "reportIncident returned \"%s\"\n", status.toString8().string()); + return 1; } + return stream_output(fds[0], STDOUT_FILENO); } else { status = service->reportIncident(args); if (!status.isOk()) { diff --git a/cmds/incidentd/src/IncidentService.cpp b/cmds/incidentd/src/IncidentService.cpp index a52726396b53..999936bda1d3 100644 --- a/cmds/incidentd/src/IncidentService.cpp +++ b/cmds/incidentd/src/IncidentService.cpp @@ -46,12 +46,11 @@ enum { #define DEFAULT_BYTES_SIZE_LIMIT (96 * 1024 * 1024) // 96MB #define DEFAULT_REFACTORY_PERIOD_MS (24 * 60 * 60 * 1000) // 1 Day -// Skip these sections for dumpstate only. Dumpstate allows 10s max for each service to dump. +// Skip these sections (for dumpstate only) // Skip logs (1100 - 1108) and traces (1200 - 1202) because they are already in the bug report. -// Skip 3018 because it takes too long. -#define SKIPPED_SECTIONS { 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, /* Logs */ \ - 1200, 1201, 1202, /* Native, hal, java traces */ \ - 3018 /* "meminfo -a --proto" */ } +#define SKIPPED_DUMPSTATE_SECTIONS { \ + 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, /* Logs */ \ + 1200, 1201, 1202, /* Native, hal, java traces */ } namespace android { namespace os { @@ -307,6 +306,39 @@ Status IncidentService::reportIncidentToStream(const IncidentReportArgs& args, return Status::ok(); } +Status IncidentService::reportIncidentToDumpstate(const unique_fd& stream, + const sp<IIncidentReportStatusListener>& listener) { + uid_t caller = IPCThreadState::self()->getCallingUid(); + if (caller != AID_ROOT && caller != AID_SHELL) { + ALOGW("Calling uid %d does not have permission: only ROOT or SHELL allowed", caller); + return Status::fromExceptionCode(Status::EX_SECURITY, "Only ROOT or SHELL allowed"); + } + + ALOGD("Stream incident report to dumpstate"); + IncidentReportArgs incidentArgs; + // Privacy policy for dumpstate incident reports is always EXPLICIT. + incidentArgs.setPrivacyPolicy(PRIVACY_POLICY_EXPLICIT); + + int skipped[] = SKIPPED_DUMPSTATE_SECTIONS; + for (const Section** section = SECTION_LIST; *section; section++) { + const int id = (*section)->id; + if (std::find(std::begin(skipped), std::end(skipped), id) == std::end(skipped) + && !section_requires_specific_mention(id)) { + incidentArgs.addSection(id); + } + } + + // The ReportRequest takes ownership of the fd, so we need to dup it. + int fd = dup(stream.get()); + if (fd < 0) { + return Status::fromStatusT(-errno); + } + + mHandler->scheduleStreamingReport(incidentArgs, listener, fd); + + return Status::ok(); +} + Status IncidentService::systemRunning() { if (IPCThreadState::self()->getCallingUid() != AID_SYSTEM) { return Status::fromExceptionCode(Status::EX_SECURITY, @@ -551,43 +583,6 @@ status_t IncidentService::cmd_privacy(FILE* in, FILE* out, FILE* err, Vector<Str return NO_ERROR; } -status_t IncidentService::dump(int fd, const Vector<String16>& args) { - if (std::find(args.begin(), args.end(), String16("--proto")) == args.end()) { - ALOGD("Skip dumping incident. Only proto format is supported."); - dprintf(fd, "Incident dump only supports proto version.\n"); - return NO_ERROR; - } - - ALOGD("Dump incident proto"); - IncidentReportArgs incidentArgs; - incidentArgs.setPrivacyPolicy(PRIVACY_POLICY_EXPLICIT); - int skipped[] = SKIPPED_SECTIONS; - for (const Section** section = SECTION_LIST; *section; section++) { - const int id = (*section)->id; - if (std::find(std::begin(skipped), std::end(skipped), id) == std::end(skipped) - && !section_requires_specific_mention(id)) { - incidentArgs.addSection(id); - } - } - - if (!checkIncidentPermissions(incidentArgs).isOk()) { - return PERMISSION_DENIED; - } - - // The ReportRequest takes ownership of the fd, so we need to dup it. - int fd1 = dup(fd); - if (fd1 < 0) { - return -errno; - } - - // TODO: Remove this. Someone even dumpstate, wanting to get an incident report - // should use the API. That will take making dumpstated call the API, which is a - // good thing. It also means it won't be subject to the timeout. - mHandler->scheduleStreamingReport(incidentArgs, NULL, fd1); - - return NO_ERROR; -} - } // namespace incidentd } // namespace os } // namespace android diff --git a/cmds/incidentd/src/IncidentService.h b/cmds/incidentd/src/IncidentService.h index 6481321bbd69..fb013d0bf92d 100644 --- a/cmds/incidentd/src/IncidentService.h +++ b/cmds/incidentd/src/IncidentService.h @@ -123,6 +123,9 @@ public: const sp<IIncidentReportStatusListener>& listener, const unique_fd& stream); + virtual Status reportIncidentToDumpstate(const unique_fd& stream, + const sp<IIncidentReportStatusListener>& listener); + virtual Status systemRunning(); virtual Status getIncidentReportList(const String16& pkg, const String16& cls, @@ -140,7 +143,6 @@ public: virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) override; virtual status_t command(FILE* in, FILE* out, FILE* err, Vector<String8>& args); - virtual status_t dump(int fd, const Vector<String16>& args); private: sp<WorkDirectory> mWorkDirectory; diff --git a/cmds/incidentd/src/Section.cpp b/cmds/incidentd/src/Section.cpp index 1572114c639f..f476fcf91bd5 100644 --- a/cmds/incidentd/src/Section.cpp +++ b/cmds/incidentd/src/Section.cpp @@ -546,16 +546,16 @@ status_t LogSection::BlockingCall(int pipeWriteFd) const { ; android_log_list_element elem; - lastTimestamp.tv_sec = msg.entry_v1.sec; - lastTimestamp.tv_nsec = msg.entry_v1.nsec; + lastTimestamp.tv_sec = msg.entry.sec; + lastTimestamp.tv_nsec = msg.entry.nsec; // format a BinaryLogEntry uint64_t token = proto.start(LogProto::BINARY_LOGS); - proto.write(BinaryLogEntry::SEC, msg.entry_v1.sec); - proto.write(BinaryLogEntry::NANOSEC, msg.entry_v1.nsec); - proto.write(BinaryLogEntry::UID, (int)msg.entry_v4.uid); - proto.write(BinaryLogEntry::PID, msg.entry_v1.pid); - proto.write(BinaryLogEntry::TID, msg.entry_v1.tid); + proto.write(BinaryLogEntry::SEC, (int32_t)msg.entry.sec); + proto.write(BinaryLogEntry::NANOSEC, (int32_t)msg.entry.nsec); + proto.write(BinaryLogEntry::UID, (int)msg.entry.uid); + proto.write(BinaryLogEntry::PID, msg.entry.pid); + proto.write(BinaryLogEntry::TID, (int32_t)msg.entry.tid); proto.write(BinaryLogEntry::TAG_INDEX, get4LE(reinterpret_cast<uint8_t const*>(msg.msg()))); do { @@ -603,7 +603,7 @@ status_t LogSection::BlockingCall(int pipeWriteFd) const { } } else { AndroidLogEntry entry; - err = android_log_processLogBuffer(&msg.entry_v1, &entry); + err = android_log_processLogBuffer(&msg.entry, &entry); if (err != NO_ERROR) { ALOGW("[%s] fails to process to an entry.\n", this->name.string()); break; diff --git a/cmds/incidentd/src/WorkDirectory.cpp b/cmds/incidentd/src/WorkDirectory.cpp index 8dcb86537487..7e7c6421e23f 100644 --- a/cmds/incidentd/src/WorkDirectory.cpp +++ b/cmds/incidentd/src/WorkDirectory.cpp @@ -209,7 +209,7 @@ void log_envelope(const ReportFileProto& envelope) { } ALOGD(" data_file=%s", envelope.data_file().c_str()); ALOGD(" privacy_policy=%d", envelope.privacy_policy()); - ALOGD(" data_file_size=%lld", envelope.data_file_size()); + ALOGD(" data_file_size=%" PRIi64, (int64_t)envelope.data_file_size()); ALOGD(" completed=%d", envelope.completed()); ALOGD("}"); } diff --git a/cmds/incidentd/src/main.cpp b/cmds/incidentd/src/main.cpp index 098d74ecd786..494882336611 100644 --- a/cmds/incidentd/src/main.cpp +++ b/cmds/incidentd/src/main.cpp @@ -45,8 +45,7 @@ int main(int /*argc*/, char** /*argv*/) { // Create the service sp<IncidentService> service = new IncidentService(looper); - if (defaultServiceManager()->addService(String16("incident"), service, false, - IServiceManager::DUMP_FLAG_PRIORITY_NORMAL | IServiceManager::DUMP_FLAG_PROTO) != 0) { + if (defaultServiceManager()->addService(String16("incident"), service) != 0) { ALOGE("Failed to add service"); return -1; } diff --git a/cmds/input/Android.bp b/cmds/input/Android.bp new file mode 100644 index 000000000000..a0ebde63eb6e --- /dev/null +++ b/cmds/input/Android.bp @@ -0,0 +1,8 @@ +// Copyright 2008 The Android Open Source Project +// + +java_binary { + name: "input", + wrapper: "input", + srcs: ["**/*.java"], +} diff --git a/cmds/input/Android.mk b/cmds/input/Android.mk deleted file mode 100644 index 4e983e398ccb..000000000000 --- a/cmds/input/Android.mk +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2008 The Android Open Source Project -# -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_SRC_FILES := $(call all-subdir-java-files) -LOCAL_MODULE := inputlib -LOCAL_MODULE_STEM := input -include $(BUILD_JAVA_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := input -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_SRC_FILES := input -LOCAL_REQUIRED_MODULES := inputlib -include $(BUILD_PREBUILT) diff --git a/cmds/input/input b/cmds/input/input index 54ab94762e5c..2625eba17153 100755 --- a/cmds/input/input +++ b/cmds/input/input @@ -1,8 +1,3 @@ #!/system/bin/sh -# Script to start "input" on the device, which has a very rudimentary -# shell. -# -base=/system -export CLASSPATH=$base/framework/input.jar -exec app_process $base/bin com.android.commands.input.Input "$@" - +export CLASSPATH=/system/framework/input.jar +exec app_process /system/bin com.android.commands.input.Input "$@" diff --git a/cmds/locksettings/Android.bp b/cmds/locksettings/Android.bp new file mode 100644 index 000000000000..59ccc5cd082e --- /dev/null +++ b/cmds/locksettings/Android.bp @@ -0,0 +1,19 @@ +// Copyright (C) 2016 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. + +java_binary { + name: "locksettings", + wrapper: "locksettings", + srcs: ["**/*.java"], +} diff --git a/cmds/locksettings/Android.mk b/cmds/locksettings/Android.mk deleted file mode 100644 index 76766c7c6955..000000000000 --- a/cmds/locksettings/Android.mk +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (C) 2016 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. - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := $(call all-subdir-java-files) -LOCAL_MODULE := locksettings -LOCAL_MODULE_TAGS := optional -include $(BUILD_JAVA_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := locksettings -LOCAL_SRC_FILES := locksettings -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_MODULE_TAGS := optional -include $(BUILD_PREBUILT) - - diff --git a/cmds/media/media b/cmds/media/media index 8ada9145a4f7..00c3915f2e65 100755 --- a/cmds/media/media +++ b/cmds/media/media @@ -1,7 +1,3 @@ #!/system/bin/sh -# Script to start "media_cmd" on the device, which has a very rudimentary -# shell. -# -base=/system -export CLASSPATH=$base/framework/media.jar -exec app_process $base/bin com.android.commands.media.Media "$@" +export CLASSPATH=/system/framework/media.jar +exec app_process /system/bin com.android.commands.media.Media "$@" diff --git a/cmds/pm/Android.bp b/cmds/pm/Android.bp new file mode 100644 index 000000000000..0644f6efcb8a --- /dev/null +++ b/cmds/pm/Android.bp @@ -0,0 +1,7 @@ +// Copyright 2007 The Android Open Source Project +// + +sh_binary { + name: "pm", + src: "pm", +} diff --git a/cmds/pm/Android.mk b/cmds/pm/Android.mk deleted file mode 100644 index 960c8052f935..000000000000 --- a/cmds/pm/Android.mk +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright 2007 The Android Open Source Project -# -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_MODULE := pm -LOCAL_SRC_FILES := pm -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_MODULE_TAGS := optional -include $(BUILD_PREBUILT) diff --git a/cmds/requestsync/Android.bp b/cmds/requestsync/Android.bp new file mode 100644 index 000000000000..ef2a8a6be3ca --- /dev/null +++ b/cmds/requestsync/Android.bp @@ -0,0 +1,8 @@ +// Copyright 2012 The Android Open Source Project +// + +java_binary { + name: "requestsync", + wrapper: "requestsync", + srcs: ["**/*.java"], +} diff --git a/cmds/requestsync/Android.mk b/cmds/requestsync/Android.mk deleted file mode 100644 index fe2ffd8de4dc..000000000000 --- a/cmds/requestsync/Android.mk +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2012 The Android Open Source Project -# -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := $(call all-subdir-java-files) -LOCAL_MODULE := requestsync -LOCAL_MODULE_TAGS := optional -include $(BUILD_JAVA_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := requestsync -LOCAL_SRC_FILES := requestsync -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_MODULE_TAGS := optional -include $(BUILD_PREBUILT) diff --git a/cmds/settings/Android.bp b/cmds/settings/Android.bp new file mode 100644 index 000000000000..8a78e5420a5f --- /dev/null +++ b/cmds/settings/Android.bp @@ -0,0 +1,7 @@ +// Copyright 2011 The Android Open Source Project +// + +sh_binary { + name: "settings", + src: "settings", +} diff --git a/cmds/settings/Android.mk b/cmds/settings/Android.mk deleted file mode 100644 index 8a8d1bb95c66..000000000000 --- a/cmds/settings/Android.mk +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2011 The Android Open Source Project -# -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -include $(CLEAR_VARS) -LOCAL_MODULE := settings -LOCAL_SRC_FILES := settings -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_MODULE_TAGS := optional -include $(BUILD_PREBUILT) - - diff --git a/cmds/sm/Android.bp b/cmds/sm/Android.bp new file mode 100644 index 000000000000..11e4e72b435b --- /dev/null +++ b/cmds/sm/Android.bp @@ -0,0 +1,8 @@ +// Copyright 2015 The Android Open Source Project +// + +java_binary { + name: "sm", + wrapper: "sm", + srcs: ["**/*.java"], +} diff --git a/cmds/sm/Android.mk b/cmds/sm/Android.mk deleted file mode 100644 index 7cb1e129d2f7..000000000000 --- a/cmds/sm/Android.mk +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2015 The Android Open Source Project -# -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_SRC_FILES := $(call all-subdir-java-files) -LOCAL_MODULE := sm -include $(BUILD_JAVA_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := sm -LOCAL_SRC_FILES := sm -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_MODULE_TAGS := optional -include $(BUILD_PREBUILT) diff --git a/cmds/sm/sm b/cmds/sm/sm index 4bc859e0c374..30eae00a990d 100755 --- a/cmds/sm/sm +++ b/cmds/sm/sm @@ -1,7 +1,3 @@ #!/system/bin/sh -# Script to start "sm" on the device, which has a very rudimentary -# shell. -# -base=/system -export CLASSPATH=$base/framework/sm.jar -exec app_process $base/bin com.android.commands.sm.Sm "$@" +export CLASSPATH=/system/framework/sm.jar +exec app_process /system/bin com.android.commands.sm.Sm "$@" diff --git a/cmds/statsd/Android.bp b/cmds/statsd/Android.bp index 6bedfcdfafa3..8944dedd6c96 100644 --- a/cmds/statsd/Android.bp +++ b/cmds/statsd/Android.bp @@ -71,7 +71,6 @@ cc_defaults { "src/config/ConfigManager.cpp", "src/external/GpuStatsPuller.cpp", "src/external/Perfetto.cpp", - "src/external/Perfprofd.cpp", "src/external/StatsPuller.cpp", "src/external/StatsCallbackPuller.cpp", "src/external/StatsCompanionServicePuller.cpp", @@ -109,8 +108,6 @@ cc_defaults { "src/socket/StatsSocketListener.cpp", "src/shell/ShellSubscriber.cpp", "src/shell/shell_config.proto", - - ":perfprofd_aidl", ], local_include_dirs: [ @@ -135,8 +132,6 @@ cc_defaults { "libhardware", "libhardware_legacy", "libhidlbase", - "libhidltransport", - "libhwbinder", "android.frameworks.stats@1.0", "android.hardware.health@2.0", "android.hardware.power@1.0", @@ -212,6 +207,10 @@ cc_test { ], srcs: [ + // atom_field_options.proto needs field_options.proto, but that is + // not included in libprotobuf-cpp-lite, so compile it here. + ":libprotobuf-internal-protos", + "src/atom_field_options.proto", "src/atoms.proto", "src/stats_log.proto", @@ -273,11 +272,11 @@ cc_test { ], proto: { - type: "full", + type: "lite", include_dirs: ["external/protobuf/src"], }, - shared_libs: ["libprotobuf-cpp-full"], + shared_libs: ["libprotobuf-cpp-lite"], } @@ -290,6 +289,10 @@ cc_benchmark { defaults: ["statsd_defaults"], srcs: [ + // atom_field_options.proto needs field_options.proto, but that is + // not included in libprotobuf-cpp-lite, so compile it here. + ":libprotobuf-internal-protos", + "src/atom_field_options.proto", "src/atoms.proto", "src/stats_log.proto", @@ -304,7 +307,7 @@ cc_benchmark { ], proto: { - type: "full", + type: "lite", include_dirs: ["external/protobuf/src"], }, @@ -326,14 +329,14 @@ cc_benchmark { shared_libs: [ "libgtest_prod", "libstatslog", - "libprotobuf-cpp-full", + "libprotobuf-cpp-lite", ], } // ==== java proto device library (for test only) ============================== java_library { name: "statsdprotolite", - no_framework_libs: true, + sdk_version: "core_platform", proto: { type: "lite", include_dirs: ["external/protobuf/src"], diff --git a/cmds/statsd/benchmark/log_event_benchmark.cpp b/cmds/statsd/benchmark/log_event_benchmark.cpp index 43addc28f074..26034695906b 100644 --- a/cmds/statsd/benchmark/log_event_benchmark.cpp +++ b/cmds/statsd/benchmark/log_event_benchmark.cpp @@ -54,9 +54,9 @@ static void getSimpleLogMsgData(log_msg* msg) { write4Bytes(99 /* a value to log*/, &buffer); buffer.push_back(EVENT_TYPE_LIST_STOP); - msg->entry_v1.len = buffer.size(); + msg->entry.len = buffer.size(); msg->entry.hdr_size = kLogMsgHeaderSize; - msg->entry_v1.sec = time(nullptr); + msg->entry.sec = time(nullptr); std::copy(buffer.begin(), buffer.end(), msg->buf + kLogMsgHeaderSize); } diff --git a/cmds/statsd/src/StatsLogProcessor.h b/cmds/statsd/src/StatsLogProcessor.h index f0db1b0128a1..313e16d19b62 100644 --- a/cmds/statsd/src/StatsLogProcessor.h +++ b/cmds/statsd/src/StatsLogProcessor.h @@ -128,13 +128,13 @@ private: std::unordered_map<ConfigKey, sp<MetricsManager>> mMetricsManagers; - std::unordered_map<ConfigKey, long> mLastBroadcastTimes; + std::unordered_map<ConfigKey, int64_t> mLastBroadcastTimes; // Last time we sent a broadcast to this uid that the active configs had changed. - std::unordered_map<int, long> mLastActivationBroadcastTimes; + std::unordered_map<int, int64_t> mLastActivationBroadcastTimes; // Tracks when we last checked the bytes consumed for each config key. - std::unordered_map<ConfigKey, long> mLastByteSizeTimes; + std::unordered_map<ConfigKey, int64_t> mLastByteSizeTimes; // Tracks which config keys has metric reports on disk std::set<ConfigKey> mOnDiskDataConfigs; @@ -205,7 +205,7 @@ private: int64_t mLastTimestampSeen = 0; - long mLastPullerCacheClearTimeSec = 0; + int64_t mLastPullerCacheClearTimeSec = 0; // Last time we wrote data to disk. int64_t mLastWriteTimeNs = 0; diff --git a/cmds/statsd/src/anomaly/AnomalyTracker.cpp b/cmds/statsd/src/anomaly/AnomalyTracker.cpp index d1dcb5df7838..7ace44eef564 100644 --- a/cmds/statsd/src/anomaly/AnomalyTracker.cpp +++ b/cmds/statsd/src/anomaly/AnomalyTracker.cpp @@ -24,6 +24,7 @@ #include "subscriber/IncidentdReporter.h" #include "subscriber/SubscriberReporter.h" +#include <inttypes.h> #include <statslog.h> #include <time.h> @@ -224,7 +225,7 @@ void AnomalyTracker::declareAnomaly(const int64_t& timestampNs, int64_t metricId } if (!mSubscriptions.empty()) { - ALOGI("An anomaly (%lld) %s has occurred! Informing subscribers.", + ALOGI("An anomaly (%" PRId64 ") %s has occurred! Informing subscribers.", mAlert.id(), key.toString().c_str()); informSubscribers(key, metricId, metricValue); } else { diff --git a/cmds/statsd/src/anomaly/subscriber_util.cpp b/cmds/statsd/src/anomaly/subscriber_util.cpp index 548a6869436d..4c30c4cb223c 100644 --- a/cmds/statsd/src/anomaly/subscriber_util.cpp +++ b/cmds/statsd/src/anomaly/subscriber_util.cpp @@ -22,7 +22,6 @@ #include <binder/IServiceManager.h> #include "external/Perfetto.h" -#include "external/Perfprofd.h" #include "subscriber/IncidentdReporter.h" #include "subscriber/SubscriberReporter.h" @@ -41,7 +40,7 @@ void triggerSubscribers(int64_t ruleId, int64_t metricId, const MetricDimensionK for (const Subscription& subscription : subscriptions) { if (subscription.probability_of_informing() < 1 - && ((float)rand() / RAND_MAX) >= subscription.probability_of_informing()) { + && ((float)rand() / (float)RAND_MAX) >= subscription.probability_of_informing()) { // Note that due to float imprecision, 0.0 and 1.0 might not truly mean never/always. // The config writer was advised to use -0.1 and 1.1 for never/always. ALOGI("Fate decided that a subscriber would not be informed."); @@ -64,12 +63,6 @@ void triggerSubscribers(int64_t ruleId, int64_t metricId, const MetricDimensionK SubscriberReporter::getInstance().alertBroadcastSubscriber(configKey, subscription, dimensionKey); break; - case Subscription::SubscriberInformationCase::kPerfprofdDetails: - if (!CollectPerfprofdTraceAndUploadToDropbox(subscription.perfprofd_details(), - ruleId, configKey)) { - ALOGW("Failed to generate perfprofd traces."); - } - break; default: break; } diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto index 1fd9caf6f7ab..32d90b70c34e 100644 --- a/cmds/statsd/src/atoms.proto +++ b/cmds/statsd/src/atoms.proto @@ -321,6 +321,9 @@ message Atom { 218 [(log_from_module) = "permissioncontroller"]; ExclusionRectStateChanged exclusion_rect_state_changed = 223; BackGesture back_gesture_reported_reported = 224; + + AppCompatibilityChangeReported app_compatibility_change_reported = + 228 [(allow_from_any_uid) = true]; } // Pulled events will start at field 10000. @@ -6819,3 +6822,39 @@ message PermissionAppsFragmentViewed { } optional Category category = 6; } + +/** + * Logs when a compatibility change is affecting an app. + * + * Logged from: + * frameworks/base/core/java/android/app/AppCompatCallbacks.java and + * frameworks/base/services/core/java/com/android/server/compat/PlatformCompat.java + */ +message AppCompatibilityChangeReported { + // The UID of the app being affected by the compatibilty change. + optional int32 uid = 1 [(is_uid) = true]; + + // The ID of the change affecting the app. + optional int64 change_id = 2; + + enum State { + UNKNOWN_STATE = 0; + ENABLED = 1; + DISABLED = 2; + LOGGED = 3; + } + + // The state of the change - if logged from gating whether it was enabled or disabled, or just + // logged otherwise. + optional State state = 3; + + enum Source { + UNKNOWN_SOURCE = 0; + APP_PROCESS = 1; + SYSTEM_SERVER = 2; + } + + // Where it was logged from. + optional Source source = 4; + +} diff --git a/cmds/statsd/src/external/Perfprofd.cpp b/cmds/statsd/src/external/Perfprofd.cpp deleted file mode 100644 index 1678f104a07a..000000000000 --- a/cmds/statsd/src/external/Perfprofd.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2018 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 "Perfprofd.h" - -#define DEBUG false // STOPSHIP if true -#include "config/ConfigKey.h" -#include "Log.h" - -#include <errno.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <unistd.h> - -#include <string> - -#include <binder/IServiceManager.h> - -#include "frameworks/base/cmds/statsd/src/statsd_config.pb.h" // Alert - -#include "android/os/IPerfProfd.h" - -namespace android { -namespace os { -namespace statsd { - -bool CollectPerfprofdTraceAndUploadToDropbox(const PerfprofdDetails& config, - int64_t alert_id, - const ConfigKey& configKey) { - VLOG("Starting trace collection through perfprofd"); - - if (!config.has_perfprofd_config()) { - ALOGE("The perfprofd trace config is empty, aborting"); - return false; - } - - sp<IPerfProfd> service = interface_cast<IPerfProfd>( - defaultServiceManager()->getService(android::String16("perfprofd"))); - if (service == NULL) { - ALOGE("Could not find perfprofd service"); - return false; - } - - auto* data = reinterpret_cast<const uint8_t*>(config.perfprofd_config().data()); - std::vector<uint8_t> proto_serialized(data, data + config.perfprofd_config().size()); - - // TODO: alert-id etc? - - binder::Status status = service->startProfilingProtobuf(proto_serialized); - if (status.isOk()) { - return true; - } - - ALOGE("Error starting perfprofd profiling: %s", status.toString8().c_str()); - return false; -} - -} // namespace statsd -} // namespace os -} // namespace android diff --git a/cmds/statsd/src/external/Perfprofd.h b/cmds/statsd/src/external/Perfprofd.h deleted file mode 100644 index b93fdf8e1cb2..000000000000 --- a/cmds/statsd/src/external/Perfprofd.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2018 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. - */ - -#pragma once - -#include <inttypes.h> - -namespace android { -namespace os { -namespace statsd { - -class ConfigKey; -class PerfprofdDetails; // Declared in statsd_config.pb.h - -// Starts the collection of a Perfprofd trace with the given |config|. -// The trace is uploaded to Dropbox by the perfprofd service once done. -// This method returns immediately after passing the config and does NOT wait -// for the full duration of the trace. -bool CollectPerfprofdTraceAndUploadToDropbox(const PerfprofdDetails& config, - int64_t alert_id, - const ConfigKey& configKey); - -} // namespace statsd -} // namespace os -} // namespace android diff --git a/cmds/statsd/src/external/StatsPullerManager.cpp b/cmds/statsd/src/external/StatsPullerManager.cpp index 475f18a9b0b8..69e6a11b9ad7 100644 --- a/cmds/statsd/src/external/StatsPullerManager.cpp +++ b/cmds/statsd/src/external/StatsPullerManager.cpp @@ -119,9 +119,10 @@ std::map<int, PullAtomInfo> StatsPullerManager::kAllPullAtomInfo = { {.puller = new StatsCompanionServicePuller(android::util::BLUETOOTH_ACTIVITY_INFO)}}, // system_elapsed_realtime {android::util::SYSTEM_ELAPSED_REALTIME, - {.pullTimeoutNs = NS_PER_SEC / 2, - .coolDownNs = NS_PER_SEC, - .puller = new StatsCompanionServicePuller(android::util::SYSTEM_ELAPSED_REALTIME)}}, + {.coolDownNs = NS_PER_SEC, + .puller = new StatsCompanionServicePuller(android::util::SYSTEM_ELAPSED_REALTIME), + .pullTimeoutNs = NS_PER_SEC / 2, + }}, // system_uptime {android::util::SYSTEM_UPTIME, {.puller = new StatsCompanionServicePuller(android::util::SYSTEM_UPTIME)}}, diff --git a/cmds/statsd/src/logd/LogEvent.cpp b/cmds/statsd/src/logd/LogEvent.cpp index 0ade53118d77..838561e3ae10 100644 --- a/cmds/statsd/src/logd/LogEvent.cpp +++ b/cmds/statsd/src/logd/LogEvent.cpp @@ -38,8 +38,8 @@ using std::vector; LogEvent::LogEvent(log_msg& msg) { mContext = create_android_log_parser(msg.msg() + sizeof(uint32_t), msg.len() - sizeof(uint32_t)); - mLogdTimestampNs = msg.entry_v1.sec * NS_PER_SEC + msg.entry_v1.nsec; - mLogUid = msg.entry_v4.uid; + mLogdTimestampNs = msg.entry.sec * NS_PER_SEC + msg.entry.nsec; + mLogUid = msg.entry.uid; init(mContext); if (mContext) { // android_log_destroy will set mContext to NULL diff --git a/cmds/statsd/src/main.cpp b/cmds/statsd/src/main.cpp index 42132ee0daae..7d446a9a1ed6 100644 --- a/cmds/statsd/src/main.cpp +++ b/cmds/statsd/src/main.cpp @@ -53,6 +53,8 @@ void sigHandler(int sig) { if (gStatsService != nullptr) { gStatsService->Terminate(); } + ALOGW("statsd terminated on receiving signal %d.", sig); + exit(1); } void registerSigHandler() diff --git a/cmds/statsd/src/metrics/metrics_manager_util.cpp b/cmds/statsd/src/metrics/metrics_manager_util.cpp index dd32c08faba3..5cfb1239d30e 100644 --- a/cmds/statsd/src/metrics/metrics_manager_util.cpp +++ b/cmds/statsd/src/metrics/metrics_manager_util.cpp @@ -35,6 +35,8 @@ #include "stats_util.h" #include "statslog.h" +#include <inttypes.h> + using std::set; using std::string; using std::unordered_map; @@ -593,7 +595,7 @@ bool initMetrics(const ConfigKey& key, const StatsdConfig& config, const int64_t for (int i = 0; i < config.no_report_metric_size(); ++i) { const auto no_report_metric = config.no_report_metric(i); if (metricMap.find(no_report_metric) == metricMap.end()) { - ALOGW("no_report_metric %lld not exist", no_report_metric); + ALOGW("no_report_metric %" PRId64 " not exist", no_report_metric); return false; } noReportMetricIds.insert(no_report_metric); diff --git a/cmds/statsd/src/socket/StatsSocketListener.cpp b/cmds/statsd/src/socket/StatsSocketListener.cpp index 92200f99c3cc..b59d88dc1cea 100755 --- a/cmds/statsd/src/socket/StatsSocketListener.cpp +++ b/cmds/statsd/src/socket/StatsSocketListener.cpp @@ -56,8 +56,7 @@ bool StatsSocketListener::onDataAvailable(SocketClient* cli) { } // + 1 to ensure null terminator if MAX_PAYLOAD buffer is received - char buffer[sizeof_log_id_t + sizeof(uint16_t) + sizeof(log_time) + LOGGER_ENTRY_MAX_PAYLOAD + - 1]; + char buffer[sizeof(android_log_header_t) + LOGGER_ENTRY_MAX_PAYLOAD + 1]; struct iovec iov = {buffer, sizeof(buffer) - 1}; alignas(4) char control[CMSG_SPACE(sizeof(struct ucred))]; diff --git a/cmds/statsd/src/statsd_config.proto b/cmds/statsd/src/statsd_config.proto index a2fd9d42f488..79c06b98a82d 100644 --- a/cmds/statsd/src/statsd_config.proto +++ b/cmds/statsd/src/statsd_config.proto @@ -343,15 +343,6 @@ message PerfettoDetails { optional bytes trace_config = 1; } -message PerfprofdDetails { - // The |perfprofd_config| field is a proto-encoded message of type - // android.perfprofd.ProfilingConfig defined in - // //system/extras/perfprofd/. On device, statsd doesn't need to - // deserialize the message as it's just passed binary-encoded to - // the perfprofd service. - optional bytes perfprofd_config = 1; -} - message BroadcastSubscriberDetails { optional int64 subscriber_id = 1; repeated string cookie = 2; @@ -373,10 +364,12 @@ message Subscription { IncidentdDetails incidentd_details = 4; PerfettoDetails perfetto_details = 5; BroadcastSubscriberDetails broadcast_subscriber_details = 6; - PerfprofdDetails perfprofd_details = 8; } optional float probability_of_informing = 7 [default = 1.1]; + + // This was used for perfprofd historically. + reserved 8; } enum ActivationType { diff --git a/cmds/svc/Android.bp b/cmds/svc/Android.bp new file mode 100644 index 000000000000..68b48f11e5a6 --- /dev/null +++ b/cmds/svc/Android.bp @@ -0,0 +1,8 @@ +// Copyright 2007 The Android Open Source Project +// + +java_binary { + name: "svc", + wrapper: "svc", + srcs: ["**/*.java"], +} diff --git a/cmds/svc/Android.mk b/cmds/svc/Android.mk deleted file mode 100644 index a4824c70f979..000000000000 --- a/cmds/svc/Android.mk +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2007 The Android Open Source Project -# -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_SRC_FILES := $(call all-subdir-java-files) -LOCAL_MODULE := svclib -LOCAL_MODULE_STEM := svc -include $(BUILD_JAVA_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := svc -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_SRC_FILES := svc -LOCAL_REQUIRED_MODULES := svclib -include $(BUILD_PREBUILT) diff --git a/cmds/svc/svc b/cmds/svc/svc index 07b50fe6c7b5..c122e981e4c7 100755 --- a/cmds/svc/svc +++ b/cmds/svc/svc @@ -1,8 +1,3 @@ #!/system/bin/sh -# Script to start "am" on the device, which has a very rudimentary -# shell. -# -base=/system -export CLASSPATH=$base/framework/svc.jar -exec app_process $base/bin com.android.commands.svc.Svc $* - +export CLASSPATH=/system/framework/svc.jar +exec app_process /system/bin com.android.commands.svc.Svc "$@" diff --git a/cmds/telecom/Android.bp b/cmds/telecom/Android.bp new file mode 100644 index 000000000000..56e147c5c8ca --- /dev/null +++ b/cmds/telecom/Android.bp @@ -0,0 +1,8 @@ +// Copyright 2015 The Android Open Source Project +// + +java_binary { + name: "telecom", + wrapper: "telecom", + srcs: ["**/*.java"], +} diff --git a/cmds/telecom/Android.mk b/cmds/telecom/Android.mk deleted file mode 100644 index 5f7bdf706355..000000000000 --- a/cmds/telecom/Android.mk +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2015 The Android Open Source Project -# -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_SRC_FILES := $(call all-subdir-java-files) -LOCAL_MODULE := telecom -include $(BUILD_JAVA_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := telecom -LOCAL_SRC_FILES := telecom -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_MODULE_TAGS := optional -include $(BUILD_PREBUILT) diff --git a/cmds/telecom/src/com/android/commands/telecom/Telecom.java b/cmds/telecom/src/com/android/commands/telecom/Telecom.java index e0f7d862e70a..c9f069d62003 100644 --- a/cmds/telecom/src/com/android/commands/telecom/Telecom.java +++ b/cmds/telecom/src/com/android/commands/telecom/Telecom.java @@ -65,11 +65,21 @@ public final class Telecom extends BaseCommand { private static final String COMMAND_UNREGISTER_PHONE_ACCOUNT = "unregister-phone-account"; private static final String COMMAND_SET_DEFAULT_DIALER = "set-default-dialer"; private static final String COMMAND_GET_DEFAULT_DIALER = "get-default-dialer"; + /** + * Change the system dialer package name if a package name was specified, + * Example: adb shell telecom set-system-dialer <PACKAGE> + * + * Restore it to the default if if argument is "default" or no argument is passed. + * Example: adb shell telecom set-system-dialer default + */ + private static final String COMMAND_SET_SYSTEM_DIALER = "set-system-dialer"; private static final String COMMAND_GET_SYSTEM_DIALER = "get-system-dialer"; private static final String COMMAND_WAIT_ON_HANDLERS = "wait-on-handlers"; private static final String COMMAND_SET_SIM_COUNT = "set-sim-count"; private static final String COMMAND_GET_SIM_CONFIG = "get-sim-config"; private static final String COMMAND_GET_MAX_PHONES = "get-max-phones"; + private static final String COMMAND_SET_TEST_EMERGENCY_PHONE_ACCOUNT_PACKAGE_FILTER = + "set-test-emergency-phone-account-package-filter"; private ComponentName mComponent; private String mAccountId; @@ -83,7 +93,10 @@ public final class Telecom extends BaseCommand { + "usage: telecom set-phone-account-enabled <COMPONENT> <ID> <USER_SN>\n" + "usage: telecom set-phone-account-disabled <COMPONENT> <ID> <USER_SN>\n" + "usage: telecom register-phone-account <COMPONENT> <ID> <USER_SN> <LABEL>\n" - + "usage: telecom set-user-selected-outgoing-phone-account <COMPONENT> <ID> " + + "usage: telecom register-sim-phone-account [-e] <COMPONENT> <ID> <USER_SN>" + + " <LABEL>: registers a PhoneAccount with CAPABILITY_SIM_SUBSCRIPTION" + + " and optionally CAPABILITY_PLACE_EMERGENCY_CALLS if \"-e\" is provided\n" + + "usage: telecom set-user-selected-outgoing-phone-account [-e] <COMPONENT> <ID> " + "<USER_SN>\n" + "usage: telecom set-test-call-redirection-app <PACKAGE>\n" + "usage: telecom set-test-call-screening-app <PACKAGE>\n" @@ -100,6 +113,7 @@ public final class Telecom extends BaseCommand { + "usage: telecom set-sim-count <COUNT>\n" + "usage: telecom get-sim-config\n" + "usage: telecom get-max-phones\n" + + "usage: telecom set-emer-phone-account-filter <PACKAGE>\n" + "\n" + "telecom set-phone-account-enabled: Enables the given phone account, if it has" + " already been registered with Telecom.\n" @@ -113,6 +127,8 @@ public final class Telecom extends BaseCommand { + "telecom get-default-dialer: Displays the current default dialer.\n" + "\n" + "telecom get-system-dialer: Displays the current system dialer.\n" + + "telecom set-system-dialer: Set the override system dialer to the given" + + " component. To remove the override, send \"default\"\n" + "\n" + "telecom wait-on-handlers: Wait until all handlers finish their work.\n" + "\n" @@ -123,6 +139,10 @@ public final class Telecom extends BaseCommand { + " or \"\" for single SIM\n" + "\n" + "telecom get-max-phones: Get the max supported phones from the modem.\n" + + "telecom set-test-emergency-phone-account-package-filter <PACKAGE>: sets a" + + " package name that will be used for test emergency calls. To clear," + + " send an empty package name. Real emergency calls will still be placed" + + " over Telephony.\n" ); } @@ -193,6 +213,9 @@ public final class Telecom extends BaseCommand { case COMMAND_GET_DEFAULT_DIALER: runGetDefaultDialer(); break; + case COMMAND_SET_SYSTEM_DIALER: + runSetSystemDialer(); + break; case COMMAND_GET_SYSTEM_DIALER: runGetSystemDialer(); break; @@ -208,6 +231,9 @@ public final class Telecom extends BaseCommand { case COMMAND_GET_MAX_PHONES: runGetMaxPhones(); break; + case COMMAND_SET_TEST_EMERGENCY_PHONE_ACCOUNT_PACKAGE_FILTER: + runSetEmergencyPhoneAccountPackageFilter(); + break; default: Log.w(this, "onRun: unknown command: %s", command); throw new IllegalArgumentException ("unknown command '" + command + "'"); @@ -234,19 +260,31 @@ public final class Telecom extends BaseCommand { } private void runRegisterSimPhoneAccount() throws RemoteException { + boolean isEmergencyAccount = false; + String opt; + while ((opt = nextOption()) != null) { + switch (opt) { + case "-e": { + isEmergencyAccount = true; + break; + } + } + } final PhoneAccountHandle handle = getPhoneAccountHandleFromArgs(); final String label = nextArgRequired(); final String address = nextArgRequired(); + int capabilities = PhoneAccount.CAPABILITY_CALL_PROVIDER + | PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION + | (isEmergencyAccount ? PhoneAccount.CAPABILITY_PLACE_EMERGENCY_CALLS : 0); PhoneAccount account = PhoneAccount.builder( handle, label) - .setAddress(Uri.parse(address)) - .setSubscriptionAddress(Uri.parse(address)) - .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER | - PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION) - .setShortDescription(label) - .addSupportedUriScheme(PhoneAccount.SCHEME_TEL) - .addSupportedUriScheme(PhoneAccount.SCHEME_VOICEMAIL) - .build(); + .setAddress(Uri.parse(address)) + .setSubscriptionAddress(Uri.parse(address)) + .setCapabilities(capabilities) + .setShortDescription(label) + .addSupportedUriScheme(PhoneAccount.SCHEME_TEL) + .addSupportedUriScheme(PhoneAccount.SCHEME_VOICEMAIL) + .build(); mTelecomService.registerPhoneAccount(account); System.out.println("Success - " + handle + " registered."); } @@ -297,6 +335,14 @@ public final class Telecom extends BaseCommand { System.out.println("Success - " + packageName + " set as override default dialer."); } + private void runSetSystemDialer() throws RemoteException { + final String flatComponentName = nextArg(); + final ComponentName componentName = (flatComponentName.equals("default") + ? null : parseComponentName(flatComponentName)); + mTelecomService.setSystemDialer(componentName); + System.out.println("Success - " + componentName + " set as override system dialer."); + } + private void runGetDefaultDialer() throws RemoteException { System.out.println(mTelecomService.getDefaultDialerPackage()); } @@ -338,6 +384,18 @@ public final class Telecom extends BaseCommand { } } + private void runSetEmergencyPhoneAccountPackageFilter() throws RemoteException { + String packageName = mArgs.getNextArg(); + if (TextUtils.isEmpty(packageName)) { + mTelecomService.setTestEmergencyPhoneAccountPackageNameFilter(null); + System.out.println("Success - filter cleared"); + } else { + mTelecomService.setTestEmergencyPhoneAccountPackageNameFilter(packageName); + System.out.println("Success = filter set to " + packageName); + } + + } + private PhoneAccountHandle getPhoneAccountHandleFromArgs() throws RemoteException { if (TextUtils.isEmpty(mArgs.peekNextArg())) { return null; diff --git a/cmds/uiautomator/Android.bp b/cmds/uiautomator/Android.bp new file mode 100644 index 000000000000..f9cb3dd38897 --- /dev/null +++ b/cmds/uiautomator/Android.bp @@ -0,0 +1,18 @@ +genrule { + name: "uiautomator-last-released-api", + srcs: ["api/*.txt"], + cmd: "cp -f $$(echo $(in) | tr \" \" \"\\n\" | sort -n | tail -1) $(genDir)/last-released-api.txt", + out: [ + "last-released-api.txt", + ], +} + +filegroup { + name: "uiautomator-current-api", + srcs: ["api/current.txt"], +} + +filegroup { + name: "uiautomator-removed-api", + srcs: ["api/removed.txt"], +} diff --git a/cmds/uiautomator/Android.mk b/cmds/uiautomator/Android.mk deleted file mode 100644 index 53913051e3a9..000000000000 --- a/cmds/uiautomator/Android.mk +++ /dev/null @@ -1,25 +0,0 @@ -# -# Copyright (C) 2012 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. -# - -# don't build uiautomator in unbundled env -ifndef TARGET_BUILD_APPS -include $(call all-subdir-makefiles) -else -ifneq ($(filter uiautomator,$(TARGET_BUILD_APPS)),) -# used by the platform apps build. -include $(call all-subdir-makefiles) -endif -endif diff --git a/cmds/uiautomator/api/current.txt b/cmds/uiautomator/api/current.txt index 634ca4d39ec5..489c2eadfd91 100644 --- a/cmds/uiautomator/api/current.txt +++ b/cmds/uiautomator/api/current.txt @@ -171,7 +171,7 @@ package com.android.uiautomator.core { method public com.android.uiautomator.core.UiSelector checked(boolean); method public com.android.uiautomator.core.UiSelector childSelector(com.android.uiautomator.core.UiSelector); method public com.android.uiautomator.core.UiSelector className(java.lang.String); - method public com.android.uiautomator.core.UiSelector className(java.lang.Class<T>); + method public <T> com.android.uiautomator.core.UiSelector className(java.lang.Class<T>); method public com.android.uiautomator.core.UiSelector classNameMatches(java.lang.String); method public com.android.uiautomator.core.UiSelector clickable(boolean); method protected com.android.uiautomator.core.UiSelector cloneSelector(); diff --git a/cmds/uiautomator/cmds/Android.mk b/cmds/uiautomator/cmds/Android.mk deleted file mode 100644 index c141484d81d5..000000000000 --- a/cmds/uiautomator/cmds/Android.mk +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright (C) 2012 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 $(call all-subdir-makefiles) diff --git a/cmds/uiautomator/cmds/uiautomator/Android.bp b/cmds/uiautomator/cmds/uiautomator/Android.bp new file mode 100644 index 000000000000..68cc5a339107 --- /dev/null +++ b/cmds/uiautomator/cmds/uiautomator/Android.bp @@ -0,0 +1,22 @@ +// +// Copyright (C) 2012 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. +// + +java_binary { + name: "uiautomator", + wrapper: "uiautomator", + srcs: ["src/**/*.java"], + static_libs: ["uiautomator.core"], +} diff --git a/cmds/uiautomator/cmds/uiautomator/Android.mk b/cmds/uiautomator/cmds/uiautomator/Android.mk deleted file mode 100644 index 5c91b525b6ea..000000000000 --- a/cmds/uiautomator/cmds/uiautomator/Android.mk +++ /dev/null @@ -1,33 +0,0 @@ -# -# Copyright (C) 2012 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. -# - -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_MODULE_TAGS := optional -LOCAL_SRC_FILES := $(call all-java-files-under, src) -LOCAL_STATIC_JAVA_LIBRARIES := uiautomator.core -LOCAL_MODULE := uiautomator - -include $(BUILD_JAVA_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := uiautomator -LOCAL_SRC_FILES := uiautomator -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_MODULE_TAGS := optional - -include $(BUILD_PREBUILT) diff --git a/cmds/uiautomator/instrumentation/Android.bp b/cmds/uiautomator/instrumentation/Android.bp new file mode 100644 index 000000000000..477f0d1f6e10 --- /dev/null +++ b/cmds/uiautomator/instrumentation/Android.bp @@ -0,0 +1,33 @@ +// +// Copyright (C) 2012 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. +// + +java_test { + name: "uiautomator-instrumentation", + + srcs: [ + "testrunner-src/**/*.java", + ], + libs: [ + "android.test.runner.stubs", + "android.test.base.stubs", + ], + static_libs: [ + "junit", + "uiautomator.library", + ], + // TODO: change this to 18 when it's available + sdk_version: "test_current", +} diff --git a/cmds/uiautomator/instrumentation/Android.mk b/cmds/uiautomator/instrumentation/Android.mk deleted file mode 100644 index e887539b718a..000000000000 --- a/cmds/uiautomator/instrumentation/Android.mk +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright (C) 2012 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. -# - -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests -LOCAL_SRC_FILES := $(call all-java-files-under, testrunner-src) \ - $(call all-java-files-under, ../library/core-src) -LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs -LOCAL_STATIC_JAVA_LIBRARIES := junit -LOCAL_MODULE := uiautomator-instrumentation -# TODO: change this to 18 when it's available -LOCAL_SDK_VERSION := current - -include $(BUILD_STATIC_JAVA_LIBRARY) diff --git a/cmds/uiautomator/library/Android.bp b/cmds/uiautomator/library/Android.bp index 77f17c5cfb65..1173d57e5e3f 100644 --- a/cmds/uiautomator/library/Android.bp +++ b/cmds/uiautomator/library/Android.bp @@ -30,6 +30,17 @@ droiddoc { api_tag_name: "UIAUTOMATOR", api_filename: "uiautomator_api.txt", removed_api_filename: "uiautomator_removed_api.txt", + + check_api: { + current: { + api_file: ":uiautomator-current-api", + removed_api_file: ":uiautomator-removed-api", + }, + last_released: { + api_file: ":uiautomator-last-released-api", + removed_api_file: ":uiautomator-removed-api", + }, + }, } java_library_static { @@ -57,3 +68,10 @@ java_library_static { "junit", ] } + +java_library_static { + name: "uiautomator.library", + srcs: [ + "core-src/**/*.java", + ], +} diff --git a/cmds/uiautomator/library/Android.mk b/cmds/uiautomator/library/Android.mk deleted file mode 100644 index 5ca201c9781a..000000000000 --- a/cmds/uiautomator/library/Android.mk +++ /dev/null @@ -1,76 +0,0 @@ -# -# Copyright (C) 2012 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. -# - -LOCAL_PATH:= $(call my-dir) - -############################################### -# API check -# Please refer to build/core/tasks/apicheck.mk. -uiautomator_api_dir := frameworks/base/cmds/uiautomator/api -last_released_sdk_version := $(lastword $(call numerically_sort, \ - $(filter-out current, \ - $(patsubst $(uiautomator_api_dir)/%.txt,%, $(wildcard $(uiautomator_api_dir)/*.txt)) \ - ))) - -checkapi_last_error_level_flags := \ - -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 \ - -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \ - -error 16 -error 17 -error 18 - -# Check that the API we're building hasn't broken the last-released SDK version. -$(eval $(call check-api, \ - uiautomator-checkapi-last, \ - $(uiautomator_api_dir)/$(last_released_sdk_version).txt, \ - $(INTERNAL_PLATFORM_UIAUTOMATOR_API_FILE), \ - $(uiautomator_api_dir)/removed.txt, \ - $(INTERNAL_PLATFORM_UIAUTOMATOR_REMOVED_API_FILE), \ - $(checkapi_last_error_level_flags), \ - cat $(LOCAL_PATH)/apicheck_msg_last.txt, \ - uiautomator.core, \ - $(OUT_DOCS)/uiautomator-stubs-docs-stubs.srcjar)) - -checkapi_current_error_level_flags := \ - -error 2 -error 3 -error 4 -error 5 -error 6 \ - -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \ - -error 16 -error 17 -error 18 -error 19 -error 20 -error 21 -error 23 -error 24 \ - -error 25 - -# Check that the API we're building hasn't changed from the not-yet-released -# SDK version. -$(eval $(call check-api, \ - uiautomator-checkapi-current, \ - $(uiautomator_api_dir)/current.txt, \ - $(INTERNAL_PLATFORM_UIAUTOMATOR_API_FILE), \ - $(uiautomator_api_dir)/removed.txt, \ - $(INTERNAL_PLATFORM_UIAUTOMATOR_REMOVED_API_FILE), \ - $(checkapi_current_error_level_flags), \ - cat $(LOCAL_PATH)/apicheck_msg_current.txt, \ - uiautomator.core, \ - $(OUT_DOCS)/uiautomator-stubs-docs-stubs.srcjar)) - -.PHONY: update-uiautomator-api -update-uiautomator-api: PRIVATE_API_DIR := $(uiautomator_api_dir) -update-uiautomator-api: PRIVATE_REMOVED_API_FILE := $(INTERNAL_PLATFORM_UIAUTOMATOR_REMOVED_API_FILE) -update-uiautomator-api: $(INTERNAL_PLATFORM_UIAUTOMATOR_API_FILE) - @echo Copying uiautomator current.txt - $(hide) cp $< $(PRIVATE_API_DIR)/current.txt - @echo Copying uiautomator removed.txt - $(hide) cp $(PRIVATE_REMOVED_API_FILE) $(PRIVATE_API_DIR)/removed.txt -############################################### -# clean up temp vars -uiautomator_api_dir := -checkapi_last_error_level_flags := -checkapi_current_error_level_flags := diff --git a/cmds/uiautomator/library/apicheck_msg_current.txt b/cmds/uiautomator/library/apicheck_msg_current.txt deleted file mode 100644 index 989248d78fec..000000000000 --- a/cmds/uiautomator/library/apicheck_msg_current.txt +++ /dev/null @@ -1,17 +0,0 @@ - -****************************** -You have tried to change the API from what has been previously approved. - -To make these errors go away, you have two choices: - 1) You can add "@hide" javadoc comments to the methods, etc. listed in the - errors above. - - 2) You can update current.txt by executing the following command: - make update-uiautomator-api - - To submit the revised current.txt to the main Android repository, - you will need approval. -****************************** - - - diff --git a/cmds/uiautomator/library/apicheck_msg_last.txt b/cmds/uiautomator/library/apicheck_msg_last.txt deleted file mode 100644 index 2993157b165d..000000000000 --- a/cmds/uiautomator/library/apicheck_msg_last.txt +++ /dev/null @@ -1,7 +0,0 @@ - -****************************** -You have tried to change the API from what has been previously released in -an SDK. Please fix the errors listed above. -****************************** - - diff --git a/cmds/vr/Android.bp b/cmds/vr/Android.bp new file mode 100644 index 000000000000..cb129bdf6853 --- /dev/null +++ b/cmds/vr/Android.bp @@ -0,0 +1,8 @@ +// Copyright 2017 The Android Open Source Project +// + +java_binary { + name: "vr", + wrapper: "vr", + srcs: ["**/*.java"], +} diff --git a/cmds/vr/Android.mk b/cmds/vr/Android.mk deleted file mode 100644 index d0dc25a36dc8..000000000000 --- a/cmds/vr/Android.mk +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2017 The Android Open Source Project -# -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_SRC_FILES := $(call all-subdir-java-files) -LOCAL_MODULE := vr -include $(BUILD_JAVA_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := vr -LOCAL_SRC_FILES := vr -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_MODULE_TAGS := optional -include $(BUILD_PREBUILT) diff --git a/cmds/wm/Android.bp b/cmds/wm/Android.bp new file mode 100644 index 000000000000..609f84b89bd8 --- /dev/null +++ b/cmds/wm/Android.bp @@ -0,0 +1,7 @@ +// Copyright 2013 The Android Open Source Project +// + +sh_binary { + name: "wm", + src: "wm", +} diff --git a/cmds/wm/Android.mk b/cmds/wm/Android.mk deleted file mode 100644 index 693c6e77d317..000000000000 --- a/cmds/wm/Android.mk +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright 2013 The Android Open Source Project -# -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_MODULE := wm -LOCAL_SRC_FILES := wm -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_MODULE_TAGS := optional -include $(BUILD_PREBUILT) |