diff options
67 files changed, 360 insertions, 330 deletions
diff --git a/cmds/stagefright/stream.cpp b/cmds/stagefright/stream.cpp index ee91c291c08d..aa3bc03bae4d 100644 --- a/cmds/stagefright/stream.cpp +++ b/cmds/stagefright/stream.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +//#define LOG_NDEBUG 0 +#define LOG_TAG "stream" +#include "utils/Log.h" + #include <binder/ProcessState.h> #include <media/IStreamSource.h> @@ -50,7 +54,7 @@ protected: private: int mFd; off64_t mFileSize; - int64_t mNextSeekTimeUs; + uint64_t mNumPacketsSent; sp<IStreamListener> mListener; Vector<sp<IMemory> > mBuffers; @@ -61,7 +65,7 @@ private: MyStreamSource::MyStreamSource(int fd) : mFd(fd), mFileSize(0), - mNextSeekTimeUs(-1) { // ALooper::GetNowUs() + 5000000ll) { + mNumPacketsSent(0) { CHECK_GE(fd, 0); mFileSize = lseek64(fd, 0, SEEK_END); @@ -84,18 +88,24 @@ void MyStreamSource::setBuffers(const Vector<sp<IMemory> > &buffers) { void MyStreamSource::onBufferAvailable(size_t index) { CHECK_LT(index, mBuffers.size()); - if (mNextSeekTimeUs >= 0 && mNextSeekTimeUs <= ALooper::GetNowUs()) { - off64_t offset = (off64_t)(((float)rand() / RAND_MAX) * mFileSize * 0.8); - offset = (offset / 188) * 188; +#if 0 + if (mNumPacketsSent >= 20000) { + LOGI("signalling discontinuity now"); + + off64_t offset = 0; + CHECK((offset % 188) == 0); lseek(mFd, offset, SEEK_SET); + sp<AMessage> extra = new AMessage; + extra->setInt32(IStreamListener::kKeyFormatChange, 0); + mListener->issueCommand( - IStreamListener::DISCONTINUITY, false /* synchronous */); + IStreamListener::DISCONTINUITY, false /* synchronous */, extra); - mNextSeekTimeUs = -1; - mNextSeekTimeUs = ALooper::GetNowUs() + 5000000ll; + mNumPacketsSent = 0; } +#endif sp<IMemory> mem = mBuffers.itemAt(index); @@ -104,6 +114,8 @@ void MyStreamSource::onBufferAvailable(size_t index) { mListener->issueCommand(IStreamListener::EOS, false /* synchronous */); } else { mListener->queueBuffer(index, n); + + mNumPacketsSent += n / 188; } } //////////////////////////////////////////////////////////////////////////////// @@ -293,12 +305,17 @@ int main(int argc, char **argv) { sp<SurfaceComposerClient> composerClient = new SurfaceComposerClient; CHECK_EQ(composerClient->initCheck(), (status_t)OK); + ssize_t displayWidth = composerClient->getDisplayWidth(0); + ssize_t displayHeight = composerClient->getDisplayHeight(0); + + LOGV("display is %d x %d\n", displayWidth, displayHeight); + sp<SurfaceControl> control = composerClient->createSurface( String8("A Surface"), 0, - 1280, - 800, + displayWidth, + displayHeight, PIXEL_FORMAT_RGB_565, 0); diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index e97d88fdad51..80b5dad37b3f 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -9992,8 +9992,6 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit // The dirty rect should always be null for a display list canvas.onPreDraw(null); - final int restoreCount = canvas.save(); - computeScroll(); canvas.translate(-mScrollX, -mScrollY); mPrivateFlags |= DRAWN | DRAWING_CACHE_VALID; @@ -10005,8 +10003,6 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit } else { draw(canvas); } - - canvas.restoreToCount(restoreCount); } finally { canvas.onPostDraw(); diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 5d776fd7dfd6..8c3c212fa0d1 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -3451,6 +3451,7 @@ public class WebView extends AbsoluteLayout } abortAnimation(); mPrivateHandler.removeMessages(RESUME_WEBCORE_PRIORITY); + nativeSetIsScrolling(false); if (!mBlockWebkitViewMessages) { WebViewCore.resumePriority(); if (!mSelectingText) { @@ -6382,6 +6383,8 @@ public class WebView extends AbsoluteLayout WebViewCore.reducePriority(); // to get better performance, pause updating the picture WebViewCore.pauseUpdatePicture(mWebViewCore); + nativeSetIsScrolling(true); + if (!mDragFromTextInput) { nativeHideCursor(); } @@ -6478,6 +6481,7 @@ public class WebView extends AbsoluteLayout || mTouchMode == TOUCH_DRAG_LAYER_MODE) && !mSelectingText) { WebViewCore.resumePriority(); WebViewCore.resumeUpdatePicture(mWebViewCore); + nativeSetIsScrolling(false); } mPrivateHandler.removeMessages(SWITCH_TO_SHORTPRESS); mPrivateHandler.removeMessages(SWITCH_TO_LONGPRESS); @@ -9277,6 +9281,7 @@ public class WebView extends AbsoluteLayout * @return True if the layer is successfully scrolled. */ private native boolean nativeScrollLayer(int layer, int newX, int newY); + private native void nativeSetIsScrolling(boolean isScrolling); private native int nativeGetBackgroundColor(); native boolean nativeSetProperty(String key, String value); native String nativeGetProperty(String key); diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index 400cdbd44f4e..fe07a76230a2 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -2070,10 +2070,8 @@ public final class WebViewCore { if (!core.getSettings().enableSmoothTransition()) return; synchronized (core) { + core.nativeSetIsPaused(true); core.mDrawIsPaused = true; - if (core.mDrawIsScheduled) { - core.mEventHub.removeMessages(EventHub.WEBKIT_DRAW); - } } } @@ -2082,15 +2080,14 @@ public final class WebViewCore { static void resumeUpdatePicture(WebViewCore core) { if (core != null) { // if mDrawIsPaused is true, ignore the setting, continue to resume - if (!core.mDrawIsPaused - && !core.getSettings().enableSmoothTransition()) return; + if (!core.mDrawIsPaused) + return; synchronized (core) { + core.nativeSetIsPaused(false); core.mDrawIsPaused = false; // always redraw on resume to reenable gif animations core.mDrawIsScheduled = false; - core.nativeContentInvalidateAll(); - core.contentDraw(); } } } @@ -2127,7 +2124,6 @@ public final class WebViewCore { // only fire an event if this is our first request if (mDrawIsScheduled) return; mDrawIsScheduled = true; - if (mDrawIsPaused) return; mEventHub.sendMessage(Message.obtain(null, EventHub.WEBKIT_DRAW)); } } @@ -2789,6 +2785,7 @@ public final class WebViewCore { return mDeviceOrientationService; } + private native void nativeSetIsPaused(boolean isPaused); private native void nativePause(); private native void nativeResume(); private native void nativeFreeMemory(); diff --git a/core/java/android/widget/FastScroller.java b/core/java/android/widget/FastScroller.java index 7ad5d6c94853..51506e8c6f7a 100644 --- a/core/java/android/widget/FastScroller.java +++ b/core/java/android/widget/FastScroller.java @@ -368,8 +368,10 @@ class FastScroller { } else if (mState == STATE_EXIT) { if (alpha == 0) { // Done with exit setState(STATE_NONE); + } else if (mTrackDrawable != null) { + mList.invalidate(viewWidth - mThumbW, 0, viewWidth, mList.getHeight()); } else { - mList.invalidate(viewWidth - mThumbW, y, viewWidth, y + mThumbH); + mList.invalidate(viewWidth - mThumbW, y, viewWidth, y + mThumbH); } } } @@ -597,7 +599,7 @@ class FastScroller { private int getThumbPositionForListPosition(int firstVisibleItem, int visibleItemCount, int totalItemCount) { - if (mSectionIndexer == null) { + if (mSectionIndexer == null || mListAdapter == null) { getSectionsFromIndexer(); } if (mSectionIndexer == null || !mMatchDragPosition) { diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 2b94417aefc9..c92b5f9f5bb3 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -4788,8 +4788,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener selEnd = getSelectionEnd(); if (selStart >= 0) { - if (mHighlightPath == null) - mHighlightPath = new Path(); + if (mHighlightPath == null) mHighlightPath = new Path(); if (selStart == selEnd) { if (isCursorVisible() && @@ -4995,6 +4994,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } else { // Selection extends across multiple lines -- the focused // rect covers the entire width. + if (mHighlightPath == null) mHighlightPath = new Path(); if (mHighlightPathBogus) { mHighlightPath.reset(); mLayout.getSelectionPath(selStart, selEnd, mHighlightPath); diff --git a/core/res/res/drawable-hdpi/btn_default_disabled_holo.9.png b/core/res/res/drawable-hdpi/btn_default_disabled_holo.9.png Binary files differindex 1b65492c4743..c5adc38aa99f 100644 --- a/core/res/res/drawable-hdpi/btn_default_disabled_holo.9.png +++ b/core/res/res/drawable-hdpi/btn_default_disabled_holo.9.png diff --git a/core/res/res/drawable-hdpi/btn_default_focused_holo.9.png b/core/res/res/drawable-hdpi/btn_default_focused_holo.9.png Binary files differindex 70c1e26216e5..efcfa26d7594 100644 --- a/core/res/res/drawable-hdpi/btn_default_focused_holo.9.png +++ b/core/res/res/drawable-hdpi/btn_default_focused_holo.9.png diff --git a/core/res/res/drawable-hdpi/btn_default_normal_holo.9.png b/core/res/res/drawable-hdpi/btn_default_normal_holo.9.png Binary files differindex 9fa19efcabd2..490b6f545aa9 100644 --- a/core/res/res/drawable-hdpi/btn_default_normal_holo.9.png +++ b/core/res/res/drawable-hdpi/btn_default_normal_holo.9.png diff --git a/core/res/res/drawable-hdpi/btn_default_pressed_holo.9.png b/core/res/res/drawable-hdpi/btn_default_pressed_holo.9.png Binary files differindex 838479709cc1..57f20268b570 100644 --- a/core/res/res/drawable-hdpi/btn_default_pressed_holo.9.png +++ b/core/res/res/drawable-hdpi/btn_default_pressed_holo.9.png diff --git a/core/res/res/drawable-hdpi/combobox_disabled.png b/core/res/res/drawable-hdpi/combobox_disabled.png Binary files differindex 50eb45e4c9fa..85fbc3c161e8 100644 --- a/core/res/res/drawable-hdpi/combobox_disabled.png +++ b/core/res/res/drawable-hdpi/combobox_disabled.png diff --git a/core/res/res/drawable-hdpi/combobox_nohighlight.png b/core/res/res/drawable-hdpi/combobox_nohighlight.png Binary files differindex 9d6030175a7e..2de2abbe5728 100644 --- a/core/res/res/drawable-hdpi/combobox_nohighlight.png +++ b/core/res/res/drawable-hdpi/combobox_nohighlight.png diff --git a/core/res/res/drawable-hdpi/quickcontact_badge_overlay_normal_dark.9.png b/core/res/res/drawable-hdpi/quickcontact_badge_overlay_normal_dark.9.png Binary files differindex da28a17283cd..db236355c3ec 100644 --- a/core/res/res/drawable-hdpi/quickcontact_badge_overlay_normal_dark.9.png +++ b/core/res/res/drawable-hdpi/quickcontact_badge_overlay_normal_dark.9.png diff --git a/core/res/res/drawable-hdpi/quickcontact_badge_overlay_normal_light.9.png b/core/res/res/drawable-hdpi/quickcontact_badge_overlay_normal_light.9.png Binary files differindex 015d30a8749f..269a4569e247 100644 --- a/core/res/res/drawable-hdpi/quickcontact_badge_overlay_normal_light.9.png +++ b/core/res/res/drawable-hdpi/quickcontact_badge_overlay_normal_light.9.png diff --git a/core/res/res/drawable-hdpi/quickcontact_badge_overlay_pressed_dark.9.png b/core/res/res/drawable-hdpi/quickcontact_badge_overlay_pressed_dark.9.png Binary files differindex df7f236d5930..d997b361faa7 100644 --- a/core/res/res/drawable-hdpi/quickcontact_badge_overlay_pressed_dark.9.png +++ b/core/res/res/drawable-hdpi/quickcontact_badge_overlay_pressed_dark.9.png diff --git a/core/res/res/drawable-hdpi/quickcontact_badge_overlay_pressed_light.9.png b/core/res/res/drawable-hdpi/quickcontact_badge_overlay_pressed_light.9.png Binary files differindex 8950f818f27f..8ed5eb7a4821 100644 --- a/core/res/res/drawable-hdpi/quickcontact_badge_overlay_pressed_light.9.png +++ b/core/res/res/drawable-hdpi/quickcontact_badge_overlay_pressed_light.9.png diff --git a/core/res/res/drawable-mdpi/btn_default_disabled_holo.9.png b/core/res/res/drawable-mdpi/btn_default_disabled_holo.9.png Binary files differindex 86debc401113..abf64938f4e1 100644 --- a/core/res/res/drawable-mdpi/btn_default_disabled_holo.9.png +++ b/core/res/res/drawable-mdpi/btn_default_disabled_holo.9.png diff --git a/core/res/res/drawable-mdpi/btn_default_focused_holo.9.png b/core/res/res/drawable-mdpi/btn_default_focused_holo.9.png Binary files differindex b403e67cd1bb..71b052b58798 100644 --- a/core/res/res/drawable-mdpi/btn_default_focused_holo.9.png +++ b/core/res/res/drawable-mdpi/btn_default_focused_holo.9.png diff --git a/core/res/res/drawable-mdpi/btn_default_normal_holo.9.png b/core/res/res/drawable-mdpi/btn_default_normal_holo.9.png Binary files differindex d06361a2dc56..87c62ff0cbd2 100644 --- a/core/res/res/drawable-mdpi/btn_default_normal_holo.9.png +++ b/core/res/res/drawable-mdpi/btn_default_normal_holo.9.png diff --git a/core/res/res/drawable-mdpi/btn_default_pressed_holo.9.png b/core/res/res/drawable-mdpi/btn_default_pressed_holo.9.png Binary files differindex a4dae6610b0d..51821fa6f065 100644 --- a/core/res/res/drawable-mdpi/btn_default_pressed_holo.9.png +++ b/core/res/res/drawable-mdpi/btn_default_pressed_holo.9.png diff --git a/core/res/res/drawable-mdpi/combobox_disabled.png b/core/res/res/drawable-mdpi/combobox_disabled.png Binary files differindex 94ad00618e2c..ac8a235c5511 100644 --- a/core/res/res/drawable-mdpi/combobox_disabled.png +++ b/core/res/res/drawable-mdpi/combobox_disabled.png diff --git a/core/res/res/drawable-mdpi/combobox_nohighlight.png b/core/res/res/drawable-mdpi/combobox_nohighlight.png Binary files differindex 75d642cf206d..9d60e266fe44 100644 --- a/core/res/res/drawable-mdpi/combobox_nohighlight.png +++ b/core/res/res/drawable-mdpi/combobox_nohighlight.png diff --git a/core/res/res/drawable-mdpi/quickcontact_badge_overlay_normal_dark.9.png b/core/res/res/drawable-mdpi/quickcontact_badge_overlay_normal_dark.9.png Binary files differindex 0fc20e01acc1..84d4c11809e4 100644 --- a/core/res/res/drawable-mdpi/quickcontact_badge_overlay_normal_dark.9.png +++ b/core/res/res/drawable-mdpi/quickcontact_badge_overlay_normal_dark.9.png diff --git a/core/res/res/drawable-mdpi/quickcontact_badge_overlay_normal_light.9.png b/core/res/res/drawable-mdpi/quickcontact_badge_overlay_normal_light.9.png Binary files differindex 2b7a262cf201..d922ef114596 100644 --- a/core/res/res/drawable-mdpi/quickcontact_badge_overlay_normal_light.9.png +++ b/core/res/res/drawable-mdpi/quickcontact_badge_overlay_normal_light.9.png diff --git a/core/res/res/drawable-mdpi/quickcontact_badge_overlay_pressed_dark.9.png b/core/res/res/drawable-mdpi/quickcontact_badge_overlay_pressed_dark.9.png Binary files differindex 14108050b975..8c37c8d7356a 100644 --- a/core/res/res/drawable-mdpi/quickcontact_badge_overlay_pressed_dark.9.png +++ b/core/res/res/drawable-mdpi/quickcontact_badge_overlay_pressed_dark.9.png diff --git a/core/res/res/drawable-mdpi/quickcontact_badge_overlay_pressed_light.9.png b/core/res/res/drawable-mdpi/quickcontact_badge_overlay_pressed_light.9.png Binary files differindex 34d79f6c4bc3..e442c28405b2 100644 --- a/core/res/res/drawable-mdpi/quickcontact_badge_overlay_pressed_light.9.png +++ b/core/res/res/drawable-mdpi/quickcontact_badge_overlay_pressed_light.9.png diff --git a/core/res/res/drawable-xhdpi/btn_default_disabled_holo.9.png b/core/res/res/drawable-xhdpi/btn_default_disabled_holo.9.png Binary files differindex a3647923dc89..aca0a23a86e1 100644 --- a/core/res/res/drawable-xhdpi/btn_default_disabled_holo.9.png +++ b/core/res/res/drawable-xhdpi/btn_default_disabled_holo.9.png diff --git a/core/res/res/drawable-xhdpi/btn_default_focused_holo.9.png b/core/res/res/drawable-xhdpi/btn_default_focused_holo.9.png Binary files differindex 5a52ad66a36d..7dc088af5eda 100644 --- a/core/res/res/drawable-xhdpi/btn_default_focused_holo.9.png +++ b/core/res/res/drawable-xhdpi/btn_default_focused_holo.9.png diff --git a/core/res/res/drawable-xhdpi/btn_default_normal_holo.9.png b/core/res/res/drawable-xhdpi/btn_default_normal_holo.9.png Binary files differindex e34ed85d3d95..a97c1d324cdb 100644 --- a/core/res/res/drawable-xhdpi/btn_default_normal_holo.9.png +++ b/core/res/res/drawable-xhdpi/btn_default_normal_holo.9.png diff --git a/core/res/res/drawable-xhdpi/btn_default_pressed_holo.9.png b/core/res/res/drawable-xhdpi/btn_default_pressed_holo.9.png Binary files differindex f76d56bd9786..25d139a71f3c 100644 --- a/core/res/res/drawable-xhdpi/btn_default_pressed_holo.9.png +++ b/core/res/res/drawable-xhdpi/btn_default_pressed_holo.9.png diff --git a/core/res/res/drawable-xhdpi/combobox_disabled.png b/core/res/res/drawable-xhdpi/combobox_disabled.png Binary files differindex 9edf16e134ea..e8ca0b0028ae 100644 --- a/core/res/res/drawable-xhdpi/combobox_disabled.png +++ b/core/res/res/drawable-xhdpi/combobox_disabled.png diff --git a/core/res/res/drawable-xhdpi/combobox_nohighlight.png b/core/res/res/drawable-xhdpi/combobox_nohighlight.png Binary files differindex 0b5804221a87..d75bb06e7afb 100644 --- a/core/res/res/drawable-xhdpi/combobox_nohighlight.png +++ b/core/res/res/drawable-xhdpi/combobox_nohighlight.png diff --git a/core/res/res/drawable-xhdpi/quickcontact_badge_overlay_normal_dark.9.png b/core/res/res/drawable-xhdpi/quickcontact_badge_overlay_normal_dark.9.png Binary files differindex 3c8979fead86..9cf9173bc6fe 100644 --- a/core/res/res/drawable-xhdpi/quickcontact_badge_overlay_normal_dark.9.png +++ b/core/res/res/drawable-xhdpi/quickcontact_badge_overlay_normal_dark.9.png diff --git a/core/res/res/drawable-xhdpi/quickcontact_badge_overlay_normal_light.9.png b/core/res/res/drawable-xhdpi/quickcontact_badge_overlay_normal_light.9.png Binary files differindex 45b7adb9b676..c8d8a17e78a6 100644 --- a/core/res/res/drawable-xhdpi/quickcontact_badge_overlay_normal_light.9.png +++ b/core/res/res/drawable-xhdpi/quickcontact_badge_overlay_normal_light.9.png diff --git a/core/res/res/drawable-xhdpi/quickcontact_badge_overlay_pressed_dark.9.png b/core/res/res/drawable-xhdpi/quickcontact_badge_overlay_pressed_dark.9.png Binary files differindex e258284a544b..e3793f783abe 100644 --- a/core/res/res/drawable-xhdpi/quickcontact_badge_overlay_pressed_dark.9.png +++ b/core/res/res/drawable-xhdpi/quickcontact_badge_overlay_pressed_dark.9.png diff --git a/core/res/res/drawable-xhdpi/quickcontact_badge_overlay_pressed_light.9.png b/core/res/res/drawable-xhdpi/quickcontact_badge_overlay_pressed_light.9.png Binary files differindex 5c4bbf5f2195..c0be34f0f52d 100644 --- a/core/res/res/drawable-xhdpi/quickcontact_badge_overlay_pressed_light.9.png +++ b/core/res/res/drawable-xhdpi/quickcontact_badge_overlay_pressed_light.9.png diff --git a/core/res/res/layout-sw600dp/preference_list_content.xml b/core/res/res/layout-sw600dp/preference_list_content.xml deleted file mode 100644 index 08f645389f67..000000000000 --- a/core/res/res/layout-sw600dp/preference_list_content.xml +++ /dev/null @@ -1,123 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* //device/apps/common/assets/res/layout/list_content.xml -** -** Copyright 2006, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_height="match_parent" - android:layout_width="match_parent"> - - <LinearLayout - android:orientation="horizontal" - android:layout_width="match_parent" - android:layout_height="0px" - android:layout_marginTop="@dimen/preference_screen_top_margin" - android:layout_marginBottom="@dimen/preference_screen_bottom_margin" - android:layout_weight="1"> - - <LinearLayout - android:id="@+id/headers" - android:orientation="vertical" - android:layout_width="0px" - android:layout_height="match_parent" - android:layout_marginRight="@dimen/preference_screen_side_margin_negative" - android:layout_marginLeft="@dimen/preference_screen_side_margin" - android:layout_weight="@integer/preferences_left_pane_weight"> - - <ListView android:id="@android:id/list" - android:layout_width="match_parent" - android:layout_height="0px" - android:layout_weight="1" - android:paddingLeft="@dimen/preference_screen_header_padding_side" - android:paddingRight="@dimen/preference_screen_header_padding_side" - android:paddingTop="@dimen/preference_screen_header_vertical_padding" - android:paddingBottom="@dimen/preference_screen_header_vertical_padding" - android:scrollbarStyle="@integer/preference_screen_header_scrollbarStyle" - android:drawSelectorOnTop="false" - android:cacheColorHint="@android:color/transparent" - android:listPreferredItemHeight="48dp" - android:scrollbarAlwaysDrawVerticalTrack="true" /> - - <FrameLayout android:id="@+id/list_footer" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_weight="0" /> - - </LinearLayout> - - <LinearLayout - android:id="@+id/prefs_frame" - android:layout_width="0px" - android:layout_height="match_parent" - android:layout_weight="@integer/preferences_right_pane_weight" - android:layout_marginLeft="@dimen/preference_screen_side_margin" - android:layout_marginRight="@dimen/preference_screen_side_margin" - android:background="?attr/detailsElementBackground" - android:orientation="vertical" - android:visibility="gone" > - - <!-- Breadcrumb inserted here, in certain screen sizes. In others, it will be an - empty layout or just padding, and PreferenceActivity will put the breadcrumbs in - the action bar. --> - <include layout="@layout/breadcrumbs_in_fragment" /> - - <android.preference.PreferenceFrameLayout android:id="@+id/prefs" - android:layout_width="match_parent" - android:layout_height="0dip" - android:layout_weight="1" - /> - </LinearLayout> - </LinearLayout> - - <RelativeLayout android:id="@+id/button_bar" - android:layout_height="wrap_content" - android:layout_width="match_parent" - android:layout_weight="0" - android:visibility="gone"> - - <Button android:id="@+id/back_button" - android:layout_width="150dip" - android:layout_height="wrap_content" - android:layout_margin="5dip" - android:layout_alignParentLeft="true" - android:text="@string/back_button_label" - /> - <LinearLayout - android:orientation="horizontal" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentRight="true"> - - <Button android:id="@+id/skip_button" - android:layout_width="150dip" - android:layout_height="wrap_content" - android:layout_margin="5dip" - android:text="@string/skip_button_label" - android:visibility="gone" - /> - - <Button android:id="@+id/next_button" - android:layout_width="150dip" - android:layout_height="wrap_content" - android:layout_margin="5dip" - android:text="@string/next_button_label" - /> - </LinearLayout> - </RelativeLayout> -</LinearLayout> diff --git a/core/res/res/layout/preference_list_content.xml b/core/res/res/layout/preference_list_content.xml index 62181b54ae69..70bc59a6ca37 100644 --- a/core/res/res/layout/preference_list_content.xml +++ b/core/res/res/layout/preference_list_content.xml @@ -27,8 +27,6 @@ android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="0px" - android:layout_marginTop="@dimen/preference_screen_top_margin" - android:layout_marginBottom="@dimen/preference_screen_bottom_margin" android:layout_weight="1"> <LinearLayout @@ -48,6 +46,7 @@ android:paddingRight="@dimen/preference_screen_header_padding_side" android:paddingTop="@dimen/preference_screen_header_vertical_padding" android:paddingBottom="@dimen/preference_screen_header_vertical_padding" + android:clipToPadding="false" android:scrollbarStyle="@integer/preference_screen_header_scrollbarStyle" android:drawSelectorOnTop="false" android:cacheColorHint="@android:color/transparent" @@ -63,11 +62,10 @@ <LinearLayout android:id="@+id/prefs_frame" + style="?attr/preferencePanelStyle" android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="@integer/preferences_right_pane_weight" - android:layout_marginLeft="@dimen/preference_screen_side_margin" - android:layout_marginRight="@dimen/preference_screen_side_margin" android:orientation="vertical" android:visibility="gone" > diff --git a/core/res/res/layout/preference_list_content_single.xml b/core/res/res/layout/preference_list_content_single.xml index 6902ffdb63b0..259869d7dc3c 100644 --- a/core/res/res/layout/preference_list_content_single.xml +++ b/core/res/res/layout/preference_list_content_single.xml @@ -39,6 +39,9 @@ android:layout_height="0px" android:layout_weight="1" android:drawSelectorOnTop="false" + android:paddingLeft="@dimen/preference_fragment_padding_side" + android:paddingRight="@dimen/preference_fragment_padding_side" + android:scrollbarStyle="@integer/preference_fragment_scrollbarStyle" android:cacheColorHint="@android:color/transparent" android:listPreferredItemHeight="48dp" android:scrollbarAlwaysDrawVerticalTrack="true" /> diff --git a/core/res/res/values-h720dp/dimens.xml b/core/res/res/values-h720dp/dimens.xml index 7efe32262fcc..6e991836bf8e 100644 --- a/core/res/res/values-h720dp/dimens.xml +++ b/core/res/res/values-h720dp/dimens.xml @@ -21,10 +21,6 @@ <dimen name="alert_dialog_button_bar_height">54dip</dimen> <!-- Preference fragment padding, bottom --> <dimen name="preference_fragment_padding_bottom">16dp</dimen> - <!-- Preference activity top margin --> - <dimen name="preference_screen_top_margin">16dp</dimen> - <!-- Preference activity bottom margin --> - <dimen name="preference_screen_bottom_margin">16dp</dimen> <dimen name="preference_screen_header_padding_side">0dip</dimen> diff --git a/core/res/res/values-large/styles.xml b/core/res/res/values-large/styles.xml deleted file mode 100644 index 5206d7c60b5e..000000000000 --- a/core/res/res/values-large/styles.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2011 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<resources> - <style name="PreferencePanel"> - <item name="android:layout_marginLeft">@dimen/preference_screen_side_margin</item> - <item name="android:layout_marginRight">@dimen/preference_screen_side_margin</item> - <item name="android:layout_marginTop">48dip</item> - <item name="android:layout_marginBottom">48dip</item> - <item name="android:background">?attr/detailsElementBackground</item> - </style> -</resources> diff --git a/core/res/res/values-sw600dp/dimens.xml b/core/res/res/values-sw600dp/dimens.xml index 24d5d8d19cd5..792066efa99c 100644 --- a/core/res/res/values-sw600dp/dimens.xml +++ b/core/res/res/values-sw600dp/dimens.xml @@ -45,13 +45,7 @@ <dimen name="keyguard_pattern_unlock_status_line_font_size">14sp</dimen> <!-- Preference activity, vertical padding for the header list --> - <dimen name="preference_screen_header_vertical_padding">16dp</dimen> - - <!-- Reduce the margin when using dual pane --> - <!-- Preference activity side margins --> - <dimen name="preference_screen_side_margin">0dp</dimen> - <!-- Preference activity side margins negative--> - <dimen name="preference_screen_side_margin_negative">-4dp</dimen> + <dimen name="preference_screen_header_vertical_padding">32dp</dimen> </resources> diff --git a/core/res/res/values-sw600dp/styles.xml b/core/res/res/values-sw600dp/styles.xml index 7dea9b89b500..f9e95b7ad2c4 100644 --- a/core/res/res/values-sw600dp/styles.xml +++ b/core/res/res/values-sw600dp/styles.xml @@ -25,4 +25,12 @@ <item name="android:measureWithLargestChild">true</item> <item name="android:tabLayout">@android:layout/tab_indicator_holo</item> </style> + + <style name="PreferencePanel"> + <item name="android:layout_marginLeft">@dimen/preference_screen_side_margin</item> + <item name="android:layout_marginRight">@dimen/preference_screen_side_margin</item> + <item name="android:layout_marginTop">@dimen/preference_screen_top_margin</item> + <item name="android:layout_marginBottom">@dimen/preference_screen_bottom_margin</item> + <item name="android:background">?attr/detailsElementBackground</item> + </style> </resources> diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 8fbb09e068d1..b155b8036d20 100755 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -582,21 +582,6 @@ If false, Content-disposition fragments are ignored --> <bool name="config_mms_content_disposition_support">true</bool> - <!-- If this value is true, the carrier supports sms delivery reports. - If false, sms delivery reports are not supported and the preference - option to enable/disable delivery reports is removed in the Messaging app. --> - <bool name="config_sms_delivery_reports_support">true</bool> - - <!-- If this value is true, the carrier supports mms delivery reports. - If false, mms delivery reports are not supported and the preference - option to enable/disable delivery reports is removed in the Messaging app. --> - <bool name="config_mms_delivery_reports_support">true</bool> - - <!-- If this value is true, the carrier supports mms read reports. - If false, mms read reports are not supported and the preference - option to enable/disable read reports is removed in the Messaging app. --> - <bool name="config_mms_read_reports_support">true</bool> - <!-- National Language Identifier codes for the following two config items. (from 3GPP TS 23.038 V9.1.1 Table 6.2.1.2.4.1): 0 - reserved diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index c522c1e90027..62a2187ea072 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -78,7 +78,7 @@ <!-- Preference activity side margins --> <dimen name="preference_screen_side_margin">0dp</dimen> <!-- Preference activity side margins negative--> - <dimen name="preference_screen_side_margin_negative">0dp</dimen> + <dimen name="preference_screen_side_margin_negative">-4dp</dimen> <!-- Preference activity top margin --> <dimen name="preference_screen_top_margin">0dp</dimen> <!-- Preference activity bottom margin --> diff --git a/data/fonts/AndroidClock.ttf b/data/fonts/AndroidClock.ttf Binary files differindex 7b550eeda2d8..6e0932e9e7e1 100644 --- a/data/fonts/AndroidClock.ttf +++ b/data/fonts/AndroidClock.ttf diff --git a/data/fonts/AndroidClock_Highlight.ttf b/data/fonts/AndroidClock_Highlight.ttf Binary files differindex a95d5482840c..6e0932e9e7e1 100644 --- a/data/fonts/AndroidClock_Highlight.ttf +++ b/data/fonts/AndroidClock_Highlight.ttf diff --git a/data/fonts/AndroidClock_Solid.ttf b/data/fonts/AndroidClock_Solid.ttf Binary files differindex 108839e39306..6e0932e9e7e1 100644 --- a/data/fonts/AndroidClock_Solid.ttf +++ b/data/fonts/AndroidClock_Solid.ttf diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp index 88cfc5a6b25e..cedf456e22c3 100644 --- a/libs/hwui/DisplayListRenderer.cpp +++ b/libs/hwui/DisplayListRenderer.cpp @@ -194,6 +194,7 @@ void DisplayList::initFromDisplayListRenderer(const DisplayListRenderer& recorde void DisplayList::init() { mSize = 0; + mIsRenderable = true; } size_t DisplayList::getSize() { @@ -892,7 +893,7 @@ bool DisplayList::replay(OpenGLRenderer& renderer, Rect& dirty, uint32_t level) // Base structure /////////////////////////////////////////////////////////////////////////////// -DisplayListRenderer::DisplayListRenderer(): mWriter(MIN_WRITER_SIZE) { +DisplayListRenderer::DisplayListRenderer(): mWriter(MIN_WRITER_SIZE), mHasDrawOps(false) { } DisplayListRenderer::~DisplayListRenderer() { @@ -926,6 +927,8 @@ void DisplayListRenderer::reset() { mPathMap.clear(); mMatrices.clear(); + + mHasDrawOps = false; } /////////////////////////////////////////////////////////////////////////////// @@ -938,6 +941,7 @@ DisplayList* DisplayListRenderer::getDisplayList(DisplayList* displayList) { } else { displayList->initFromDisplayListRenderer(*this, true); } + displayList->setRenderable(mHasDrawOps); return displayList; } @@ -982,7 +986,11 @@ int DisplayListRenderer::save(int flags) { } void DisplayListRenderer::restore() { - addOp(DisplayList::Restore); + if (mRestoreSaveCount < 0) { + addOp(DisplayList::Restore); + } else { + mRestoreSaveCount--; + } OpenGLRenderer::restore(); } diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h index 69e72a454408..8cd7fea07d01 100644 --- a/libs/hwui/DisplayListRenderer.h +++ b/libs/hwui/DisplayListRenderer.h @@ -63,6 +63,7 @@ public: // IMPORTANT: Update the intialization of OP_NAMES in the .cpp file // when modifying this file enum Op { + // Non-drawing operations Save = 0, Restore, RestoreToCount, @@ -75,6 +76,7 @@ public: SetMatrix, ConcatMatrix, ClipRect, + // Drawing operations DrawDisplayList, DrawLayer, DrawBitmap, @@ -113,6 +115,14 @@ public: static void outputLogBuffer(int fd); + void setRenderable(bool renderable) { + mIsRenderable = renderable; + } + + bool isRenderable() const { + return mIsRenderable; + } + private: void init(); @@ -207,6 +217,8 @@ private: mutable SkFlattenableReadBuffer mReader; size_t mSize; + + bool mIsRenderable; }; /////////////////////////////////////////////////////////////////////////////// @@ -328,6 +340,7 @@ private: inline void addOp(DisplayList::Op drawOp) { insertRestoreToCount(); mWriter.writeInt(drawOp); + mHasDrawOps = mHasDrawOps || drawOp >= DisplayList::DrawDisplayList; } inline void addInt(int value) { @@ -479,6 +492,7 @@ private: SkWriter32 mWriter; int mRestoreSaveCount; + bool mHasDrawOps; friend class DisplayList; diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 04f3c58244c7..a20a88e34388 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -1278,7 +1278,7 @@ bool OpenGLRenderer::drawDisplayList(DisplayList* displayList, uint32_t width, u // All the usual checks and setup operations (quickReject, setupDraw, etc.) // will be performed by the display list itself - if (displayList) { + if (displayList && displayList->isRenderable()) { return displayList->replay(*this, dirty, level); } diff --git a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp index 2e66a2cf1d5f..ce07e32ddc26 100644 --- a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp +++ b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp @@ -136,24 +136,28 @@ void AnotherPacketSource::queueAccessUnit(const sp<ABuffer> &buffer) { void AnotherPacketSource::queueDiscontinuity( ATSParser::DiscontinuityType type, const sp<AMessage> &extra) { - sp<ABuffer> buffer = new ABuffer(0); - buffer->meta()->setInt32("discontinuity", static_cast<int32_t>(type)); - buffer->meta()->setMessage("extra", extra); - Mutex::Autolock autoLock(mLock); -#if 0 - if (type == ATSParser::DISCONTINUITY_SEEK - || type == ATSParser::DISCONTINUITY_FORMATCHANGE) { - // XXX Fix this: This will also clear any pending discontinuities, - // If there's a pending DISCONTINUITY_FORMATCHANGE and the new - // discontinuity is "just" a DISCONTINUITY_SEEK, this will effectively - // downgrade the type of discontinuity received by the client. + // Leave only discontinuities in the queue. + List<sp<ABuffer> >::iterator it = mBuffers.begin(); + while (it != mBuffers.end()) { + sp<ABuffer> oldBuffer = *it; + + int32_t oldDiscontinuityType; + if (!oldBuffer->meta()->findInt32( + "discontinuity", &oldDiscontinuityType)) { + it = mBuffers.erase(it); + continue; + } - mBuffers.clear(); - mEOSResult = OK; + ++it; } -#endif + + mEOSResult = OK; + + sp<ABuffer> buffer = new ABuffer(0); + buffer->meta()->setInt32("discontinuity", static_cast<int32_t>(type)); + buffer->meta()->setMessage("extra", extra); mBuffers.push_back(buffer); mCondition.signal(); diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp index 10cea22bbdd5..1f0016ab1731 100644 --- a/opengl/libs/EGL/eglApi.cpp +++ b/opengl/libs/EGL/eglApi.cpp @@ -454,13 +454,6 @@ EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface) EGLBoolean result = s->cnx->egl.eglDestroySurface( dp->disp[s->impl].dpy, s->surface); if (result == EGL_TRUE) { - ANativeWindow* const window = s->win.get(); - if (window != NULL) { - native_window_set_buffers_format(window, 0); - if (native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL)) { - LOGE("EGLNativeWindowType %p disconnected failed", window); - } - } _s.terminate(); } return result; diff --git a/opengl/libs/EGL/egl_object.h b/opengl/libs/EGL/egl_object.h index 3459a8a8de3e..d2b737897af7 100644 --- a/opengl/libs/EGL/egl_object.h +++ b/opengl/libs/EGL/egl_object.h @@ -125,7 +125,15 @@ void egl_object_t::LocalRef<N,T>::terminate() { class egl_surface_t: public egl_object_t { protected: - ~egl_surface_t() {} + ~egl_surface_t() { + ANativeWindow* const window = win.get(); + if (window != NULL) { + native_window_set_buffers_format(window, 0); + if (native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL)) { + LOGE("EGLNativeWindowType %p disconnected failed", window); + } + } + } public: typedef egl_object_t::LocalRef<egl_surface_t, EGLSurface> Ref; @@ -232,4 +240,3 @@ egl_sync_t* get_sync(EGLSyncKHR sync) { // ---------------------------------------------------------------------------- #endif // ANDROID_EGL_OBJECT_H - diff --git a/packages/SystemUI/res/drawable-hdpi/status_bar_bg_tile.png b/packages/SystemUI/res/drawable-hdpi/status_bar_bg_tile.png Binary files differindex 37cad222e037..aee197cd8364 100644 --- a/packages/SystemUI/res/drawable-hdpi/status_bar_bg_tile.png +++ b/packages/SystemUI/res/drawable-hdpi/status_bar_bg_tile.png diff --git a/packages/SystemUI/res/drawable-mdpi/status_bar_bg_tile.png b/packages/SystemUI/res/drawable-mdpi/status_bar_bg_tile.png Binary files differindex 83d106df0ceb..6579ff940012 100644 --- a/packages/SystemUI/res/drawable-mdpi/status_bar_bg_tile.png +++ b/packages/SystemUI/res/drawable-mdpi/status_bar_bg_tile.png diff --git a/packages/SystemUI/res/drawable-xhdpi/status_bar_bg_tile.png b/packages/SystemUI/res/drawable-xhdpi/status_bar_bg_tile.png Binary files differindex 9e2134839229..d01b117bb718 100644 --- a/packages/SystemUI/res/drawable-xhdpi/status_bar_bg_tile.png +++ b/packages/SystemUI/res/drawable-xhdpi/status_bar_bg_tile.png diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 6db5fc494563..f633825c5e26 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -63,4 +63,28 @@ <!-- thickness (height) of dividers between each notification row --> <dimen name="notification_divider_height">1dp</dimen> + + <!-- Notification drawer tuning parameters (phone UI) --> + <!-- Initial velocity of the shade when expanding on its own --> + <dimen name="self_expand_velocity">2000dp</dimen> + <!-- Initial velocity of the shade when collapsing on its own --> + <dimen name="self_collapse_velocity">2000dp</dimen> + <!-- Minimum final velocity of gestures interpreted as expand requests --> + <dimen name="fling_expand_min_velocity">200dp</dimen> + <!-- Minimum final velocity of gestures interpreted as collapse requests --> + <dimen name="fling_collapse_min_velocity">200dp</dimen> + <!-- Cap on contribution of x dimension of gesture to overall velocity --> + <dimen name="fling_gesture_max_x_velocity">200dp</dimen> + + <!-- Minimum fraction of the display a gesture must travel, at any velocity, to qualify as a + collapse request --> + <item type="dimen" name="collapse_min_display_fraction">10%</item> + <!-- Minimum fraction of the display a gesture must travel to qualify as an expand request --> + <item type="dimen" name="expand_min_display_fraction">50%</item> + + <!-- Initial acceleration of an expand animation after fling --> + <dimen name="expand_accel">2000dp</dimen> + <!-- Initial acceleration of an collapse animation after fling --> + <dimen name="collapse_accel">2000dp</dimen> + </resources> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index dd8e3e810d76..6e6567bf1f08 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -112,6 +112,18 @@ public class PhoneStatusBar extends StatusBar { // will likely move to a resource or other tunable param at some point private static final int INTRUDER_ALERT_DECAY_MS = 10000; + // fling gesture tuning parameters, scaled to display density + private float mSelfExpandVelocityPx; // classic value: 2000px/s + private float mSelfCollapseVelocityPx; // classic value: 2000px/s (will be negated to collapse "up") + private float mFlingExpandMinVelocityPx; // classic value: 200px/s + private float mFlingCollapseMinVelocityPx; // classic value: 200px/s + private float mCollapseMinDisplayFraction; // classic value: 0.08 (25px/min(320px,480px) on G1) + private float mExpandMinDisplayFraction; // classic value: 0.5 (drag open halfway to expand) + private float mFlingGestureMaxXVelocityPx; // classic value: 150px/s + + private float mExpandAccelPx; // classic value: 2000px/s/s + private float mCollapseAccelPx; // classic value: 2000px/s/s (will be negated to collapse "up") + PhoneStatusBarPolicy mIconPolicy; // These are no longer handled by the policy, because we need custom strategies for them @@ -1179,7 +1191,7 @@ public class PhoneStatusBar extends StatusBar { } prepareTracking(0, true); - performFling(0, 2000.0f, true); + performFling(0, mSelfExpandVelocityPx, true); } public void animateCollapse() { @@ -1215,7 +1227,7 @@ public class PhoneStatusBar extends StatusBar { // and doesn't try to re-open the windowshade. mExpanded = true; prepareTracking(y, false); - performFling(y, -2000.0f, true); + performFling(y, -mSelfCollapseVelocityPx, true); } void performExpand() { @@ -1331,8 +1343,8 @@ public class PhoneStatusBar extends StatusBar { mTracking = true; mVelocityTracker = VelocityTracker.obtain(); if (opening) { - mAnimAccel = 2000.0f; - mAnimVel = 200; + mAnimAccel = mExpandAccelPx; + mAnimVel = mFlingExpandMinVelocityPx; mAnimY = mStatusBarView.getHeight(); updateExpandedViewPos((int)mAnimY); mAnimating = true; @@ -1370,29 +1382,31 @@ public class PhoneStatusBar extends StatusBar { if (mExpanded) { if (!always && ( - vel > 200.0f - || (y > (mDisplayMetrics.heightPixels-25) && vel > -200.0f))) { + vel > mFlingCollapseMinVelocityPx + || (y > (mDisplayMetrics.heightPixels*(1f-mCollapseMinDisplayFraction)) && + vel > -mFlingExpandMinVelocityPx))) { // We are expanded, but they didn't move sufficiently to cause // us to retract. Animate back to the expanded position. - mAnimAccel = 2000.0f; + mAnimAccel = mExpandAccelPx; if (vel < 0) { mAnimVel = 0; } } else { // We are expanded and are now going to animate away. - mAnimAccel = -2000.0f; + mAnimAccel = -mCollapseAccelPx; if (vel > 0) { mAnimVel = 0; } } } else { if (always || ( - vel > 200.0f - || (y > (mDisplayMetrics.heightPixels/2) && vel > -200.0f))) { + vel > mFlingExpandMinVelocityPx + || (y > (mDisplayMetrics.heightPixels*(1f-mExpandMinDisplayFraction)) && + vel > -mFlingCollapseMinVelocityPx))) { // We are collapsed, and they moved enough to allow us to // expand. Animate in the notifications. - mAnimAccel = 2000.0f; + mAnimAccel = mExpandAccelPx; if (vel < 0) { mAnimVel = 0; } @@ -1400,7 +1414,7 @@ public class PhoneStatusBar extends StatusBar { else { // We are collapsed, but they didn't move sufficiently to cause // us to retract. Animate back to the collapsed position. - mAnimAccel = -2000.0f; + mAnimAccel = -mCollapseAccelPx; if (vel > 0) { mAnimVel = 0; } @@ -1480,8 +1494,8 @@ public class PhoneStatusBar extends StatusBar { if (xVel < 0) { xVel = -xVel; } - if (xVel > 150.0f) { - xVel = 150.0f; // limit how much we care about the x axis + if (xVel > mFlingGestureMaxXVelocityPx) { + xVel = mFlingGestureMaxXVelocityPx; // limit how much we care about the x axis } float vel = (float)Math.hypot(yVel, xVel); @@ -1489,6 +1503,14 @@ public class PhoneStatusBar extends StatusBar { vel = -vel; } + if (CHATTY) { + Slog.d(TAG, String.format("gesture: vraw=(%f,%f) vnorm=(%f,%f) vlinear=%f", + mVelocityTracker.getXVelocity(), + mVelocityTracker.getYVelocity(), + xVel, yVel, + vel)); + } + performFling((int)event.getRawY(), vel, false); } @@ -2133,6 +2155,19 @@ public class PhoneStatusBar extends StatusBar { mEdgeBorder = res.getDimensionPixelSize(R.dimen.status_bar_edge_ignore); + mSelfExpandVelocityPx = res.getDimension(R.dimen.self_expand_velocity); + mSelfCollapseVelocityPx = res.getDimension(R.dimen.self_collapse_velocity); + mFlingExpandMinVelocityPx = res.getDimension(R.dimen.fling_expand_min_velocity); + mFlingCollapseMinVelocityPx = res.getDimension(R.dimen.fling_collapse_min_velocity); + + mCollapseMinDisplayFraction = res.getFraction(R.dimen.collapse_min_display_fraction, 1, 1); + mExpandMinDisplayFraction = res.getFraction(R.dimen.expand_min_display_fraction, 1, 1); + + mExpandAccelPx = res.getDimension(R.dimen.expand_accel); + mCollapseAccelPx = res.getDimension(R.dimen.collapse_accel); + + mFlingGestureMaxXVelocityPx = res.getDimension(R.dimen.fling_gesture_max_x_velocity); + if (false) Slog.v(TAG, "updateResources"); } diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index be129a8eef85..dfd1b00cec90 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -124,6 +124,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_BOOT_PROGRESS; import android.view.WindowManagerImpl; import android.view.WindowManagerPolicy; import android.view.KeyCharacterMap.FallbackAction; +import android.view.accessibility.AccessibilityEvent; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.media.IAudioService; @@ -3104,7 +3105,29 @@ public class PhoneWindowManager implements WindowManagerPolicy { mHandler.post(new Runnable() { @Override public void run() { if (mBootMsgDialog == null) { - mBootMsgDialog = new ProgressDialog(mContext); + mBootMsgDialog = new ProgressDialog(mContext) { + // This dialog will consume all events coming in to + // it, to avoid it trying to do things too early in boot. + @Override public boolean dispatchKeyEvent(KeyEvent event) { + return true; + } + @Override public boolean dispatchKeyShortcutEvent(KeyEvent event) { + return true; + } + @Override public boolean dispatchTouchEvent(MotionEvent ev) { + return true; + } + @Override public boolean dispatchTrackballEvent(MotionEvent ev) { + return true; + } + @Override public boolean dispatchGenericMotionEvent(MotionEvent ev) { + return true; + } + @Override public boolean dispatchPopulateAccessibilityEvent( + AccessibilityEvent event) { + return true; + } + }; mBootMsgDialog.setTitle(R.string.android_upgrading_title); mBootMsgDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); mBootMsgDialog.setIndeterminate(true); diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index e6f92a5baad2..d0e8b5ea123d 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -182,7 +182,7 @@ class ServerThread extends Thread { // only initialize the power service after we have started the // lights service, content providers and the battery service. - power.init(context, lights, ActivityManagerService.getDefault(), battery); + power.init(context, lights, ActivityManagerService.self(), battery); Slog.i(TAG, "Alarm Manager"); alarm = new AlarmManagerService(context); @@ -197,8 +197,7 @@ class ServerThread extends Thread { factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL); ServiceManager.addService(Context.WINDOW_SERVICE, wm); - ((ActivityManagerService)ServiceManager.getService("activity")) - .setWindowManager(wm); + ActivityManagerService.self().setWindowManager(wm); // Skip Bluetooth if we have an emulator kernel // TODO: Use a more reliable check to see if this product should @@ -265,7 +264,7 @@ class ServerThread extends Thread { } catch (Throwable e) { reportWtf("making display ready", e); } - + try { pm.performBootDexOpt(); } catch (Throwable e) { @@ -618,8 +617,7 @@ class ServerThread extends Thread { // where third party code can really run (but before it has actually // started launching the initial applications), for us to complete our // initialization. - ((ActivityManagerService)ActivityManagerNative.getDefault()) - .systemReady(new Runnable() { + ActivityManagerService.self().systemReady(new Runnable() { public void run() { Slog.i(TAG, "Making services ready"); diff --git a/services/java/com/android/server/TelephonyRegistry.java b/services/java/com/android/server/TelephonyRegistry.java index dd54c1692ed9..4447ad098920 100644 --- a/services/java/com/android/server/TelephonyRegistry.java +++ b/services/java/com/android/server/TelephonyRegistry.java @@ -421,11 +421,13 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { modified = true; } if (modified) { - Slog.d(TAG, "onDataConnectionStateChanged(" + state + ", " + networkType + ")"); + Slog.d(TAG, "onDataConnectionStateChanged(" + mDataConnectionState + + ", " + mDataConnectionNetworkType + ")"); for (Record r : mRecords) { if ((r.events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) { try { - r.callback.onDataConnectionStateChanged(state, networkType); + r.callback.onDataConnectionStateChanged(mDataConnectionState, + mDataConnectionNetworkType); } catch (RemoteException ex) { mRemoveList.add(r.binder); } diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 7232a9447f70..bb5e989a534a 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -91,7 +91,6 @@ import android.os.Environment; import android.os.FileObserver; import android.os.FileUtils; import android.os.Handler; -import android.os.HandlerThread; import android.os.IBinder; import android.os.IPermissionController; import android.os.Looper; @@ -5518,6 +5517,48 @@ public final class ActivityManagerService extends ActivityManagerNative return msg; } + boolean incProviderCount(ProcessRecord r, ContentProviderRecord cpr) { + if (r != null) { + Integer cnt = r.conProviders.get(cpr); + if (DEBUG_PROVIDER) Slog.v(TAG, + "Adding provider requested by " + + r.processName + " from process " + + cpr.info.processName + ": " + cpr.name.flattenToShortString() + + " cnt=" + (cnt == null ? 1 : cnt)); + if (cnt == null) { + cpr.clients.add(r); + r.conProviders.put(cpr, new Integer(1)); + return true; + } else { + r.conProviders.put(cpr, new Integer(cnt.intValue()+1)); + } + } else { + cpr.externals++; + } + return false; + } + + boolean decProviderCount(ProcessRecord r, ContentProviderRecord cpr) { + if (r != null) { + Integer cnt = r.conProviders.get(cpr); + if (DEBUG_PROVIDER) Slog.v(TAG, + "Removing provider requested by " + + r.processName + " from process " + + cpr.info.processName + ": " + cpr.name.flattenToShortString() + + " cnt=" + cnt); + if (cnt == null || cnt.intValue() <= 1) { + cpr.clients.remove(r); + r.conProviders.remove(cpr); + return true; + } else { + r.conProviders.put(cpr, new Integer(cnt.intValue()-1)); + } + } else { + cpr.externals++; + } + return false; + } + private final ContentProviderHolder getContentProviderImpl( IApplicationThread caller, String name) { ContentProviderRecord cpr; @@ -5537,7 +5578,8 @@ public final class ActivityManagerService extends ActivityManagerNative // First check if this content provider has been published... cpr = mProvidersByName.get(name); - if (cpr != null) { + boolean providerRunning = cpr != null; + if (providerRunning) { cpi = cpr.info; String msg; if ((msg=checkContentProviderPermissionLocked(cpi, r)) != null) { @@ -5561,18 +5603,8 @@ public final class ActivityManagerService extends ActivityManagerNative // In this case the provider instance already exists, so we can // return it right away. - if (r != null) { - if (DEBUG_PROVIDER) Slog.v(TAG, - "Adding provider requested by " - + r.processName + " from process " - + cpr.info.processName); - Integer cnt = r.conProviders.get(cpr); - if (cnt == null) { - r.conProviders.put(cpr, new Integer(1)); - } else { - r.conProviders.put(cpr, new Integer(cnt.intValue()+1)); - } - cpr.clients.add(r); + final boolean countChanged = incProviderCount(r, cpr); + if (countChanged) { if (cpr.app != null && r.setAdj <= ProcessList.PERCEPTIBLE_APP_ADJ) { // If this is a perceptible app accessing the provider, // make sure to count it as being accessed and thus @@ -5580,17 +5612,46 @@ public final class ActivityManagerService extends ActivityManagerNative // content providers are often expensive to start. updateLruProcessLocked(cpr.app, false, true); } - } else { - cpr.externals++; } if (cpr.app != null) { - updateOomAdjLocked(cpr.app); + if (false) { + if (cpr.name.flattenToShortString().equals( + "com.android.providers.calendar/.CalendarProvider2")) { + Slog.v(TAG, "****************** KILLING " + + cpr.name.flattenToShortString()); + Process.killProcess(cpr.app.pid); + } + } + boolean success = updateOomAdjLocked(cpr.app); + if (DEBUG_PROVIDER) Slog.i(TAG, "Adjust success: " + success); + // NOTE: there is still a race here where a signal could be + // pending on the process even though we managed to update its + // adj level. Not sure what to do about this, but at least + // the race is now smaller. + if (!success) { + // Uh oh... it looks like the provider's process + // has been killed on us. We need to wait for a new + // process to be started, and make sure its death + // doesn't kill our process. + Slog.i(TAG, + "Existing provider " + cpr.name.flattenToShortString() + + " is crashing; detaching " + r); + boolean lastRef = decProviderCount(r, cpr); + appDiedLocked(cpr.app, cpr.app.pid, cpr.app.thread); + if (!lastRef) { + // This wasn't the last ref our process had on + // the provider... we have now been killed, bail. + return null; + } + providerRunning = false; + } } Binder.restoreCallingIdentity(origId); + } - } else { + if (!providerRunning) { try { cpi = AppGlobals.getPackageManager(). resolveContentProvider(name, @@ -5701,22 +5762,7 @@ public final class ActivityManagerService extends ActivityManagerNative mProvidersByClass.put(comp, cpr); } mProvidersByName.put(name, cpr); - - if (r != null) { - if (DEBUG_PROVIDER) Slog.v(TAG, - "Adding provider requested by " - + r.processName + " from process " - + cpr.info.processName); - Integer cnt = r.conProviders.get(cpr); - if (cnt == null) { - r.conProviders.put(cpr, new Integer(1)); - } else { - r.conProviders.put(cpr, new Integer(cnt.intValue()+1)); - } - cpr.clients.add(r); - } else { - cpr.externals++; - } + incProviderCount(r, cpr); } } @@ -5780,24 +5826,16 @@ public final class ActivityManagerService extends ActivityManagerNative //update content provider record entry info ComponentName comp = new ComponentName(cpr.info.packageName, cpr.info.name); ContentProviderRecord localCpr = mProvidersByClass.get(comp); - if (DEBUG_PROVIDER) Slog.v(TAG, "Removing provider requested by " - + r.info.processName + " from process " - + localCpr.appInfo.processName); if (localCpr.app == r) { //should not happen. taken care of as a local provider Slog.w(TAG, "removeContentProvider called on local provider: " + cpr.info.name + " in process " + r.processName); return; } else { - Integer cnt = r.conProviders.get(localCpr); - if (cnt == null || cnt.intValue() <= 1) { - localCpr.clients.remove(r); - r.conProviders.remove(localCpr); - } else { - r.conProviders.put(localCpr, new Integer(cnt.intValue()-1)); + if (decProviderCount(r, localCpr)) { + updateOomAdjLocked(); } } - updateOomAdjLocked(); } } @@ -13458,16 +13496,18 @@ public final class ActivityManagerService extends ActivityManagerNative } } - private final void updateOomAdjLocked( + private final boolean updateOomAdjLocked( ProcessRecord app, int hiddenAdj, ProcessRecord TOP_APP) { app.hiddenAdj = hiddenAdj; if (app.thread == null) { - return; + return false; } final boolean wasKeeping = app.keeping; + boolean success = true; + computeOomAdjLocked(app, hiddenAdj, TOP_APP, false); if (app.curRawAdj != app.setRawAdj) { @@ -13504,6 +13544,7 @@ public final class ActivityManagerService extends ActivityManagerNative " oom adj to " + app.curAdj + " because " + app.adjType); app.setAdj = app.curAdj; } else { + success = false; Slog.w(TAG, "Failed setting oom adj of " + app + " to " + app.curAdj); } } @@ -13518,6 +13559,7 @@ public final class ActivityManagerService extends ActivityManagerNative EventLog.writeEvent(EventLogTags.AM_KILL, app.pid, app.processName, app.setAdj, app.waitingToKill); Process.killProcessQuiet(app.pid); + success = false; } else { if (true) { long oldId = Binder.clearCallingIdentity(); @@ -13540,6 +13582,7 @@ public final class ActivityManagerService extends ActivityManagerNative } } } + return success; } private final ActivityRecord resumedAppLocked() { @@ -13553,7 +13596,7 @@ public final class ActivityManagerService extends ActivityManagerNative return resumedActivity; } - private final void updateOomAdjLocked(ProcessRecord app) { + private final boolean updateOomAdjLocked(ProcessRecord app) { final ActivityRecord TOP_ACT = resumedAppLocked(); final ProcessRecord TOP_APP = TOP_ACT != null ? TOP_ACT.app : null; int curAdj = app.curAdj; @@ -13562,7 +13605,7 @@ public final class ActivityManagerService extends ActivityManagerNative mAdjSeq++; - updateOomAdjLocked(app, app.hiddenAdj, TOP_APP); + boolean success = updateOomAdjLocked(app, app.hiddenAdj, TOP_APP); final boolean nowHidden = app.curAdj >= ProcessList.HIDDEN_APP_MIN_ADJ && app.curAdj <= ProcessList.HIDDEN_APP_MAX_ADJ; if (nowHidden != wasHidden) { @@ -13570,6 +13613,7 @@ public final class ActivityManagerService extends ActivityManagerNative // list may also be changed. updateOomAdjLocked(); } + return success; } final void updateOomAdjLocked() { diff --git a/services/java/com/android/server/am/ProcessList.java b/services/java/com/android/server/am/ProcessList.java index dfcc0bfa254a..131255fbbc3d 100644 --- a/services/java/com/android/server/am/ProcessList.java +++ b/services/java/com/android/server/am/ProcessList.java @@ -163,7 +163,7 @@ class ProcessList { int minSize = 320*480; // 153600 int maxSize = 1280*800; // 1024000 230400 870400 .264 float scaleDisp = ((float)(displayWidth*displayHeight)-minSize)/(maxSize-minSize); - Slog.i("XXXXXX", "scaleDisp=" + scaleDisp + " dw=" + displayWidth + " dh=" + displayHeight); + //Slog.i("XXXXXX", "scaleDisp=" + scaleDisp + " dw=" + displayWidth + " dh=" + displayHeight); StringBuilder adjString = new StringBuilder(); StringBuilder memString = new StringBuilder(); diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java index c8671c1237c1..00fb0e0d1a72 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java @@ -576,7 +576,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { boolean allowed = (gprsState == ServiceState.STATE_IN_SERVICE || mAutoAttachOnCreation) && mPhone.mIccRecords.getRecordsLoaded() && - mPhone.getState() == Phone.State.IDLE && + (mPhone.getState() == Phone.State.IDLE || + mPhone.getServiceStateTracker().isConcurrentVoiceAndDataAllowed()) && internalDataEnabled && (!mPhone.getServiceState().getRoaming() || getDataOnRoamingEnabled()) && !mIsPsRestricted && @@ -587,8 +588,10 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { reason += " - gprs= " + gprsState; } if (!mPhone.mIccRecords.getRecordsLoaded()) reason += " - SIM not loaded"; - if (mPhone.getState() != Phone.State.IDLE) { + if (mPhone.getState() != Phone.State.IDLE && + !mPhone.getServiceStateTracker().isConcurrentVoiceAndDataAllowed()) { reason += " - PhoneState= " + mPhone.getState(); + reason += " - Concurrent voice and data not allowed"; } if (!internalDataEnabled) reason += " - mInternalDataEnabled= false"; if (mPhone.getServiceState().getRoaming() && !getDataOnRoamingEnabled()) { diff --git a/wifi/java/android/net/wifi/WifiConfigStore.java b/wifi/java/android/net/wifi/WifiConfigStore.java index 5b4bce2fb63c..45c98696c0da 100644 --- a/wifi/java/android/net/wifi/WifiConfigStore.java +++ b/wifi/java/android/net/wifi/WifiConfigStore.java @@ -281,7 +281,11 @@ class WifiConfigStore { if (WifiNative.removeNetworkCommand(netId)) { WifiNative.saveConfigCommand(); synchronized (sConfiguredNetworks) { - sConfiguredNetworks.remove(netId); + WifiConfiguration config = sConfiguredNetworks.get(netId); + if (config != null) { + sConfiguredNetworks.remove(netId); + sNetworkIds.remove(configKey(config)); + } } writeIpAndProxyConfigurations(); sendConfiguredNetworksChangedBroadcast(); @@ -315,7 +319,13 @@ class WifiConfigStore { static boolean removeNetwork(int netId) { boolean ret = WifiNative.removeNetworkCommand(netId); synchronized (sConfiguredNetworks) { - if (ret) sConfiguredNetworks.remove(netId); + if (ret) { + WifiConfiguration config = sConfiguredNetworks.get(netId); + if (config != null) { + sConfiguredNetworks.remove(netId); + sNetworkIds.remove(configKey(config)); + } + } } sendConfiguredNetworksChangedBroadcast(); return ret; @@ -854,18 +864,24 @@ class WifiConfigStore { * refer to an existing configuration. */ int netId = config.networkId; - boolean updateFailed = true; + boolean newNetwork = false; // networkId of INVALID_NETWORK_ID means we want to create a new network - boolean newNetwork = (netId == INVALID_NETWORK_ID); - - if (newNetwork) { - netId = WifiNative.addNetworkCommand(); - if (netId < 0) { - Log.e(TAG, "Failed to add a network!"); - return new NetworkUpdateResult(INVALID_NETWORK_ID); - } + if (netId == INVALID_NETWORK_ID) { + Integer savedNetId = sNetworkIds.get(configKey(config)); + if (savedNetId != null) { + netId = savedNetId; + } else { + newNetwork = true; + netId = WifiNative.addNetworkCommand(); + if (netId < 0) { + Log.e(TAG, "Failed to add a network!"); + return new NetworkUpdateResult(INVALID_NETWORK_ID); + } + } } + boolean updateFailed = true; + setVariables: { if (config.SSID != null && @@ -1053,12 +1069,15 @@ class WifiConfigStore { if (sConfig == null) { sConfig = new WifiConfiguration(); sConfig.networkId = netId; - synchronized (sConfiguredNetworks) { - sConfiguredNetworks.put(netId, sConfig); - } } + readNetworkVariables(sConfig); + synchronized (sConfiguredNetworks) { + sConfiguredNetworks.put(netId, sConfig); + sNetworkIds.put(configKey(sConfig), netId); + } + NetworkUpdateResult result = writeIpAndProxyConfigurationsOnChange(sConfig, config); result.setNetworkId(netId); return result; diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pService.java b/wifi/java/android/net/wifi/p2p/WifiP2pService.java index 9e0f124aa7e9..adf13be41cb0 100644 --- a/wifi/java/android/net/wifi/p2p/WifiP2pService.java +++ b/wifi/java/android/net/wifi/p2p/WifiP2pService.java @@ -129,6 +129,11 @@ public class WifiP2pService extends IWifiP2pManager.Stub { private NetworkInfo mNetworkInfo; + /* Is chosen as a unique range to avoid conflict with + the range defined in Tethering.java */ + private static final String[] DHCP_RANGE = {"192.168.49.2", "192.168.49.254"}; + private static final String SERVER_ADDRESS = "192.168.49.1"; + public WifiP2pService(Context context) { mContext = context; @@ -739,6 +744,12 @@ public class WifiP2pService extends IWifiP2pManager.Stub { public void enter() { if (DBG) logd(getName()); mNetworkInfo.setDetailedState(NetworkInfo.DetailedState.CONNECTED, null, null); + + //DHCP server has already been started if I am a group owner + if (mGroup.isGroupOwner()) { + setWifiP2pInfoOnGroupFormation(SERVER_ADDRESS); + sendP2pConnectionChangedBroadcast(); + } } @Override @@ -895,30 +906,22 @@ public class WifiP2pService extends IWifiP2pManager.Stub { } private void startDhcpServer(String intf) { - /* Is chosen as a unique range to avoid conflict with - the range defined in Tethering.java */ - String[] dhcp_range = {"192.168.49.2", "192.168.49.254"}; - String serverAddress = "192.168.49.1"; - InterfaceConfiguration ifcg = null; try { ifcg = mNwService.getInterfaceConfig(intf); ifcg.addr = new LinkAddress(NetworkUtils.numericToInetAddress( - serverAddress), 24); + SERVER_ADDRESS), 24); ifcg.interfaceFlags = "[up]"; mNwService.setInterfaceConfig(intf, ifcg); /* This starts the dnsmasq server */ - mNwService.startTethering(dhcp_range); + mNwService.startTethering(DHCP_RANGE); } catch (Exception e) { loge("Error configuring interface " + intf + ", :" + e); return; } logd("Started Dhcp server on " + intf); - - setWifiP2pInfoOnGroupFormation(serverAddress); - sendP2pConnectionChangedBroadcast(); - } + } private void stopDhcpServer() { try { |