Merge change I620f67c8
* changes:
Cherry-picking change I476e5a00 from eclair-china
diff --git a/api/current.xml b/api/current.xml
index 290b2cc..346aed7 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -37315,6 +37315,17 @@
visibility="public"
>
</field>
+<field name="FLAG_RECEIVER_REPLACE_PENDING"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="536870912"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="METADATA_DOCK_HOME"
type="java.lang.String"
transient="false"
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index dfdfa15..d784759 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -1181,7 +1181,7 @@
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
- public static final String ACTION_USER_PRESENT= "android.intent.action.USER_PRESENT";
+ public static final String ACTION_USER_PRESENT = "android.intent.action.USER_PRESENT";
/**
* Broadcast Action: The current time has changed. Sent every
@@ -2399,6 +2399,20 @@
*/
public static final int FLAG_RECEIVER_REGISTERED_ONLY = 0x40000000;
/**
+ * If set, when sending a broadcast the new broadcast will replace
+ * any existing pending broadcast that matches it. Matching is defined
+ * by {@link Intent#filterEquals(Intent) Intent.filterEquals} returning
+ * true for the intents of the two broadcasts. When a match is found,
+ * the new broadcast (and receivers associated with it) will replace the
+ * existing one in the pending broadcast list, remaining at the same
+ * position in the list.
+ *
+ * <p>This flag is most typically used with sticky broadcasts, which
+ * only care about delivering the most recent values of the broadcast
+ * to their receivers.
+ */
+ public static final int FLAG_RECEIVER_REPLACE_PENDING = 0x20000000;
+ /**
* If set, when sending a broadcast <i>before boot has completed</i> only
* registered receivers will be called -- no BroadcastReceiver components
* will be launched. Sticky intent state will be recorded properly even
@@ -2411,14 +2425,14 @@
*
* @hide
*/
- public static final int FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT = 0x20000000;
+ public static final int FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT = 0x10000000;
/**
* Set when this broadcast is for a boot upgrade, a special mode that
* allows the broadcast to be sent before the system is ready and launches
* the app process with no providers running in it.
* @hide
*/
- public static final int FLAG_RECEIVER_BOOT_UPGRADE = 0x10000000;
+ public static final int FLAG_RECEIVER_BOOT_UPGRADE = 0x08000000;
/**
* @hide Flags that can't be changed with PendingIntent.
diff --git a/core/java/android/server/search/SearchManagerService.java b/core/java/android/server/search/SearchManagerService.java
index 6e8b7ee..f9a0b93 100644
--- a/core/java/android/server/search/SearchManagerService.java
+++ b/core/java/android/server/search/SearchManagerService.java
@@ -150,8 +150,9 @@
* Informs all listeners that the list of searchables has been updated.
*/
void broadcastSearchablesChanged() {
- mContext.sendBroadcast(
- new Intent(SearchManager.INTENT_ACTION_SEARCHABLES_CHANGED));
+ Intent intent = new Intent(SearchManager.INTENT_ACTION_SEARCHABLES_CHANGED);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
+ mContext.sendBroadcast(intent);
}
//
diff --git a/core/java/android/text/method/ArrowKeyMovementMethod.java b/core/java/android/text/method/ArrowKeyMovementMethod.java
index e27804c..0d04b13 100644
--- a/core/java/android/text/method/ArrowKeyMovementMethod.java
+++ b/core/java/android/text/method/ArrowKeyMovementMethod.java
@@ -262,44 +262,51 @@
widget.getParent().requestDisallowInterceptTouchEvent(true);
}
} else if (event.getAction() == MotionEvent.ACTION_MOVE ) {
- boolean cap = (MetaKeyKeyListener.getMetaState(buffer,
- KeyEvent.META_SHIFT_ON) == 1) ||
- (MetaKeyKeyListener.getMetaState(buffer,
- MetaKeyKeyListener.META_SELECTING) != 0);
+ boolean cap = (MetaKeyKeyListener.getMetaState(buffer,
+ KeyEvent.META_SHIFT_ON) == 1) ||
+ (MetaKeyKeyListener.getMetaState(buffer,
+ MetaKeyKeyListener.META_SELECTING) != 0);
- if (cap) {
- // Update selection as we're moving the selection area.
+ if (cap & handled) {
+ // Before selecting, make sure we've moved out of the "slop".
+ // handled will be true, if we're in select mode AND we're
+ // OUT of the slop
- // Get the current touch position
- int x = (int) event.getX();
- int y = (int) event.getY();
- int offset = getOffset(x, y, widget);
+ // Turn long press off while we're selecting. User needs to
+ // re-tap on the selection to enable longpress
+ widget.cancelLongPress();
- // Get the last down touch position (the position at which the
- // user started the selection)
- int lastDownOffset = buffer.getSpanStart(LAST_TAP_DOWN);
+ // Update selection as we're moving the selection area.
- // Compute the selection boundries
- int spanstart;
- int spanend;
- if (offset >= lastDownOffset) {
- // Expand from word start of the original tap to new word
- // end, since we are selecting "forwards"
- spanstart = findWordStart(buffer, lastDownOffset);
- spanend = findWordEnd(buffer, offset);
- } else {
- // Expand to from new word start to word end of the original
- // tap since we are selecting "backwards".
- // The spanend will always need to be associated with the touch
- // up position, so that refining the selection with the
- // trackball will work as expected.
- spanstart = findWordEnd(buffer, lastDownOffset);
- spanend = findWordStart(buffer, offset);
+ // Get the current touch position
+ int x = (int) event.getX();
+ int y = (int) event.getY();
+ int offset = getOffset(x, y, widget);
+
+ // Get the last down touch position (the position at which the
+ // user started the selection)
+ int lastDownOffset = buffer.getSpanStart(LAST_TAP_DOWN);
+
+ // Compute the selection boundries
+ int spanstart;
+ int spanend;
+ if (offset >= lastDownOffset) {
+ // Expand from word start of the original tap to new word
+ // end, since we are selecting "forwards"
+ spanstart = findWordStart(buffer, lastDownOffset);
+ spanend = findWordEnd(buffer, offset);
+ } else {
+ // Expand to from new word start to word end of the original
+ // tap since we are selecting "backwards".
+ // The spanend will always need to be associated with the touch
+ // up position, so that refining the selection with the
+ // trackball will work as expected.
+ spanstart = findWordEnd(buffer, lastDownOffset);
+ spanend = findWordStart(buffer, offset);
+ }
+ Selection.setSelection(buffer, spanstart, spanend);
+ return true;
}
-
- Selection.setSelection(buffer, spanstart, spanend);
- return true;
- }
} else if (event.getAction() == MotionEvent.ACTION_UP) {
// If we have scrolled, then the up shouldn't move the cursor,
// but we do need to make sure the cursor is still visible at
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 7f5d254..788f04a 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -2726,9 +2726,7 @@
setPressed(false);
if (!mHasPerformedLongPress) {
- if (mPendingCheckForLongPress != null) {
- removeCallbacks(mPendingCheckForLongPress);
- }
+ cancelLongPress();
}
}
}
@@ -3750,9 +3748,7 @@
if (imm != null && (mPrivateFlags & FOCUSED) != 0) {
imm.focusOut(this);
}
- if (mPendingCheckForLongPress != null) {
- removeCallbacks(mPendingCheckForLongPress);
- }
+ cancelLongPress();
onFocusLost();
} else if (imm != null && (mPrivateFlags & FOCUSED) != 0) {
imm.focusIn(this);
@@ -3998,9 +3994,7 @@
if (!mHasPerformedLongPress) {
// This is a tap, so remove the longpress check
- if (mPendingCheckForLongPress != null) {
- removeCallbacks(mPendingCheckForLongPress);
- }
+ cancelLongPress();
result = performClick();
}
@@ -4190,9 +4184,7 @@
if (!mHasPerformedLongPress) {
// This is a tap, so remove the longpress check
- if (mPendingCheckForLongPress != null) {
- removeCallbacks(mPendingCheckForLongPress);
- }
+ cancelLongPress();
// Only perform take click actions if we were in the pressed state
if (!focusTaken) {
@@ -4235,9 +4227,7 @@
// Outside button
if ((mPrivateFlags & PRESSED) != 0) {
// Remove any future long press checks
- if (mPendingCheckForLongPress != null) {
- removeCallbacks(mPendingCheckForLongPress);
- }
+ cancelLongPress();
// Need to switch from pressed to not pressed
mPrivateFlags &= ~PRESSED;
@@ -5769,9 +5759,7 @@
* @see #onAttachedToWindow()
*/
protected void onDetachedFromWindow() {
- if (mPendingCheckForLongPress != null) {
- removeCallbacks(mPendingCheckForLongPress);
- }
+ cancelLongPress();
destroyDrawingCache();
}
diff --git a/core/java/android/view/ViewDebug.java b/core/java/android/view/ViewDebug.java
index 2fd974e..9232616 100644
--- a/core/java/android/view/ViewDebug.java
+++ b/core/java/android/view/ViewDebug.java
@@ -702,7 +702,7 @@
if (parameter.indexOf('@') != -1) {
final String[] ids = parameter.split("@");
final String className = ids[0];
- final int hashCode = Integer.parseInt(ids[1], 16);
+ final int hashCode = (int) Long.parseLong(ids[1], 16);
View view = root.getRootView();
if (view instanceof ViewGroup) {
diff --git a/core/res/res/layout/date_picker.xml b/core/res/res/layout/date_picker.xml
index 0760cc0..56d5494 100644
--- a/core/res/res/layout/date_picker.xml
+++ b/core/res/res/layout/date_picker.xml
@@ -29,7 +29,7 @@
android:layout_height="wrap_content">
<!-- Month -->
- <com.android.internal.widget.NumberPicker
+ <com.android.common.widget.NumberPicker
android:id="@+id/month"
android:layout_width="80dip"
android:layout_height="wrap_content"
@@ -40,7 +40,7 @@
/>
<!-- Day -->
- <com.android.internal.widget.NumberPicker
+ <com.android.common.widget.NumberPicker
android:id="@+id/day"
android:layout_width="80dip"
android:layout_height="wrap_content"
@@ -51,7 +51,7 @@
/>
<!-- Year -->
- <com.android.internal.widget.NumberPicker
+ <com.android.common.widget.NumberPicker
android:id="@+id/year"
android:layout_width="95dip"
android:layout_height="wrap_content"
diff --git a/core/res/res/layout/number_picker.xml b/core/res/res/layout/number_picker.xml
index bbdb31c..6380d25 100644
--- a/core/res/res/layout/number_picker.xml
+++ b/core/res/res/layout/number_picker.xml
@@ -19,7 +19,7 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android">
- <com.android.internal.widget.NumberPickerButton android:id="@+id/increment"
+ <com.android.common.widget.NumberPickerButton android:id="@+id/increment"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/timepicker_up_btn" />
@@ -34,7 +34,7 @@
android:textSize="30sp"
android:background="@drawable/timepicker_input" />
- <com.android.internal.widget.NumberPickerButton android:id="@+id/decrement"
+ <com.android.common.widget.NumberPickerButton android:id="@+id/decrement"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/timepicker_down_btn" />
diff --git a/core/res/res/layout/time_picker.xml b/core/res/res/layout/time_picker.xml
index 6ba5e81..b9f42ce 100644
--- a/core/res/res/layout/time_picker.xml
+++ b/core/res/res/layout/time_picker.xml
@@ -26,7 +26,7 @@
android:layout_height="wrap_content">
<!-- hour -->
- <com.android.internal.widget.NumberPicker
+ <com.android.common.widget.NumberPicker
android:id="@+id/hour"
android:layout_width="70dip"
android:layout_height="wrap_content"
@@ -35,7 +35,7 @@
/>
<!-- minute -->
- <com.android.internal.widget.NumberPicker
+ <com.android.common.widget.NumberPicker
android:id="@+id/minute"
android:layout_width="70dip"
android:layout_height="wrap_content"
diff --git a/data/etc/required_hardware.xml b/data/etc/required_hardware.xml
index 05e7f8a..3ffe6b2 100644
--- a/data/etc/required_hardware.xml
+++ b/data/etc/required_hardware.xml
@@ -18,6 +18,9 @@
These are always added for you by the build system, you do not need
to add them yourself. -->
<permissions>
+ <feature name="android.hardware.location" />
+ <feature name="android.hardware.location.network" />
+ <feature name="android.hardware.location.gps" />
<feature name="android.hardware.sensor.compass" />
<feature name="android.hardware.sensor.accelerometer" />
<feature name="android.hardware.bluetooth" />
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index c8213c8..eff0fbb 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -251,9 +251,9 @@
}
void validateSurface() {
- if (mSurface == null) {
- throw new IllegalStateException("Uploading data to GL with no surface.");
- }
+ //if (mSurface == null) {
+ //throw new IllegalStateException("Uploading data to GL with no surface.");
+ //}
}
public void contextSetPriority(Priority p) {
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index b41f3e2..e5837ee 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -892,13 +892,13 @@
private void broadcastRingerMode() {
// Send sticky broadcast
- if (ActivityManagerNative.isSystemReady()) {
- Intent broadcast = new Intent(AudioManager.RINGER_MODE_CHANGED_ACTION);
- broadcast.putExtra(AudioManager.EXTRA_RINGER_MODE, mRingerMode);
- long origCallerIdentityToken = Binder.clearCallingIdentity();
- mContext.sendStickyBroadcast(broadcast);
- Binder.restoreCallingIdentity(origCallerIdentityToken);
- }
+ Intent broadcast = new Intent(AudioManager.RINGER_MODE_CHANGED_ACTION);
+ broadcast.putExtra(AudioManager.EXTRA_RINGER_MODE, mRingerMode);
+ broadcast.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT
+ | Intent.FLAG_RECEIVER_REPLACE_PENDING);
+ long origCallerIdentityToken = Binder.clearCallingIdentity();
+ mContext.sendStickyBroadcast(broadcast);
+ Binder.restoreCallingIdentity(origCallerIdentityToken);
}
private void broadcastVibrateSetting(int vibrateType) {
diff --git a/media/libmediaplayerservice/Android.mk b/media/libmediaplayerservice/Android.mk
index b8defde..5e59710 100644
--- a/media/libmediaplayerservice/Android.mk
+++ b/media/libmediaplayerservice/Android.mk
@@ -40,7 +40,8 @@
libmedia \
libandroid_runtime \
libstagefright \
- libstagefright_omx
+ libstagefright_omx \
+ libstagefright_color_conversion
ifneq ($(BUILD_WITHOUT_PV),true)
LOCAL_SHARED_LIBRARIES += \
diff --git a/media/libstagefright/Android.mk b/media/libstagefright/Android.mk
index d145542..fb75aef 100644
--- a/media/libstagefright/Android.mk
+++ b/media/libstagefright/Android.mk
@@ -63,7 +63,8 @@
LOCAL_SHARED_LIBRARIES += \
libstagefright_amrnb_common \
- libstagefright_avc_common
+ libstagefright_avc_common \
+ libstagefright_color_conversion
endif
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 570e431f..9e388f9 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -19,6 +19,7 @@
#include <utils/Log.h>
#include "include/AwesomePlayer.h"
+#include "include/SoftwareRenderer.h"
#include <binder/IPCThreadState.h>
#include <media/stagefright/AudioPlayer.h>
@@ -30,7 +31,6 @@
#include <media/stagefright/MediaSource.h>
#include <media/stagefright/MetaData.h>
#include <media/stagefright/OMXCodec.h>
-
namespace android {
struct AwesomeEvent : public TimedEventQueue::Event {
@@ -54,6 +54,55 @@
AwesomeEvent &operator=(const AwesomeEvent &);
};
+struct AwesomeRemoteRenderer : public AwesomeRenderer {
+ AwesomeRemoteRenderer(const sp<IOMXRenderer> &target)
+ : mTarget(target) {
+ }
+
+ virtual void render(MediaBuffer *buffer) {
+ void *id;
+ if (buffer->meta_data()->findPointer(kKeyBufferID, &id)) {
+ mTarget->render((IOMX::buffer_id)id);
+ }
+ }
+
+private:
+ sp<IOMXRenderer> mTarget;
+
+ AwesomeRemoteRenderer(const AwesomeRemoteRenderer &);
+ AwesomeRemoteRenderer &operator=(const AwesomeRemoteRenderer &);
+};
+
+struct AwesomeLocalRenderer : public AwesomeRenderer {
+ AwesomeLocalRenderer(
+ OMX_COLOR_FORMATTYPE colorFormat,
+ const sp<ISurface> &surface,
+ size_t displayWidth, size_t displayHeight,
+ size_t decodedWidth, size_t decodedHeight)
+ : mTarget(new SoftwareRenderer(
+ colorFormat, surface, displayWidth, displayHeight,
+ decodedWidth, decodedHeight)) {
+ }
+
+ virtual void render(MediaBuffer *buffer) {
+ mTarget->render(
+ (const uint8_t *)buffer->data() + buffer->range_offset(),
+ buffer->range_length(), NULL);
+ }
+
+protected:
+ virtual ~AwesomeLocalRenderer() {
+ delete mTarget;
+ mTarget = NULL;
+ }
+
+private:
+ SoftwareRenderer *mTarget;
+
+ AwesomeLocalRenderer(const AwesomeLocalRenderer &);
+ AwesomeLocalRenderer &operator=(const AwesomeLocalRenderer &);;
+};
+
AwesomePlayer::AwesomePlayer()
: mTimeSource(NULL),
mAudioPlayer(NULL),
@@ -326,12 +375,25 @@
// before creating a new one.
IPCThreadState::self()->flushCommands();
- mVideoRenderer =
- mClient.interface()->createRenderer(
- mISurface, component,
- (OMX_COLOR_FORMATTYPE)format,
- decodedWidth, decodedHeight,
- mVideoWidth, mVideoHeight);
+ if (!strncmp("OMX.", component, 4)) {
+ // Our OMX codecs allocate buffers on the media_server side
+ // therefore they require a remote IOMXRenderer that knows how
+ // to display them.
+ mVideoRenderer = new AwesomeRemoteRenderer(
+ mClient.interface()->createRenderer(
+ mISurface, component,
+ (OMX_COLOR_FORMATTYPE)format,
+ decodedWidth, decodedHeight,
+ mVideoWidth, mVideoHeight));
+ } else {
+ // Other decoders are instantiated locally and as a consequence
+ // allocate their buffers in local address space.
+ mVideoRenderer = new AwesomeLocalRenderer(
+ (OMX_COLOR_FORMATTYPE)format,
+ mISurface,
+ mVideoWidth, mVideoHeight,
+ decodedWidth, decodedHeight);
+ }
}
}
@@ -528,6 +590,7 @@
}
for (;;) {
status_t err = mVideoSource->read(&mVideoBuffer, &options);
+ options.clearSeekTo();
if (err != OK) {
CHECK_EQ(mVideoBuffer, NULL);
@@ -612,10 +675,7 @@
return;
}
- void *id;
- if (mVideoBuffer->meta_data()->findPointer(kKeyBufferID, &id)) {
- mVideoRenderer->render((IOMX::buffer_id)id);
- }
+ mVideoRenderer->render(mVideoBuffer);
if (mLastVideoBuffer) {
mLastVideoBuffer->release();
diff --git a/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp b/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp
index 7e18c1f..484c742 100644
--- a/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp
+++ b/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp
@@ -14,6 +14,10 @@
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "AVCDecoder"
+#include <utils/Log.h>
+
#include "AVCDecoder.h"
#include "avcdec_api.h"
@@ -44,7 +48,8 @@
mHandle(new tagAVCHandle),
mInputBuffer(NULL),
mAnchorTimeUs(0),
- mNumSamplesOutput(0) {
+ mNumSamplesOutput(0),
+ mPendingSeekTimeUs(-1) {
memset(mHandle, 0, sizeof(tagAVCHandle));
mHandle->AVCObject = NULL;
mHandle->userData = this;
@@ -152,6 +157,7 @@
mAnchorTimeUs = 0;
mNumSamplesOutput = 0;
+ mPendingSeekTimeUs = -1;
mStarted = true;
return OK;
@@ -195,6 +201,21 @@
MediaBuffer **out, const ReadOptions *options) {
*out = NULL;
+ int64_t seekTimeUs;
+ if (options && options->getSeekTo(&seekTimeUs)) {
+ LOGV("seek requested to %lld us (%.2f secs)", seekTimeUs, seekTimeUs / 1E6);
+
+ CHECK(seekTimeUs >= 0);
+ mPendingSeekTimeUs = seekTimeUs;
+
+ if (mInputBuffer) {
+ mInputBuffer->release();
+ mInputBuffer = NULL;
+ }
+
+ PVAVCDecReset(mHandle);
+ }
+
if (mInputBuffer == NULL) {
LOGV("fetching new input buffer.");
@@ -203,7 +224,19 @@
mCodecSpecificData.removeAt(0);
} else {
for (;;) {
- status_t err = mSource->read(&mInputBuffer);
+ if (mPendingSeekTimeUs >= 0) {
+ LOGV("reading data from timestamp %lld (%.2f secs)",
+ mPendingSeekTimeUs, mPendingSeekTimeUs / 1E6);
+ }
+
+ ReadOptions seekOptions;
+ if (mPendingSeekTimeUs >= 0) {
+ seekOptions.setSeekTo(mPendingSeekTimeUs);
+ mPendingSeekTimeUs = -1;
+ }
+ status_t err = mSource->read(&mInputBuffer, &seekOptions);
+ seekOptions.clearSeekTo();
+
if (err != OK) {
return err;
}
diff --git a/media/libstagefright/colorconversion/Android.mk b/media/libstagefright/colorconversion/Android.mk
new file mode 100644
index 0000000..c08ce3a
--- /dev/null
+++ b/media/libstagefright/colorconversion/Android.mk
@@ -0,0 +1,22 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES:= \
+ ColorConverter.cpp \
+ SoftwareRenderer.cpp
+
+LOCAL_C_INCLUDES := \
+ $(TOP)/external/opencore/extern_libs_v2/khronos/openmax/include
+
+LOCAL_SHARED_LIBRARIES := \
+ libbinder \
+ libmedia \
+ libutils \
+ libui \
+ libcutils
+
+LOCAL_PRELINK_MODULE:= false
+
+LOCAL_MODULE:= libstagefright_color_conversion
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libstagefright/omx/ColorConverter.cpp b/media/libstagefright/colorconversion/ColorConverter.cpp
similarity index 100%
rename from media/libstagefright/omx/ColorConverter.cpp
rename to media/libstagefright/colorconversion/ColorConverter.cpp
diff --git a/media/libstagefright/omx/SoftwareRenderer.cpp b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
similarity index 100%
rename from media/libstagefright/omx/SoftwareRenderer.cpp
rename to media/libstagefright/colorconversion/SoftwareRenderer.cpp
diff --git a/media/libstagefright/include/AVCDecoder.h b/media/libstagefright/include/AVCDecoder.h
index ee3cd47..621aa9a 100644
--- a/media/libstagefright/include/AVCDecoder.h
+++ b/media/libstagefright/include/AVCDecoder.h
@@ -57,6 +57,7 @@
int64_t mAnchorTimeUs;
int64_t mNumSamplesOutput;
+ int64_t mPendingSeekTimeUs;
void addCodecSpecificData(const uint8_t *data, size_t size);
diff --git a/media/libstagefright/include/AwesomePlayer.h b/media/libstagefright/include/AwesomePlayer.h
index 2727c3c..37b14eb 100644
--- a/media/libstagefright/include/AwesomePlayer.h
+++ b/media/libstagefright/include/AwesomePlayer.h
@@ -32,6 +32,16 @@
struct AudioPlayer;
struct TimeSource;
+struct AwesomeRenderer : public RefBase {
+ AwesomeRenderer() {}
+
+ virtual void render(MediaBuffer *buffer) = 0;
+
+private:
+ AwesomeRenderer(const AwesomeRenderer &);
+ AwesomeRenderer &operator=(const AwesomeRenderer &);
+};
+
struct AwesomePlayer {
AwesomePlayer();
~AwesomePlayer();
@@ -80,7 +90,7 @@
TimeSource *mTimeSource;
sp<MediaSource> mVideoSource;
- sp<IOMXRenderer> mVideoRenderer;
+ sp<AwesomeRenderer> mVideoRenderer;
sp<MediaSource> mAudioSource;
AudioPlayer *mAudioPlayer;
diff --git a/media/libstagefright/omx/Android.mk b/media/libstagefright/omx/Android.mk
index 7dfab11..965852b 100644
--- a/media/libstagefright/omx/Android.mk
+++ b/media/libstagefright/omx/Android.mk
@@ -9,13 +9,11 @@
LOCAL_C_INCLUDES += $(JNI_H_INCLUDE)
LOCAL_SRC_FILES:= \
- ColorConverter.cpp \
OMX.cpp \
OMXComponentBase.cpp \
OMXNodeInstance.cpp \
OMXMaster.cpp \
OMXSoftwareCodecsPlugin.cpp \
- SoftwareRenderer.cpp
ifneq ($(BUILD_WITHOUT_PV),true)
LOCAL_SRC_FILES += \
@@ -29,7 +27,8 @@
libmedia \
libutils \
libui \
- libcutils
+ libcutils \
+ libstagefright_color_conversion
ifneq ($(BUILD_WITHOUT_PV),true)
LOCAL_SHARED_LIBRARIES += \
diff --git a/preloaded-classes b/preloaded-classes
index 1311335..1403b97 100644
--- a/preloaded-classes
+++ b/preloaded-classes
@@ -364,13 +364,6 @@
android.text.style.UpdateLayout
android.text.style.WrapTogetherSpan
android.text.util.Linkify
-<<<<<<< HEAD
-android.util.AndroidRuntimeException
-=======
-android.text.util.Linkify$1
-android.text.util.Linkify$4
-android.text.util.Rfc822Tokenizer
->>>>>>> 15d3bb2c
android.util.AttributeSet
android.util.DisplayMetrics
android.util.FloatMath
@@ -695,17 +688,6 @@
com.android.internal.view.menu.MenuDialogHelper
com.android.internal.view.menu.MenuItemImpl
com.android.internal.view.menu.SubMenuBuilder
-<<<<<<< HEAD
-com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
-com.android.internal.widget.LockPatternView
-com.android.internal.widget.NumberPicker
-com.android.internal.widget.NumberPickerButton
-=======
-com.android.internal.widget.ContactHeaderWidget
-com.android.internal.widget.DialogTitle
-com.android.internal.widget.EditableInputConnection
-com.android.internal.widget.LockPatternUtils
->>>>>>> 15d3bb2c
com.android.internal.widget.RotarySelector
com.android.internal.widget.Smileys
com.google.android.gles_jni.EGLDisplayImpl
diff --git a/services/java/com/android/server/AlarmManagerService.java b/services/java/com/android/server/AlarmManagerService.java
index 8d86219..18a5615 100644
--- a/services/java/com/android/server/AlarmManagerService.java
+++ b/services/java/com/android/server/AlarmManagerService.java
@@ -127,8 +127,9 @@
mTimeTickSender = PendingIntent.getBroadcast(context, 0,
new Intent(Intent.ACTION_TIME_TICK).addFlags(
Intent.FLAG_RECEIVER_REGISTERED_ONLY), 0);
- mDateChangeSender = PendingIntent.getBroadcast(context, 0,
- new Intent(Intent.ACTION_DATE_CHANGED), 0);
+ Intent intent = new Intent(Intent.ACTION_DATE_CHANGED);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
+ mDateChangeSender = PendingIntent.getBroadcast(context, 0, intent, 0);
// now that we have initied the driver schedule the alarm
mClockReceiver= new ClockReceiver();
@@ -272,6 +273,7 @@
if (timeZoneWasChanged) {
Intent intent = new Intent(Intent.ACTION_TIMEZONE_CHANGED);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra("time-zone", zone.getID());
mContext.sendBroadcast(intent);
}
@@ -609,7 +611,9 @@
if ((result & TIME_CHANGED_MASK) != 0) {
remove(mTimeTickSender);
mClockReceiver.scheduleTimeTickEvent();
- mContext.sendBroadcast(new Intent(Intent.ACTION_TIME_CHANGED));
+ Intent intent = new Intent(Intent.ACTION_TIME_CHANGED);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
+ mContext.sendBroadcast(intent);
}
synchronized (mLock) {
diff --git a/services/java/com/android/server/BatteryService.java b/services/java/com/android/server/BatteryService.java
index e98fa99..bdebc8d 100644
--- a/services/java/com/android/server/BatteryService.java
+++ b/services/java/com/android/server/BatteryService.java
@@ -327,7 +327,8 @@
private final void sendIntent() {
// Pack up the values and broadcast them to everyone
Intent intent = new Intent(Intent.ACTION_BATTERY_CHANGED);
- intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
+ intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY
+ | Intent.FLAG_RECEIVER_REPLACE_PENDING);
try {
mBatteryStats.setOnBattery(mPlugType == BATTERY_PLUGGED_NONE, mBatteryLevel);
} catch (RemoteException e) {
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 9980be7..2981599 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -98,7 +98,7 @@
private List mFeatureUsers;
private boolean mSystemReady;
- private ArrayList<Intent> mDeferredBroadcasts;
+ private Intent mInitialBroadcast;
private static class NetworkAttributes {
/**
@@ -794,6 +794,7 @@
}
Intent intent = new Intent(ConnectivityManager.CONNECTIVITY_ACTION);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra(ConnectivityManager.EXTRA_NETWORK_INFO, info);
if (info.isFailover()) {
intent.putExtra(ConnectivityManager.EXTRA_IS_FAILOVER, true);
@@ -890,6 +891,7 @@
private void sendConnectedBroadcast(NetworkInfo info) {
Intent intent = new Intent(ConnectivityManager.CONNECTIVITY_ACTION);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra(ConnectivityManager.EXTRA_NETWORK_INFO, info);
if (info.isFailover()) {
intent.putExtra(ConnectivityManager.EXTRA_IS_FAILOVER, true);
@@ -927,6 +929,7 @@
}
Intent intent = new Intent(ConnectivityManager.CONNECTIVITY_ACTION);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra(ConnectivityManager.EXTRA_NETWORK_INFO, info);
if (getActiveNetworkInfo() == null) {
intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true);
@@ -946,26 +949,20 @@
private void sendStickyBroadcast(Intent intent) {
synchronized(this) {
- if (mSystemReady) {
- mContext.sendStickyBroadcast(intent);
- } else {
- if (mDeferredBroadcasts == null) {
- mDeferredBroadcasts = new ArrayList<Intent>();
- }
- mDeferredBroadcasts.add(intent);
+ if (!mSystemReady) {
+ mInitialBroadcast = new Intent(intent);
}
+ intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
+ mContext.sendStickyBroadcast(intent);
}
}
void systemReady() {
synchronized(this) {
mSystemReady = true;
- if (mDeferredBroadcasts != null) {
- int count = mDeferredBroadcasts.size();
- for (int i = 0; i < count; i++) {
- mContext.sendStickyBroadcast(mDeferredBroadcasts.get(i));
- }
- mDeferredBroadcasts = null;
+ if (mInitialBroadcast != null) {
+ mContext.sendStickyBroadcast(mInitialBroadcast);
+ mInitialBroadcast = null;
}
}
}
diff --git a/services/java/com/android/server/DockObserver.java b/services/java/com/android/server/DockObserver.java
index 2fff54c..6ea50c7 100644
--- a/services/java/com/android/server/DockObserver.java
+++ b/services/java/com/android/server/DockObserver.java
@@ -179,6 +179,7 @@
}
// Pack up the values and broadcast them to everyone
Intent intent = new Intent(Intent.ACTION_DOCK_EVENT);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra(Intent.EXTRA_DOCK_STATE, mDockState);
// Check if this is Bluetooth Dock
diff --git a/services/java/com/android/server/HeadsetObserver.java b/services/java/com/android/server/HeadsetObserver.java
index 43de36b..a935131 100644
--- a/services/java/com/android/server/HeadsetObserver.java
+++ b/services/java/com/android/server/HeadsetObserver.java
@@ -49,7 +49,6 @@
private int mHeadsetState;
private int mPrevHeadsetState;
private String mHeadsetName;
- private boolean mPendingIntent;
private final Context mContext;
private final WakeLock mWakeLock; // held while there is a pending route change
@@ -114,7 +113,6 @@
mHeadsetName = newName;
mPrevHeadsetState = mHeadsetState;
mHeadsetState = headsetState;
- mPendingIntent = true;
if (headsetState == 0) {
Intent intent = new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
@@ -126,25 +124,28 @@
// This could be improved once the audio sub-system provides an
// interface to clear the audio pipeline.
mWakeLock.acquire();
- mHandler.sendEmptyMessageDelayed(0, 1000);
+ mHandler.sendMessageDelayed(mHandler.obtainMessage(0,
+ mHeadsetState,
+ mPrevHeadsetState,
+ mHeadsetName),
+ 1000);
} else {
- sendIntents();
- mPendingIntent = false;
+ sendIntents(mHeadsetState, mPrevHeadsetState, mHeadsetName);
}
}
- private synchronized final void sendIntents() {
+ private synchronized final void sendIntents(int headsetState, int prevHeadsetState, String headsetName) {
int allHeadsets = SUPPORTED_HEADSETS;
for (int curHeadset = 1; allHeadsets != 0; curHeadset <<= 1) {
if ((curHeadset & allHeadsets) != 0) {
- sendIntent(curHeadset);
+ sendIntent(curHeadset, headsetState, prevHeadsetState, headsetName);
allHeadsets &= ~curHeadset;
}
}
}
- private final void sendIntent(int headset) {
- if ((mHeadsetState & headset) != (mPrevHeadsetState & headset)) {
+ private final void sendIntent(int headset, int headsetState, int prevHeadsetState, String headsetName) {
+ if ((headsetState & headset) != (prevHeadsetState & headset)) {
// Pack up the values and broadcast them to everyone
Intent intent = new Intent(Intent.ACTION_HEADSET_PLUG);
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
@@ -154,14 +155,14 @@
if ((headset & HEADSETS_WITH_MIC) != 0) {
microphone = 1;
}
- if ((mHeadsetState & headset) != 0) {
+ if ((headsetState & headset) != 0) {
state = 1;
}
intent.putExtra("state", state);
- intent.putExtra("name", mHeadsetName);
+ intent.putExtra("name", headsetName);
intent.putExtra("microphone", microphone);
- if (LOG) Log.v(TAG, "Intent.ACTION_HEADSET_PLUG: state: "+state+" name: "+mHeadsetName+" mic: "+microphone);
+ if (LOG) Log.v(TAG, "Intent.ACTION_HEADSET_PLUG: state: "+state+" name: "+headsetName+" mic: "+microphone);
// TODO: Should we require a permission?
ActivityManagerNative.broadcastStickyIntent(intent, null);
}
@@ -170,12 +171,8 @@
private final Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
- if (mPendingIntent) {
- sendIntents();
- mPendingIntent = false;
- }
+ sendIntents(msg.arg1, msg.arg2, (String)msg.obj);
mWakeLock.release();
}
};
-
}
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index a64cb1a..405dc2e 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -949,6 +949,7 @@
if (ActivityManagerNative.isSystemReady()) {
Intent intent = new Intent(Intent.ACTION_INPUT_METHOD_CHANGED);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra("input_method_id", id);
mContext.sendBroadcast(intent);
}
diff --git a/services/java/com/android/server/TelephonyRegistry.java b/services/java/com/android/server/TelephonyRegistry.java
index 47cb6ad..3bee40c 100644
--- a/services/java/com/android/server/TelephonyRegistry.java
+++ b/services/java/com/android/server/TelephonyRegistry.java
@@ -485,6 +485,7 @@
}
Intent intent = new Intent(TelephonyIntents.ACTION_SERVICE_STATE_CHANGED);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
Bundle data = new Bundle();
state.fillInNotifierBundle(data);
intent.putExtras(data);
@@ -502,6 +503,7 @@
}
Intent intent = new Intent(TelephonyIntents.ACTION_SIGNAL_STRENGTH_CHANGED);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
Bundle data = new Bundle();
signalStrength.fillInNotifierBundle(data);
intent.putExtras(data);
@@ -523,6 +525,7 @@
}
Intent intent = new Intent(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra(Phone.STATE_KEY, DefaultPhoneNotifier.convertCallState(state).toString());
if (!TextUtils.isEmpty(incomingNumber)) {
intent.putExtra(TelephonyManager.EXTRA_INCOMING_NUMBER, incomingNumber);
@@ -537,6 +540,7 @@
// status bar takes care of that after taking into account all of the
// required info.
Intent intent = new Intent(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra(Phone.STATE_KEY, DefaultPhoneNotifier.convertDataState(state).toString());
if (!isDataConnectivityPossible) {
intent.putExtra(Phone.NETWORK_UNAVAILABLE_KEY, true);
@@ -559,6 +563,7 @@
private void broadcastDataConnectionFailed(String reason) {
Intent intent = new Intent(TelephonyIntents.ACTION_DATA_CONNECTION_FAILED);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra(Phone.FAILURE_REASON_KEY, reason);
mContext.sendStickyBroadcast(intent);
}
diff --git a/services/java/com/android/server/ViewServer.java b/services/java/com/android/server/ViewServer.java
index 07826a6..e9a1951 100644
--- a/services/java/com/android/server/ViewServer.java
+++ b/services/java/com/android/server/ViewServer.java
@@ -45,7 +45,7 @@
private static final String LOG_TAG = "ViewServer";
private static final String VALUE_PROTOCOL_VERSION = "2";
- private static final String VALUE_SERVER_VERSION = "2";
+ private static final String VALUE_SERVER_VERSION = "3";
// Protocol commands
// Returns the protocol version
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index d250e3c..e61cb94 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -4642,7 +4642,7 @@
index = parameters.length();
}
final String code = parameters.substring(0, index);
- int hashCode = "ffffffff".equals(code) ? -1 : Integer.parseInt(code, 16);
+ int hashCode = (int) Long.parseLong(code, 16);
// Extract the command's parameter after the window description
if (index < parameters.length()) {
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index a268b0e..3c66445 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -11845,6 +11845,12 @@
// pm is in same process, this will never happen.
}
+ final boolean replacePending =
+ (intent.getFlags()&Intent.FLAG_RECEIVER_REPLACE_PENDING) != 0;
+
+ if (DEBUG_BROADCAST) Log.v(TAG, "Enqueing broadcast: " + intent.getAction()
+ + " replacePending=" + replacePending);
+
int NR = registeredReceivers != null ? registeredReceivers.size() : 0;
if (!ordered && NR > 0) {
// If we are not serializing this broadcast, then send the
@@ -11857,8 +11863,22 @@
if (DEBUG_BROADCAST) Log.v(
TAG, "Enqueueing parallel broadcast " + r
+ ": prev had " + mParallelBroadcasts.size());
- mParallelBroadcasts.add(r);
- scheduleBroadcastsLocked();
+ boolean replaced = false;
+ if (replacePending) {
+ for (int i=mParallelBroadcasts.size()-1; i>=0; i--) {
+ if (intent.filterEquals(mParallelBroadcasts.get(i).intent)) {
+ if (DEBUG_BROADCAST) Log.v(TAG,
+ "***** DROPPING PARALLEL: " + intent);
+ mParallelBroadcasts.set(i, r);
+ replaced = true;
+ break;
+ }
+ }
+ }
+ if (!replaced) {
+ mParallelBroadcasts.add(r);
+ scheduleBroadcastsLocked();
+ }
registeredReceivers = null;
NR = 0;
}
@@ -11941,8 +11961,22 @@
int seq = r.intent.getIntExtra("seq", -1);
Log.i(TAG, "Enqueueing broadcast " + r.intent.getAction() + " seq=" + seq);
}
- mOrderedBroadcasts.add(r);
- scheduleBroadcastsLocked();
+ boolean replaced = false;
+ if (replacePending) {
+ for (int i=mOrderedBroadcasts.size()-1; i>=0; i--) {
+ if (intent.filterEquals(mOrderedBroadcasts.get(i).intent)) {
+ if (DEBUG_BROADCAST) Log.v(TAG,
+ "***** DROPPING ORDERED: " + intent);
+ mOrderedBroadcasts.set(i, r);
+ replaced = true;
+ break;
+ }
+ }
+ }
+ if (!replaced) {
+ mOrderedBroadcasts.add(r);
+ scheduleBroadcastsLocked();
+ }
}
return BROADCAST_SUCCESS;
@@ -12838,7 +12872,8 @@
}
}
Intent intent = new Intent(Intent.ACTION_CONFIGURATION_CHANGED);
- intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
+ intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY
+ | Intent.FLAG_RECEIVER_REPLACE_PENDING);
broadcastIntentLocked(null, null, intent, null, null, 0, null, null,
null, false, false, MY_PID, Process.SYSTEM_UID);
if ((changes&ActivityInfo.CONFIG_LOCALE) != 0) {
diff --git a/telephony/java/com/android/internal/telephony/IccCard.java b/telephony/java/com/android/internal/telephony/IccCard.java
index 0f76633..6eea46e 100644
--- a/telephony/java/com/android/internal/telephony/IccCard.java
+++ b/telephony/java/com/android/internal/telephony/IccCard.java
@@ -468,6 +468,7 @@
public void broadcastIccStateChangedIntent(String value, String reason) {
Intent intent = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra(Phone.PHONE_NAME_KEY, mPhone.getPhoneName());
intent.putExtra(INTENT_KEY_ICC_STATE, value);
intent.putExtra(INTENT_KEY_LOCKED_REASON, reason);
diff --git a/telephony/java/com/android/internal/telephony/PhoneProxy.java b/telephony/java/com/android/internal/telephony/PhoneProxy.java
index c693ae1..3eadd81 100644
--- a/telephony/java/com/android/internal/telephony/PhoneProxy.java
+++ b/telephony/java/com/android/internal/telephony/PhoneProxy.java
@@ -134,6 +134,7 @@
//Send an Intent to the PhoneApp that we had a radio technology change
Intent intent = new Intent(TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra(Phone.PHONE_NAME_KEY, mActivePhone.getPhoneName());
ActivityManagerNative.broadcastStickyIntent(intent, null);
break;
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
index c3d4940..8698b38 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
@@ -597,6 +597,7 @@
|| !TextUtils.equals(spn, curSpn)
|| !TextUtils.equals(plmn, curPlmn)) {
Intent intent = new Intent(Intents.SPN_STRINGS_UPDATED_ACTION);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra(Intents.EXTRA_SHOW_SPN, showSpn);
intent.putExtra(Intents.EXTRA_SPN, spn);
intent.putExtra(Intents.EXTRA_SHOW_PLMN, showPlmn);
@@ -1523,6 +1524,7 @@
(AlarmManager) phone.getContext().getSystemService(Context.ALARM_SERVICE);
alarm.setTimeZone(zoneId);
Intent intent = new Intent(TelephonyIntents.ACTION_NETWORK_SET_TIMEZONE);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra("time-zone", zoneId);
phone.getContext().sendStickyBroadcast(intent);
}
@@ -1536,6 +1538,7 @@
private void setAndBroadcastNetworkSetTime(long time) {
SystemClock.setCurrentTimeMillis(time);
Intent intent = new Intent(TelephonyIntents.ACTION_NETWORK_SET_TIME);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra("time", time);
phone.getContext().sendStickyBroadcast(intent);
}
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
index 8140654..f82474c 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
@@ -557,6 +557,7 @@
boolean showPlmn =
(rule & SIMRecords.SPN_RULE_SHOW_PLMN) == SIMRecords.SPN_RULE_SHOW_PLMN;
Intent intent = new Intent(Intents.SPN_STRINGS_UPDATED_ACTION);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra(Intents.EXTRA_SHOW_SPN, showSpn);
intent.putExtra(Intents.EXTRA_SPN, spn);
intent.putExtra(Intents.EXTRA_SHOW_PLMN, showPlmn);
@@ -1488,6 +1489,7 @@
(AlarmManager) phone.getContext().getSystemService(Context.ALARM_SERVICE);
alarm.setTimeZone(zoneId);
Intent intent = new Intent(TelephonyIntents.ACTION_NETWORK_SET_TIMEZONE);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra("time-zone", zoneId);
phone.getContext().sendStickyBroadcast(intent);
}
@@ -1501,6 +1503,7 @@
private void setAndBroadcastNetworkSetTime(long time) {
SystemClock.setCurrentTimeMillis(time);
Intent intent = new Intent(TelephonyIntents.ACTION_NETWORK_SET_TIME);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra("time", time);
phone.getContext().sendStickyBroadcast(intent);
}
diff --git a/tools/aapt/Bundle.h b/tools/aapt/Bundle.h
index a2c6a12..c53f7f1 100644
--- a/tools/aapt/Bundle.h
+++ b/tools/aapt/Bundle.h
@@ -37,7 +37,7 @@
mForce(false), mGrayscaleTolerance(0), mMakePackageDirs(false),
mUpdate(false), mExtending(false),
mRequireLocalization(false), mPseudolocalize(false),
- mUTF8(false), mValues(false),
+ mUTF8(false), mEncodingSpecified(false), mValues(false),
mCompressionMethod(0), mOutputAPKFile(NULL),
mAssetSourceDir(NULL), mProguardFile(NULL),
mAndroidManifestFile(NULL), mPublicOutputFile(NULL),
@@ -78,6 +78,8 @@
void setPseudolocalize(bool val) { mPseudolocalize = val; }
bool getUTF8(void) const { return mUTF8; }
void setUTF8(bool val) { mUTF8 = val; }
+ bool getEncodingSpecified(void) const { return mEncodingSpecified; }
+ void setEncodingSpecified(bool val) { mEncodingSpecified = val; }
bool getValues(void) const { return mValues; }
void setValues(bool val) { mValues = val; }
int getCompressionMethod(void) const { return mCompressionMethod; }
@@ -116,7 +118,9 @@
const char* getMinSdkVersion() const { return mMinSdkVersion; }
void setMinSdkVersion(const char* val) {
mMinSdkVersion = val;
- setUTF8(isUTF8Available());
+ if (!mEncodingSpecified) {
+ setUTF8(isUTF8Available());
+ }
}
const char* getTargetSdkVersion() const { return mTargetSdkVersion; }
void setTargetSdkVersion(const char* val) { mTargetSdkVersion = val; }
@@ -169,6 +173,7 @@
bool mRequireLocalization;
bool mPseudolocalize;
bool mUTF8;
+ bool mEncodingSpecified;
bool mValues;
int mCompressionMethod;
bool mJunkPath;
diff --git a/tools/aapt/Main.cpp b/tools/aapt/Main.cpp
index efbb2f7..1e6b52e 100644
--- a/tools/aapt/Main.cpp
+++ b/tools/aapt/Main.cpp
@@ -59,7 +59,7 @@
" [-0 extension [-0 extension ...]] [-g tolerance] [-j jarfile] \\\n"
" [--min-sdk-version VAL] [--target-sdk-version VAL] \\\n"
" [--max-sdk-version VAL] [--app-version VAL] \\\n"
- " [--app-version-name TEXT] [--custom-package VAL] \\\n"
+ " [--app-version-name TEXT] [--custom-package VAL] [--utf16] \\\n"
" [-I base-package [-I base-package ...]] \\\n"
" [-A asset-source-dir] [-G class-list-file] [-P public-definitions-file] \\\n"
" [-S resource-sources [-S resource-sources ...]] "
@@ -118,12 +118,12 @@
" -P specify where to output public resource definitions\n"
" -S directory in which to find resources. Multiple directories will be scanned\n"
" and the first match found (left to right) will take precedence.\n"
- " -8 Encode string resources in UTF-8.\n"
" -0 specifies an additional extension for which such files will not\n"
" be stored compressed in the .apk. An empty string means to not\n"
" compress any files at all.\n"
" --min-sdk-version\n"
- " inserts android:minSdkVersion in to manifest.\n"
+ " inserts android:minSdkVersion in to manifest. If the version is 7 or\n"
+ " higher, the default encoding for resources will be in UTF-8.\n"
" --target-sdk-version\n"
" inserts android:targetSdkVersion in to manifest.\n"
" --max-sdk-version\n"
@@ -135,7 +135,10 @@
" --version-name\n"
" inserts android:versionName in to manifest.\n"
" --custom-package\n"
- " generates R.java into a different package.\n");
+ " generates R.java into a different package.\n"
+ " --utf16\n"
+ " changes default encoding for resources to UTF-16. Only useful when API\n"
+ " level is set to 7 or higher where the default encoding is UTF-8.\n");
}
/*
@@ -373,9 +376,6 @@
bundle.setCompressionMethod(ZipEntry::kCompressStored);
}
break;
- case '8':
- bundle.setUTF8(true);
- break;
case '-':
if (strcmp(cp, "-min-sdk-version") == 0) {
argc--;
@@ -433,6 +433,9 @@
goto bail;
}
bundle.setCustomPackage(argv[0]);
+ } else if (strcmp(cp, "-utf16") == 0) {
+ bundle.setEncodingSpecified(true);
+ bundle.setUTF8(false);
} else {
fprintf(stderr, "ERROR: Unknown option '-%s'\n", cp);
wantUsage = true;
diff --git a/wifi/java/android/net/wifi/WifiStateTracker.java b/wifi/java/android/net/wifi/WifiStateTracker.java
index 0b9c69c..9d8f730 100644
--- a/wifi/java/android/net/wifi/WifiStateTracker.java
+++ b/wifi/java/android/net/wifi/WifiStateTracker.java
@@ -973,7 +973,8 @@
mDisconnectExpected = false;
intent = new Intent(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION);
- intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
+ intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT
+ | Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra(WifiManager.EXTRA_NEW_STATE, (Parcelable)newState);
if (failedToAuthenticate) {
if (LOCAL_LOGD) Log.d(TAG, "Failed to authenticate, disabling network " + networkId);
@@ -1443,7 +1444,8 @@
private void sendNetworkStateChangeBroadcast(String bssid) {
Intent intent = new Intent(WifiManager.NETWORK_STATE_CHANGED_ACTION);
- intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
+ intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT
+ | Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra(WifiManager.EXTRA_NETWORK_INFO, mNetworkInfo);
if (bssid != null)
intent.putExtra(WifiManager.EXTRA_BSSID, bssid);