diff options
45 files changed, 813 insertions, 446 deletions
diff --git a/Android.mk b/Android.mk index d92809a9ab7e..5034c7ef517a 100644 --- a/Android.mk +++ b/Android.mk @@ -208,6 +208,7 @@ aidl_files := \ frameworks/base/core/java/android/accounts/IAccountAuthenticatorResponse.aidl \ frameworks/base/core/java/android/app/Notification.aidl \ frameworks/base/core/java/android/app/PendingIntent.aidl \ + frameworks/base/core/java/android/bluetooth/BluetoothDevice.aidl \ frameworks/base/core/java/android/content/ComponentName.aidl \ frameworks/base/core/java/android/content/Intent.aidl \ frameworks/base/core/java/android/content/IntentSender.aidl \ diff --git a/api/5.xml b/api/5.xml index 614804708a48..73df0cbd1944 100644 --- a/api/5.xml +++ b/api/5.xml @@ -162357,17 +162357,6 @@ visibility="protected" > </field> -<field name="FLAG_USE_CHILD_DRAWING_ORDER" - type="int" - transient="false" - volatile="false" - value="1024" - static="true" - final="true" - deprecated="not deprecated" - visibility="protected" -> -</field> <field name="FOCUS_AFTER_DESCENDANTS" type="int" transient="false" diff --git a/api/current.xml b/api/current.xml index b4161ae2381e..e72a88c5aeb1 100644 --- a/api/current.xml +++ b/api/current.xml @@ -6389,6 +6389,72 @@ visibility="public" > </field> +<field name="quickContactBadgeStyleSmallWindowLarge" + type="int" + transient="false" + volatile="false" + value="16843443" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="quickContactBadgeStyleSmallWindowMedium" + type="int" + transient="false" + volatile="false" + value="16843442" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="quickContactBadgeStyleSmallWindowSmall" + type="int" + transient="false" + volatile="false" + value="16843441" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="quickContactBadgeStyleWindowLarge" + type="int" + transient="false" + volatile="false" + value="16843440" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="quickContactBadgeStyleWindowMedium" + type="int" + transient="false" + volatile="false" + value="16843439" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="quickContactBadgeStyleWindowSmall" + type="int" + transient="false" + volatile="false" + value="16843438" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="radioButtonStyle" type="int" transient="false" @@ -158042,6 +158108,17 @@ visibility="public" > </method> +<method name="isOpaque" + return="boolean" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> <method name="isPaddingOffsetRequired" return="boolean" abstract="false" @@ -161910,6 +161987,17 @@ visibility="public" > </method> +<method name="isChildrenDrawingOrderEnabled" + return="boolean" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="protected" +> +</method> <method name="isChildrenDrawnWithCacheEnabled" return="boolean" abstract="false" @@ -162293,6 +162381,19 @@ <parameter name="enabled" type="boolean"> </parameter> </method> +<method name="setChildrenDrawingOrderEnabled" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="protected" +> +<parameter name="enabled" type="boolean"> +</parameter> +</method> <method name="setChildrenDrawnWithCacheEnabled" return="void" abstract="false" @@ -162460,17 +162561,6 @@ visibility="protected" > </field> -<field name="FLAG_USE_CHILD_DRAWING_ORDER" - type="int" - transient="false" - volatile="false" - value="1024" - static="true" - final="true" - deprecated="not deprecated" - visibility="protected" -> -</field> <field name="FOCUS_AFTER_DESCENDANTS" type="int" transient="false" diff --git a/core/java/android/os/IHardwareService.aidl b/core/java/android/os/IHardwareService.aidl index 594c0e89b936..34f30a7d3304 100755 --- a/core/java/android/os/IHardwareService.aidl +++ b/core/java/android/os/IHardwareService.aidl @@ -1,16 +1,16 @@ /** * Copyright (c) 2007, 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 + * 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 + * 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 + * 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. */ @@ -23,13 +23,13 @@ interface IHardwareService void vibrate(long milliseconds, IBinder token); void vibratePattern(in long[] pattern, int repeat, IBinder token); void cancelVibrate(IBinder token); - + // flashlight support boolean getFlashlightEnabled(); void setFlashlightEnabled(boolean on); void enableCameraFlash(int milliseconds); // for the phone - void setAttentionLight(boolean on); + void setAttentionLight(boolean on, int color); } diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index eb3e52398825..ef306fec445f 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -4956,8 +4956,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility * invalidate/draw passes. * * @return True if this View is guaranteed to be fully opaque, false otherwise. - * - * @hide Pending API council approval */ @ViewDebug.ExportedProperty public boolean isOpaque() { diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index f7b7f029df82..e2f15c7b9e40 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -150,6 +150,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager /** * When set, the drawing method will call {@link #getChildDrawingOrder(int, int)} * to get the index of the child to draw for that iteration. + * + * @hide */ protected static final int FLAG_USE_CHILD_DRAWING_ORDER = 0x400; @@ -1307,11 +1309,14 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * if you want to change the drawing order of children. By default, it * returns i. * <p> - * NOTE: In order for this method to be called, the - * {@link #FLAG_USE_CHILD_DRAWING_ORDER} must be set. + * NOTE: In order for this method to be called, you must enable child ordering + * first by calling {@link #setChildrenDrawingOrderEnabled(boolean)}. * * @param i The current iteration. * @return The index of the child to draw this iteration. + * + * @see #setChildrenDrawingOrderEnabled(boolean) + * @see #isChildrenDrawingOrderEnabled() */ protected int getChildDrawingOrder(int childCount, int i) { return i; @@ -2706,6 +2711,35 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager setBooleanFlag(FLAG_CHILDREN_DRAWN_WITH_CACHE, enabled); } + /** + * Indicates whether the ViewGroup is drawing its children in the order defined by + * {@link #getChildDrawingOrder(int, int)}. + * + * @return true if children drawing order is defined by {@link #getChildDrawingOrder(int, int)}, + * false otherwise + * + * @see #setChildrenDrawingOrderEnabled(boolean) + * @see #getChildDrawingOrder(int, int) + */ + @ViewDebug.ExportedProperty + protected boolean isChildrenDrawingOrderEnabled() { + return (mGroupFlags & FLAG_USE_CHILD_DRAWING_ORDER) == FLAG_USE_CHILD_DRAWING_ORDER; + } + + /** + * Tells the ViewGroup whether to draw its children in the order defined by the method + * {@link #getChildDrawingOrder(int, int)}. + * + * @param enabled true if the order of the children when drawing is determined by + * {@link #getChildDrawingOrder(int, int)}, false otherwise + * + * @see #isChildrenDrawingOrderEnabled() + * @see #getChildDrawingOrder(int, int) + */ + protected void setChildrenDrawingOrderEnabled(boolean enabled) { + setBooleanFlag(FLAG_USE_CHILD_DRAWING_ORDER, enabled); + } + private void setBooleanFlag(int flag, boolean value) { if (value) { mGroupFlags |= flag; diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index bf3d26e075ed..596fd98e1338 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -3964,8 +3964,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener mHighlightPath = new Path(); if (selStart == selEnd) { - if ((SystemClock.uptimeMillis() - mShowCursor) % (2 * BLINK) - < BLINK) { + if ((SystemClock.uptimeMillis() - mShowCursor) % (2 * BLINK) < BLINK) { if (mHighlightPathBogus) { mHighlightPath.reset(); mLayout.getCursorPath(selStart, mHighlightPath, mText); @@ -5344,21 +5343,24 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * will happen at measure). */ makeNewLayout(want, hintWant, UNKNOWN_BORING, UNKNOWN_BORING, - mRight - mLeft - getCompoundPaddingLeft() - getCompoundPaddingRight(), false); + mRight - mLeft - getCompoundPaddingLeft() - getCompoundPaddingRight(), + false); - // In a fixed-height view, so use our new text layout. - if (mLayoutParams.height != LayoutParams.WRAP_CONTENT && - mLayoutParams.height != LayoutParams.FILL_PARENT) { - invalidate(); - return; - } - - // Dynamic height, but height has stayed the same, - // so use our new text layout. - if (mLayout.getHeight() == oldht && - (mHintLayout == null || mHintLayout.getHeight() == oldht)) { - invalidate(); - return; + if (mEllipsize != TextUtils.TruncateAt.MARQUEE) { + // In a fixed-height view, so use our new text layout. + if (mLayoutParams.height != LayoutParams.WRAP_CONTENT && + mLayoutParams.height != LayoutParams.FILL_PARENT) { + invalidate(); + return; + } + + // Dynamic height, but height has stayed the same, + // so use our new text layout. + if (mLayout.getHeight() == oldht && + (mHintLayout == null || mHintLayout.getHeight() == oldht)) { + invalidate(); + return; + } } // We lose: the height has changed and we have a dynamic height. diff --git a/core/jni/android_media_ToneGenerator.cpp b/core/jni/android_media_ToneGenerator.cpp index 07bb1abafd32..50aa967df38e 100644 --- a/core/jni/android_media_ToneGenerator.cpp +++ b/core/jni/android_media_ToneGenerator.cpp @@ -79,7 +79,7 @@ static void android_media_ToneGenerator_release(JNIEnv *env, jobject thiz) { static void android_media_ToneGenerator_native_setup(JNIEnv *env, jobject thiz, jint streamType, jint volume) { - ToneGenerator *lpToneGen = new ToneGenerator(streamType, AudioSystem::linearToLog(volume)); + ToneGenerator *lpToneGen = new ToneGenerator(streamType, AudioSystem::linearToLog(volume), true); env->SetIntField(thiz, fields.context, 0); diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index bfb25b873f9d..8aab59558546 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -14,6 +14,11 @@ limitations under the License. --> +<!-- Formatting note: terminate all comments with a period, to avoid breaking + the documentation output. To suppress comment lines from the documentation + output, insert an eat-comment element after the comment lines. +--> + <resources> <!-- These are the standard attributes that make up a complete theme. --> <declare-styleable name="Theme"> @@ -47,27 +52,27 @@ <!-- =========== --> <eat-comment /> - <!-- Default appearance of text: color, typeface, size, and style --> + <!-- Default appearance of text: color, typeface, size, and style. --> <attr name="textAppearance" format="reference" /> <!-- Default appearance of text against an inverted background: - color, typeface, size, and style --> + color, typeface, size, and style. --> <attr name="textAppearanceInverse" format="reference" /> - <!-- The most prominent text color, for the --> + <!-- The most prominent text color. --> <attr name="textColorPrimary" format="reference|color" /> - <!-- Secondary text color --> + <!-- Secondary text color. --> <attr name="textColorSecondary" format="reference|color" /> - <!-- Tertiary text color --> + <!-- Tertiary text color. --> <attr name="textColorTertiary" format="reference|color" /> - <!-- Primary inverse text color, useful for inverted backgrounds --> + <!-- Primary inverse text color, useful for inverted backgrounds. --> <attr name="textColorPrimaryInverse" format="reference|color" /> - <!-- Secondary inverse text color, useful for inverted backgrounds --> + <!-- Secondary inverse text color, useful for inverted backgrounds. --> <attr name="textColorSecondaryInverse" format="reference|color" /> - <!-- Tertiary inverse text color, useful for inverted backgrounds --> + <!-- Tertiary inverse text color, useful for inverted backgrounds. --> <attr name="textColorTertiaryInverse" format="reference|color" /> - <!-- Inverse hint text color --> + <!-- Inverse hint text color. --> <attr name="textColorHintInverse" format="reference|color" /> <!-- Bright text color. Only differentiates based on the disabled state. --> @@ -122,14 +127,14 @@ to the candidate text as it is edited. --> <attr name="candidatesTextStyleSpans" format="reference|string" /> - <!-- Drawable to use for check marks --> + <!-- Drawable to use for check marks. --> <attr name="textCheckMark" format="reference" /> <attr name="textCheckMarkInverse" format="reference" /> - <!-- Drawable to use for multiple choice indicators--> + <!-- Drawable to use for multiple choice indicators. --> <attr name="listChoiceIndicatorMultiple" format="reference" /> - <!-- Drawable to use for single choice indicators--> + <!-- Drawable to use for single choice indicators. --> <attr name="listChoiceIndicatorSingle" format="reference" /> <!-- ============= --> @@ -163,9 +168,9 @@ <!-- =========== --> <eat-comment /> - <!-- The preferred list item height --> + <!-- The preferred list item height. --> <attr name="listPreferredItemHeight" format="dimension" /> - <!-- The drawable for the list divider --> + <!-- The drawable for the list divider. --> <!-- The list item height for search results. @hide --> <attr name="searchResultListItemHeight" format="dimension" /> <attr name="listDivider" format="reference" /> @@ -341,9 +346,9 @@ <attr name="gestureOverlayViewStyle" format="reference" /> <!-- Default GridView style. --> <attr name="gridViewStyle" format="reference" /> - <!-- The style resource to use for an ImageButton --> + <!-- The style resource to use for an ImageButton. --> <attr name="imageButtonStyle" format="reference" /> - <!-- The style resource to use for an ImageButton that is an image well --> + <!-- The style resource to use for an ImageButton that is an image well. --> <attr name="imageWellStyle" format="reference" /> <!-- Default ListView style. --> <attr name="listViewStyle" format="reference" /> @@ -747,21 +752,21 @@ automatically found and converted to clickable links. The default value is "none", disabling this feature. --> <attr name="autoLink"> - <!-- Match no patterns (default) --> + <!-- Match no patterns (default). --> <flag name="none" value="0x00" /> - <!-- Match Web URLs --> + <!-- Match Web URLs. --> <flag name="web" value="0x01" /> - <!-- Match email addresses --> + <!-- Match email addresses. --> <flag name="email" value="0x02" /> - <!-- Match phone numbers --> + <!-- Match phone numbers. --> <flag name="phone" value="0x04" /> - <!-- Match map addresses --> + <!-- Match map addresses. --> <flag name="map" value="0x08" /> - <!-- Match all patterns (equivalent to web|email|phone|map) --> + <!-- Match all patterns (equivalent to web|email|phone|map). --> <flag name="all" value="0x0f" /> </attr> - <!-- Reference to an array resource that will populate a list/adapter --> + <!-- Reference to an array resource that will populate a list/adapter. --> <attr name="entries" format="reference" /> <!-- Standard gravity constant that a child can supply to its parent. @@ -813,7 +818,7 @@ <eat-comment /> <!-- This enum provides the same keycode values as can be found in - {@link android.view.KeyEvent} --> + {@link android.view.KeyEvent}. --> <attr name="keycode"> <enum name="KEYCODE_UNKNOWN" value="0" /> <enum name="KEYCODE_SOFT_LEFT" value="1" /> @@ -1185,7 +1190,7 @@ <attr name="scrollbarTrackVertical" format="reference" /> <!-- Defines whether the horizontal scrollbar track should always be drawn. --> <attr name="scrollbarAlwaysDrawHorizontalTrack" format="boolean" /> - <!-- Defines whether the vertical scrollbar track should always be drawn --> + <!-- Defines whether the vertical scrollbar track should always be drawn. --> <attr name="scrollbarAlwaysDrawVerticalTrack" format="boolean" /> <!-- Defines which edges should be fadeded on scrolling. --> @@ -1296,7 +1301,7 @@ exactly one parameter of type View. For instance, if you specify <code>android:onClick="sayHello"</code>, you must declare a <code>public void sayHello(View v)</code> method of your context - (typically, your Activity.)--> + (typically, your Activity). --> <attr name="onClick" format="string" /> </declare-styleable> @@ -1467,7 +1472,7 @@ value is true. --> <attr name="scrollingCache" format="boolean" /> <!-- When set to true, the list will filter results as the user types. The - List's adapter must support the Filterable interface for this to work --> + List's adapter must support the Filterable interface for this to work. --> <attr name="textFilterEnabled" format="boolean" /> <!-- Sets the transcript mode for the list. In transcript mode, the list scrolls to the bottom to make new items visible when they are added. --> @@ -1519,15 +1524,15 @@ <attr name="format" format="string" localization="suggested" /> </declare-styleable> <declare-styleable name="CompoundButton"> - <!-- Indicates the initial checked state of this button --> + <!-- Indicates the initial checked state of this button. --> <attr name="checked" format="boolean" /> <!-- Drawable used for the button graphic (e.g. checkbox, radio button, etc). --> <attr name="button" format="reference"/> </declare-styleable> <declare-styleable name="CheckedTextView"> - <!-- Indicates the initial checked state of this text --> + <!-- Indicates the initial checked state of this text. --> <attr name="checked" /> - <!-- Drawable used for the check mark graphic --> + <!-- Drawable used for the check mark graphic. --> <attr name="checkMark" format="reference"/> </declare-styleable> <declare-styleable name="EditText"> @@ -1648,12 +1653,12 @@ <!-- An optional argument to supply a maximum height for this view. See {see android.widget.ImageView#setMaxHeight} for details. --> <attr name="maxHeight" format="dimension" /> - <!-- Set a tinting color for the image --> + <!-- Set a tinting color for the image. --> <attr name="tint" format="color" /> <!-- If true, the image view will be baseline aligned with based on its - bottom edge --> + bottom edge. --> <attr name="baselineAlignBottom" format="boolean" /> - <!-- If true, the image will be cropped to fit within its padding --> + <!-- If true, the image will be cropped to fit within its padding. --> <attr name="cropToPadding" format="boolean" /> </declare-styleable> <declare-styleable name="ToggleButton"> @@ -1681,7 +1686,7 @@ <attr name="baselineAligned" format="boolean" /> <!-- When a linear layout is part of another layout that is baseline aligned, it can specify which of its children to baseline align to - (i.e which child TextView).--> + (that is, which child TextView).--> <attr name="baselineAlignedChildIndex" format="integer" min="0"/> <!-- Defines the maximum weight sum. If unspecified, the sum is computed by adding the layout_weight of all of the children. This can be @@ -1704,11 +1709,11 @@ allows up to one item to be in a chosen state. By setting the choiceMode to multipleChoice, the list allows any number of items to be chosen. --> <attr name="choiceMode"> - <!-- Normal list that does not indicate choices --> + <!-- Normal list that does not indicate choices. --> <enum name="none" value="0" /> - <!-- The list allows up to one choice --> + <!-- The list allows up to one choice. --> <enum name="singleChoice" value="1" /> - <!-- The list allows multiple choices --> + <!-- The list allows multiple choices. --> <enum name="multipleChoice" value="2" /> </attr> <!-- When set to false, the ListView will not draw the divider after each header view. @@ -1729,7 +1734,7 @@ <attr name="headerBackground" format="color|reference" /> <!-- Default background for each menu item. --> <attr name="itemBackground" format="color|reference" /> - <!-- Default animations for the menu --> + <!-- Default animations for the menu. --> <attr name="windowAnimationStyle" /> <!-- Default disabled icon alpha for each menu item that shows an icon. --> <attr name="itemIconDisabledAlpha" format="float" /> @@ -1743,7 +1748,7 @@ <attr name="maxItemsPerRow" format="integer" /> <!-- Defines the maximum number of items to show. --> <attr name="maxItems" format="integer" /> - <!-- 'More' icon --> + <!-- 'More' icon. --> <attr name="moreIcon" format="reference" /> </declare-styleable> @@ -1783,7 +1788,7 @@ </declare-styleable> <declare-styleable name="SeekBar"> - <!-- Draws the thumb on a seekbar --> + <!-- Draws the thumb on a seekbar. --> <attr name="thumb" format="reference" /> <!-- An offset for the thumb that allows it to extend out of the range of the track. --> <attr name="thumbOffset" format="dimension" /> @@ -1810,19 +1815,19 @@ <attr name="orientation" /> </declare-styleable> <declare-styleable name="TableLayout"> - <!-- The 0 based index of the columns to stretch. The column indices + <!-- The zero-based index of the columns to stretch. The column indices must be separated by a comma: 1, 2, 5. Illegal and duplicate indices are ignored. You can stretch all columns by using the value "*" instead. Note that a column can be marked stretchable and shrinkable at the same time. --> <attr name="stretchColumns" format="string" /> - <!-- The 0 based index of the columns to shrink. The column indices + <!-- The zero-based index of the columns to shrink. The column indices must be separated by a comma: 1, 2, 5. Illegal and duplicate indices are ignored. You can shrink all columns by using the value "*" instead. Note that a column can be marked stretchable and shrinkable at the same time. --> <attr name="shrinkColumns" format="string" /> - <!-- The 0 based index of the columns to collapse. The column indices + <!-- The zero-based index of the columns to collapse. The column indices must be separated by a comma: 1, 2, 5. Illegal and duplicate indices are ignored. --> <attr name="collapseColumns" format="string" /> @@ -1884,7 +1889,7 @@ <attr name="textAppearance" /> <!-- Size of the text. Recommended dimension type for text is "sp" for scaled-pixels (example: 15sp). --> <attr name="textSize" /> - <!-- Sets the horizontal scaling factor for the text --> + <!-- Sets the horizontal scaling factor for the text. --> <attr name="textScaleX" format="float" /> <!-- Typeface (normal, sans, serif, monospace) for the text. --> <attr name="typeface" /> @@ -1892,35 +1897,35 @@ <attr name="textStyle" /> <!-- Text color for links. --> <attr name="textColorLink" /> - <!-- Makes the cursor visible (the default) or invisible --> + <!-- Makes the cursor visible (the default) or invisible. --> <attr name="cursorVisible" format="boolean" /> - <!-- Makes the TextView be at most this many lines tall --> + <!-- Makes the TextView be at most this many lines tall. --> <attr name="maxLines" format="integer" min="0" /> - <!-- Makes the TextView be at most this many pixels tall --> + <!-- Makes the TextView be at most this many pixels tall. --> <attr name="maxHeight" /> - <!-- Makes the TextView be exactly this many lines tall --> + <!-- Makes the TextView be exactly this many lines tall. --> <attr name="lines" format="integer" min="0" /> <!-- Makes the TextView be exactly this many pixels tall. You could get the same effect by specifying this number in the layout parameters. --> <attr name="height" format="dimension" /> - <!-- Makes the TextView be at least this many lines tall --> + <!-- Makes the TextView be at least this many lines tall. --> <attr name="minLines" format="integer" min="0" /> - <!-- Makes the TextView be at least this many pixels tall --> + <!-- Makes the TextView be at least this many pixels tall. --> <attr name="minHeight" /> - <!-- Makes the TextView be at most this many ems wide --> + <!-- Makes the TextView be at most this many ems wide. --> <attr name="maxEms" format="integer" min="0" /> - <!-- Makes the TextView be at most this many pixels wide --> + <!-- Makes the TextView be at most this many pixels wide. --> <attr name="maxWidth" /> - <!-- Makes the TextView be exactly this many ems wide --> + <!-- Makes the TextView be exactly this many ems wide. --> <attr name="ems" format="integer" min="0" /> <!-- Makes the TextView be exactly this many pixels wide. You could get the same effect by specifying this number in the layout parameters. --> <attr name="width" format="dimension" /> - <!-- Makes the TextView be at least this many ems wide --> + <!-- Makes the TextView be at least this many ems wide. --> <attr name="minEms" format="integer" min="0" /> - <!-- Makes the TextView be at least this many pixels wide --> + <!-- Makes the TextView be at least this many pixels wide. --> <attr name="minWidth" /> <!-- Specifies how to align the text by the view's x- and/or y-axis when the text is smaller than the view. --> @@ -1946,7 +1951,7 @@ inputType attributes are found, the inputType flags will override the value of singleLine.) } --> <attr name="singleLine" format="boolean" /> - <!-- {@deprecated Use state_enabled instead.} --> + <!-- Specifies whether the TextView is enabled or not. {@deprecated Use state_enabled instead}. --> <attr name="enabled" format="boolean" /> <!-- If the text is selectable, select it all when the view takes focus instead of moving the cursor to the start or end. --> @@ -2050,7 +2055,7 @@ <!-- The number of times to repeat the marquee animation. Only applied if the TextView has marquee enabled. --> <attr name="marqueeRepeatLimit" format="integer"> - <!-- Indicates that marquee should repeat indefinitely --> + <!-- Indicates that marquee should repeat indefinitely. --> <enum name="marquee_forever" value="-1" /> </attr> <attr name="inputType" /> @@ -2149,9 +2154,9 @@ <attr name="prompt" format="reference" /> </declare-styleable> <declare-styleable name="DatePicker"> - <!-- The first year (inclusive) i.e. 1940 --> + <!-- The first year (inclusive), for example "1940". --> <attr name="startYear" format="integer" /> - <!-- The last year (inclusive) i.e. 2010 --> + <!-- The last year (inclusive), for example "2010". --> <attr name="endYear" format="integer" /> </declare-styleable> @@ -2160,7 +2165,7 @@ <!-- Always show only the first line. --> <enum name="oneLine" value="1" /> <!-- When selected show both lines, otherwise show only the first line. - This is the default mode--> + This is the default mode. --> <enum name="collapsing" value="2" /> <!-- Always show both lines. --> <enum name="twoLine" value="3" /> @@ -2323,7 +2328,7 @@ <declare-styleable name="Drawable"> <!-- Provides initial visibility state of the drawable; the default value is false. See - {@link android.graphics.drawable.Drawable#setVisible} --> + {@link android.graphics.drawable.Drawable#setVisible}. --> <attr name="visible" format="boolean" /> </declare-styleable> @@ -2343,7 +2348,7 @@ <attr name="constantSize" format="boolean" /> <!-- Enables or disables dithering of the bitmap if the bitmap does not have the same pixel configuration as the screen (for instance: a ARGB 8888 bitmap with - an RGB 565 screen.) --> + an RGB 565 screen). --> <attr name="dither" format="boolean" /> </declare-styleable> @@ -2490,7 +2495,7 @@ <attr name="filter" format="boolean" /> <!-- Enables or disables dithering of the bitmap if the bitmap does not have the same pixel configuration as the screen (for instance: a ARGB 8888 bitmap with - an RGB 565 screen.) --> + an RGB 565 screen). --> <attr name="dither" /> <!-- Defines the gravity for the bitmap. The gravity indicates where to position the drawable in its container if the bitmap is smaller than the container. --> @@ -2516,7 +2521,7 @@ <attr name="src" /> <!-- Enables or disables dithering of the bitmap if the bitmap does not have the same pixel configuration as the screen (for instance: a ARGB 8888 bitmap with - an RGB 565 screen.) --> + an RGB 565 screen). --> <attr name="dither" /> </declare-styleable> @@ -3350,7 +3355,7 @@ <!-- Size of the text for custom keys with some text and no icon. --> <attr name="labelTextSize" format="dimension" /> - <!-- Color to use for the label in a key --> + <!-- Color to use for the label in a key. --> <attr name="keyTextColor" format="color" /> <!-- Layout resource for key press feedback.--> @@ -3365,7 +3370,7 @@ <!-- Amount to offset the touch Y coordinate by, for bias correction. --> <attr name="verticalCorrection" format="dimension" /> - <!-- Layout resource for popup keyboards --> + <!-- Layout resource for popup keyboards. --> <attr name="popupLayout" format="reference" /> <attr name="shadowColor" /> @@ -3374,74 +3379,75 @@ <declare-styleable name="KeyboardViewPreviewState"> <!-- State for {@link android.inputmethodservice.KeyboardView KeyboardView} - key preview background --> + key preview background. --> <attr name="state_long_pressable" format="boolean" /> </declare-styleable> <declare-styleable name="Keyboard"> - <!-- Default width of a key, in pixels or percentage of display width --> + <!-- Default width of a key, in pixels or percentage of display width. --> <attr name="keyWidth" format="dimension|fraction" /> - <!-- Default height of a key, in pixels or percentage of display width --> + <!-- Default height of a key, in pixels or percentage of display width. --> <attr name="keyHeight" format="dimension|fraction" /> - <!-- Default horizontal gap between keys --> + <!-- Default horizontal gap between keys. --> <attr name="horizontalGap" format="dimension|fraction" /> - <!-- Default vertical gap between rows of keys --> + <!-- Default vertical gap between rows of keys. --> <attr name="verticalGap" format="dimension|fraction" /> </declare-styleable> <declare-styleable name="Keyboard_Row"> - <!-- Row edge flags--> + <!-- Row edge flags. --> <attr name="rowEdgeFlags"> - <!-- Row is anchored to the top of the keyboard --> + <!-- Row is anchored to the top of the keyboard. --> <flag name="top" value="4" /> - <!-- Row is anchored to the bottom of the keyboard --> + <!-- Row is anchored to the bottom of the keyboard. --> <flag name="bottom" value="8" /> </attr> <!-- Mode of the keyboard. If the mode doesn't match the - requested keyboard mode, the row will be skipped --> + requested keyboard mode, the row will be skipped. --> <attr name="keyboardMode" format="reference" /> </declare-styleable> <declare-styleable name="Keyboard_Key"> - <!-- The unicode value or comma-separated values that this key outputs --> + <!-- The unicode value or comma-separated values that this key outputs. --> <attr name="codes" format="integer|string" /> - <!-- The XML keyboard layout of any popup keyboard --> + <!-- The XML keyboard layout of any popup keyboard. --> <attr name="popupKeyboard" format="reference" /> - <!-- The characters to display in the popup keyboard --> + <!-- The characters to display in the popup keyboard. --> <attr name="popupCharacters" format="string" /> - <!-- Key edge flags --> + <!-- Key edge flags. --> <attr name="keyEdgeFlags"> - <!-- Key is anchored to the left of the keyboard --> + <!-- Key is anchored to the left of the keyboard. --> <flag name="left" value="1" /> - <!-- Key is anchored to the right of the keyboard --> + <!-- Key is anchored to the right of the keyboard. --> <flag name="right" value="2" /> </attr> - <!-- Whether this is a modifier key such as Alt or Shift --> + <!-- Whether this is a modifier key such as Alt or Shift. --> <attr name="isModifier" format="boolean" /> - <!-- Whether this is a toggle key --> + <!-- Whether this is a toggle key. --> <attr name="isSticky" format="boolean" /> - <!-- Whether long-pressing on this key will make it repeat --> + <!-- Whether long-pressing on this key will make it repeat. --> <attr name="isRepeatable" format="boolean" /> - <!-- The icon to show in the popup preview --> + <!-- The icon to show in the popup preview. --> <attr name="iconPreview" format="reference" /> - <!-- The string of characters to output when this key is pressed --> + <!-- The string of characters to output when this key is pressed. --> <attr name="keyOutputText" format="string" /> - <!-- The label to display on the key --> + <!-- The label to display on the key. --> <attr name="keyLabel" format="string" /> - <!-- The icon to display on the key instead of the label --> + <!-- The icon to display on the key instead of the label. --> <attr name="keyIcon" format="reference" /> <!-- Mode of the keyboard. If the mode doesn't match the - requested keyboard mode, the key will be skipped --> + requested keyboard mode, the key will be skipped. --> <attr name="keyboardMode" /> </declare-styleable> <!-- =============================== --> <!-- AppWidget package class attributes --> <!-- =============================== --> - + <eat-comment /> + <!-- Use <code>appwidget-provider</code> as the root tag of the XML resource that - describes an AppWidget provider. See TODO android.appwidget package - for more info. + describes an AppWidget provider. See {@link android.appwidget android.appwidget} + package for more info. --> <declare-styleable name="AppWidgetProviderInfo"> <!-- Minimum width of the AppWidget. --> @@ -3460,7 +3466,8 @@ <!-- =============================== --> <!-- App package class attributes --> <!-- =============================== --> - + <eat-comment /> + <!-- Use <code>wallpaper</code> as the root tag of the XML resource that describes an {@link android.service.wallpaper.WallpaperService}, which is @@ -3481,27 +3488,29 @@ <!-- =============================== --> <!-- Accounts package class attributes --> <!-- =============================== --> - + <eat-comment /> + <!-- Use <code>account-authenticator</code> as the root tag of the XML resource that describes an account authenticator. --> <declare-styleable name="AccountAuthenticator"> - <!-- the account type this authenticator handles. --> + <!-- The account type this authenticator handles. --> <attr name="accountType" format="string"/> - <!-- the user-visible name of the authenticator. --> + <!-- The user-visible name of the authenticator. --> <attr name="label"/> - <!-- the icon of the authenticator. --> + <!-- The icon of the authenticator. --> <attr name="icon"/> - <!-- smaller icon of the authenticator --> + <!-- Smaller icon of the authenticator. --> <attr name="smallIcon" format="reference"/> - <!-- a preferences.xml file for authenticator-specific settings --> + <!-- A preferences.xml file for authenticator-specific settings. --> <attr name="accountPreferences" format="reference"/> </declare-styleable> <!-- =============================== --> <!-- Accounts package class attributes --> <!-- =============================== --> - + <eat-comment /> + <!-- Use <code>account-authenticator</code> as the root tag of the XML resource that describes an account authenticator. --> @@ -3516,29 +3525,32 @@ <!-- =============================== --> <!-- Contacts meta-data attributes --> <!-- =============================== --> - - <!-- TODO: remove this deprecated styleable --> + <eat-comment /> + + <!-- TODO: remove this deprecated styleable. --> + <eat-comment /> <declare-styleable name="Icon"> <attr name="icon" /> <attr name="mimeType" /> </declare-styleable> <!-- TODO: remove this deprecated styleable --> + <eat-comment /> <declare-styleable name="IconDefault"> <attr name="icon" /> </declare-styleable> - <!-- Maps a specific contact data MIME-type to styling information --> + <!-- Maps a specific contact data MIME-type to styling information. --> <declare-styleable name="ContactsDataKind"> - <!-- Mime-type handled by this mapping --> + <!-- Mime-type handled by this mapping. --> <attr name="mimeType" /> - <!-- Icon used to represent data of this kind --> + <!-- Icon used to represent data of this kind. --> <attr name="icon" /> - <!-- Column in data table that summarizes this data --> + <!-- Column in data table that summarizes this data. --> <attr name="summaryColumn" format="string" /> - <!-- Column in data table that contains details for this data --> + <!-- Column in data table that contains details for this data. --> <attr name="detailColumn" format="string" /> - <!-- Flag indicating that detail should be built from SocialProvider --> + <!-- Flag indicating that detail should be built from SocialProvider. --> <attr name="detailSocialSummary" format="boolean" /> </declare-styleable> diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml index 85f5ce315c0d..4a3da11f1cb8 100644 --- a/core/res/res/values/attrs_manifest.xml +++ b/core/res/res/values/attrs_manifest.xml @@ -661,7 +661,7 @@ for normal behavior. --> <attr name="hasCode" format="boolean" /> <attr name="persistent" /> - <!-- Specify whether the components in this application are enabled or not (i.e. can be + <!-- Specify whether the components in this application are enabled or not (that is, can be instantiated by the system). If "false", it overrides any component specific values (a value of "true" will not override the component specific values). --> @@ -929,7 +929,7 @@ <declare-styleable name="AndroidManifestProvider" parent="AndroidManifestApplication"> <!-- Required name of the class implementing the provider, deriving from {@link android.content.ContentProvider}. This is a fully - qualified class name (i.e., com.mycompany.myapp.MyProvider); as a + qualified class name (for example, com.mycompany.myapp.MyProvider); as a short-hand if the first character of the class is a period then it is appended to your package name. --> <attr name="name" /> @@ -944,7 +944,7 @@ <attr name="permission" /> <attr name="multiprocess" /> <attr name="initOrder" /> - <!-- Specify whether this provider is enabled or not (i.e. can be instantiated by the system). + <!-- Specify whether this provider is enabled or not (that is, can be instantiated by the system). It can also be specified for an application as a whole, in which case a value of "false" will override any component specific values (a value of "true" will not override the component specific values). --> @@ -1007,7 +1007,7 @@ <declare-styleable name="AndroidManifestService" parent="AndroidManifestApplication"> <!-- Required name of the class implementing the service, deriving from {@link android.app.Service}. This is a fully - qualified class name (i.e., com.mycompany.myapp.MyService); as a + qualified class name (for example, com.mycompany.myapp.MyService); as a short-hand if the first character of the class is a period then it is appended to your package name. --> <attr name="name" /> @@ -1015,7 +1015,7 @@ <attr name="icon" /> <attr name="permission" /> <attr name="process" /> - <!-- Specify whether the service is enabled or not (i.e. can be instantiated by the system). + <!-- Specify whether the service is enabled or not (that is, can be instantiated by the system). It can also be specified for an application as a whole, in which case a value of "false" will override any component specific values (a value of "true" will not override the component specific values). --> @@ -1038,7 +1038,7 @@ <declare-styleable name="AndroidManifestReceiver" parent="AndroidManifestApplication"> <!-- Required name of the class implementing the receiver, deriving from {@link android.content.BroadcastReceiver}. This is a fully - qualified class name (i.e., com.mycompany.myapp.MyReceiver); as a + qualified class name (for example, com.mycompany.myapp.MyReceiver); as a short-hand if the first character of the class is a period then it is appended to your package name. --> <attr name="name" /> @@ -1046,7 +1046,7 @@ <attr name="icon" /> <attr name="permission" /> <attr name="process" /> - <!-- Specify whether the receiver is enabled or not (i.e. can be instantiated by the system). + <!-- Specify whether the receiver is enabled or not (that is, can be instantiated by the system). It can also be specified for an application as a whole, in which case a value of "false" will override any component specific values (a value of "true" will not override the component specific values). --> @@ -1068,7 +1068,7 @@ <declare-styleable name="AndroidManifestActivity" parent="AndroidManifestApplication"> <!-- Required name of the class implementing the activity, deriving from {@link android.app.Activity}. This is a fully - qualified class name (i.e., com.mycompany.myapp.MyActivity); as a + qualified class name (for example, com.mycompany.myapp.MyActivity); as a short-hand if the first character of the class is a period then it is appended to your package name. --> <attr name="name" /> @@ -1090,7 +1090,7 @@ <attr name="alwaysRetainTaskState" /> <attr name="stateNotNeeded" /> <attr name="excludeFromRecents" /> - <!-- Specify whether the activity is enabled or not (i.e. can be instantiated by the system). + <!-- Specify whether the activity is enabled or not (that is, can be instantiated by the system). It can also be specified for an application as a whole, in which case a value of "false" will override any component specific values (a value of "true" will not override the component specific values). --> @@ -1115,7 +1115,7 @@ <declare-styleable name="AndroidManifestActivityAlias" parent="AndroidManifestApplication"> <!-- Required name of the class implementing the activity, deriving from {@link android.app.Activity}. This is a fully - qualified class name (i.e., com.mycompany.myapp.MyActivity); as a + qualified class name (for example, com.mycompany.myapp.MyActivity); as a short-hand if the first character of the class is a period then it is appended to your package name. --> <attr name="name" /> @@ -1128,7 +1128,7 @@ <attr name="label" /> <attr name="icon" /> <attr name="permission" /> - <!-- Specify whether the activity-alias is enabled or not (i.e. can be instantiated by the system). + <!-- Specify whether the activity-alias is enabled or not (that is, can be instantiated by the system). It can also be specified for an application as a whole, in which case a value of "false" will override any component specific values (a value of "true" will not override the component specific values). --> @@ -1295,7 +1295,7 @@ <declare-styleable name="AndroidManifestInstrumentation" parent="AndroidManifest"> <!-- Required name of the class implementing the instrumentation, deriving from {@link android.app.Instrumentation}. This is a fully - qualified class name (i.e., com.mycompany.myapp.MyActivity); as a + qualified class name (for example, com.mycompany.myapp.MyActivity); as a short-hand if the first character of the class is a period then it is appended to your package name. --> <attr name="name" /> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 52e3200211eb..a0b56101b943 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -1194,4 +1194,12 @@ <public type="drawable" name="screen_background_dark_transparent" /> <public type="drawable" name="screen_background_light_transparent" /> <public type="drawable" name="stat_notify_sdcard_prepare" /> + + <public type="attr" name="quickContactBadgeStyleWindowSmall" /> + <public type="attr" name="quickContactBadgeStyleWindowMedium" /> + <public type="attr" name="quickContactBadgeStyleWindowLarge" /> + <public type="attr" name="quickContactBadgeStyleSmallWindowSmall" /> + <public type="attr" name="quickContactBadgeStyleSmallWindowMedium" /> + <public type="attr" name="quickContactBadgeStyleSmallWindowLarge" /> + </resources> diff --git a/graphics/java/android/renderscript/RSSurfaceView.java b/graphics/java/android/renderscript/RSSurfaceView.java index 53466cc5f0b9..1bc03ac34382 100644 --- a/graphics/java/android/renderscript/RSSurfaceView.java +++ b/graphics/java/android/renderscript/RSSurfaceView.java @@ -80,6 +80,9 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback */ public void surfaceDestroyed(SurfaceHolder holder) { // Surface will be destroyed when we return + if (mRS != null) { + mRS.contextSetSurface(null); + } //Log.v(RenderScript.LOG_TAG, "surfaceDestroyed"); } @@ -88,6 +91,9 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback * not normally called or subclassed by clients of RSSurfaceView. */ public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { + if (mRS != null) { + mRS.contextSetSurface(holder.getSurface()); + } //Log.v(RenderScript.LOG_TAG, "surfaceChanged"); } diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java index 1f2ea38faf9c..f1e5af1eb540 100644 --- a/graphics/java/android/renderscript/RenderScript.java +++ b/graphics/java/android/renderscript/RenderScript.java @@ -64,6 +64,7 @@ public class RenderScript { native void nDeviceSetConfig(int dev, int param, int value); native int nContextCreate(int dev, Surface sur, int ver, boolean useDepth); native void nContextDestroy(int con); + native void nContextSetSurface(Surface sur); native void nContextBindRootScript(int script); native void nContextBindSampler(int sampler, int slot); @@ -276,6 +277,11 @@ public class RenderScript { mMessageThread.start(); } + public void contextSetSurface(Surface sur) { + mSurface = sur; + nContextSetSurface(mSurface); + } + public void destroy() { nContextDeinitToClient(); mMessageThread.mRun = false; diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp index fa3baa200fe3..f3dda417e064 100644 --- a/graphics/jni/android_renderscript_RenderScript.cpp +++ b/graphics/jni/android_renderscript_RenderScript.cpp @@ -171,6 +171,24 @@ nContextCreate(JNIEnv *_env, jobject _this, jint dev, jobject wnd, jint ver, jbo } static void +nContextSetSurface(JNIEnv *_env, jobject _this, jobject wnd) +{ + RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); + LOG_API("nContextSetSurface, con(%p), surface(%p)", con, (Surface *)wnd); + + Surface * window = NULL; + if (wnd == NULL) { + + } else { + jclass surface_class = _env->FindClass("android/view/Surface"); + jfieldID surfaceFieldID = _env->GetFieldID(surface_class, "mSurface", "I"); + window = (Surface*)_env->GetIntField(wnd, surfaceFieldID); + } + + rsContextSetSurface(con, window); +} + +static void nContextDestroy(JNIEnv *_env, jobject _this, jint con) { LOG_API("nContextDestroy, con(%p)", (RsContext)con); @@ -1328,6 +1346,7 @@ static JNINativeMethod methods[] = { {"nDeviceDestroy", "(I)V", (void*)nDeviceDestroy }, {"nDeviceSetConfig", "(III)V", (void*)nDeviceSetConfig }, {"nContextCreate", "(ILandroid/view/Surface;IZ)I", (void*)nContextCreate }, +{"nContextSetSurface", "(Landroid/view/Surface;)V", (void*)nContextSetSurface }, {"nContextDestroy", "(I)V", (void*)nContextDestroy }, {"nContextPause", "()V", (void*)nContextPause }, {"nContextResume", "()V", (void*)nContextResume }, diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h index 503cb315246f..008468c91b09 100644 --- a/include/media/AudioRecord.h +++ b/include/media/AudioRecord.h @@ -314,6 +314,11 @@ private: }; bool processAudioBuffer(const sp<ClientRecordThread>& thread); + status_t openRecord(uint32_t sampleRate, + int format, + int channelCount, + int frameCount, + uint32_t flags); sp<IAudioRecord> mAudioRecord; sp<IMemory> mCblkMemory; @@ -341,6 +346,7 @@ private: uint32_t mNewPosition; uint32_t mUpdatePeriod; audio_io_handle_t mInput; + uint32_t mFlags; }; }; // namespace android diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h index 981c2f6b696c..14b30ae9cba4 100644 --- a/include/media/AudioTrack.h +++ b/include/media/AudioTrack.h @@ -391,6 +391,14 @@ private: }; bool processAudioBuffer(const sp<AudioTrackThread>& thread); + status_t createTrack(int streamType, + uint32_t sampleRate, + int format, + int channelCount, + int frameCount, + uint32_t flags, + const sp<IMemory>& sharedBuffer, + audio_io_handle_t output); sp<IAudioTrack> mAudioTrack; sp<IMemory> mCblkMemory; diff --git a/include/media/ToneGenerator.h b/include/media/ToneGenerator.h index c884c2c5b16a..1ad1f26e108a 100644 --- a/include/media/ToneGenerator.h +++ b/include/media/ToneGenerator.h @@ -151,7 +151,7 @@ public: NUM_SUP_TONES = LAST_SUP_TONE-FIRST_SUP_TONE+1 }; - ToneGenerator(int streamType, float volume); + ToneGenerator(int streamType, float volume, bool threadCanCallJava = false); ~ToneGenerator(); bool startTone(int toneType, int durationMs = -1); @@ -242,6 +242,7 @@ private: static const ToneDescriptor sToneDescriptors[]; + bool mThreadCanCallJava; unsigned int mTotalSmp; // Total number of audio samples played (gives current time) unsigned int mNextSegSmp; // Position of next segment transition expressed in samples // NOTE: because mTotalSmp, mNextSegSmp are stored on 32 bit, current design will operate properly diff --git a/include/media/mediarecorder.h b/include/media/mediarecorder.h index d8ab63d6092f..8c7392b026f4 100644 --- a/include/media/mediarecorder.h +++ b/include/media/mediarecorder.h @@ -42,7 +42,8 @@ enum audio_source { AUDIO_SOURCE_VOICE_DOWNLINK = 3, AUDIO_SOURCE_VOICE_CALL = 4, AUDIO_SOURCE_CAMCORDER = 5, - AUDIO_SOURCE_MAX = AUDIO_SOURCE_CAMCORDER, + AUDIO_SOURCE_VOICE_RECOGNITION = 6, + AUDIO_SOURCE_MAX = AUDIO_SOURCE_VOICE_RECOGNITION, AUDIO_SOURCE_LIST_END // must be last - used to validate audio source type }; diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp index c371a23b85f4..d474571bebc7 100644 --- a/libs/binder/IPCThreadState.cpp +++ b/libs/binder/IPCThreadState.cpp @@ -14,10 +14,13 @@ * limitations under the License. */ +#define LOG_TAG "IPCThreadState" + #include <binder/IPCThreadState.h> #include <binder/Binder.h> #include <binder/BpBinder.h> +#include <cutils/sched_policy.h> #include <utils/Debug.h> #include <utils/Log.h> #include <utils/TextOutput.h> @@ -418,7 +421,14 @@ void IPCThreadState::joinThreadPool(bool isMain) alog << "Processing top-level Command: " << getReturnString(cmd) << endl; } + + result = executeCommand(cmd); + + // Make sure that after executing the command that we put the thread back into the + // default cgroup. This is just a failsafe incase the thread's priority or cgroup was + // not properly restored. + set_sched_policy(getpid(), SP_FOREGROUND); } // Let this thread exit the thread pool if it is no longer diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec index a393e2f22c5a..865e43555ad7 100644 --- a/libs/rs/rs.spec +++ b/libs/rs/rs.spec @@ -36,6 +36,10 @@ ContextPause { ContextResume { } +ContextSetSurface { + param void *sur + } + AssignName { param void *obj param const char *name diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp index 2cbfe17d40a9..38cec64e3753 100644 --- a/libs/rs/rsAllocation.cpp +++ b/libs/rs/rsAllocation.cpp @@ -54,6 +54,17 @@ Allocation::~Allocation() { free(mPtr); mPtr = NULL; + + if (mBufferID) { + // Causes a SW crash.... + //LOGV(" mBufferID %i", mBufferID); + //glDeleteBuffers(1, &mBufferID); + //mBufferID = 0; + } + if (mTextureID) { + glDeleteTextures(1, &mTextureID); + mTextureID = 0; + } } void Allocation::setCpuWritable(bool) diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp index 961ec0b2709c..3e4cc36bc36a 100644 --- a/libs/rs/rsContext.cpp +++ b/libs/rs/rsContext.cpp @@ -85,17 +85,6 @@ void Context::initEGL() } //eglChooseConfig(mEGL.mDisplay, configAttribs, &mEGL.mConfig, 1, &mEGL.mNumConfigs); - if (mWndSurface) { - mEGL.mSurface = eglCreateWindowSurface(mEGL.mDisplay, mEGL.mConfig, mWndSurface, NULL); - } else { - mEGL.mSurface = eglCreateWindowSurface(mEGL.mDisplay, mEGL.mConfig, - android_createDisplaySurface(), - NULL); - } - checkEglError("eglCreateWindowSurface"); - if (mEGL.mSurface == EGL_NO_SURFACE) { - LOGE("eglCreateWindowSurface returned EGL_NO_SURFACE"); - } mEGL.mContext = eglCreateContext(mEGL.mDisplay, mEGL.mConfig, EGL_NO_CONTEXT, NULL); checkEglError("eglCreateContext"); @@ -104,10 +93,10 @@ void Context::initEGL() } gGLContextCount++; - EGLBoolean ret = eglMakeCurrent(mEGL.mDisplay, mEGL.mSurface, mEGL.mSurface, mEGL.mContext); - checkEglError("eglCreateContext", ret); - if (mEGL.mContext == EGL_NO_CONTEXT) { - LOGE("eglCreateContext returned EGL_NO_CONTEXT"); + if (mWndSurface) { + setSurface(mWndSurface); + } else { + setSurface((Surface *)android_createDisplaySurface()); } eglQuerySurface(mEGL.mDisplay, mEGL.mSurface, EGL_WIDTH, &mEGL.mWidth); @@ -134,12 +123,7 @@ void Context::initEGL() void Context::deinitEGL() { - EGLBoolean ret = eglMakeCurrent(mEGL.mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - checkEglError("eglCreateContext", ret); - if (mEGL.mContext == EGL_NO_CONTEXT) { - LOGE("eglCreateContext returned EGL_NO_CONTEXT"); - } - + setSurface(NULL); eglDestroyContext(mEGL.mDisplay, mEGL.mContext); checkEglError("eglDestroyContext"); @@ -311,6 +295,7 @@ void * Context::threadProc(void *vrsc) while (!rsc->mExit) { mDraw |= rsc->mIO.playCoreCommands(rsc, !mDraw); mDraw &= (rsc->mRootScript.get() != NULL); + mDraw &= (rsc->mWndSurface != NULL); if (mDraw) { mDraw = rsc->runRootScript() && !rsc->mPaused; @@ -342,6 +327,9 @@ void * Context::threadProc(void *vrsc) rsc->mStateFragmentStore.deinit(rsc); ObjectBase::zeroAllUserRef(rsc); + rsc->mObjDestroy.mNeedToEmpty = true; + rsc->objDestroyOOBRun(); + glClearColor(0,0,0,0); glClear(GL_COLOR_BUFFER_BIT); eglSwapBuffers(rsc->mEGL.mDisplay, rsc->mEGL.mSurface); @@ -350,8 +338,6 @@ void * Context::threadProc(void *vrsc) rsc->deinitEGL(); pthread_mutex_unlock(&gInitMutex); - rsc->mObjDestroy.mNeedToEmpty = true; - rsc->objDestroyOOBRun(); LOGV("RS Thread exited"); return NULL; } @@ -440,6 +426,32 @@ Context::~Context() objDestroyOOBDestroy(); } +void Context::setSurface(Surface *sur) +{ + EGLBoolean ret; + if (mEGL.mSurface != NULL) { + ret = eglMakeCurrent(mEGL.mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + checkEglError("eglMakeCurrent", ret); + + ret = eglDestroySurface(mEGL.mDisplay, mEGL.mSurface); + checkEglError("eglDestroySurface", ret); + + mEGL.mSurface = NULL; + } + + mWndSurface = sur; + if (mWndSurface != NULL) { + mEGL.mSurface = eglCreateWindowSurface(mEGL.mDisplay, mEGL.mConfig, mWndSurface, NULL); + checkEglError("eglCreateWindowSurface"); + if (mEGL.mSurface == EGL_NO_SURFACE) { + LOGE("eglCreateWindowSurface returned EGL_NO_SURFACE"); + } + + ret = eglMakeCurrent(mEGL.mDisplay, mEGL.mSurface, mEGL.mSurface, mEGL.mContext); + checkEglError("eglMakeCurrent", ret); + } +} + void Context::pause() { mPaused = true; @@ -755,6 +767,11 @@ void rsi_ContextResume(Context *rsc) rsc->resume(); } +void rsi_ContextSetSurface(Context *rsc, void *sur) +{ + rsc->setSurface((Surface *)sur); +} + } } diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h index c80fd5a7785e..bffc55b7cb8b 100644 --- a/libs/rs/rsContext.h +++ b/libs/rs/rsContext.h @@ -94,6 +94,7 @@ public: void pause(); void resume(); + void setSurface(Surface *sur); void assignName(ObjectBase *obj, const char *name, uint32_t len); void removeName(ObjectBase *obj); diff --git a/libs/rs/rsObjectBase.cpp b/libs/rs/rsObjectBase.cpp index 1b442ba39a7e..b7d67cca4b3c 100644 --- a/libs/rs/rsObjectBase.cpp +++ b/libs/rs/rsObjectBase.cpp @@ -113,12 +113,7 @@ bool ObjectBase::decSysRef() const void ObjectBase::setName(const char *name) { - delete mName; - mName = NULL; - if (name) { - mName = new char[strlen(name) +1]; - strcpy(mName, name); - } + setName(name, strlen(name)); } void ObjectBase::setName(const char *name, uint32_t len) diff --git a/libs/rs/rsScript.h b/libs/rs/rsScript.h index 8aa45423c774..bc4085429fd9 100644 --- a/libs/rs/rsScript.h +++ b/libs/rs/rsScript.h @@ -54,7 +54,7 @@ public: ObjectBaseRef<ProgramRaster> mRaster; ObjectBaseRef<ProgramFragmentStore> mFragmentStore; InvokeFunc_t mInvokables[MAX_SCRIPT_BANKS]; - const char * mScriptText; + char * mScriptText; uint32_t mScriptTextLength; }; Enviroment_t mEnviroment; diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp index 9da7766217b6..073d98bf4e1b 100644 --- a/libs/rs/rsScriptC.cpp +++ b/libs/rs/rsScriptC.cpp @@ -46,6 +46,8 @@ ScriptC::~ScriptC() if (mAccScript) { accDeleteScript(mAccScript); } + free(mEnviroment.mScriptText); + mEnviroment.mScriptText = NULL; } void ScriptC::setupScript() @@ -404,7 +406,11 @@ void rsi_ScriptCSetScript(Context * rsc, void *vp) void rsi_ScriptCSetText(Context *rsc, const char *text, uint32_t len) { ScriptCState *ss = &rsc->mScriptC; - ss->mScript->mEnviroment.mScriptText = text; + + char *t = (char *)malloc(len + 1); + memcpy(t, text, len); + t[len] = 0; + ss->mScript->mEnviroment.mScriptText = t; ss->mScript->mEnviroment.mScriptTextLength = len; } diff --git a/libs/rs/rsScriptC.h b/libs/rs/rsScriptC.h index ae124b45e741..69afc18bc9b6 100644 --- a/libs/rs/rsScriptC.h +++ b/libs/rs/rsScriptC.h @@ -41,10 +41,6 @@ public: virtual ~ScriptC(); struct Program_t { - const char * mScriptText; - uint32_t mScriptTextLength; - - int mVersionMajor; int mVersionMinor; diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java index 9bb00c64bf2c..0b42cf61e04e 100644 --- a/media/java/android/media/MediaRecorder.java +++ b/media/java/android/media/MediaRecorder.java @@ -135,6 +135,12 @@ public class MediaRecorder /** Voice call uplink + downlink audio source */ public static final int VOICE_CALL = 4; + + /** @hide Microphone audio source with same orientation as camera */ + public static final int CAMCORDER = 5; + + /** @hide Microphone audio source tuned for voice recognition */ + public static final int VOICE_RECOGNITION = 6; } /** @@ -274,7 +280,7 @@ public class MediaRecorder * Gets the maximum value for audio sources. * @see android.media.MediaRecorder.AudioSource */ - public static final int getAudioSourceMax() { return AudioSource.VOICE_CALL; } + public static final int getAudioSourceMax() { return AudioSource.VOICE_RECOGNITION; } /** * Sets the video source to be used for recording. If this method is not diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp index 5e355644a65a..e63c0d2dd281 100644 --- a/media/libmedia/AudioRecord.cpp +++ b/media/libmedia/AudioRecord.cpp @@ -101,11 +101,6 @@ status_t AudioRecord::set( return INVALID_OPERATION; } - const sp<IAudioFlinger>& audioFlinger = AudioSystem::get_audio_flinger(); - if (audioFlinger == 0) { - return NO_INIT; - } - if (inputSource == AUDIO_SOURCE_DEFAULT) { inputSource = AUDIO_SOURCE_MIC; } @@ -171,22 +166,14 @@ status_t AudioRecord::set( notificationFrames = frameCount/2; } - // open record channel - status_t status; - sp<IAudioRecord> record = audioFlinger->openRecord(getpid(), mInput, - sampleRate, format, - channelCount, - frameCount, - ((uint16_t)flags) << 16, - &status); - if (record == 0) { - LOGE("AudioFlinger could not create record track, status: %d", status); + // create the IAudioRecord + status_t status = openRecord(sampleRate, format, channelCount, + frameCount, flags); + + if (status != NO_ERROR) { return status; } - sp<IMemory> cblk = record->getCblk(); - if (cblk == 0) { - return NO_INIT; - } + if (cbf != 0) { mClientRecordThread = new ClientRecordThread(*this, threadCanCallJava); if (mClientRecordThread == 0) { @@ -196,11 +183,6 @@ status_t AudioRecord::set( mStatus = NO_ERROR; - mAudioRecord = record; - mCblkMemory = cblk; - mCblk = static_cast<audio_track_cblk_t*>(cblk->pointer()); - mCblk->buffers = (char*)mCblk + sizeof(audio_track_cblk_t); - mCblk->out = 0; mFormat = format; // Update buffer size in case it has been limited by AudioFlinger during track creation mFrameCount = mCblk->frameCount; @@ -217,6 +199,7 @@ status_t AudioRecord::set( mNewPosition = 0; mUpdatePeriod = 0; mInputSource = (uint8_t)inputSource; + mFlags = flags; return NO_ERROR; } @@ -284,15 +267,26 @@ status_t AudioRecord::start() if (android_atomic_or(1, &mActive) == 0) { ret = AudioSystem::startInput(mInput); if (ret == NO_ERROR) { - mNewPosition = mCblk->user + mUpdatePeriod; - mCblk->bufferTimeoutMs = MAX_RUN_TIMEOUT_MS; - mCblk->waitTimeMs = 0; - if (t != 0) { - t->run("ClientRecordThread", THREAD_PRIORITY_AUDIO_CLIENT); + ret = mAudioRecord->start(); + if (ret == DEAD_OBJECT) { + LOGV("start() dead IAudioRecord: creating a new one"); + ret = openRecord(mCblk->sampleRate, mFormat, mChannelCount, + mFrameCount, mFlags); + } + if (ret == NO_ERROR) { + mNewPosition = mCblk->user + mUpdatePeriod; + mCblk->bufferTimeoutMs = MAX_RUN_TIMEOUT_MS; + mCblk->waitTimeMs = 0; + if (t != 0) { + t->run("ClientRecordThread", THREAD_PRIORITY_AUDIO_CLIENT); + } else { + setpriority(PRIO_PROCESS, 0, THREAD_PRIORITY_AUDIO_CLIENT); + } } else { - setpriority(PRIO_PROCESS, 0, THREAD_PRIORITY_AUDIO_CLIENT); + LOGV("start() failed"); + AudioSystem::stopInput(mInput); + android_atomic_and(~1, &mActive); } - ret = mAudioRecord->start(); } } @@ -396,10 +390,48 @@ status_t AudioRecord::getPosition(uint32_t *position) // ------------------------------------------------------------------------- +status_t AudioRecord::openRecord( + uint32_t sampleRate, + int format, + int channelCount, + int frameCount, + uint32_t flags) +{ + status_t status; + const sp<IAudioFlinger>& audioFlinger = AudioSystem::get_audio_flinger(); + if (audioFlinger == 0) { + return NO_INIT; + } + + sp<IAudioRecord> record = audioFlinger->openRecord(getpid(), mInput, + sampleRate, format, + channelCount, + frameCount, + ((uint16_t)flags) << 16, + &status); + if (record == 0) { + LOGE("AudioFlinger could not create record track, status: %d", status); + return status; + } + sp<IMemory> cblk = record->getCblk(); + if (cblk == 0) { + LOGE("Could not get control block"); + return NO_INIT; + } + mAudioRecord.clear(); + mAudioRecord = record; + mCblkMemory.clear(); + mCblkMemory = cblk; + mCblk = static_cast<audio_track_cblk_t*>(cblk->pointer()); + mCblk->buffers = (char*)mCblk + sizeof(audio_track_cblk_t); + mCblk->out = 0; + + return NO_ERROR; +} + status_t AudioRecord::obtainBuffer(Buffer* audioBuffer, int32_t waitCount) { int active; - int timeout = 0; status_t result; audio_track_cblk_t* cblk = mCblk; uint32_t framesReq = audioBuffer->frameCount; @@ -411,25 +443,40 @@ status_t AudioRecord::obtainBuffer(Buffer* audioBuffer, int32_t waitCount) uint32_t framesReady = cblk->framesReady(); if (framesReady == 0) { - Mutex::Autolock _l(cblk->lock); + cblk->lock.lock(); goto start_loop_here; while (framesReady == 0) { active = mActive; - if (UNLIKELY(!active)) + if (UNLIKELY(!active)) { + cblk->lock.unlock(); return NO_MORE_BUFFERS; - if (UNLIKELY(!waitCount)) + } + if (UNLIKELY(!waitCount)) { + cblk->lock.unlock(); return WOULD_BLOCK; - timeout = 0; + } result = cblk->cv.waitRelative(cblk->lock, milliseconds(waitTimeMs)); if (__builtin_expect(result!=NO_ERROR, false)) { cblk->waitTimeMs += waitTimeMs; if (cblk->waitTimeMs >= cblk->bufferTimeoutMs) { LOGW( "obtainBuffer timed out (is the CPU pegged?) " "user=%08x, server=%08x", cblk->user, cblk->server); - timeout = 1; + cblk->lock.unlock(); + result = mAudioRecord->start(); + if (result == DEAD_OBJECT) { + LOGW("obtainBuffer() dead IAudioRecord: creating a new one"); + result = openRecord(cblk->sampleRate, mFormat, mChannelCount, + mFrameCount, mFlags); + if (result == NO_ERROR) { + cblk = mCblk; + cblk->bufferTimeoutMs = MAX_RUN_TIMEOUT_MS; + } + } + cblk->lock.lock(); cblk->waitTimeMs = 0; } if (--waitCount == 0) { + cblk->lock.unlock(); return TIMED_OUT; } } @@ -437,13 +484,9 @@ status_t AudioRecord::obtainBuffer(Buffer* audioBuffer, int32_t waitCount) start_loop_here: framesReady = cblk->framesReady(); } + cblk->lock.unlock(); } - LOGW_IF(timeout, - "*** SERIOUS WARNING *** obtainBuffer() timed out " - "but didn't need to be locked. We recovered, but " - "this shouldn't happen (user=%08x, server=%08x)", cblk->user, cblk->server); - cblk->waitTimeMs = 0; if (framesReq > framesReady) { diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index 4b9d272cf60a..8529a8e46fa1 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -122,11 +122,6 @@ status_t AudioTrack::set( return INVALID_OPERATION; } - const sp<IAudioFlinger>& audioFlinger = AudioSystem::get_audio_flinger(); - if (audioFlinger == 0) { - LOGE("Could not get audioflinger"); - return NO_INIT; - } int afSampleRate; if (AudioSystem::getOutputSamplingRate(&afSampleRate, streamType) != NO_ERROR) { return NO_INIT; @@ -217,28 +212,16 @@ status_t AudioTrack::set( } } - // create the track - status_t status; - sp<IAudioTrack> track = audioFlinger->createTrack(getpid(), - streamType, - sampleRate, - format, - channelCount, - frameCount, - ((uint16_t)flags) << 16, - sharedBuffer, - output, - &status); + mVolume[LEFT] = 1.0f; + mVolume[RIGHT] = 1.0f; + // create the IAudioTrack + status_t status = createTrack(streamType, sampleRate, format, channelCount, + frameCount, flags, sharedBuffer, output); - if (track == 0) { - LOGE("AudioFlinger could not create track, status: %d", status); + if (status != NO_ERROR) { return status; } - sp<IMemory> cblk = track->getCblk(); - if (cblk == 0) { - LOGE("Could not get control block"); - return NO_INIT; - } + if (cbf != 0) { mAudioTrackThread = new AudioTrackThread(*this, threadCanCallJava); if (mAudioTrackThread == 0) { @@ -249,22 +232,6 @@ status_t AudioTrack::set( mStatus = NO_ERROR; - mAudioTrack = track; - mCblkMemory = cblk; - mCblk = static_cast<audio_track_cblk_t*>(cblk->pointer()); - mCblk->out = 1; - // Update buffer size in case it has been limited by AudioFlinger during track creation - mFrameCount = mCblk->frameCount; - if (sharedBuffer == 0) { - mCblk->buffers = (char*)mCblk + sizeof(audio_track_cblk_t); - } else { - mCblk->buffers = sharedBuffer->pointer(); - // Force buffer full condition as data is already present in shared memory - mCblk->stepUser(mFrameCount); - } - mCblk->volume[0] = mCblk->volume[1] = 0x1000; - mVolume[LEFT] = 1.0f; - mVolume[RIGHT] = 1.0f; mStreamType = streamType; mFormat = format; mChannels = channels; @@ -351,16 +318,27 @@ void AudioTrack::start() } if (android_atomic_or(1, &mActive) == 0) { - AudioSystem::startOutput(getOutput(), (AudioSystem::stream_type)mStreamType); - mNewPosition = mCblk->server + mUpdatePeriod; - mCblk->bufferTimeoutMs = MAX_STARTUP_TIMEOUT_MS; - mCblk->waitTimeMs = 0; - if (t != 0) { - t->run("AudioTrackThread", THREAD_PRIORITY_AUDIO_CLIENT); + audio_io_handle_t output = AudioTrack::getOutput(); + status_t status = mAudioTrack->start(); + if (status == DEAD_OBJECT) { + LOGV("start() dead IAudioTrack: creating a new one"); + status = createTrack(mStreamType, mCblk->sampleRate, mFormat, mChannelCount, + mFrameCount, mFlags, mSharedBuffer, output); + } + if (status == NO_ERROR) { + AudioSystem::startOutput(output, (AudioSystem::stream_type)mStreamType); + mNewPosition = mCblk->server + mUpdatePeriod; + mCblk->bufferTimeoutMs = MAX_STARTUP_TIMEOUT_MS; + mCblk->waitTimeMs = 0; + if (t != 0) { + t->run("AudioTrackThread", THREAD_PRIORITY_AUDIO_CLIENT); + } else { + setpriority(PRIO_PROCESS, 0, THREAD_PRIORITY_AUDIO_CLIENT); + } } else { - setpriority(PRIO_PROCESS, 0, THREAD_PRIORITY_AUDIO_CLIENT); + LOGV("start() failed"); + android_atomic_and(~1, &mActive); } - mAudioTrack->start(); } if (t != 0) { @@ -617,10 +595,67 @@ audio_io_handle_t AudioTrack::getOutput() // ------------------------------------------------------------------------- +status_t AudioTrack::createTrack( + int streamType, + uint32_t sampleRate, + int format, + int channelCount, + int frameCount, + uint32_t flags, + const sp<IMemory>& sharedBuffer, + audio_io_handle_t output) +{ + status_t status; + const sp<IAudioFlinger>& audioFlinger = AudioSystem::get_audio_flinger(); + if (audioFlinger == 0) { + LOGE("Could not get audioflinger"); + return NO_INIT; + } + + sp<IAudioTrack> track = audioFlinger->createTrack(getpid(), + streamType, + sampleRate, + format, + channelCount, + frameCount, + ((uint16_t)flags) << 16, + sharedBuffer, + output, + &status); + + if (track == 0) { + LOGE("AudioFlinger could not create track, status: %d", status); + return status; + } + sp<IMemory> cblk = track->getCblk(); + if (cblk == 0) { + LOGE("Could not get control block"); + return NO_INIT; + } + mAudioTrack.clear(); + mAudioTrack = track; + mCblkMemory.clear(); + mCblkMemory = cblk; + mCblk = static_cast<audio_track_cblk_t*>(cblk->pointer()); + mCblk->out = 1; + // Update buffer size in case it has been limited by AudioFlinger during track creation + mFrameCount = mCblk->frameCount; + if (sharedBuffer == 0) { + mCblk->buffers = (char*)mCblk + sizeof(audio_track_cblk_t); + } else { + mCblk->buffers = sharedBuffer->pointer(); + // Force buffer full condition as data is already present in shared memory + mCblk->stepUser(mFrameCount); + } + + mCblk->volumeLR = (int32_t(int16_t(mVolume[LEFT] * 0x1000)) << 16) | int16_t(mVolume[RIGHT] * 0x1000); + + return NO_ERROR; +} + status_t AudioTrack::obtainBuffer(Buffer* audioBuffer, int32_t waitCount) { int active; - int timeout = 0; status_t result; audio_track_cblk_t* cblk = mCblk; uint32_t framesReq = audioBuffer->frameCount; @@ -632,17 +667,20 @@ status_t AudioTrack::obtainBuffer(Buffer* audioBuffer, int32_t waitCount) uint32_t framesAvail = cblk->framesAvailable(); if (framesAvail == 0) { - Mutex::Autolock _l(cblk->lock); + cblk->lock.lock(); goto start_loop_here; while (framesAvail == 0) { active = mActive; if (UNLIKELY(!active)) { LOGV("Not active and NO_MORE_BUFFERS"); + cblk->lock.unlock(); return NO_MORE_BUFFERS; } - if (UNLIKELY(!waitCount)) + if (UNLIKELY(!waitCount)) { + cblk->lock.unlock(); return WOULD_BLOCK; - timeout = 0; + } + result = cblk->cv.waitRelative(cblk->lock, milliseconds(waitTimeMs)); if (__builtin_expect(result!=NO_ERROR, false)) { cblk->waitTimeMs += waitTimeMs; @@ -654,14 +692,23 @@ status_t AudioTrack::obtainBuffer(Buffer* audioBuffer, int32_t waitCount) "user=%08x, server=%08x", this, cblk->user, cblk->server); //unlock cblk mutex before calling mAudioTrack->start() (see issue #1617140) cblk->lock.unlock(); - mAudioTrack->start(); + result = mAudioTrack->start(); + if (result == DEAD_OBJECT) { + LOGW("obtainBuffer() dead IAudioTrack: creating a new one"); + result = createTrack(mStreamType, cblk->sampleRate, mFormat, mChannelCount, + mFrameCount, mFlags, mSharedBuffer, getOutput()); + if (result == NO_ERROR) { + cblk = mCblk; + cblk->bufferTimeoutMs = MAX_RUN_TIMEOUT_MS; + } + } cblk->lock.lock(); - timeout = 1; } cblk->waitTimeMs = 0; } if (--waitCount == 0) { + cblk->lock.unlock(); return TIMED_OUT; } } @@ -669,6 +716,7 @@ status_t AudioTrack::obtainBuffer(Buffer* audioBuffer, int32_t waitCount) start_loop_here: framesAvail = cblk->framesAvailable_l(); } + cblk->lock.unlock(); } cblk->waitTimeMs = 0; @@ -684,11 +732,6 @@ status_t AudioTrack::obtainBuffer(Buffer* audioBuffer, int32_t waitCount) framesReq = bufferEnd - u; } - LOGW_IF(timeout, - "*** SERIOUS WARNING *** obtainBuffer() timed out " - "but didn't need to be locked. We recovered, but " - "this shouldn't happen (user=%08x, server=%08x)", cblk->user, cblk->server); - audioBuffer->flags = mMuted ? Buffer::MUTE : 0; audioBuffer->channelCount = mChannelCount; audioBuffer->frameCount = framesReq; @@ -991,7 +1034,7 @@ bool audio_track_cblk_t::stepServer(uint32_t frameCount) // Mark that we have read the first buffer so that next time stepUser() is called // we switch to normal obtainBuffer() timeout period if (bufferTimeoutMs == MAX_STARTUP_TIMEOUT_MS) { - bufferTimeoutMs = MAX_RUN_TIMEOUT_MS - 1; + bufferTimeoutMs = MAX_STARTUP_TIMEOUT_MS - 1; } // It is possible that we receive a flush() // while the mixer is processing a block: in this case, diff --git a/media/libmedia/IAudioRecord.cpp b/media/libmedia/IAudioRecord.cpp index dacf75aae873..ba0d55b843d4 100644 --- a/media/libmedia/IAudioRecord.cpp +++ b/media/libmedia/IAudioRecord.cpp @@ -15,6 +15,10 @@ ** limitations under the License. */ +#define LOG_TAG "IAudioRecord" +//#define LOG_NDEBUG 0 +#include <utils/Log.h> + #include <stdint.h> #include <sys/types.h> @@ -42,8 +46,13 @@ public: { Parcel data, reply; data.writeInterfaceToken(IAudioRecord::getInterfaceDescriptor()); - remote()->transact(START, data, &reply); - return reply.readInt32(); + status_t status = remote()->transact(START, data, &reply); + if (status == NO_ERROR) { + status = reply.readInt32(); + } else { + LOGW("start() error: %s", strerror(-status)); + } + return status; } virtual void stop() diff --git a/media/libmedia/IAudioTrack.cpp b/media/libmedia/IAudioTrack.cpp index 7f43347a86cb..01ffd75e56c5 100644 --- a/media/libmedia/IAudioTrack.cpp +++ b/media/libmedia/IAudioTrack.cpp @@ -15,6 +15,10 @@ ** limitations under the License. */ +#define LOG_TAG "IAudioTrack" +//#define LOG_NDEBUG 0 +#include <utils/Log.h> + #include <stdint.h> #include <sys/types.h> @@ -45,8 +49,13 @@ public: { Parcel data, reply; data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor()); - remote()->transact(START, data, &reply); - return reply.readInt32(); + status_t status = remote()->transact(START, data, &reply); + if (status == NO_ERROR) { + status = reply.readInt32(); + } else { + LOGW("start() error: %s", strerror(-status)); + } + return status; } virtual void stop() diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp index 91d0d0095338..60e3d71171a6 100644 --- a/media/libmedia/ToneGenerator.cpp +++ b/media/libmedia/ToneGenerator.cpp @@ -798,7 +798,7 @@ const unsigned char ToneGenerator::sToneMappingTable[NUM_REGIONS-1][NUM_SUP_TONE // none // //////////////////////////////////////////////////////////////////////////////// -ToneGenerator::ToneGenerator(int streamType, float volume) { +ToneGenerator::ToneGenerator(int streamType, float volume, bool threadCanCallJava) { LOGV("ToneGenerator constructor: streamType=%d, volume=%f\n", streamType, volume); @@ -808,6 +808,7 @@ ToneGenerator::ToneGenerator(int streamType, float volume) { LOGE("Unable to marshal AudioFlinger"); return; } + mThreadCanCallJava = threadCanCallJava; mStreamType = streamType; mVolume = volume; mpAudioTrack = 0; @@ -1015,15 +1016,25 @@ bool ToneGenerator::initAudioTrack() { } // Open audio track in mono, PCM 16bit, default sampling rate, default buffer size - mpAudioTrack - = new AudioTrack(mStreamType, 0, AudioSystem::PCM_16_BIT, AudioSystem::CHANNEL_OUT_MONO, 0, 0, audioCallback, this, 0); - + mpAudioTrack = new AudioTrack(); if (mpAudioTrack == 0) { LOGE("AudioTrack allocation failed"); goto initAudioTrack_exit; } LOGV("Create Track: %p\n", mpAudioTrack); + mpAudioTrack->set(mStreamType, + 0, + AudioSystem::PCM_16_BIT, + AudioSystem::CHANNEL_OUT_MONO, + 0, + 0, + audioCallback, + this, + 0, + 0, + mThreadCanCallJava); + if (mpAudioTrack->initCheck() != NO_ERROR) { LOGE("AudioTrack->initCheck failed"); goto initAudioTrack_exit; diff --git a/media/libstagefright/omx/QComHardwareRenderer.cpp b/media/libstagefright/omx/QComHardwareRenderer.cpp index 7dc368f16520..c65d1f3bebc4 100644 --- a/media/libstagefright/omx/QComHardwareRenderer.cpp +++ b/media/libstagefright/omx/QComHardwareRenderer.cpp @@ -126,7 +126,8 @@ void QComHardwareRenderer::publishBuffers(uint32_t pmem_fd) { master->setDevice("/dev/pmem"); - mMemoryHeap = new MemoryHeapPmem(master, 0); + uint32_t heap_flags = master->getFlags() & MemoryHeapBase::NO_CACHING; + mMemoryHeap = new MemoryHeapPmem(master, heap_flags); mMemoryHeap->slap(); ISurface::BufferHeap bufferHeap( diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp index 80ddc0280f9a..673c174ef45c 100644 --- a/opengl/libagl/egl.cpp +++ b/opengl/libagl/egl.cpp @@ -40,6 +40,7 @@ #include <pixelflinger/pixelflinger.h> #include <private/ui/android_natives_priv.h> +#include <private/ui/sw_gralloc_handle.h> #include <hardware/copybit.h> @@ -449,15 +450,26 @@ void egl_window_surface_v2_t::disconnect() status_t egl_window_surface_v2_t::lock( android_native_buffer_t* buf, int usage, void** vaddr) { - int err = module->lock(module, buf->handle, - usage, 0, 0, buf->width, buf->height, vaddr); + int err; + if (sw_gralloc_handle_t::validate(buf->handle) < 0) { + err = module->lock(module, buf->handle, + usage, 0, 0, buf->width, buf->height, vaddr); + } else { + sw_gralloc_handle_t const* hnd = + reinterpret_cast<sw_gralloc_handle_t const*>(buf->handle); + *vaddr = (void*)hnd->base; + err = NO_ERROR; + } return err; } status_t egl_window_surface_v2_t::unlock(android_native_buffer_t* buf) { if (!buf) return BAD_VALUE; - int err = module->unlock(module, buf->handle); + int err = NO_ERROR; + if (sw_gralloc_handle_t::validate(buf->handle) < 0) { + err = module->unlock(module, buf->handle); + } return err; } @@ -623,6 +635,7 @@ static bool supportedCopybitsDestinationFormat(int format) { switch (format) { case HAL_PIXEL_FORMAT_RGB_565: case HAL_PIXEL_FORMAT_RGBA_8888: + case HAL_PIXEL_FORMAT_RGBX_8888: case HAL_PIXEL_FORMAT_RGBA_4444: case HAL_PIXEL_FORMAT_RGBA_5551: case HAL_PIXEL_FORMAT_BGRA_8888: @@ -792,6 +805,7 @@ egl_pbuffer_surface_t::egl_pbuffer_surface_t(EGLDisplay dpy, case GGL_PIXEL_FORMAT_A_8: size *= 1; break; case GGL_PIXEL_FORMAT_RGB_565: size *= 2; break; case GGL_PIXEL_FORMAT_RGBA_8888: size *= 4; break; + case GGL_PIXEL_FORMAT_RGBX_8888: size *= 4; break; default: LOGE("incompatible pixel format for pbuffer (format=%d)", f); pbuffer.data = 0; @@ -963,7 +977,7 @@ static config_pair_t const config_base_attribute_list[] = { // These configs can override the base attribute list // NOTE: when adding a config here, don't forget to update eglCreate*Surface() - +// 565 configs static config_pair_t const config_0_attribute_list[] = { { EGL_BUFFER_SIZE, 16 }, { EGL_ALPHA_SIZE, 0 }, @@ -986,8 +1000,32 @@ static config_pair_t const config_1_attribute_list[] = { { EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT }, }; +// RGB 888 configs static config_pair_t const config_2_attribute_list[] = { { EGL_BUFFER_SIZE, 32 }, + { EGL_ALPHA_SIZE, 0 }, + { EGL_BLUE_SIZE, 8 }, + { EGL_GREEN_SIZE, 8 }, + { EGL_RED_SIZE, 8 }, + { EGL_DEPTH_SIZE, 0 }, + { EGL_CONFIG_ID, 6 }, + { EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT }, +}; + +static config_pair_t const config_3_attribute_list[] = { + { EGL_BUFFER_SIZE, 32 }, + { EGL_ALPHA_SIZE, 0 }, + { EGL_BLUE_SIZE, 8 }, + { EGL_GREEN_SIZE, 8 }, + { EGL_RED_SIZE, 8 }, + { EGL_DEPTH_SIZE, 16 }, + { EGL_CONFIG_ID, 7 }, + { EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT }, +}; + +// 8888 configs +static config_pair_t const config_4_attribute_list[] = { + { EGL_BUFFER_SIZE, 32 }, { EGL_ALPHA_SIZE, 8 }, { EGL_BLUE_SIZE, 8 }, { EGL_GREEN_SIZE, 8 }, @@ -997,7 +1035,7 @@ static config_pair_t const config_2_attribute_list[] = { { EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT }, }; -static config_pair_t const config_3_attribute_list[] = { +static config_pair_t const config_5_attribute_list[] = { { EGL_BUFFER_SIZE, 32 }, { EGL_ALPHA_SIZE, 8 }, { EGL_BLUE_SIZE, 8 }, @@ -1008,7 +1046,8 @@ static config_pair_t const config_3_attribute_list[] = { { EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT }, }; -static config_pair_t const config_4_attribute_list[] = { +// A8 configs +static config_pair_t const config_6_attribute_list[] = { { EGL_BUFFER_SIZE, 8 }, { EGL_ALPHA_SIZE, 8 }, { EGL_BLUE_SIZE, 0 }, @@ -1019,7 +1058,7 @@ static config_pair_t const config_4_attribute_list[] = { { EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT }, }; -static config_pair_t const config_5_attribute_list[] = { +static config_pair_t const config_7_attribute_list[] = { { EGL_BUFFER_SIZE, 8 }, { EGL_ALPHA_SIZE, 8 }, { EGL_BLUE_SIZE, 0 }, @@ -1037,6 +1076,8 @@ static configs_t const gConfigs[] = { { config_3_attribute_list, NELEM(config_3_attribute_list) }, { config_4_attribute_list, NELEM(config_4_attribute_list) }, { config_5_attribute_list, NELEM(config_5_attribute_list) }, + { config_6_attribute_list, NELEM(config_6_attribute_list) }, + { config_7_attribute_list, NELEM(config_7_attribute_list) }, }; static config_management_t const gConfigManagement[] = { @@ -1083,6 +1124,50 @@ static config_pair_t const config_defaults[] = { // ---------------------------------------------------------------------------- +static status_t getConfigFormatInfo(EGLint configID, + int32_t& pixelFormat, int32_t& depthFormat) +{ + switch(configID) { + case 0: + pixelFormat = GGL_PIXEL_FORMAT_RGB_565; + depthFormat = 0; + break; + case 1: + pixelFormat = GGL_PIXEL_FORMAT_RGB_565; + depthFormat = GGL_PIXEL_FORMAT_Z_16; + break; + case 2: + pixelFormat = GGL_PIXEL_FORMAT_RGBX_8888; + depthFormat = 0; + break; + case 3: + pixelFormat = GGL_PIXEL_FORMAT_RGBX_8888; + depthFormat = GGL_PIXEL_FORMAT_Z_16; + break; + case 4: + pixelFormat = GGL_PIXEL_FORMAT_RGBA_8888; + depthFormat = 0; + break; + case 5: + pixelFormat = GGL_PIXEL_FORMAT_RGBA_8888; + depthFormat = GGL_PIXEL_FORMAT_Z_16; + break; + case 6: + pixelFormat = GGL_PIXEL_FORMAT_A_8; + depthFormat = 0; + break; + case 7: + pixelFormat = GGL_PIXEL_FORMAT_A_8; + depthFormat = GGL_PIXEL_FORMAT_Z_16; + break; + default: + return NAME_NOT_FOUND; + } + return NO_ERROR; +} + +// ---------------------------------------------------------------------------- + template<typename T> static int binarySearch(T const sortedArray[], int first, int last, EGLint key) { @@ -1226,32 +1311,7 @@ static EGLSurface createWindowSurface(EGLDisplay dpy, EGLConfig config, int32_t depthFormat; int32_t pixelFormat; - switch(configID) { - case 0: - pixelFormat = GGL_PIXEL_FORMAT_RGB_565; - depthFormat = 0; - break; - case 1: - pixelFormat = GGL_PIXEL_FORMAT_RGB_565; - depthFormat = GGL_PIXEL_FORMAT_Z_16; - break; - case 2: - pixelFormat = GGL_PIXEL_FORMAT_RGBA_8888; - depthFormat = 0; - break; - case 3: - pixelFormat = GGL_PIXEL_FORMAT_RGBA_8888; - depthFormat = GGL_PIXEL_FORMAT_Z_16; - break; - case 4: - pixelFormat = GGL_PIXEL_FORMAT_A_8; - depthFormat = 0; - break; - case 5: - pixelFormat = GGL_PIXEL_FORMAT_A_8; - depthFormat = GGL_PIXEL_FORMAT_Z_16; - break; - default: + if (getConfigFormatInfo(configID, pixelFormat, depthFormat) != NO_ERROR) { return setError(EGL_BAD_MATCH, EGL_NO_SURFACE); } @@ -1300,32 +1360,7 @@ static EGLSurface createPixmapSurface(EGLDisplay dpy, EGLConfig config, int32_t depthFormat; int32_t pixelFormat; - switch(configID) { - case 0: - pixelFormat = GGL_PIXEL_FORMAT_RGB_565; - depthFormat = 0; - break; - case 1: - pixelFormat = GGL_PIXEL_FORMAT_RGB_565; - depthFormat = GGL_PIXEL_FORMAT_Z_16; - break; - case 2: - pixelFormat = GGL_PIXEL_FORMAT_RGBA_8888; - depthFormat = 0; - break; - case 3: - pixelFormat = GGL_PIXEL_FORMAT_RGBA_8888; - depthFormat = GGL_PIXEL_FORMAT_Z_16; - break; - case 4: - pixelFormat = GGL_PIXEL_FORMAT_A_8; - depthFormat = 0; - break; - case 5: - pixelFormat = GGL_PIXEL_FORMAT_A_8; - depthFormat = GGL_PIXEL_FORMAT_Z_16; - break; - default: + if (getConfigFormatInfo(configID, pixelFormat, depthFormat) != NO_ERROR) { return setError(EGL_BAD_MATCH, EGL_NO_SURFACE); } @@ -1364,32 +1399,7 @@ static EGLSurface createPbufferSurface(EGLDisplay dpy, EGLConfig config, int32_t depthFormat; int32_t pixelFormat; - switch(configID) { - case 0: - pixelFormat = GGL_PIXEL_FORMAT_RGB_565; - depthFormat = 0; - break; - case 1: - pixelFormat = GGL_PIXEL_FORMAT_RGB_565; - depthFormat = GGL_PIXEL_FORMAT_Z_16; - break; - case 2: - pixelFormat = GGL_PIXEL_FORMAT_RGBA_8888; - depthFormat = 0; - break; - case 3: - pixelFormat = GGL_PIXEL_FORMAT_RGBA_8888; - depthFormat = GGL_PIXEL_FORMAT_Z_16; - break; - case 4: - pixelFormat = GGL_PIXEL_FORMAT_A_8; - depthFormat = 0; - break; - case 5: - pixelFormat = GGL_PIXEL_FORMAT_A_8; - depthFormat = GGL_PIXEL_FORMAT_Z_16; - break; - default: + if (getConfigFormatInfo(configID, pixelFormat, depthFormat) != NO_ERROR) { return setError(EGL_BAD_MATCH, EGL_NO_SURFACE); } diff --git a/opengl/libagl/matrix.cpp b/opengl/libagl/matrix.cpp index 21ef50e6b622..3c5097708648 100644 --- a/opengl/libagl/matrix.cpp +++ b/opengl/libagl/matrix.cpp @@ -741,20 +741,19 @@ void point4__generic(transform_t const* mx, vec4_t* lhs, vec4_t const* rhs) { void point4__mvui(transform_t const* mx, vec4_t* lhs, vec4_t const* rhs) { // this used for transforming light positions back to object space. - // Lights have 3 components positions, so w is always 1. - // however, it is used as a switch for directional lights, so we need + // w is used as a switch for directional lights, so we need // to preserve it. const GLfixed* const m = mx->matrix.m; const GLfixed rx = rhs->x; const GLfixed ry = rhs->y; const GLfixed rz = rhs->z; - lhs->x = mla3a(rx, m[ 0], ry, m[ 4], rz, m[ 8], m[12]); - lhs->y = mla3a(rx, m[ 1], ry, m[ 5], rz, m[ 9], m[13]); - lhs->z = mla3a(rx, m[ 2], ry, m[ 6], rz, m[10], m[14]); - lhs->w = rhs->w; + const GLfixed rw = rhs->w; + lhs->x = mla4(rx, m[ 0], ry, m[ 4], rz, m[ 8], rw, m[12]); + lhs->y = mla4(rx, m[ 1], ry, m[ 5], rz, m[ 9], rw, m[13]); + lhs->z = mla4(rx, m[ 2], ry, m[ 6], rz, m[10], rw, m[14]); + lhs->w = rw; } - void point2__nop(transform_t const*, vec4_t* lhs, vec4_t const* rhs) { lhs->z = 0; lhs->w = 0x10000; diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java index 754e6e578b53..c3b591ee64f9 100644 --- a/services/java/com/android/server/BackupManagerService.java +++ b/services/java/com/android/server/BackupManagerService.java @@ -1260,9 +1260,20 @@ class BackupManagerService extends IBackupManager.Stub { // ----- Restore handling ----- - private boolean signaturesMatch(Signature[] storedSigs, Signature[] deviceSigs) { + private boolean signaturesMatch(Signature[] storedSigs, PackageInfo target) { + // If the target resides on the system partition, we allow it to restore + // data from the like-named package in a restore set even if the signatures + // do not match. (Unlike general applications, those flashed to the system + // partition will be signed with the device's platform certificate, so on + // different phones the same system app will have different signatures.) + if ((target.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) { + if (DEBUG) Log.v(TAG, "System app " + target.packageName + " - skipping sig check"); + return true; + } + // Allow unsigned apps, but not signed on one device and unsigned on the other // !!! TODO: is this the right policy? + Signature[] deviceSigs = target.signatures; if (DEBUG) Log.v(TAG, "signaturesMatch(): stored=" + storedSigs + " device=" + deviceSigs); if ((storedSigs == null || storedSigs.length == 0) @@ -1465,7 +1476,7 @@ class BackupManagerService extends IBackupManager.Stub { continue; } - if (!signaturesMatch(metaInfo.signatures, packageInfo.signatures)) { + if (!signaturesMatch(metaInfo.signatures, packageInfo)) { Log.w(TAG, "Signature mismatch restoring " + packageName); EventLog.writeEvent(RESTORE_AGENT_FAILURE_EVENT, packageName, "Signature mismatch"); diff --git a/services/java/com/android/server/HardwareService.java b/services/java/com/android/server/HardwareService.java index b1d58ce8d1b0..3e3cf065bedb 100755 --- a/services/java/com/android/server/HardwareService.java +++ b/services/java/com/android/server/HardwareService.java @@ -52,6 +52,7 @@ public class HardwareService extends IHardwareService.Stub { static final int LIGHT_FLASH_NONE = 0; static final int LIGHT_FLASH_TIMED = 1; + static final int LIGHT_FLASH_HARDWARE = 2; private final LinkedList<Vibration> mVibrations; private Vibration mCurrentVibration; @@ -125,7 +126,7 @@ public class HardwareService extends IHardwareService.Stub { mVibrations = new LinkedList<Vibration>(); mBatteryStats = BatteryStatsService.getService(); - + IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_SCREEN_OFF); context.registerReceiver(mIntentReceiver, filter); @@ -239,15 +240,15 @@ public class HardwareService extends IHardwareService.Stub { Binder.restoreCallingIdentity(identity); } } - + public boolean getFlashlightEnabled() { return Hardware.getFlashlightEnabled(); } - + public void setFlashlightEnabled(boolean on) { - if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.FLASHLIGHT) + if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.FLASHLIGHT) != PackageManager.PERMISSION_GRANTED && - mContext.checkCallingOrSelfPermission(android.Manifest.permission.HARDWARE_TEST) + mContext.checkCallingOrSelfPermission(android.Manifest.permission.HARDWARE_TEST) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException("Requires FLASHLIGHT or HARDWARE_TEST permission"); } @@ -255,9 +256,9 @@ public class HardwareService extends IHardwareService.Stub { } public void enableCameraFlash(int milliseconds) { - if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.CAMERA) + if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED && - mContext.checkCallingOrSelfPermission(android.Manifest.permission.HARDWARE_TEST) + mContext.checkCallingOrSelfPermission(android.Manifest.permission.HARDWARE_TEST) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException("Requires CAMERA or HARDWARE_TEST permission"); } @@ -282,13 +283,13 @@ public class HardwareService extends IHardwareService.Stub { setLight_native(mNativePointer, light, color, mode, onMS, offMS); } - public void setAttentionLight(boolean on) { + public void setAttentionLight(boolean on, int color) { // Not worthy of a permission. We shouldn't have a flashlight permission. synchronized (this) { mAttentionLightOn = on; mPulsing = false; - setLight_native(mNativePointer, LIGHT_ID_ATTENTION, on ? 0xffffffff : 0, - LIGHT_FLASH_NONE, 0, 0); + setLight_native(mNativePointer, LIGHT_ID_ATTENTION, color, + LIGHT_FLASH_HARDWARE, on ? 3 : 0, 0); } } @@ -302,8 +303,8 @@ public class HardwareService extends IHardwareService.Stub { } if (!mAttentionLightOn && !mPulsing) { mPulsing = true; - setLight_native(mNativePointer, LIGHT_ID_ATTENTION, 0xff101010, - LIGHT_FLASH_NONE, 0, 0); + setLight_native(mNativePointer, LIGHT_ID_ATTENTION, 0x00ffffff, + LIGHT_FLASH_HARDWARE, 7, 0); mH.sendMessageDelayed(Message.obtain(mH, 1), 3000); } } @@ -391,7 +392,7 @@ public class HardwareService extends IHardwareService.Stub { private class VibrateThread extends Thread { final Vibration mVibration; boolean mDone; - + VibrateThread(Vibration vib) { mVibration = vib; mWakeLock.acquire(); @@ -425,7 +426,7 @@ public class HardwareService extends IHardwareService.Stub { long duration = 0; while (!mDone) { - // add off-time duration to any accumulated on-time duration + // add off-time duration to any accumulated on-time duration if (index < len) { duration += pattern[index++]; } @@ -478,7 +479,7 @@ public class HardwareService extends IHardwareService.Stub { } } }; - + private static native int init_native(); private static native void finalize_native(int ptr); @@ -489,7 +490,7 @@ public class HardwareService extends IHardwareService.Stub { private final PowerManager.WakeLock mWakeLock; private final IBatteryStats mBatteryStats; - + volatile VibrateThread mThread; private int mNativePointer; diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java index f75f7195be0a..93b469f54a7b 100644 --- a/services/java/com/android/server/PowerManagerService.java +++ b/services/java/com/android/server/PowerManagerService.java @@ -1760,7 +1760,8 @@ class PowerManagerService extends IPowerManager.Stub try { if (mScreenBrightnessOverride >= 0) { return mScreenBrightnessOverride; - } else if (mLightSensorBrightness >= 0 && mUseSoftwareAutoBrightness) { + } else if (mLightSensorBrightness >= 0 && mUseSoftwareAutoBrightness + && mAutoBrightessEnabled) { return mLightSensorBrightness; } final int brightness = Settings.System.getInt(mContext.getContentResolver(), diff --git a/services/java/com/android/server/status/StatusBarService.java b/services/java/com/android/server/status/StatusBarService.java index bd7b471c9fe2..8d739041622f 100644 --- a/services/java/com/android/server/status/StatusBarService.java +++ b/services/java/com/android/server/status/StatusBarService.java @@ -952,6 +952,7 @@ public class StatusBarService extends IStatusBar.Stub updateExpandedViewPos(EXPANDED_LEAVE_ALONE); mExpandedParams.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; + mExpandedParams.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; mExpandedDialog.getWindow().setAttributes(mExpandedParams); mExpandedView.requestFocus(View.FOCUS_FORWARD); mTrackingView.setVisibility(View.VISIBLE); @@ -1030,6 +1031,7 @@ public class StatusBarService extends IStatusBar.Stub mExpandedVisible = false; panelSlightlyVisible(false); mExpandedParams.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; + mExpandedParams.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; mExpandedDialog.getWindow().setAttributes(mExpandedParams); mTrackingView.setVisibility(View.GONE); @@ -1522,7 +1524,6 @@ public class StatusBarService extends IStatusBar.Stub lp.flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL - | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM | WindowManager.LayoutParams.FLAG_DITHER | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; lp.format = pixelFormat; diff --git a/tests/AndroidTests/src/com/android/unit_tests/AppCacheTest.java b/tests/AndroidTests/src/com/android/unit_tests/AppCacheTest.java index fb1b9ad5bcff..f2f7743c002a 100755 --- a/tests/AndroidTests/src/com/android/unit_tests/AppCacheTest.java +++ b/tests/AndroidTests/src/com/android/unit_tests/AppCacheTest.java @@ -137,7 +137,8 @@ public class AppCacheTest extends AndroidTestCase { verifyTestFiles1(cacheDir, "testtmpdir", 5); } - @LargeTest + // TODO: flaky test + // @LargeTest public void testFreeApplicationCacheSomeFiles() throws Exception { StatFs st = new StatFs("/data"); long blks1 = getFreeStorageBlks(st); diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp index 108499211602..fdcada44a50d 100644 --- a/tools/aapt/Resource.cpp +++ b/tools/aapt/Resource.cpp @@ -1285,10 +1285,10 @@ static status_t writeLayoutClasses( hasTable = true; fprintf(fp, "%s <p>Includes the following attributes:</p>\n" - "%s <table border=\"2\" width=\"85%%\" align=\"center\" frame=\"hsides\" rules=\"all\" cellpadding=\"5\">\n" + "%s <table>\n" "%s <colgroup align=\"left\" />\n" "%s <colgroup align=\"left\" />\n" - "%s <tr><th>Attribute<th>Summary</tr>\n", + "%s <tr><th>Attribute</th><th>Description</th></tr>\n", indentStr, indentStr, indentStr, @@ -1322,7 +1322,7 @@ static status_t writeLayoutClasses( } String16 name(name8); fixupSymbol(&name); - fprintf(fp, "%s <tr><th><code>{@link #%s_%s %s:%s}</code><td>%s</tr>\n", + fprintf(fp, "%s <tr><td><code>{@link #%s_%s %s:%s}</code></td><td>%s</td></tr>\n", indentStr, nclassName.string(), String8(name).string(), assets->getPackage().string(), diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp index 3cf6a711c460..19b9b01070a4 100644 --- a/tools/aapt/ResourceTable.cpp +++ b/tools/aapt/ResourceTable.cpp @@ -480,22 +480,22 @@ static status_t compileAttribute(const sp<AaptFile>& in, enumOrFlagsComment.append((attr.type&ResTable_map::TYPE_ENUM) ? String16(" be one of the following constant values.") : String16(" be one or more (separated by '|') of the following constant values.")); - enumOrFlagsComment.append(String16("</p>\n<table border=\"2\" width=\"85%\" align=\"center\" frame=\"hsides\" rules=\"all\" cellpadding=\"5\">\n" + enumOrFlagsComment.append(String16("</p>\n<table>\n" "<colgroup align=\"left\" />\n" "<colgroup align=\"left\" />\n" "<colgroup align=\"left\" />\n" - "<tr><th>Constant<th>Value<th>Description</tr>")); + "<tr><th>Constant</th><th>Value</th><th>Description</th></tr>")); } - enumOrFlagsComment.append(String16("\n<tr><th><code>")); + enumOrFlagsComment.append(String16("\n<tr><td><code>")); enumOrFlagsComment.append(itemIdent); - enumOrFlagsComment.append(String16("</code><td>")); + enumOrFlagsComment.append(String16("</code></td><td>")); enumOrFlagsComment.append(value); - enumOrFlagsComment.append(String16("<td>")); + enumOrFlagsComment.append(String16("</td><td>")); if (block.getComment(&len)) { enumOrFlagsComment.append(String16(block.getComment(&len))); } - enumOrFlagsComment.append(String16("</tr>")); + enumOrFlagsComment.append(String16("</td></tr>")); err = outTable->addBag(SourcePos(in->getPrintableSource(), block.getLineNumber()), myPackage, diff --git a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/BridgeXmlBlockParserTest.java b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/BridgeXmlBlockParserTest.java index 9e2987a4d33e..db1262f8b19b 100644 --- a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/BridgeXmlBlockParserTest.java +++ b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/BridgeXmlBlockParserTest.java @@ -41,7 +41,7 @@ public class BridgeXmlBlockParserTest extends TestCase { parser = new BridgeXmlBlockParser(parser, null, false /* platformResourceFlag */); InputStream input = this.getClass().getClassLoader().getResourceAsStream( - "/com/android/layoutlib/testdata/layout1.xml"); + "com/android/layoutlib/testdata/layout1.xml"); parser.setInput(input, null /*encoding*/); assertEquals(XmlPullParser.START_DOCUMENT, parser.next()); diff --git a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/NinePatchTest.java b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/NinePatchTest.java index 5314976ff89a..d5993dbb7f37 100644 --- a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/NinePatchTest.java +++ b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/NinePatchTest.java @@ -13,7 +13,7 @@ public class NinePatchTest extends TestCase { @Override protected void setUp() throws Exception { URL url = this.getClass().getClassLoader().getResource( - "/com/android/layoutlib/testdata/button.9.png"); + "com/android/layoutlib/testdata/button.9.png"); mPatch = NinePatch.load(url, false /* convert */); } |