Merge "WindowManager: unset the wallpaper window crop" into jb-dev
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index c0fb06f..1d5f207 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -55,6 +55,10 @@
#define SYSTEM_BOOTANIMATION_FILE "/system/media/bootanimation.zip"
#define SYSTEM_ENCRYPTED_BOOTANIMATION_FILE "/system/media/bootanimation-encrypted.zip"
+extern "C" int clock_nanosleep(clockid_t clock_id, int flags,
+ const struct timespec *request,
+ struct timespec *remain);
+
namespace android {
// ---------------------------------------------------------------------------
@@ -476,6 +480,7 @@
for (int r=0 ; !part.count || r<part.count ; r++) {
for (int j=0 ; j<fcount && !exitPending(); j++) {
const Animation::Frame& frame(part.frames[j]);
+ nsecs_t lastFrame = systemTime();
if (r > 0) {
glBindTexture(GL_TEXTURE_2D, frame.tid);
@@ -508,10 +513,18 @@
nsecs_t now = systemTime();
nsecs_t delay = frameDuration - (now - lastFrame);
+ //ALOGD("%lld, %lld", ns2ms(now - lastFrame), ns2ms(delay));
lastFrame = now;
- long wait = ns2us(delay);
- if (wait > 0)
- usleep(wait);
+
+ if (delay > 0) {
+ struct timespec spec;
+ spec.tv_sec = (now + delay) / 1000000000;
+ spec.tv_nsec = (now + delay) % 1000000000;
+ int err;
+ do {
+ err = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &spec, NULL);
+ } while (err<0 && errno == EINTR);
+ }
}
usleep(part.pause * ns2us(frameDuration));
}
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index f4ca9d2..fd302dc 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -230,7 +230,17 @@
public void setVisibility(int visibility) {
super.setVisibility(visibility);
mViewVisibility = visibility == VISIBLE;
- mRequestedVisible = mWindowVisibility && mViewVisibility;
+ boolean newRequestedVisible = mWindowVisibility && mViewVisibility;
+ if (newRequestedVisible != mRequestedVisible) {
+ // our base class (View) invalidates the layout only when
+ // we go from/to the GONE state. However, SurfaceView needs
+ // to request a re-layout when the visibility changes at all.
+ // This is needed because the transparent region is computed
+ // as part of the layout phase, and it changes (obviously) when
+ // the visibility changes.
+ requestLayout();
+ }
+ mRequestedVisible = newRequestedVisible;
updateWindow(false, false);
}
diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java
index f51a24a..96f01db 100644
--- a/media/java/android/media/AudioTrack.java
+++ b/media/java/android/media/AudioTrack.java
@@ -401,7 +401,7 @@
mChannels = AudioFormat.CHANNEL_OUT_STEREO;
break;
default:
- if ((channelConfig & SUPPORTED_OUT_CHANNELS) != channelConfig) {
+ if (!isMultichannelConfigSupported(channelConfig)) {
// input channel configuration features unsupported channels
mChannelCount = 0;
mChannels = AudioFormat.CHANNEL_INVALID;
@@ -438,6 +438,37 @@
}
}
+ /**
+ * Convenience method to check that the channel configuration (a.k.a channel mask) is supported
+ * @param channelConfig the mask to validate
+ * @return false if the AudioTrack can't be used with such a mask
+ */
+ private static boolean isMultichannelConfigSupported(int channelConfig) {
+ // check for unsupported channels
+ if ((channelConfig & SUPPORTED_OUT_CHANNELS) != channelConfig) {
+ Log.e(TAG, "Channel configuration features unsupported channels");
+ return false;
+ }
+ // check for unsupported multichannel combinations:
+ // - FL/FR must be present
+ // - L/R channels must be paired (e.g. no single L channel)
+ final int frontPair =
+ AudioFormat.CHANNEL_OUT_FRONT_LEFT | AudioFormat.CHANNEL_OUT_FRONT_RIGHT;
+ if ((channelConfig & frontPair) != frontPair) {
+ Log.e(TAG, "Front channels must be present in multichannel configurations");
+ return false;
+ }
+ final int backPair =
+ AudioFormat.CHANNEL_OUT_BACK_LEFT | AudioFormat.CHANNEL_OUT_BACK_RIGHT;
+ if ((channelConfig & backPair) != 0) {
+ if ((channelConfig & backPair) != backPair) {
+ Log.e(TAG, "Rear channels can't be used independently");
+ return false;
+ }
+ }
+ return true;
+ }
+
// Convenience method for the contructor's audio buffer size check.
// preconditions:
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
index 7238fdf..18b8042 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
@@ -81,7 +81,7 @@
private int mFailedAttempts = 0;
private int mFailedBiometricUnlockAttempts = 0;
- private static final int FAILED_BIOMETRIC_UNLOCK_ATTEMPTS_BEFORE_BACKUP = 15;
+ private static final int FAILED_BIOMETRIC_UNLOCK_ATTEMPTS_BEFORE_BACKUP = 5;
private boolean mClockVisible;