Merge SP1A.201105.002
Change-Id: I2e1a17105f000737ddb1489ea5c66662226dd2d8
diff --git a/debuggerd/Android.bp b/debuggerd/Android.bp
index 6391acc..962ce74 100644
--- a/debuggerd/Android.bp
+++ b/debuggerd/Android.bp
@@ -3,7 +3,6 @@
cflags: [
"-Wall",
"-Wextra",
- "-Werror",
"-Wno-unused-argument",
"-Wno-unused-function",
"-Wno-nullability-completeness",
diff --git a/debuggerd/handler/debuggerd_handler.cpp b/debuggerd/handler/debuggerd_handler.cpp
index 121a074..1a7102d 100644
--- a/debuggerd/handler/debuggerd_handler.cpp
+++ b/debuggerd/handler/debuggerd_handler.cpp
@@ -555,9 +555,8 @@
};
// Set PR_SET_DUMPABLE to 1, so that crash_dump can ptrace us.
- int orig_dumpable = prctl(PR_GET_DUMPABLE);
if (prctl(PR_SET_DUMPABLE, 1) != 0) {
- fatal_errno("failed to set dumpable");
+ fatal_errno("failed to set dumpable");
}
// On kernels with yama_ptrace enabled, also allow any process to attach.
@@ -587,9 +586,14 @@
// and then wait for it to terminate.
futex_wait(&thread_info.pseudothread_tid, child_pid);
- // Restore PR_SET_DUMPABLE to its original value.
- if (prctl(PR_SET_DUMPABLE, orig_dumpable) != 0) {
- fatal_errno("failed to restore dumpable");
+ // Signals can either be fatal or nonfatal.
+ // For fatal signals, crash_dump will PTRACE_CONT us with the signal we
+ // crashed with, so that processes using waitpid on us will see that we
+ // exited with the correct exit status (e.g. so that sh will report
+ // "Segmentation fault" instead of "Killed"). For this to work, we need
+ // to deregister our signal handler for that signal before continuing.
+ if (signal_number != DEBUGGER_SIGNAL) {
+ signal(signal_number, SIG_DFL);
}
// Restore PR_SET_PTRACER to its original value.
diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp
old mode 100644
new mode 100755
index 6294b3f..453a062
--- a/fs_mgr/fs_mgr.cpp
+++ b/fs_mgr/fs_mgr.cpp
@@ -184,7 +184,14 @@
Timer t;
/* Check for the types of filesystems we know how to check */
- if (is_extfs(fs_type)) {
+ if (fs_type == "vfat") {
+ const char* vfat_fsck_argv[] = {"/system/bin/fsck_msdos", "-y", blk_device.c_str()};
+ ret = logwrap_fork_execvp(ARRAY_SIZE(vfat_fsck_argv), vfat_fsck_argv, &status,
+ false, LOG_KLOG | LOG_FILE, false, FSCK_LOG_FILE);
+ if (ret < 0)
+ LERROR << "Failed running '/system/bin/fsck_msdos' on '" << blk_device.c_str()
+ << "' - " << ret;
+ } else if (is_extfs(fs_type)) {
/*
* First try to mount and unmount the filesystem. We do this because
* the kernel is more efficient than e2fsck in running the journal and
@@ -1320,18 +1327,29 @@
int encryptable = FS_MGR_MNTALL_DEV_NOT_ENCRYPTABLE;
int error_count = 0;
CheckpointManager checkpoint_manager;
+ char propbuf[PROPERTY_VALUE_MAX];
+ bool is_ffbm = false;
AvbUniquePtr avb_handle(nullptr);
bool userdata_mounted = false;
if (fstab->empty()) {
return {FS_MGR_MNTALL_FAIL, userdata_mounted};
}
+ /**get boot mode*/
+ property_get("ro.bootmode", propbuf, "");
+ if ((strncmp(propbuf, "ffbm-00", 7) == 0) || (strncmp(propbuf, "ffbm-01", 7) == 0))
+ is_ffbm = true;
// Keep i int to prevent unsigned integer overflow from (i = top_idx - 1),
// where top_idx is 0. It will give SIGABRT
for (int i = 0; i < static_cast<int>(fstab->size()); i++) {
auto& current_entry = (*fstab)[i];
+ /* Skip userdata partition in ffbm mode */
+ if (is_ffbm && !strcmp(current_entry.mount_point.c_str(), "/data")){
+ continue;
+ }
+
// If a filesystem should have been mounted in the first stage, we
// ignore it here. With one exception, if the filesystem is
// formattable, then it can only be formatted in the second stage,
@@ -1341,7 +1359,6 @@
IsMountPointMounted(current_entry.mount_point))) {
continue;
}
-
// Don't mount entries that are managed by vold or not for the mount mode.
if (current_entry.fs_mgr_flags.vold_managed || current_entry.fs_mgr_flags.recovery_only ||
((mount_mode == MOUNT_MODE_LATE) && !current_entry.fs_mgr_flags.late_mount) ||
@@ -1533,11 +1550,18 @@
if (!call_vdc({"cryptfs", "mountFstab", attempted_entry.blk_device,
attempted_entry.mount_point},
nullptr)) {
- ++error_count;
- } else if (current_entry.mount_point == "/data") {
- userdata_mounted = true;
+ PERROR << android::base::StringPrintf(
+ "Failure while mounting metadata, setting flag to needing recovery "
+ "partition on %s at %s options: %s",
+ attempted_entry.blk_device.c_str(), attempted_entry.mount_point.c_str(),
+ attempted_entry.fs_options.c_str());
+ encryptable = FS_MGR_MNTALL_DEV_NEEDS_RECOVERY_WIPE_PROMPT;
+ } else {
+ if (current_entry.mount_point == "/data") {
+ userdata_mounted = true;
+ }
+ encryptable = FS_MGR_MNTALL_DEV_IS_METADATA_ENCRYPTED;
}
- encryptable = FS_MGR_MNTALL_DEV_IS_METADATA_ENCRYPTED;
continue;
} else {
// fs_options might be null so we cannot use PERROR << directly.
diff --git a/fs_mgr/fs_mgr_format.cpp b/fs_mgr/fs_mgr_format.cpp
index 301c907..bbccb90 100644
--- a/fs_mgr/fs_mgr_format.cpp
+++ b/fs_mgr/fs_mgr_format.cpp
@@ -176,6 +176,10 @@
} else if (entry.fs_type == "ext4") {
return format_ext4(entry.blk_device, entry.mount_point, crypt_footer, needs_projid,
entry.fs_mgr_flags.ext_meta_csum);
+ } else if (entry.fs_type == "vfat") {
+ std::vector<const char*> args = {"/system/bin/newfs_msdos", "-F", "16",
+ entry.blk_device.c_str()};
+ return logwrap_fork_execvp(args.size(), args.data(), nullptr, false, LOG_KLOG, false, nullptr);
} else {
LERROR << "File system type '" << entry.fs_type << "' is not supported";
return -EINVAL;
diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp
index 793a725..be8fee1 100644
--- a/fs_mgr/fs_mgr_fstab.cpp
+++ b/fs_mgr/fs_mgr_fstab.cpp
@@ -179,6 +179,7 @@
CheckFlag("fsverity", fs_verity);
CheckFlag("metadata_csum", ext_meta_csum);
CheckFlag("fscompress", fs_compress);
+ CheckFlag("wrappedkey", wrapped_key);
#undef CheckFlag
diff --git a/fs_mgr/include/fs_mgr.h b/fs_mgr/include/fs_mgr.h
index 11e3664..2ba0417 100644
--- a/fs_mgr/include/fs_mgr.h
+++ b/fs_mgr/include/fs_mgr.h
@@ -51,6 +51,8 @@
MOUNT_MODE_ONLY_USERDATA = 3
};
+
+#define FS_MGR_MNTALL_DEV_NEEDS_RECOVERY_WIPE_PROMPT 8
#define FS_MGR_MNTALL_DEV_IS_METADATA_ENCRYPTED 7
#define FS_MGR_MNTALL_DEV_NEEDS_METADATA_ENCRYPTION 6
#define FS_MGR_MNTALL_DEV_FILE_ENCRYPTED 5
diff --git a/fs_mgr/include_fstab/fstab/fstab.h b/fs_mgr/include_fstab/fstab/fstab.h
index 2d4de09..7575338 100644
--- a/fs_mgr/include_fstab/fstab/fstab.h
+++ b/fs_mgr/include_fstab/fstab/fstab.h
@@ -84,6 +84,7 @@
bool fs_verity : 1;
bool ext_meta_csum : 1;
bool fs_compress : 1;
+ bool wrapped_key : 1;
} fs_mgr_flags = {};
bool is_encryptable() const {
diff --git a/healthd/healthd_mode_charger.cpp b/healthd/healthd_mode_charger.cpp
index e95efc0..47cdea3 100644
--- a/healthd/healthd_mode_charger.cpp
+++ b/healthd/healthd_mode_charger.cpp
@@ -346,6 +346,9 @@
disp_time = batt_anim_.frames[batt_anim_.cur_frame].disp_time;
+ /* unblank the screen on first cycle and first frame */
+ if (batt_anim_.cur_cycle == 0 && batt_anim_.cur_frame == 0) healthd_draw_->blank_screen(false);
+
if (screen_blanked_) {
healthd_draw_->blank_screen(false);
screen_blanked_ = false;
diff --git a/init/builtins.cpp b/init/builtins.cpp
index d00d1b1..d58dd60 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -588,6 +588,13 @@
PLOG(ERROR) << "fs_mgr_mount_all suggested recovery, so wiping data via recovery.";
const std::vector<std::string> options = {"--wipe_data", "--reason=fs_mgr_mount_all" };
return reboot_into_recovery(options);
+ } else if (code == FS_MGR_MNTALL_DEV_NEEDS_RECOVERY_WIPE_PROMPT) {
+ /* Setup a wipe via recovery with prompt, and reboot into recovery if chosen */
+ PLOG(ERROR) << "fs_mgr_mount_all suggested recovery, so wiping data via recovery "
+ "with prompt.";
+ const std::vector<std::string> options = {"--prompt_and_wipe_data",
+ "--reason=fs_mgr_mount_all" };
+ return reboot_into_recovery(options);
/* If reboot worked, there is no return. */
} else if (code == FS_MGR_MNTALL_DEV_FILE_ENCRYPTED) {
if (!FscryptInstallKeyring()) {
@@ -1059,6 +1066,19 @@
return {};
}
+static int check_rlim_action() {
+ struct rlimit rl;
+ std::string value = android::base::GetProperty("persist.debug.trace", "");
+ if(value == "1") {
+ rl.rlim_cur = RLIM_INFINITY;
+ rl.rlim_max = RLIM_INFINITY;
+ if (setrlimit(RLIMIT_CORE, &rl) < 0) {
+ PLOG(ERROR) << "could not enable core file generation";
+ }
+ }
+ return 0;
+}
+
static Result<void> do_load_persist_props(const BuiltinArguments& args) {
// Devices with FDE have load_persist_props called twice; the first time when the temporary
// /data partition is mounted and then again once /data is truly mounted. We do not want to
@@ -1074,6 +1094,8 @@
SendLoadPersistentPropertiesMessage();
start_waiting_for_property("ro.persistent_properties.ready", "true");
+ /*check for coredump*/
+ check_rlim_action();
return {};
}
diff --git a/init/first_stage_mount.cpp b/init/first_stage_mount.cpp
index b7d50cf..17c1a49 100644
--- a/init/first_stage_mount.cpp
+++ b/init/first_stage_mount.cpp
@@ -71,6 +71,16 @@
namespace android {
namespace init {
+namespace {
+
+bool DeferOverlayfsMount() {
+ std::string cmdline;
+ android::base::ReadFileToString("/proc/cmdline", &cmdline);
+ return cmdline.find("androidboot.defer_overlayfs_mount=1") != std::string::npos;
+}
+} // namespace
+
+
// Class Declarations
// ------------------
class FirstStageMount {
@@ -548,7 +558,9 @@
};
MapScratchPartitionIfNeeded(&fstab_, init_devices);
- fs_mgr_overlayfs_mount_all(&fstab_);
+ if (!DeferOverlayfsMount()) {
+ fs_mgr_overlayfs_mount_all(&fstab_);
+ }
return true;
}
diff --git a/init/init.cpp b/init/init.cpp
index c6f2066..cc88a11 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -49,11 +49,16 @@
#include <android-base/strings.h>
#include <backtrace/Backtrace.h>
#include <fs_avb/fs_avb.h>
+#include <fs_mgr.h>
+#include <fs_mgr_dm_linear.h>
+#include <fs_mgr_overlayfs.h>
#include <fs_mgr_vendor_overlay.h>
+
#include <keyutils.h>
#include <libavb/libavb.h>
#include <libgsi/libgsi.h>
#include <libsnapshot/snapshot.h>
+#include <private/android_filesystem_config.h>
#include <processgroup/processgroup.h>
#include <processgroup/setup.h>
#include <selinux/android.h>
@@ -96,10 +101,20 @@
using android::base::Trim;
using android::fs_mgr::AvbHandle;
using android::snapshot::SnapshotManager;
+using android::fs_mgr::Fstab;
+using android::fs_mgr::ReadDefaultFstab;
namespace android {
namespace init {
+namespace {
+bool DeferOverlayfsMount() {
+ std::string cmdline;
+ android::base::ReadFileToString("/proc/cmdline", &cmdline);
+ return cmdline.find("androidboot.defer_overlayfs_mount=1") != std::string::npos;
+}
+}
+
static int property_triggers_enabled = 0;
static int signal_fd = -1;
@@ -779,6 +794,20 @@
sigaction(SIGPIPE, &action, nullptr);
}
+ if (DeferOverlayfsMount()) {
+ Fstab fstab;
+ if (ReadDefaultFstab(&fstab)) {
+ fstab.erase(std::remove_if(fstab.begin(), fstab.end(),
+ [](const auto& entry) {
+ return !entry.fs_mgr_flags.first_stage_mount;
+ }),
+ fstab.end());
+ LOG(INFO) << "Running deferred mounting of overlayfs";
+ fs_mgr_overlayfs_mount_all(&fstab);
+ }
+
+ }
+
// Set init and its forked children's oom_adj.
if (auto result =
WriteFile("/proc/1/oom_score_adj", StringPrintf("%d", DEFAULT_OOM_SCORE_ADJUST));
@@ -801,6 +830,7 @@
if (force_debuggable_env && AvbHandle::IsDeviceUnlocked()) {
load_debug_prop = "true"s == force_debuggable_env;
}
+
unsetenv("INIT_FORCE_DEBUGGABLE");
// Umount the debug ramdisk so property service doesn't read .prop files from there, when it
diff --git a/init/property_service.cpp b/init/property_service.cpp
index e71c386..a1eba52 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -890,6 +890,109 @@
}
}
+// Initialize ro.build.product property with the value of ro.product.device, if it has not been set.
+static void property_derive_build_product() {
+ std::string build_product = GetProperty("ro.build.product", "");
+ if (!build_product.empty()) {
+ return;
+ }
+
+ const std::string UNKNOWN = "unknown";
+ build_product = GetProperty("ro.product.device", UNKNOWN);
+
+ LOG(INFO) << "Setting property 'ro.build.product' to '" << build_product << "'";
+
+ std::string error;
+ uint32_t res = PropertySet("ro.build.product", build_product, &error);
+ if (res != PROP_SUCCESS) {
+ LOG(ERROR) << "Error setting property 'ro.build.product': err=" << res << " (" << error
+ << ")";
+ }
+}
+
+// If the ro.build.description property has not been set, derive it from constituent pieces
+static void property_derive_build_description() {
+ std::string build_description = GetProperty("ro.build.description", "");
+ if (!build_description.empty()) {
+ return;
+ }
+
+ const std::string UNKNOWN = "unknown";
+ build_description = GetProperty("ro.product.name", UNKNOWN);
+ build_description += '-';
+ build_description += GetProperty("ro.build.type", UNKNOWN);
+ build_description += ' ';
+ build_description += GetProperty("ro.build.version.release", UNKNOWN);
+ build_description += ' ';
+ build_description += GetProperty("ro.build.id", UNKNOWN);
+ build_description += ' ';
+ build_description += GetProperty("ro.build.version.incremental", UNKNOWN);
+ build_description += ' ';
+ build_description += GetProperty("ro.build.tags", UNKNOWN);
+
+ LOG(INFO) << "Setting property 'ro.build.description' to '" << build_description << "'";
+
+ std::string error;
+ uint32_t res = PropertySet("ro.build.description", build_description, &error);
+ if (res != PROP_SUCCESS) {
+ LOG(ERROR) << "Error setting property 'ro.build.description': err=" << res << " (" << error
+ << ")";
+ }
+}
+
+// If the ro.build.display.id property has not been set, derive it from constituent pieces
+static void property_derive_build_display_id() {
+ std::string build_display_id = GetProperty("ro.build.display.id", "");
+ if (!build_display_id.empty()) {
+ return;
+ }
+
+ const std::string UNKNOWN = "unknown";
+ std::string build_type = GetProperty("ro.build.type", "");
+ if (build_type == "user") {
+ std::string display_build_number = GetProperty("ro.build.display_build_number", "");
+ if (display_build_number == "true") {
+ build_display_id = GetProperty("ro.build.id", UNKNOWN);
+ build_display_id += '.';
+ build_display_id += GetProperty("ro.build.version.incremental", UNKNOWN);
+ build_display_id += ' ';
+ build_display_id += GetProperty("ro.build.keys", UNKNOWN);
+ } else {
+ build_display_id = GetProperty("ro.build.id", UNKNOWN);
+ build_display_id += ' ';
+ build_display_id += GetProperty("ro.build.keys", UNKNOWN);
+ }
+ } else {
+ build_display_id = GetProperty("ro.product.name", UNKNOWN);
+ build_display_id += '-';
+ build_display_id += GetProperty("ro.build.type", UNKNOWN);
+ build_display_id += ' ';
+ build_display_id += GetProperty("ro.build.version.release", UNKNOWN);
+ build_display_id += ' ';
+ build_display_id += GetProperty("ro.build.id", UNKNOWN);
+ build_display_id += ' ';
+ build_display_id += GetProperty("ro.build.version.incremental", UNKNOWN);
+ build_display_id += ' ';
+ build_display_id += GetProperty("ro.build.tags", UNKNOWN);
+ }
+
+ LOG(INFO) << "Setting property 'ro.build.display.id' to '" << build_display_id << "'";
+
+ std::string error;
+ uint32_t res = PropertySet("ro.build.display.id", build_display_id, &error);
+ if (res != PROP_SUCCESS) {
+ LOG(ERROR) << "Error setting property 'ro.build.display.id': err=" << res << " (" << error
+ << ")";
+ }
+}
+
+static void property_derive_build_props() {
+ property_derive_build_fingerprint();
+ property_derive_build_product();
+ property_derive_build_description();
+ property_derive_build_display_id();
+}
+
void PropertyLoadBootDefaults() {
// We read the properties and their values into a map, in order to always allow properties
// loaded in the later property files to override the properties in loaded in the earlier
@@ -973,7 +1076,7 @@
}
property_initialize_ro_product_props();
- property_derive_build_fingerprint();
+ property_derive_build_props();
update_sys_usb_config();
}
diff --git a/init/reboot.cpp b/init/reboot.cpp
index 49baf9e..2065fcf 100644
--- a/init/reboot.cpp
+++ b/init/reboot.cpp
@@ -54,6 +54,8 @@
#include <private/android_filesystem_config.h>
#include <selinux/selinux.h>
+#include <cutils/properties.h>
+
#include "action.h"
#include "action_manager.h"
#include "builtin_arguments.h"
@@ -426,11 +428,17 @@
UmountStat stat = UmountPartitions(timeout - t.duration());
if (stat != UMOUNT_STAT_SUCCESS) {
LOG(INFO) << "umount timeout, last resort, kill all and try";
- if (DUMP_ON_UMOUNT_FAILURE) DumpUmountDebuggingInfo();
+ bool dumpUmountDebugInfo = property_get_bool("persist.sys.dumpUmountDebugInfo",false);
+ if (dumpUmountDebugInfo) {
+ if (DUMP_ON_UMOUNT_FAILURE) DumpUmountDebuggingInfo();
+ }
KillAllProcesses();
// even if it succeeds, still it is timeout and do not run fsck with all processes killed
UmountStat st = UmountPartitions(0ms);
- if ((st != UMOUNT_STAT_SUCCESS) && DUMP_ON_UMOUNT_FAILURE) DumpUmountDebuggingInfo();
+ if (dumpUmountDebugInfo) {
+ if ((st != UMOUNT_STAT_SUCCESS) && DUMP_ON_UMOUNT_FAILURE)
+ DumpUmountDebuggingInfo();
+ }
}
if (stat == UMOUNT_STAT_SUCCESS && run_fsck) {
diff --git a/libasyncio/Android.bp b/libasyncio/Android.bp
index 44e7933..b4db22c 100644
--- a/libasyncio/Android.bp
+++ b/libasyncio/Android.bp
@@ -16,11 +16,7 @@
cc_defaults {
name: "libasyncio_defaults",
- cflags: [
- "-Wall",
- "-Werror",
- "-Wextra",
- ],
+ cflags: ["-Wall", "-Werror", "-Wextra"],
}
cc_library {
diff --git a/libprocessgroup/profiles/cgroups.json b/libprocessgroup/profiles/cgroups.json
index 5b7a28a..c3d28ea 100644
--- a/libprocessgroup/profiles/cgroups.json
+++ b/libprocessgroup/profiles/cgroups.json
@@ -29,8 +29,8 @@
{
"Controller": "memory",
"Path": "/dev/memcg",
- "Mode": "0700",
- "UID": "root",
+ "Mode": "0755",
+ "UID": "system",
"GID": "system"
}
],
diff --git a/libprocessgroup/profiles/task_profiles.json b/libprocessgroup/profiles/task_profiles.json
index ea0064f..53285b9 100644
--- a/libprocessgroup/profiles/task_profiles.json
+++ b/libprocessgroup/profiles/task_profiles.json
@@ -16,6 +16,12 @@
"File": "top-app/cpus"
},
{
+ "Name": "AudioAppCapacityCPUs",
+ "Controller": "cpuset",
+ "File": "audio-app/cpus"
+ },
+
+ {
"Name": "MemLimit",
"Controller": "memory",
"File": "memory.limit_in_bytes"
@@ -158,6 +164,19 @@
]
},
{
+ "Name": "AudioAppPerformance",
+ "Actions" : [
+ {
+ "Name" : "JoinCgroup",
+ "Params" :
+ {
+ "Controller": "schedtune",
+ "Path": "audio-app"
+ }
+ }
+ ]
+ },
+ {
"Name": "NNApiHALPerformance",
"Actions": [
{
@@ -383,6 +402,46 @@
}
]
},
+ {
+ "Name": "AudioAppCapacity",
+ "Actions" : [
+ {
+ "Name" : "JoinCgroup",
+ "Params" :
+ {
+ "Controller": "cpuset",
+ "Path": "audio-app"
+ }
+ }
+ ]
+ },
+
+ {
+ "Name": "BlkIOForeground",
+ "Actions" : [
+ {
+ "Name" : "JoinCgroup",
+ "Params" :
+ {
+ "Controller": "blkio",
+ "Path": ""
+ }
+ }
+ ]
+ },
+ {
+ "Name": "BlkIOBackground",
+ "Actions" : [
+ {
+ "Name" : "JoinCgroup",
+ "Params" :
+ {
+ "Controller": "blkio",
+ "Path": "bg"
+ }
+ }
+ ]
+ },
{
"Name": "LowIoPriority",
diff --git a/libprocessgroup/sched_policy.cpp b/libprocessgroup/sched_policy.cpp
index 698e74d..f6272cb 100644
--- a/libprocessgroup/sched_policy.cpp
+++ b/libprocessgroup/sched_policy.cpp
@@ -46,15 +46,16 @@
switch (policy) {
case SP_BACKGROUND:
- return SetTaskProfiles(tid, {"CPUSET_SP_BACKGROUND"}, true) ? 0 : -1;
+ return SetTaskProfiles(tid, {"CPUSET_SP_BACKGROUND", "BlkIOBackground"}, true) ? 0 : -1;
case SP_FOREGROUND:
+ return SetTaskProfiles(tid, {"CPUSET_SP_FOREGROUND", "BlkIOForeground"}, true) ? 0 : -1;
case SP_AUDIO_APP:
case SP_AUDIO_SYS:
- return SetTaskProfiles(tid, {"CPUSET_SP_FOREGROUND"}, true) ? 0 : -1;
+ return SetTaskProfiles(tid, {"CPUSET_SP_FOREGROUND", "AudioAppCapacity", "BlkIOForeground"}, true) ? 0 : -1;
case SP_TOP_APP:
- return SetTaskProfiles(tid, {"CPUSET_SP_TOP_APP"}, true) ? 0 : -1;
+ return SetTaskProfiles(tid, {"CPUSET_SP_TOP_APP", "BlkIOBackground"}, true) ? 0 : -1;
case SP_SYSTEM:
- return SetTaskProfiles(tid, {"CPUSET_SP_SYSTEM"}, true) ? 0 : -1;
+ return SetTaskProfiles(tid, {"CPUSET_SP_SYSTEM", "BlkIOForeground"}, true) ? 0 : -1;
case SP_RESTRICTED:
return SetTaskProfiles(tid, {"CPUSET_SP_RESTRICTED"}, true) ? 0 : -1;
default:
@@ -101,7 +102,7 @@
case SP_AUDIO_APP:
case SP_AUDIO_SYS:
case SP_TOP_APP:
- SLOGD("^^^ tid %d (%s)", tid, thread_name);
+ SLOGD("^^^ tid %d policy %d (%s)", tid, policy, thread_name);
break;
case SP_SYSTEM:
SLOGD("/// tid %d (%s)", tid, thread_name);
@@ -117,15 +118,15 @@
switch (policy) {
case SP_BACKGROUND:
- return SetTaskProfiles(tid, {"SCHED_SP_BACKGROUND"}, true) ? 0 : -1;
+ return SetTaskProfiles(tid, {"SCHED_SP_BACKGROUND", "BlkIOBackground"}, true) ? 0 : -1;
case SP_FOREGROUND:
case SP_AUDIO_APP:
case SP_AUDIO_SYS:
- return SetTaskProfiles(tid, {"SCHED_SP_FOREGROUND"}, true) ? 0 : -1;
+ return SetTaskProfiles(tid, {"SCHED_SP_FOREGROUND", "BlkIOForeground"}, true) ? 0 : -1;
case SP_TOP_APP:
- return SetTaskProfiles(tid, {"SCHED_SP_TOP_APP"}, true) ? 0 : -1;
+ return SetTaskProfiles(tid, {"SCHED_SP_TOP_APP", "BlkIOForeground"}, true) ? 0 : -1;
case SP_RT_APP:
- return SetTaskProfiles(tid, {"SCHED_SP_RT_APP"}, true) ? 0 : -1;
+ return SetTaskProfiles(tid, {"SCHED_SP_RT_APP", "BlkIOForeground"}, true) ? 0 : -1;
default:
return SetTaskProfiles(tid, {"SCHED_SP_DEFAULT"}, true) ? 0 : -1;
}
@@ -192,6 +193,8 @@
*policy = SP_TOP_APP;
} else if (group == "restricted") {
*policy = SP_RESTRICTED;
+ } else if (group == "audio-app") {
+ *policy = SP_AUDIO_APP;
} else {
errno = ERANGE;
return -1;
diff --git a/libsystem/include/system/camera.h b/libsystem/include/system/camera.h
index 2ca90c3..990edcf 100644
--- a/libsystem/include/system/camera.h
+++ b/libsystem/include/system/camera.h
@@ -88,9 +88,20 @@
// Notify on autofocus start and stop. This is useful in continuous
// autofocus - FOCUS_MODE_CONTINUOUS_VIDEO and FOCUS_MODE_CONTINUOUS_PICTURE.
CAMERA_MSG_FOCUS_MOVE = 0x0800, // notifyCallback
+ CAMERA_MSG_VENDOR_START = 0x1000,
+ CAMERA_MSG_STATS_DATA = CAMERA_MSG_VENDOR_START,
+ CAMERA_MSG_META_DATA = 0x2000,
+ CAMERA_MSG_VENDOR_END = 0x8000,
CAMERA_MSG_ALL_MSGS = 0xFFFF
};
+/** meta data type in CameraMetaDataCallback */
+enum {
+ CAMERA_META_DATA_ASD = 0x001, //ASD data
+ CAMERA_META_DATA_FD = 0x002, //FD/FP data
+ CAMERA_META_DATA_HDR = 0x003, //Auto HDR data
+};
+
/** cmdType in sendCommand functions */
enum {
CAMERA_CMD_START_SMOOTH_ZOOM = 1,
@@ -189,7 +200,25 @@
* IMPLEMENTATION_DEFINED, then HALv3 devices will use gralloc usage flags
* of SW_READ_OFTEN.
*/
- CAMERA_CMD_SET_VIDEO_FORMAT = 11
+ CAMERA_CMD_SET_VIDEO_FORMAT = 11,
+
+ CAMERA_CMD_VENDOR_START = 20,
+ /**
+ * Commands to enable/disable preview histogram
+ *
+ * Based on user's input to enable/disable histogram from the camera
+ * UI, send the appropriate command to the HAL to turn on/off the histogram
+ * stats and start sending the data to the application.
+ */
+ CAMERA_CMD_HISTOGRAM_ON = CAMERA_CMD_VENDOR_START,
+ CAMERA_CMD_HISTOGRAM_OFF = CAMERA_CMD_VENDOR_START + 1,
+ CAMERA_CMD_HISTOGRAM_SEND_DATA = CAMERA_CMD_VENDOR_START + 2,
+ CAMERA_CMD_LONGSHOT_ON = CAMERA_CMD_VENDOR_START + 3,
+ CAMERA_CMD_LONGSHOT_OFF = CAMERA_CMD_VENDOR_START + 4,
+ CAMERA_CMD_STOP_LONGSHOT = CAMERA_CMD_VENDOR_START + 5,
+ CAMERA_CMD_METADATA_ON = CAMERA_CMD_VENDOR_START + 6,
+ CAMERA_CMD_METADATA_OFF = CAMERA_CMD_VENDOR_START + 7,
+ CAMERA_CMD_VENDOR_END = 200,
};
/** camera fatal errors */
@@ -284,10 +313,32 @@
* -2000, -2000 if this is not supported.
*/
int32_t mouth[2];
+ int32_t smile_degree;
+ int32_t smile_score;
+ int32_t blink_detected;
+ int32_t face_recognised;
+ int32_t gaze_angle;
+ int32_t updown_dir;
+ int32_t leftright_dir;
+ int32_t roll_dir;
+ int32_t left_right_gaze;
+ int32_t top_bottom_gaze;
+ int32_t leye_blink;
+ int32_t reye_blink;
} camera_face_t;
/**
+ * The information of a data type received in a camera frame.
+ */
+typedef enum {
+ /** Data buffer */
+ CAMERA_FRAME_DATA_BUF = 0x000,
+ /** File descriptor */
+ CAMERA_FRAME_DATA_FD = 0x100
+} camera_frame_data_type_t;
+
+/**
* The metadata of the frame data.
*/
typedef struct camera_frame_metadata {
diff --git a/libutils/RefBase.cpp b/libutils/RefBase.cpp
index 8e45226..98d0963 100644
--- a/libutils/RefBase.cpp
+++ b/libutils/RefBase.cpp
@@ -527,7 +527,7 @@
weakref_impl* const impl = static_cast<weakref_impl*>(this);
impl->removeWeakRef(id);
const int32_t c = impl->mWeak.fetch_sub(1, std::memory_order_release);
- LOG_ALWAYS_FATAL_IF(BAD_WEAK(c), "decWeak called on %p too many times",
+ ALOGW_IF(BAD_WEAK(c), "decWeak called on %p too many times",
this);
if (c != 1) return;
atomic_thread_fence(std::memory_order_acquire);
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 746fc61..91b7a2c 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -32,10 +32,14 @@
# memory.pressure_level used by lmkd
chown root system /dev/memcg/memory.pressure_level
chmod 0040 /dev/memcg/memory.pressure_level
+
# app mem cgroups, used by activity manager, lmkd and zygote
mkdir /dev/memcg/apps/ 0755 system system
+ write /dev/memcg/apps/memory.swappiness 100
+
# cgroup for system_server and surfaceflinger
mkdir /dev/memcg/system 0550 system system
+ write /dev/memcg/system/memory.swappiness 100
# symlink the Android specific /dev/tun to Linux expected /dev/net/tun
mkdir /dev/net 0755 root root
@@ -132,21 +136,25 @@
mkdir /dev/stune/background
mkdir /dev/stune/top-app
mkdir /dev/stune/rt
+ mkdir /dev/stune/audio-app
chown system system /dev/stune
chown system system /dev/stune/foreground
chown system system /dev/stune/background
chown system system /dev/stune/top-app
chown system system /dev/stune/rt
+ chown system system /dev/stune/audio-app
chown system system /dev/stune/tasks
chown system system /dev/stune/foreground/tasks
chown system system /dev/stune/background/tasks
chown system system /dev/stune/top-app/tasks
chown system system /dev/stune/rt/tasks
+ chown system system /dev/stune/audio-app/tasks
chmod 0664 /dev/stune/tasks
chmod 0664 /dev/stune/foreground/tasks
chmod 0664 /dev/stune/background/tasks
chmod 0664 /dev/stune/top-app/tasks
chmod 0664 /dev/stune/rt/tasks
+ chmod 0664 /dev/stune/audio-app/tasks
# cpuctl hierarchy for devices using utilclamp
mkdir /dev/cpuctl/foreground
@@ -332,18 +340,24 @@
copy /dev/cpuset/cpus /dev/cpuset/top-app/cpus
copy /dev/cpuset/mems /dev/cpuset/top-app/mems
+ mkdir /dev/cpuset/audio-app
+ copy /dev/cpuset/cpus /dev/cpuset/audio-app/cpus
+ copy /dev/cpuset/mems /dev/cpuset/audio-app/mems
+
# change permissions for all cpusets we'll touch at runtime
chown system system /dev/cpuset
chown system system /dev/cpuset/foreground
chown system system /dev/cpuset/background
chown system system /dev/cpuset/system-background
chown system system /dev/cpuset/top-app
+ chown system system /dev/cpuset/audio-app
chown system system /dev/cpuset/restricted
chown system system /dev/cpuset/tasks
chown system system /dev/cpuset/foreground/tasks
chown system system /dev/cpuset/background/tasks
chown system system /dev/cpuset/system-background/tasks
chown system system /dev/cpuset/top-app/tasks
+ chown system system /dev/cpuset/audio-app/tasks
chown system system /dev/cpuset/restricted/tasks
# set system-background to 0775 so SurfaceFlinger can touch it
@@ -353,6 +367,7 @@
chmod 0664 /dev/cpuset/background/tasks
chmod 0664 /dev/cpuset/system-background/tasks
chmod 0664 /dev/cpuset/top-app/tasks
+ chmod 0664 /dev/cpuset/audio-app/tasks
chmod 0664 /dev/cpuset/restricted/tasks
chmod 0664 /dev/cpuset/tasks
@@ -453,6 +468,7 @@
# '--early' can be specified to skip entries with 'latemount'.
# /system and /vendor must be mounted by the end of the fs stage,
# while /data is optional.
+ trigger factory-fs
trigger fs
trigger post-fs
@@ -481,6 +497,7 @@
trigger early-boot
trigger boot
+ trigger mmi
on early-fs
# Once metadata has been mounted, we'll need vold to deal with userdata checkpointing
@@ -1002,6 +1019,11 @@
start logd
start logd-reinit
+# corefile limit
+on property:persist.debug.trace=1
+ mkdir /data/core 0777 root root
+ write /proc/sys/kernel/core_pattern "/data/core/%E.%p.%e"
+
on property:vold.decrypt=trigger_post_fs_data
trigger post-fs-data
trigger zygote-start