Merge "fastboot: Change -w to format after the erase of userdata & cache" into jb-dev
diff --git a/include/private/android_filesystem_config.h b/include/private/android_filesystem_config.h
index 5b556d6..6521cbe 100644
--- a/include/private/android_filesystem_config.h
+++ b/include/private/android_filesystem_config.h
@@ -225,7 +225,7 @@
{ 00750, AID_ROOT, AID_SHELL, "init*" },
{ 00750, AID_ROOT, AID_SHELL, "charger*" },
{ 00750, AID_ROOT, AID_SHELL, "sbin/fs_mgr" },
- { 00644, AID_ROOT, AID_SHELL, "fstab.*" },
+ { 00640, AID_ROOT, AID_SHELL, "fstab.*" },
{ 00644, AID_ROOT, AID_ROOT, 0 },
};
diff --git a/include/system/camera.h b/include/system/camera.h
index b8389b1..e4cacc5 100644
--- a/include/system/camera.h
+++ b/include/system/camera.h
@@ -137,7 +137,8 @@
* KEY_FOCUS_AREAS and KEY_METERING_AREAS have no effect.
*
* arg1 is the face detection type. It can be CAMERA_FACE_DETECTION_HW or
- * CAMERA_FACE_DETECTION_SW.
+ * CAMERA_FACE_DETECTION_SW. If the type of face detection requested is not
+ * supported, the HAL must return BAD_VALUE.
*/
CAMERA_CMD_START_FACE_DETECTION = 6,
diff --git a/include/system/window.h b/include/system/window.h
index 1a036df..8e00bcd 100644
--- a/include/system/window.h
+++ b/include/system/window.h
@@ -248,7 +248,7 @@
NATIVE_WINDOW_API_CONNECT = 13, /* private */
NATIVE_WINDOW_API_DISCONNECT = 14, /* private */
NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS = 15, /* private */
- NATIVE_WINDOW_SET_ACTIVE_RECT = 16, /* private */
+ NATIVE_WINDOW_SET_POST_TRANSFORM_CROP = 16, /* private */
};
/* parameter for NATIVE_WINDOW_[API_][DIS]CONNECT */
@@ -298,6 +298,11 @@
* of the buffer matches the window size (cropping in the process)
*/
NATIVE_WINDOW_SCALING_MODE_SCALE_CROP = 2,
+ /* the window is clipped to the size of the buffer's crop rectangle; pixels
+ * outside the crop rectangle are treated as if they are completely
+ * transparent.
+ */
+ NATIVE_WINDOW_SCALING_MODE_NO_SCALE_CROP = 3,
};
/* values returned by the NATIVE_WINDOW_CONCRETE_TYPE query */
@@ -440,7 +445,7 @@
* NATIVE_WINDOW_API_CONNECT (private)
* NATIVE_WINDOW_API_DISCONNECT (private)
* NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS (private)
- * NATIVE_WINDOW_SET_ACTIVE_RECT (private)
+ * NATIVE_WINDOW_SET_POST_TRANSFORM_CROP (private)
*
*/
@@ -504,14 +509,16 @@
/*
* native_window_set_crop(..., crop)
* Sets which region of the next queued buffers needs to be considered.
- * A buffer's crop region is scaled to match the surface's size.
+ * Depending on the scaling mode, a buffer's crop region is scaled and/or
+ * cropped to match the surface's size. This function sets the crop in
+ * pre-transformed buffer pixel coordinates.
*
* The specified crop region applies to all buffers queued after it is called.
*
- * if 'crop' is NULL, subsequently queued buffers won't be cropped.
+ * If 'crop' is NULL, subsequently queued buffers won't be cropped.
*
- * An error is returned if for instance the crop region is invalid,
- * out of the buffer's bound or if the window is invalid.
+ * An error is returned if for instance the crop region is invalid, out of the
+ * buffer's bound or if the window is invalid.
*/
static inline int native_window_set_crop(
struct ANativeWindow* window,
@@ -521,23 +528,38 @@
}
/*
+ * native_window_set_post_transform_crop(..., crop)
+ * Sets which region of the next queued buffers needs to be considered.
+ * Depending on the scaling mode, a buffer's crop region is scaled and/or
+ * cropped to match the surface's size. This function sets the crop in
+ * post-transformed pixel coordinates.
+ *
+ * The specified crop region applies to all buffers queued after it is called.
+ *
+ * If 'crop' is NULL, subsequently queued buffers won't be cropped.
+ *
+ * An error is returned if for instance the crop region is invalid, out of the
+ * buffer's bound or if the window is invalid.
+ */
+static inline int native_window_set_post_transform_crop(
+ struct ANativeWindow* window,
+ android_native_rect_t const * crop)
+{
+ return window->perform(window, NATIVE_WINDOW_SET_POST_TRANSFORM_CROP, crop);
+}
+
+/*
* native_window_set_active_rect(..., active_rect)
- * Sets the region of future queued buffers that are 'active'. Pixels outside
- * this 'active' region are considered to be completely transparent regardless
- * of the pixel values in the buffer. The active_rect argument specifies the
- * active rectangle in buffer pixel coordinates.
*
- * The specified active rectangle applies to all buffers queued after it is
- * called.
- *
- * An error is returned if for instance the crop region is invalid,
- * out of the buffer's bound or if the window is invalid.
+ * This function is deprectated and will be removed soon. For now it simply
+ * sets the post-transform crop for compatibility while multi-project commits
+ * get checked.
*/
static inline int native_window_set_active_rect(
struct ANativeWindow* window,
android_native_rect_t const * active_rect)
{
- return window->perform(window, NATIVE_WINDOW_SET_ACTIVE_RECT, active_rect);
+ return native_window_set_post_transform_crop(window, active_rect);
}
/*
diff --git a/libcutils/sched_policy.c b/libcutils/sched_policy.c
index 20771c0..e03ce00 100644
--- a/libcutils/sched_policy.c
+++ b/libcutils/sched_policy.c
@@ -16,24 +16,31 @@
** limitations under the License.
*/
+#define LOG_TAG "SchedPolicy"
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
+#include <cutils/sched_policy.h>
+#include <cutils/log.h>
-#define LOG_TAG "SchedPolicy"
-#include "cutils/log.h"
+/* Re-map SP_DEFAULT to the system default policy, and leave other values unchanged.
+ * Call this any place a SchedPolicy is used as an input parameter.
+ * Returns the possibly re-mapped policy.
+ */
+static inline SchedPolicy _policy(SchedPolicy p)
+{
+ return p == SP_DEFAULT ? SP_SYSTEM_DEFAULT : p;
+}
-#ifdef HAVE_SCHED_H
-#ifdef HAVE_PTHREADS
+#if defined(HAVE_ANDROID_OS) && defined(HAVE_SCHED_H) && defined(HAVE_PTHREADS)
#include <sched.h>
#include <pthread.h>
-#include <cutils/sched_policy.h>
-
#ifndef SCHED_NORMAL
#define SCHED_NORMAL 0
#endif
@@ -124,32 +131,32 @@
#if CAN_SET_SP_SYSTEM
filename = "/dev/cpuctl/tasks";
- system_cgroup_fd = open(filename, O_WRONLY);
+ system_cgroup_fd = open(filename, O_WRONLY | O_CLOEXEC);
if (system_cgroup_fd < 0) {
SLOGV("open of %s failed: %s\n", filename, strerror(errno));
}
#endif
filename = "/dev/cpuctl/foreground/tasks";
- fg_cgroup_fd = open(filename, O_WRONLY);
+ fg_cgroup_fd = open(filename, O_WRONLY | O_CLOEXEC);
if (fg_cgroup_fd < 0) {
SLOGE("open of %s failed: %s\n", filename, strerror(errno));
}
filename = "/dev/cpuctl/bg_non_interactive/tasks";
- bg_cgroup_fd = open(filename, O_WRONLY);
+ bg_cgroup_fd = open(filename, O_WRONLY | O_CLOEXEC);
if (bg_cgroup_fd < 0) {
SLOGE("open of %s failed: %s\n", filename, strerror(errno));
}
filename = "/dev/cpuctl/audio_app/tasks";
- audio_app_cgroup_fd = open(filename, O_WRONLY);
+ audio_app_cgroup_fd = open(filename, O_WRONLY | O_CLOEXEC);
if (audio_app_cgroup_fd < 0) {
SLOGV("open of %s failed: %s\n", filename, strerror(errno));
}
filename = "/dev/cpuctl/audio_sys/tasks";
- audio_sys_cgroup_fd = open(filename, O_WRONLY);
+ audio_sys_cgroup_fd = open(filename, O_WRONLY | O_CLOEXEC);
if (audio_sys_cgroup_fd < 0) {
SLOGV("open of %s failed: %s\n", filename, strerror(errno));
}
@@ -274,15 +281,6 @@
return 0;
}
-/* Re-map SP_DEFAULT to the system default policy, and leave other values unchanged.
- * Call this any place a SchedPolicy is used as an input parameter.
- * Returns the possibly re-mapped policy.
- */
-static inline SchedPolicy _policy(SchedPolicy p)
-{
- return p == SP_DEFAULT ? SP_SYSTEM_DEFAULT : p;
-}
-
int set_sched_policy(int tid, SchedPolicy policy)
{
#ifdef HAVE_GETTID
@@ -356,6 +354,23 @@
return 0;
}
+#else
+
+/* Stubs for non-Android targets. */
+
+int set_sched_policy(int tid, SchedPolicy policy)
+{
+ return 0;
+}
+
+int get_sched_policy(int tid, SchedPolicy *policy)
+{
+ *policy = SP_SYSTEM_DEFAULT;
+ return 0;
+}
+
+#endif
+
const char *get_sched_policy_name(SchedPolicy policy)
{
policy = _policy(policy);
@@ -372,5 +387,3 @@
return "error";
}
-#endif /* HAVE_PTHREADS */
-#endif /* HAVE_SCHED_H */
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 698415b..a97b923 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -97,7 +97,7 @@
chown system system /dev/cpuctl/foreground/tasks
chmod 0666 /dev/cpuctl/foreground/tasks
write /dev/cpuctl/foreground/cpu.shares 1024
- write /dev/cpuctl/foreground/cpu.rt_runtime_us 0
+ write /dev/cpuctl/foreground/cpu.rt_runtime_us 1000
write /dev/cpuctl/foreground/cpu.rt_period_us 1000000
mkdir /dev/cpuctl/bg_non_interactive
@@ -105,7 +105,7 @@
chmod 0666 /dev/cpuctl/bg_non_interactive/tasks
# 5.0 %
write /dev/cpuctl/bg_non_interactive/cpu.shares 52
- write /dev/cpuctl/bg_non_interactive/cpu.rt_runtime_us 0
+ write /dev/cpuctl/bg_non_interactive/cpu.rt_runtime_us 1000
write /dev/cpuctl/bg_non_interactive/cpu.rt_period_us 1000000
mkdir /dev/cpuctl/audio_app