Merge "Mention external storage changes in KITKAT docs." into klp-dev
diff --git a/core/java/android/view/InputEventReceiver.java b/core/java/android/view/InputEventReceiver.java
index f5ee7ed..25972e7 100644
--- a/core/java/android/view/InputEventReceiver.java
+++ b/core/java/android/view/InputEventReceiver.java
@@ -48,7 +48,7 @@
InputChannel inputChannel, MessageQueue messageQueue);
private static native void nativeDispose(int receiverPtr);
private static native void nativeFinishInputEvent(int receiverPtr, int seq, boolean handled);
- private static native void nativeConsumeBatchedInputEvents(int receiverPtr,
+ private static native boolean nativeConsumeBatchedInputEvents(int receiverPtr,
long frameTimeNanos);
/**
@@ -165,14 +165,17 @@
*
* @param frameTimeNanos The time in the {@link System#nanoTime()} time base
* when the current display frame started rendering, or -1 if unknown.
+ *
+ * @return Whether a batch was consumed
*/
- public final void consumeBatchedInputEvents(long frameTimeNanos) {
+ public final boolean consumeBatchedInputEvents(long frameTimeNanos) {
if (mReceiverPtr == 0) {
Log.w(TAG, "Attempted to consume batched input events but the input event "
+ "receiver has already been disposed.");
} else {
- nativeConsumeBatchedInputEvents(mReceiverPtr, frameTimeNanos);
+ return nativeConsumeBatchedInputEvents(mReceiverPtr, frameTimeNanos);
}
+ return false;
}
// Called from native code.
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index ab93084..637af6f 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -5635,7 +5635,13 @@
if (mConsumeBatchedInputScheduled) {
mConsumeBatchedInputScheduled = false;
if (mInputEventReceiver != null) {
- mInputEventReceiver.consumeBatchedInputEvents(frameTimeNanos);
+ if (mInputEventReceiver.consumeBatchedInputEvents(frameTimeNanos)) {
+ // If we consumed a batch here, we want to go ahead and schedule the
+ // consumption of batched input events on the next frame. Otherwise, we would
+ // wait until we have more input events pending and might get starved by other
+ // things occurring in the process.
+ scheduleConsumeBatchedInput();
+ }
}
doProcessInputEvents();
}
diff --git a/core/jni/android_view_InputEventReceiver.cpp b/core/jni/android_view_InputEventReceiver.cpp
index b254de7..92a3e62 100644
--- a/core/jni/android_view_InputEventReceiver.cpp
+++ b/core/jni/android_view_InputEventReceiver.cpp
@@ -56,7 +56,8 @@
status_t initialize();
void dispose();
status_t finishInputEvent(uint32_t seq, bool handled);
- status_t consumeEvents(JNIEnv* env, bool consumeBatches, nsecs_t frameTime);
+ status_t consumeEvents(JNIEnv* env, bool consumeBatches, nsecs_t frameTime,
+ bool* outConsumedBatch);
protected:
virtual ~NativeInputEventReceiver();
@@ -167,7 +168,7 @@
if (events & ALOOPER_EVENT_INPUT) {
JNIEnv* env = AndroidRuntime::getJNIEnv();
- status_t status = consumeEvents(env, false /*consumeBatches*/, -1);
+ status_t status = consumeEvents(env, false /*consumeBatches*/, -1, NULL);
mMessageQueue->raiseAndClearException(env, "handleReceiveCallback");
return status == OK || status == NO_MEMORY ? 1 : 0;
}
@@ -214,7 +215,7 @@
}
status_t NativeInputEventReceiver::consumeEvents(JNIEnv* env,
- bool consumeBatches, nsecs_t frameTime) {
+ bool consumeBatches, nsecs_t frameTime, bool* outConsumedBatch) {
#if DEBUG_DISPATCH_CYCLE
ALOGD("channel '%s' ~ Consuming input events, consumeBatches=%s, frameTime=%lld.",
getInputChannelName(), consumeBatches ? "true" : "false", frameTime);
@@ -223,6 +224,9 @@
if (consumeBatches) {
mBatchedInputEventPending = false;
}
+ if (outConsumedBatch) {
+ *outConsumedBatch = false;
+ }
ScopedLocalRef<jobject> receiverObj(env, NULL);
bool skipCallbacks = false;
@@ -285,13 +289,17 @@
static_cast<KeyEvent*>(inputEvent));
break;
- case AINPUT_EVENT_TYPE_MOTION:
+ case AINPUT_EVENT_TYPE_MOTION: {
#if DEBUG_DISPATCH_CYCLE
ALOGD("channel '%s' ~ Received motion event.", getInputChannelName());
#endif
- inputEventObj = android_view_MotionEvent_obtainAsCopy(env,
- static_cast<MotionEvent*>(inputEvent));
+ MotionEvent* motionEvent = static_cast<MotionEvent*>(inputEvent);
+ if ((motionEvent->getAction() & AMOTION_EVENT_ACTION_MOVE) && outConsumedBatch) {
+ *outConsumedBatch = true;
+ }
+ inputEventObj = android_view_MotionEvent_obtainAsCopy(env, motionEvent);
break;
+ }
default:
assert(false); // InputConsumer should prevent this from ever happening
@@ -370,16 +378,20 @@
}
}
-static void nativeConsumeBatchedInputEvents(JNIEnv* env, jclass clazz, jint receiverPtr,
+static bool nativeConsumeBatchedInputEvents(JNIEnv* env, jclass clazz, jint receiverPtr,
jlong frameTimeNanos) {
sp<NativeInputEventReceiver> receiver =
reinterpret_cast<NativeInputEventReceiver*>(receiverPtr);
- status_t status = receiver->consumeEvents(env, true /*consumeBatches*/, frameTimeNanos);
+ bool consumedBatch;
+ status_t status = receiver->consumeEvents(env, true /*consumeBatches*/, frameTimeNanos,
+ &consumedBatch);
if (status && status != DEAD_OBJECT && !env->ExceptionCheck()) {
String8 message;
message.appendFormat("Failed to consume batched input event. status=%d", status);
jniThrowRuntimeException(env, message.string());
+ return false;
}
+ return consumedBatch;
}
@@ -392,7 +404,7 @@
(void*)nativeDispose },
{ "nativeFinishInputEvent", "(IIZ)V",
(void*)nativeFinishInputEvent },
- { "nativeConsumeBatchedInputEvents", "(IJ)V",
+ { "nativeConsumeBatchedInputEvents", "(IJ)Z",
(void*)nativeConsumeBatchedInputEvents },
};
diff --git a/docs/html/google/play-services/setup.jd b/docs/html/google/play-services/setup.jd
index 4d38850..a7de709 100644
--- a/docs/html/google/play-services/setup.jd
+++ b/docs/html/google/play-services/setup.jd
@@ -81,6 +81,19 @@
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
+
+-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
+ public static final *** NULL;
+}
+
+-keepnames @com.google.android.gms.common.annotation.KeepName class *
+-keepclassmembernames class * {
+ @ccom.google.android.gms.common.annotation.KeepName *;
+}
+
+-keepnames class * implements android.os.Parcelable {
+ public static final ** CREATOR;
+}
</pre>
</ol>
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardTransportControlView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardTransportControlView.java
index de26efb..29ba60d 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardTransportControlView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardTransportControlView.java
@@ -75,7 +75,7 @@
private View mTransientSeek;
private SeekBar mTransientSeekBar;
private TextView mTransientSeekTimeElapsed;
- private TextView mTransientSeekTimeRemaining;
+ private TextView mTransientSeekTimeTotal;
private ImageView mBtnPrev;
private ImageView mBtnPlay;
@@ -92,6 +92,9 @@
private boolean mUserSeeking;
private java.text.DateFormat mFormat;
+ private Date mTimeElapsed;
+ private Date mTrackDuration;
+
/**
* The metadata which should be populated into the view once we've been attached
*/
@@ -278,7 +281,7 @@
mTransientSeekBar = (SeekBar) findViewById(R.id.transient_seek_bar);
mTransientSeekBar.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
mTransientSeekTimeElapsed = (TextView) findViewById(R.id.transient_seek_time_elapsed);
- mTransientSeekTimeRemaining = (TextView) findViewById(R.id.transient_seek_time_remaining);
+ mTransientSeekTimeTotal = (TextView) findViewById(R.id.transient_seek_time_remaining);
mBtnPrev = (ImageView) findViewById(R.id.btn_prev);
mBtnPlay = (ImageView) findViewById(R.id.btn_play);
mBtnNext = (ImageView) findViewById(R.id.btn_next);
@@ -452,15 +455,19 @@
void updateSeekDisplay() {
if (mMetadata != null && mRemoteController != null && mFormat != null) {
- final long timeElapsed = mRemoteController.getEstimatedMediaPosition();
- final long duration = mMetadata.duration;
- final long remaining = duration - timeElapsed;
+ if (mTimeElapsed == null) {
+ mTimeElapsed = new Date();
+ }
+ if (mTrackDuration == null) {
+ mTrackDuration = new Date();
+ }
+ mTimeElapsed.setTime(mRemoteController.getEstimatedMediaPosition());
+ mTrackDuration.setTime(mMetadata.duration);
+ mTransientSeekTimeElapsed.setText(mFormat.format(mTimeElapsed));
+ mTransientSeekTimeTotal.setText(mFormat.format(mTrackDuration));
- mTransientSeekTimeElapsed.setText(mFormat.format(new Date(timeElapsed)));
- mTransientSeekTimeRemaining.setText(mFormat.format(new Date(remaining)));
-
- if (DEBUG) Log.d(TAG, "updateSeekDisplay timeElapsed=" + timeElapsed +
- " duration=" + duration + " remaining=" + remaining);
+ if (DEBUG) Log.d(TAG, "updateSeekDisplay timeElapsed=" + mTimeElapsed +
+ " duration=" + mMetadata.duration);
}
}
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_location.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_location.png
deleted file mode 100644
index c561446..0000000
--- a/packages/SystemUI/res/drawable-hdpi/ic_qs_location.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_settings.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_settings.png
index a53108d..cfa539f 100644
--- a/packages/SystemUI/res/drawable-hdpi/ic_qs_settings.png
+++ b/packages/SystemUI/res/drawable-hdpi/ic_qs_settings.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_location.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_location.png
deleted file mode 100644
index e285bba..0000000
--- a/packages/SystemUI/res/drawable-mdpi/ic_qs_location.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_settings.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_settings.png
index 0f7607b..e6237eb 100644
--- a/packages/SystemUI/res/drawable-mdpi/ic_qs_settings.png
+++ b/packages/SystemUI/res/drawable-mdpi/ic_qs_settings.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_location.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_location.png
deleted file mode 100644
index a52dc8d..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/ic_qs_location.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_settings.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_settings.png
index 4ce9460..208089d 100644
--- a/packages/SystemUI/res/drawable-xhdpi/ic_qs_settings.png
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_qs_settings.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_location.png b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_location.png
deleted file mode 100644
index 3175636..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_location.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_settings.png b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_settings.png
index 74a78dc..452942e 100644
--- a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_settings.png
+++ b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_settings.png
Binary files differ