Merge "Fixed bug with invalidation in top-level Views."
diff --git a/api/current.txt b/api/current.txt
index 334df2f..e379f8b 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -1610,6 +1610,7 @@
field public static final int TextAppearance_StatusBar_EventContent_Title = 16973928; // 0x1030068
field public static final int TextAppearance_StatusBar_Icon = 16973926; // 0x1030066
field public static final int TextAppearance_StatusBar_Title = 16973925; // 0x1030065
+ field public static final int TextAppearance_SuggestionHighlight = 16974104; // 0x1030118
field public static final int TextAppearance_Theme = 16973888; // 0x1030040
field public static final int TextAppearance_Theme_Dialog = 16973896; // 0x1030048
field public static final int TextAppearance_Widget = 16973897; // 0x1030049
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 0c791e1..efdb79e 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -1738,6 +1738,14 @@
public static final String POINTER_LOCATION = "pointer_location";
/**
+ * Show touch positions on screen?
+ * 0 = no
+ * 1 = yes
+ * @hide
+ */
+ public static final String SHOW_TOUCHES = "show_touches";
+
+ /**
* Log raw orientation data from {@link WindowOrientationListener} for use with the
* orientationplot.py tool.
* 0 = no
diff --git a/core/java/android/text/TextUtils.java b/core/java/android/text/TextUtils.java
index 83ef6ce..b8b54f4 100644
--- a/core/java/android/text/TextUtils.java
+++ b/core/java/android/text/TextUtils.java
@@ -31,9 +31,11 @@
import android.text.style.RelativeSizeSpan;
import android.text.style.ReplacementSpan;
import android.text.style.ScaleXSpan;
+import android.text.style.SpellCheckSpan;
import android.text.style.StrikethroughSpan;
import android.text.style.StyleSpan;
import android.text.style.SubscriptSpan;
+import android.text.style.SuggestionRangeSpan;
import android.text.style.SuggestionSpan;
import android.text.style.SuperscriptSpan;
import android.text.style.TextAppearanceSpan;
@@ -579,6 +581,10 @@
public static final int ANNOTATION = 18;
/** @hide */
public static final int SUGGESTION_SPAN = 19;
+ /** @hide */
+ public static final int SPELL_CHECK_SPAN = 20;
+ /** @hide */
+ public static final int SUGGESTION_RANGE_SPAN = 21;
/**
* Flatten a CharSequence and whatever styles can be copied across processes
@@ -734,6 +740,14 @@
readSpan(p, sp, new SuggestionSpan(p));
break;
+ case SPELL_CHECK_SPAN:
+ readSpan(p, sp, new SpellCheckSpan(p));
+ break;
+
+ case SUGGESTION_RANGE_SPAN:
+ readSpan(p, sp, new SuggestionRangeSpan());
+ break;
+
default:
throw new RuntimeException("bogus span encoding " + kind);
}
diff --git a/core/java/android/text/style/SpellCheckSpan.java b/core/java/android/text/style/SpellCheckSpan.java
index 9b23177..caaae99 100644
--- a/core/java/android/text/style/SpellCheckSpan.java
+++ b/core/java/android/text/style/SpellCheckSpan.java
@@ -16,6 +16,10 @@
package android.text.style;
+import android.os.Parcel;
+import android.text.ParcelableSpan;
+import android.text.TextUtils;
+
/**
* A SpellCheckSpan is an internal data structure created by the TextView's SpellChecker to
* annotate portions of the text that are about to or currently being spell checked. They are
@@ -23,7 +27,7 @@
*
* @hide
*/
-public class SpellCheckSpan {
+public class SpellCheckSpan implements ParcelableSpan {
private boolean mSpellCheckInProgress;
@@ -31,6 +35,10 @@
mSpellCheckInProgress = false;
}
+ public SpellCheckSpan(Parcel src) {
+ mSpellCheckInProgress = (src.readInt() != 0);
+ }
+
public void setSpellCheckInProgress() {
mSpellCheckInProgress = true;
}
@@ -38,4 +46,19 @@
public boolean isSpellCheckInProgress() {
return mSpellCheckInProgress;
}
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(mSpellCheckInProgress ? 1 : 0);
+ }
+
+ @Override
+ public int getSpanTypeId() {
+ return TextUtils.SPELL_CHECK_SPAN;
+ }
}
diff --git a/core/java/android/text/style/SuggestionRangeSpan.java b/core/java/android/text/style/SuggestionRangeSpan.java
new file mode 100644
index 0000000..fc91697
--- /dev/null
+++ b/core/java/android/text/style/SuggestionRangeSpan.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.text.style;
+
+import android.graphics.Color;
+import android.os.Parcel;
+import android.text.ParcelableSpan;
+import android.text.TextPaint;
+import android.text.TextUtils;
+
+/**
+ * A SuggestionRangeSpan is used to show which part of an EditText is affected by a suggestion
+ * popup window.
+ *
+ * @hide
+ */
+public class SuggestionRangeSpan extends CharacterStyle implements ParcelableSpan {
+ @Override
+ public void updateDrawState(TextPaint tp) {
+ tp.setColor(Color.GREEN);
+ }
+
+ public SuggestionRangeSpan() { /* Nothing to do*/ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) { /* Nothing to do*/ }
+
+ @Override
+ public int getSpanTypeId() {
+ return TextUtils.SUGGESTION_RANGE_SPAN;
+ }
+}
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index 5e7e509..ef3d3fa5 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -36,6 +36,20 @@
public static final int ROTATION_270 = 3;
/**
+ * Create Surface from a SurfaceTexture.
+ *
+ * @param surfaceTexture The {@link SurfaceTexture} that is updated by this Surface.
+ * @hide
+ */
+ public Surface(SurfaceTexture surfaceTexture) {
+ if (DEBUG_RELEASE) {
+ mCreationStack = new Exception();
+ }
+ mCanvas = new CompatibleCanvas();
+ initFromSurfaceTexture(surfaceTexture);
+ }
+
+ /**
* Does this object hold a valid surface? Returns true if it holds
* a physical surface, so lockCanvas() will succeed. Otherwise
* returns false.
@@ -222,20 +236,6 @@
native private static void nativeClassInit();
static { nativeClassInit(); }
- /**
- * Create Surface from a SurfaceTexture.
- *
- * @param surfaceTexture The {@link SurfaceTexture} that is updated by this Surface.
- * @hide
- */
- public Surface(SurfaceTexture surfaceTexture) {
- if (DEBUG_RELEASE) {
- mCreationStack = new Exception();
- }
- mCanvas = new CompatibleCanvas();
- initFromSurfaceTexture(surfaceTexture);
- }
-
/** create a surface @hide */
public Surface(SurfaceSession s,
int pid, int display, int w, int h, int format, int flags)
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 6238b72..2aa481c 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -4004,9 +4004,12 @@
// state.
// If mNativeClass is 0, we should not reach here, so we do not
// need to check it again.
- nativeRecordButtons(hasFocus() && hasWindowFocus(),
- mTouchMode == TOUCH_SHORTPRESS_START_MODE
- || mTrackballDown || mGotCenterDown, false);
+ if (mDrawCursorRing && drawRings) {
+ // Only update if we are actually going to use the result
+ nativeRecordButtons(hasFocus() && hasWindowFocus(),
+ mTouchMode == TOUCH_SHORTPRESS_START_MODE
+ || mTrackballDown || mGotCenterDown, false);
+ }
drawCoreAndCursorRing(canvas, mBackgroundColor,
mDrawCursorRing && drawRings);
}
@@ -4075,7 +4078,8 @@
boolean drawJavaRings = !mTouchHighlightRegion.isEmpty()
&& (mTouchMode == TOUCH_INIT_MODE
|| mTouchMode == TOUCH_SHORTPRESS_START_MODE
- || mTouchMode == TOUCH_SHORTPRESS_MODE);
+ || mTouchMode == TOUCH_SHORTPRESS_MODE
+ || mTouchMode == TOUCH_DONE_MODE);
boolean drawNativeRings = !drawJavaRings;
if (USE_WEBKIT_RINGS) {
drawNativeRings = !drawJavaRings && !isInTouchMode();
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index c021c48..e9662ae 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -84,10 +84,10 @@
import android.text.style.ClickableSpan;
import android.text.style.ParagraphStyle;
import android.text.style.SpellCheckSpan;
+import android.text.style.SuggestionRangeSpan;
import android.text.style.SuggestionSpan;
import android.text.style.TextAppearanceSpan;
import android.text.style.URLSpan;
-import android.text.style.UnderlineSpan;
import android.text.style.UpdateAppearance;
import android.text.util.Linkify;
import android.util.AttributeSet;
@@ -2894,7 +2894,6 @@
sp.removeSpan(cw);
}
- // hideControllers would do it, but it gets called after this method on rotation
sp.removeSpan(mSuggestionRangeSpan);
ss.text = sp;
@@ -5099,10 +5098,9 @@
@Override
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
- boolean areSuggestionsShown = areSuggestionsShown();
boolean isInSelectionMode = mSelectionActionMode != null;
- if (areSuggestionsShown || isInSelectionMode) {
+ if (isInSelectionMode) {
if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
KeyEvent.DispatcherState state = getKeyDispatcherState();
if (state != null) {
@@ -5115,10 +5113,6 @@
state.handleUpEvent(event);
}
if (event.isTracking() && !event.isCanceled()) {
- if (areSuggestionsShown) {
- hideSuggestions();
- return true;
- }
if (isInSelectionMode) {
stopSelectionActionMode();
return true;
@@ -5282,10 +5276,6 @@
// Has to be done on key down (and not on key up) to correctly be intercepted.
case KeyEvent.KEYCODE_BACK:
- if (areSuggestionsShown()) {
- hideSuggestions();
- return -1;
- }
if (mSelectionActionMode != null) {
stopSelectionActionMode();
return -1;
@@ -7950,9 +7940,6 @@
}
hideControllers();
-
- removeSpans(0, mText.length(), SuggestionSpan.class);
- removeSpans(0, mText.length(), SpellCheckSpan.class);
}
startStopMarquee(hasWindowFocus);
@@ -9196,11 +9183,6 @@
}
}
- private static class SuggestionRangeSpan extends UnderlineSpan {
- // TODO themable, would be nice to make it a child class of TextAppearanceSpan, but
- // there is no way to have underline and TextAppearanceSpan.
- }
-
private class SuggestionsPopupWindow extends PinnedPopupWindow implements OnClickListener {
private static final int MAX_NUMBER_SUGGESTIONS = SuggestionSpan.SUGGESTIONS_MAX_SIZE;
private static final int NO_SUGGESTIONS = -1;
@@ -9208,13 +9190,42 @@
private WordIterator mSuggestionWordIterator;
private TextAppearanceSpan[] mHighlightSpans = new TextAppearanceSpan
[(int) (AVERAGE_HIGHLIGHTS_PER_SUGGESTION * MAX_NUMBER_SUGGESTIONS)];
+ private boolean mCursorWasVisibleBeforeSuggestions;
+
+ private class CustomPopupWindow extends PopupWindow {
+ public CustomPopupWindow(Context context, int defStyle) {
+ super(context, null, defStyle);
+ }
+
+ @Override
+ public void dismiss() {
+ super.dismiss();
+
+ if ((mText instanceof Editable) && mSuggestionRangeSpan != null) {
+ ((Editable) mText).removeSpan(mSuggestionRangeSpan);
+ }
+
+ setCursorVisible(mCursorWasVisibleBeforeSuggestions);
+ if (hasInsertionController()) {
+ getInsertionController().show();
+ }
+ }
+ }
+
+ public SuggestionsPopupWindow() {
+ for (int i = 0; i < mHighlightSpans.length; i++) {
+ mHighlightSpans[i] = new TextAppearanceSpan(mContext,
+ android.R.style.TextAppearance_SuggestionHighlight);
+ }
+ mCursorWasVisibleBeforeSuggestions = mCursorVisible;
+ }
@Override
protected void createPopupWindow() {
- mPopupWindow = new PopupWindow(TextView.this.mContext, null,
+ mPopupWindow = new CustomPopupWindow(TextView.this.mContext,
com.android.internal.R.attr.textSuggestionsWindowStyle);
mPopupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
- mPopupWindow.setOutsideTouchable(true);
+ mPopupWindow.setFocusable(true);
mPopupWindow.setClippingEnabled(false);
}
@@ -9288,6 +9299,8 @@
if (!(mText instanceof Editable)) return;
if (updateSuggestions()) {
+ mCursorWasVisibleBeforeSuggestions = mCursorVisible;
+ setCursorVisible(false);
super.show();
}
}
@@ -9312,9 +9325,6 @@
@Override
public void hide() {
super.hide();
- if ((mText instanceof Editable) && mSuggestionRangeSpan != null) {
- ((Editable) mText).removeSpan(mSuggestionRangeSpan);
- }
}
private boolean updateSuggestions() {
@@ -9553,7 +9563,7 @@
final int spanEnd = suggestionInfo.spanEnd;
if (spanStart != NO_SUGGESTIONS) {
// SuggestionSpans are removed by replace: save them before
- Editable editable = ((Editable) mText);
+ Editable editable = (Editable) mText;
SuggestionSpan[] suggestionSpans = editable.getSpans(spanStart, spanEnd,
SuggestionSpan.class);
final int length = suggestionSpans.length;
@@ -9572,7 +9582,7 @@
final String suggestion = textView.getText().subSequence(
suggestionStart, suggestionEnd).toString();
final String originalText = mText.subSequence(spanStart, spanEnd).toString();
- ((Editable) mText).replace(spanStart, spanEnd, suggestion);
+ editable.replace(spanStart, spanEnd, suggestion);
// A replacement on a misspelled text removes the misspelled flag.
// TODO restore the flag if the misspelled word is selected back?
@@ -9624,12 +9634,6 @@
mSuggestionsPopupWindow.show();
}
- void hideSuggestions() {
- if (mSuggestionsPopupWindow != null) {
- mSuggestionsPopupWindow.hide();
- }
- }
-
boolean areSuggestionsShown() {
return mSuggestionsPopupWindow != null && mSuggestionsPopupWindow.isShowing();
}
@@ -10579,7 +10583,6 @@
mEndHandle.setActionPopupWindow(mStartHandle.getActionPopupWindow());
hideInsertionPointCursorController();
- hideSuggestions();
}
public void hide() {
@@ -10691,7 +10694,6 @@
private void hideControllers() {
hideInsertionPointCursorController();
stopSelectionActionMode();
- hideSuggestions();
}
/**
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index c35c5e6..052a040 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -890,11 +890,9 @@
<item name="android:textSize">30sp</item>
</style>
- <!-- @hide -->
<style name="TextAppearance.SuggestionHighlight">
<item name="android:textSize">18sp</item>
<item name="android:textColor">@android:color/suggestion_highlight_text</item>
- <item name="android:textStyle">bold</item>
</style>
<!-- Preference Styles -->
diff --git a/docs/html/guide/topics/usb/index.jd b/docs/html/guide/topics/usb/index.jd
index 3e2a18b..6dc8ec5 100644
--- a/docs/html/guide/topics/usb/index.jd
+++ b/docs/html/guide/topics/usb/index.jd
@@ -6,9 +6,9 @@
<h2>Topics</h2>
<ol>
- <li><a href="{@docRoot}guide/topics/USB/accessory.jd">USB Accessory</a></li>
+ <li><a href="{@docRoot}guide/topics/usb/accessory.html">USB Accessory</a></li>
- <li><a href="{@docRoot}guide/topics/USB/host.jd">USB Host</a></li>
+ <li><a href="{@docRoot}guide/topics/usb/host.html">USB Host</a></li>
</ol>
</div>
</div>
diff --git a/docs/html/resources/tutorials/hello-world.jd b/docs/html/resources/tutorials/hello-world.jd
index b11770f..9afab6a 100644
--- a/docs/html/resources/tutorials/hello-world.jd
+++ b/docs/html/resources/tutorials/hello-world.jd
@@ -18,16 +18,14 @@
</div>
</div>
-<p>As a developer, you know that the first impression
-of a development framework is how easy it is to write "Hello,
-World." Well, on Android, it's pretty easy.
-It's particularly easy if you're using Eclipse as your IDE, because we've provided a
-great plugin that handles your project creation and management to greatly speed-up your
-development cycles.</p>
+<p>As a developer, you know that the first impression of a development framework is how easy it is
+to write "Hello, World." Well, on Android, it's pretty easy. It's particularly easy if you're using
+Eclipse as your IDE, because we've provided a great plugin that handles your project creation and
+management to greatly speed up your development cycles.</p>
-<p>This tutorial assumes that you're using Eclipse. If you're not, see
-<a href="{@docRoot}guide/developing/other-ide.html">Developing in Other IDEs</a>.
-You can then return to this tutorial and ignore anything about Eclipse.</p>
+<p>This tutorial assumes that you're using Eclipse. If you're using the command line, see
+<a href="{@docRoot}/guide/developing/building/building-cmdline.html">Building and Running from the
+Command Line</a>. You can then return to this tutorial and ignore anything about Eclipse.</p>
<p>Before you start, you should already have the SDK installed, and if you're
using Eclipse, you should have installed the ADT plugin as well. If you have not
@@ -43,12 +41,12 @@
<p>To install a platform in Eclipse:</p>
<ol>
-
+
<li>In the Android SDK and AVD Manager, choose <strong>Available
-Packages</strong> in the left panel.</li>
-
-<li>Click the repository site checkbox to display the components
-available for installation.</li>
+Packages</strong> in the left panel.</li>
+
+<li>In the right panel, expand the Android Repository list to display
+the components available for installation.</li>
<li>Select at least one platform to install, and click <strong>Install
Selected</strong>. If you aren't sure which platform to install, use the latest
@@ -59,15 +57,14 @@
<div class="sidebox-wrapper">
<div class="sidebox">
- <p>To learn more about how to use AVDs and the options
- available to you, refer to the
- <a href="{@docRoot}guide/developing/tools/avd.html">Android
- Virtual Devices</a> document.</p>
+ <p>To learn more about how to use AVDs and the options
+ available to you, see <a href="{@docRoot}guide/developing/devices/index.html">Managing
+ Virtual Devices</a>.</p>
</div>
</div>
<p>In this tutorial, you will run your application in the Android Emulator.
-Before you can launch the emulator, you must create an
+Before you can launch the emulator, you must create an
Android Virtual Device (AVD). An AVD defines the system image and
device settings used by the emulator.</p>
@@ -75,32 +72,31 @@
<p>To create an AVD:</p>
<ol>
- <li>In Eclipse, choose <strong>Window > Android SDK and AVD Manager</strong>.
+ <li>In Eclipse, select <strong>Window > Android SDK and AVD Manager</strong>.</li>
<li>Select <strong>Virtual Devices</strong> in the left panel.</li>
- <li>Click <strong>New</strong>. </li>
-
-
-<p>The <strong>Create New AVD</strong> dialog appears.</p>
-
+ <li>Click <strong>New...</strong>.
+ <p>The <strong>Create New AVD</strong> dialog appears.</p>
+ </li>
<li>Type the name of the AVD, such as "my_avd".</li>
- <li>Choose a target. The target is the platform (that is, the version of the Android
- SDK, such as 2.1) you want to run on the emulator. </li>
-
- <p>You can ignore the rest of the fields for now. </p>
+ <li>Choose a target.
+ <p>The target is the platform (that is, the version of the Android SDK, such as 2.3.3) you want
+ to run on the emulator. For this tutorial, choose the latest platform that you have installed
+ and ignore the rest of the fields.</p>
+ </li>
<li>Click <strong>Create AVD</strong>.</li>
</ol>
<h2 id="create">Create a New Android Project</h2>
-<p>After you've created an AVD, the next step is to start a new
-Android project in Eclipse.</p>
+<p>After you've created an AVD you can move to the next step and start a new Android project in
+Eclipse.</p>
<ol>
- <li>From Eclipse, select <strong>File > New > Project</strong>.
+ <li>In Eclipse, select <strong>File > New > Project...</strong>.
<p>If the ADT
Plugin for Eclipse has been successfully installed, the resulting dialog
should have a folder labeled "Android" which should contain
- "Android Project". (After you create one or more Android projects, an entry for
+ "Android Project". (After you create one or more Android projects, an entry for
"Android XML File" will also be available.)</p>
</li>
@@ -111,6 +107,8 @@
<li>Fill in the project details with the following values:
<ul>
<li><em>Project name:</em> HelloAndroid</li>
+ <li><em>Build Target:</em> Select a platform version that is equal to or lower than the
+ target you chose for your AVD.</li>
<li><em>Application name:</em> Hello, Android</li>
<li><em>Package name:</em> com.example.helloandroid (or your own private namespace)</li>
<li><em>Create Activity:</em> HelloAndroid</li>
@@ -120,55 +118,60 @@
<a href="images/hello_world_1.png"><img src="images/hello_world_1.png" style="height:400px" alt="" /></a>
<p>Here is a description of each field:</p>
-
+
<dl>
<dt><em>Project Name</em></dt>
- <dd>This is the Eclipse Project name — the name of the directory
- that will contain the project files.</dd>
+ <dd>This is the Eclipse project name — the name of the directory
+ that contains the project files.</dd>
+ <dt><em>Build Target</em></dt>
+ <dd>This is the version of the Android SDK that you're using to build your
+ application. For example, if you choose Android 2.1, your application will be
+ compiled against the Android 2.1 platform library. The target you choose here
+ does not have to match the target you chose for your AVD; however, the target must
+ be equal to or lower than the target you chose for your AVD. Android
+ applications are forward-compatible, which means an application will run on the
+ platform against which it is built as well as all platforms that are released in the
+ future. For example, an application that is built against the 2.1 platform library
+ will run normally on an AVD or device that is running the 2.3.3. The reverse is not
+ true.</dd>
<dt><em>Application Name</em></dt>
<dd>This is the human-readable title for your application — the name that
- will appear on the Android device.</dd>
+ appears on the Android device.</dd>
<dt><em>Package Name</em></dt>
<dd>This is the package namespace (following the same rules as for
packages in the Java programming language) that you want all your source code to
reside under. This also sets the package name under which the stub
- Activity will be generated.
+ Activity is generated.
<p>Your package name must be unique across
- all packages installed on the Android system; for this reason, it's
+ all packages installed on the Android system; for this reason, it's
important to use a standard domain-style package for your
applications. The example above uses the "com.example" namespace, which is
a namespace reserved for example documentation —
when you develop your own applications, you should use a namespace that's
appropriate to your organization or entity.</p></dd>
<dt><em>Create Activity</em></dt>
- <dd>This is the name for the class stub that will be generated by the plugin.
- This will be a subclass of Android's {@link android.app.Activity} class. An
- Activity is simply a class that can run and do work. It can create a UI if it
+ <dd>This is the name for the class stub that is generated by the plugin.
+ This is a subclass of Android's {@link android.app.Activity} class. An
+ Activity is simply a class that can run and do work. It can create a UI if it
chooses, but it doesn't need to. As the checkbox suggests, this is optional, but an
Activity is almost always used as the basis for an application.</dd>
<dt><em>Min SDK Version</em></dt>
- <dd>This value specifies the minimum API Level required by your application. For
- more information, see <a href="{@docRoot}guide/appendix/api-levels.html">Android API Levels</a>.
+ <dd>This value specifies the minimum API Level on which your application will run.
+ The <em>Min SDK Version</em> should be the same as the <em>Build Target</em> you
+ chose. For example, if the <em>Build Target</em> is Android 2.1, then the <em>Min
+ SDK Version</em> should be 7 or lower (it can never be higher than 7). For more
+ information, see
+ <a href="{@docRoot}guide/appendix/api-levels.html">Android API Levels</a>.
</dd>
</dl>
-
- <p><em>Other fields</em>: The checkbox for "Use default location" allows you to change
- the location on disk where the project's files will be generated and stored. "Build Target"
- is the platform target that your application will be compiled against
- (this should be selected automatically, based on your Min SDK Version).</p>
- <p class="note">Notice that the "Build Target" you've selected uses the Android 1.1
- platform. This means that your application will be compiled against the Android 1.1
- platform library. If you recall, the AVD created above runs on the Android 1.5 platform.
- These don't have to match; Android applications are forward-compatible, so an application
- built against the 1.1 platform library will run normally on the 1.5 platform. The reverse
- is not true.</p>
+ <p><em>Other fields</em>: The checkbox for "Use default location" allows you to change
+ the location on disk where the project's files are generated and stored.</p>
</li>
</ol>
-<p>Your Android project is now ready. It should be visible in the Package
-Explorer on the left.
-Open the <code>HelloAndroid.java</code> file, located inside <em>HelloAndroid > src >
+<p>Your Android project is now ready. It should be visible in the Package Explorer on the left. Open
+the <code>HelloAndroid.java</code> file, located inside <em>HelloAndroid > src >
com.example.helloandroid</em>). It should look like this:</p>
<pre>
@@ -186,13 +189,13 @@
}
}</pre>
-<p>Notice that the class is based on the {@link android.app.Activity} class. An Activity is a
-single application entity that is used to perform actions. An application may have many separate
-activities, but the user interacts with them one at a time. The
-{@link android.app.Activity#onCreate(Bundle) onCreate()} method
-will be called by the Android system when your Activity starts —
+<p>Notice that the class is based on the {@link android.app.Activity} class. An Activity is a
+single application entity that is used to perform actions. An application may have many separate
+activities, but the user interacts with them one at a time. The
+{@link android.app.Activity#onCreate(Bundle) onCreate()} method
+is called by the Android system when your Activity starts —
it is where you should perform all initialization and UI setup. An activity is not required to
-have a user interface, but usually will.</p>
+have a user interface, but usually does.</p>
<p>Now let's modify some code! </p>
@@ -221,11 +224,12 @@
}</pre>
<p class="note"><strong>Tip:</strong> An easy way to add import packages to your project is
-to press <strong>Ctrl-Shift-O</strong> (<strong>Cmd-Shift-O</strong>, on Mac). This is an Eclipse
-shortcut that identifies missing packages based on your code and adds them for you.</p>
+to press <strong>Ctrl-Shift-O</strong> (<strong>Cmd-Shift-O</strong>, on Mac). This is an Eclipse
+shortcut that identifies missing packages based on your code and adds them for you. You may have
+to expand the <code>import</code> statements in your code for this to work.</p>
<p>An Android user interface is composed of hierarchies of objects called
-Views. A {@link android.view.View} is a drawable object used as an element in your UI layout,
+Views. A {@link android.view.View} is a drawable object used as an element in your UI layout,
such as a button, image, or (in this case) a text label. Each of these objects is a subclass
of the View class and the subclass that handles text is {@link android.widget.TextView}.</p>
@@ -237,7 +241,7 @@
HelloAndroid class is a subclass of Activity, it is also a Context. So, you can
pass <code>this</code> as your Context reference to the TextView.</p>
-<p>Next, you define the text content with
+<p>Next, you define the text content with
{@link android.widget.TextView#setText(CharSequence) setText()}.</p>
<p>Finally, you pass the TextView to
@@ -277,7 +281,7 @@
<p>The "Hello, Android" you see in the grey bar is actually the application title. The Eclipse plugin
creates this automatically (the string is defined in the <code>res/values/strings.xml</code> file and referenced
-by your <code>AndroidManifest.xml</code> file). The text below the title is the actual text that you have
+by your <code>AndroidManifest.xml</code> file). The text below the title is the actual text that you have
created in the TextView object.</p>
<p>That concludes the basic "Hello World" tutorial, but you should continue reading for some more
@@ -307,7 +311,7 @@
android:text="@string/hello"/></pre>
<p>The general structure of an Android XML layout file is simple: it's a tree
-of XML elements, wherein each node is the name of a View class
+of XML elements, wherein each node is the name of a View class
(this example, however, is just one View element). You can use the
name of any class that extends {@link android.view.View} as an element in your XML layouts,
including custom View classes you define in your own code. This
@@ -316,7 +320,7 @@
by the web development model, wherein you can separate the presentation of your
application (its UI) from the application logic used to fetch and fill in data.</p>
-<p>In the above XML example, there's just one View element: the <code>TextView</code>,
+<p>In the above XML example, there's just one View element: the <code>TextView</code>,
which has five XML attributes. Here's a summary of what they mean:</p>
<table>
@@ -343,7 +347,7 @@
</td>
<td>
This attribute assigns a unique identifier to the <code>TextView</code> element.
- You can use the assigned ID to reference this View from your source code or from other
+ You can use the assigned ID to reference this View from your source code or from other
XML resource declarations.
</td>
</tr>
@@ -352,7 +356,7 @@
<code>android:layout_width</code>
</td>
<td>
- This attribute defines how much of the available width on the screen this View should consume.
+ This attribute defines how much of the available width on the screen this View should consume.
In this case, it's the only View so you want it to take up the entire screen, which is what a value of "fill_parent" means.<br>
</td>
</tr>
@@ -369,7 +373,7 @@
<code>android:text</code>
</td>
<td>
- This sets the text that the TextView should display. In this example, you use a string
+ This sets the text that the TextView should display. In this example, you use a string
resource instead of a hard-coded string value.
The <em>hello</em> string is defined in the <em>res/values/strings.xml</em> file. This is the
recommended practice for inserting strings to your application, because it makes the localization
@@ -396,17 +400,17 @@
</div>
</div>
-<p>The Eclipse plugin automatically creates one of these layout files for you: main.xml.
-In the "Hello World" application you just completed, this file was ignored and you created a
+<p>The Eclipse plugin automatically creates one of these layout files for you: main.xml.
+In the "Hello World" application you just completed, this file was ignored and you created a
layout programmatically. This was meant to teach you more
-about the Android framework, but you should almost always define your layout
+about the Android framework, but you should almost always define your layout
in an XML file instead of in your code.
-The following procedures will instruct you how to change your
+The following procedures will instruct you how to change your
existing application to use an XML layout.</p>
<ol>
<li>In the Eclipse Package Explorer, expand the
-<code>/res/layout/</code> folder and open <code>main.xml</code> (once opened, you might need to click
+<code>/res/layout/</code> folder and open <code>main.xml</code> (once opened, you might need to click
the "main.xml" tab at the bottom of the window to see the XML source). Replace the contents with
the following XML:
@@ -421,7 +425,7 @@
<li>Inside the <code>res/values/</code> folder, open <code>strings.xml</code>.
This is where you should save all default text strings for your user interface. If you're using Eclipse, then
-ADT will have started you with two strings, <em>hello</em> and <em>app_name</em>.
+ADT will have started you with two strings, <em>hello</em> and <em>app_name</em>.
Revise <em>hello</em> to something else. Perhaps "Hello, Android! I am a string resource!"
The entire file should now look like this:
<pre>
@@ -450,11 +454,11 @@
}
}</pre>
-<p>When you make this change, type it by hand to try the
+<p>When you make this change, type it by hand to try the
code-completion feature. As you begin typing "R.layout.main" the plugin will offer you
suggestions. You'll find that it helps in a lot of situations.</p>
-<p>Instead of passing <code>setContentView()</code> a View object, you give it a reference
+<p>Instead of passing <code>setContentView()</code> a View object, you give it a reference
to the layout resource.
The resource is identified as <code>R.layout.main</code>, which is actually a compiled object representation of
the layout defined in <code>/res/layout/main.xml</code>. The Eclipse plugin automatically creates this reference for
@@ -464,25 +468,27 @@
</ol>
<p>Now re-run your application — because you've created a launch configuration, all
-you need to do is click the green arrow icon to run, or select
+you need to do is click the green arrow icon to run, or select
<strong>Run > Run History > Android Activity</strong>. Other than the change to the TextView
string, the application looks the same. After all, the point was to show that the two different
layout approaches produce identical results.</p>
-<p class="note"><strong>Tip:</strong> Use the shortcut <strong>Ctrl-F11</strong>
-(<strong>Cmd-Shift-F11</strong>, on Mac) to run your currently visible application.</p>
+<p class="note"><strong>Note:</strong> You may have to unlock the screen on the emulator to see
+your application — just as you would unlock the screen on a device. If you have problems
+running the emulator, see <a href="{@docRoot}guide/developing/devices/emulator.html">Using the
+Android Emulator</a>.</p>
<p>Continue reading for an introduction
to debugging and a little more information on using other IDEs. When you're ready to learn more,
read <a href="{@docRoot}guide/topics/fundamentals.html">Application
-Fundamentals</a> for an introduction to all the elements that make Android applications work.
+Fundamentals</a> for an introduction to all the elements that make Android applications work.
Also refer to the <a href="{@docRoot}guide/index.html">Developer's Guide</a>
introduction page for an overview of the <em>Dev Guide</em> documentation.</p>
<div class="special">
<h3>R class</h3>
-<p>In Eclipse, open the file named <code>R.java</code> (in the <code>gen/</code> [Generated Java Files] folder).
+<p>In Eclipse, open the file named <code>R.java</code> (in the <code>gen/</code> [Generated Java Files] folder).
It should look something like this:</p>
<pre>
@@ -510,16 +516,17 @@
<p>A project's <code>R.java</code> file is an index into all the resources defined in the
file. You use this class in your source code as a sort of short-hand
way to refer to resources you've included in your project. This is
-particularly powerful with the code-completion features of IDEs like Eclipse
+particularly powerful with the code-completion features of IDEs like Eclipse
because it lets you quickly and interactively locate the specific reference
you're looking for.</p>
-<p>It's possible yours looks slighly different than this (perhaps the hexadecimal values are different).
+<p>It's possible yours looks slightly different than this (perhaps the hexadecimal values are
+different).
For now, notice the inner class named "layout", and its
member field "main". The Eclipse plugin noticed the XML
layout file named main.xml and generated a class for it here. As you add other
resources to your project (such as strings in the <code>res/values/string.xml</code> file or drawables inside
-the <code>res/drawable/</code> direcory) you'll see <code>R.java</code> change to keep up.</p>
+the <code>res/drawable/</code> directory) you'll see <code>R.java</code> change to keep up.</p>
<p>When not using Eclipse, this class file will be generated for you at build time (with the Ant tool).</p>
<p><em>You should never edit this file by hand.</em></p>
</div>
@@ -554,9 +561,9 @@
<p>Press "Force Quit" to terminate the application and close the emulator window.</p>
-<p>To find out more about the error, set a breakpoint in your source code
-on the line <code>Object o = null;</code> (double-click on the marker bar next to the source code line). Then select <strong>Run > Debug History > Hello,
-Android</strong> from the menu to enter debug mode. Your app will restart in the
+<p>To find out more about the error, set a breakpoint in your source code
+on the line <code>Object o = null;</code> (double-click on the marker bar next to the source code line). Then select <strong>Run > Debug History > Hello,
+Android</strong> from the menu to enter debug mode. Your app will restart in the
emulator, but this time it will suspend when it reaches the breakpoint you
set. You can then step through the code in Eclipse's Debug Perspective,
just as you would for any other application.</p>
@@ -565,36 +572,36 @@
<h2 id="noeclipse">Creating the Project without Eclipse</h2>
-
+
<p>If you don't use Eclipse (such as if you prefer another IDE, or simply use text
editors and command line tools) then the Eclipse plugin can't help you.
Don't worry though — you don't lose any functionality just because you don't
use Eclipse.</p>
-
+
<p>The Android Plugin for Eclipse is really just a wrapper around a set of tools
included with the Android SDK. (These tools, like the emulator, aapt, adb,
- ddms, and others are <a href="{@docRoot}guide/developing/tools/index.html">documented elsewhere.</a>)
+ ddms, and others are <a href="{@docRoot}guide/developing/tools/index.html">documented elsewhere.</a>)
Thus, it's possible to
wrap those tools with another tool, such as an 'ant' build file.</p>
-
+
<p>The Android SDK includes a tool named "android" that can be
used to create all the source code and directory stubs for your project, as well
as an ant-compatible <code>build.xml</code> file. This allows you to build your project
from the command line, or integrate it with the IDE of your choice.</p>
-
+
<p>For example, to create a HelloAndroid project similar to the one created
in Eclipse, use this command:</p>
-
+
<pre>
android create project \
--package com.example.helloandroid \
- --activity HelloAndroid \
+ --activity HelloAndroid \
--target 2 \
- --path <em><path-to-your-project></em>/HelloAndroid
+ --path <em><path-to-your-project></em>/HelloAndroid
</pre>
- <p>This creates the required folders and files for the project at the location
+ <p>This creates the required folders and files for the project at the location
defined by the <em>path</em>.</p>
-
- <p>For more information on how to use the SDK tools to create and build projects, please read
+
+ <p>For more information on how to use the SDK tools to create and build projects, please read
<a href="{@docRoot}guide/developing/other-ide.html">Developing in Other IDEs</a>.</p>
\ No newline at end of file
diff --git a/include/utils/threads.h b/include/utils/threads.h
index c84a9b4..c685625 100644
--- a/include/utils/threads.h
+++ b/include/utils/threads.h
@@ -143,6 +143,13 @@
// in either case errno is set. Thread ID zero means current thread.
extern int androidSetThreadPriority(pid_t tid, int prio);
+// Get the current scheduling group of a particular thread. Normally returns
+// one of the ANDROID_TGROUP constants other than ANDROID_TGROUP_DEFAULT.
+// Returns ANDROID_TGROUP_DEFAULT if no pthread support (e.g. on host) or if
+// scheduling groups are disabled. Returns INVALID_OPERATION if unexpected error.
+// Thread ID zero means current thread.
+extern int androidGetThreadSchedulingGroup(pid_t tid);
+
#ifdef __cplusplus
}
#endif
diff --git a/libs/rs/scriptc/rs_time.rsh b/libs/rs/scriptc/rs_time.rsh
index f8f297d..60e3dee 100644
--- a/libs/rs/scriptc/rs_time.rsh
+++ b/libs/rs/scriptc/rs_time.rsh
@@ -15,43 +15,96 @@
*/
/** @file rs_time.rsh
- * \brief Time routines
+ * \brief Renderscript time routines
*
- *
+ * This file contains Renderscript functions relating to time and date
+ * manipulation.
*/
#ifndef __RS_TIME_RSH__
#define __RS_TIME_RSH__
+/**
+ * Calendar time interpreted as seconds elapsed since the Epoch (00:00:00 on
+ * January 1, 1970, Coordinated Universal Time (UTC)).
+ */
typedef int rs_time_t;
+/**
+ * Data structure for broken-down time components.
+ *
+ * tm_sec - Seconds after the minute. This ranges from 0 to 59, but possibly
+ * up to 60 for leap seconds.
+ * tm_min - Minutes after the hour. This ranges from 0 to 59.
+ * tm_hour - Hours past midnight. This ranges from 0 to 23.
+ * tm_mday - Day of the month. This ranges from 1 to 31.
+ * tm_mon - Months since January. This ranges from 0 to 11.
+ * tm_year - Years since 1900.
+ * tm_wday - Days since Sunday. This ranges from 0 to 6.
+ * tm_yday - Days since January 1. This ranges from 0 to 365.
+ * tm_isdst - Flag to indicate whether daylight saving time is in effect. The
+ * value is positive if it is in effect, zero if it is not, and
+ * negative if the information is not available.
+ */
typedef struct {
- int tm_sec;
- int tm_min;
- int tm_hour;
- int tm_mday;
- int tm_mon;
- int tm_year;
- int tm_wday;
- int tm_yday;
- int tm_isdst;
+ int tm_sec; ///< seconds
+ int tm_min; ///< minutes
+ int tm_hour; ///< hours
+ int tm_mday; ///< day of the month
+ int tm_mon; ///< month
+ int tm_year; ///< year
+ int tm_wday; ///< day of the week
+ int tm_yday; ///< day of the year
+ int tm_isdst; ///< daylight savings time
} rs_tm;
+/**
+ * Returns the number of seconds since the Epoch (00:00:00 UTC, January 1,
+ * 1970). If @p timer is non-NULL, the result is also stored in the memory
+ * pointed to by this variable. If an error occurs, a value of -1 is returned.
+ *
+ * @param timer Location to also store the returned calendar time.
+ *
+ * @return Seconds since the Epoch.
+ */
extern rs_time_t __attribute__((overloadable))
rsTime(rs_time_t *timer);
+/**
+ * Converts the time specified by @p timer into broken-down time and stores it
+ * in @p local. This function also returns a pointer to @p local. If @p local
+ * is NULL, this function does nothing and returns NULL.
+ *
+ * @param local Broken-down time.
+ * @param timer Input time as calendar time.
+ *
+ * @return Pointer to broken-down time (same as input @p local).
+ */
extern rs_tm * __attribute__((overloadable))
rsLocaltime(rs_tm *local, const rs_time_t *timer);
-// Return the current system clock in milliseconds
+/**
+ * Returns the current system clock (uptime) in milliseconds.
+ *
+ * @return Uptime in milliseconds.
+ */
extern int64_t __attribute__((overloadable))
rsUptimeMillis(void);
-// Return the current system clock in nanoseconds
+/**
+ * Returns the current system clock (uptime) in nanoseconds.
+ *
+ * @return Uptime in nanoseconds.
+ */
extern int64_t __attribute__((overloadable))
rsUptimeNanos(void);
-// Return the time in seconds since function was last called in this script.
+/**
+ * Returns the time in seconds since this function was last called in this
+ * script.
+ *
+ * @return Time in seconds.
+ */
extern float __attribute__((overloadable))
rsGetDt(void);
diff --git a/libs/rs/scriptc/rs_types.rsh b/libs/rs/scriptc/rs_types.rsh
index 875beb9..5d5df60 100644
--- a/libs/rs/scriptc/rs_types.rsh
+++ b/libs/rs/scriptc/rs_types.rsh
@@ -89,7 +89,7 @@
*/
typedef uint32_t uint;
/**
- * Typedef for unsigned char (use for 64-bit unsigned integers)
+ * Typedef for unsigned long (use for 64-bit unsigned integers)
*/
typedef uint64_t ulong;
/**
@@ -102,67 +102,67 @@
typedef int32_t ssize_t;
/**
- * \brief Opaque handle to a RenderScript element.
+ * \brief Opaque handle to a Renderscript element.
*
* See: android.renderscript.Element
*/
typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_element;
/**
- * \brief Opaque handle to a RenderScript type.
+ * \brief Opaque handle to a Renderscript type.
*
* See: android.renderscript.Type
*/
typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_type;
/**
- * \brief Opaque handle to a RenderScript allocation.
+ * \brief Opaque handle to a Renderscript allocation.
*
* See: android.renderscript.Allocation
*/
typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_allocation;
/**
- * \brief Opaque handle to a RenderScript sampler object.
+ * \brief Opaque handle to a Renderscript sampler object.
*
* See: android.renderscript.Sampler
*/
typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_sampler;
/**
- * \brief Opaque handle to a RenderScript script object.
+ * \brief Opaque handle to a Renderscript script object.
*
* See: android.renderscript.ScriptC
*/
typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_script;
/**
- * \brief Opaque handle to a RenderScript mesh object.
+ * \brief Opaque handle to a Renderscript mesh object.
*
* See: android.renderscript.Mesh
*/
typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_mesh;
/**
- * \brief Opaque handle to a RenderScript ProgramFragment object.
+ * \brief Opaque handle to a Renderscript ProgramFragment object.
*
* See: android.renderscript.ProgramFragment
*/
typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_fragment;
/**
- * \brief Opaque handle to a RenderScript ProgramVertex object.
+ * \brief Opaque handle to a Renderscript ProgramVertex object.
*
* See: android.renderscript.ProgramVertex
*/
typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_vertex;
/**
- * \brief Opaque handle to a RenderScript sampler object.
+ * \brief Opaque handle to a Renderscript ProgramRaster object.
*
- * See: android.renderscript.Sampler
+ * See: android.renderscript.ProgramRaster
*/
typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_raster;
/**
- * \brief Opaque handle to a RenderScript ProgramStore object.
+ * \brief Opaque handle to a Renderscript ProgramStore object.
*
* See: android.renderscript.ProgramStore
*/
typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_store;
/**
- * \brief Opaque handle to a RenderScript font object.
+ * \brief Opaque handle to a Renderscript font object.
*
* See: android.renderscript.Font
*/
@@ -170,163 +170,163 @@
/**
* Vector version of the basic float type.
- * Provides two float fields packed into a single 64bit field with 64 bit
+ * Provides two float fields packed into a single 64 bit field with 64 bit
* alignment.
*/
typedef float float2 __attribute__((ext_vector_type(2)));
/**
* Vector version of the basic float type. Provides three float fields packed
- * into a single 128bit field with 128 bit alignment.
+ * into a single 128 bit field with 128 bit alignment.
*/
typedef float float3 __attribute__((ext_vector_type(3)));
/**
* Vector version of the basic float type.
- * Provides four float fields packed into a single 128bit field with 128bit
+ * Provides four float fields packed into a single 128 bit field with 128 bit
* alignment.
*/
typedef float float4 __attribute__((ext_vector_type(4)));
/**
* Vector version of the basic double type. Provides two double fields packed
- * into a single 128bit field with 128bit alignment.
+ * into a single 128 bit field with 128 bit alignment.
*/
typedef double double2 __attribute__((ext_vector_type(2)));
/**
* Vector version of the basic double type. Provides three double fields packed
- * into a single 256bit field with 256bit alignment.
+ * into a single 256 bit field with 256 bit alignment.
*/
typedef double double3 __attribute__((ext_vector_type(3)));
/**
* Vector version of the basic double type. Provides four double fields packed
- * into a single 256bit field with 256bit alignment.
+ * into a single 256 bit field with 256 bit alignment.
*/
typedef double double4 __attribute__((ext_vector_type(4)));
/**
* Vector version of the basic uchar type. Provides two uchar fields packed
- * into a single 16bit field with 16bit alignment.
+ * into a single 16 bit field with 16 bit alignment.
*/
typedef uchar uchar2 __attribute__((ext_vector_type(2)));
/**
* Vector version of the basic uchar type. Provides three uchar fields packed
- * into a single 32bit field with 32bit alignment.
+ * into a single 32 bit field with 32 bit alignment.
*/
typedef uchar uchar3 __attribute__((ext_vector_type(3)));
/**
* Vector version of the basic uchar type. Provides four uchar fields packed
- * into a single 32bit field with 32bit alignment.
+ * into a single 32 bit field with 32 bit alignment.
*/
typedef uchar uchar4 __attribute__((ext_vector_type(4)));
/**
* Vector version of the basic ushort type. Provides two ushort fields packed
- * into a single 32bit field with 32bit alignment.
+ * into a single 32 bit field with 32 bit alignment.
*/
typedef ushort ushort2 __attribute__((ext_vector_type(2)));
/**
* Vector version of the basic ushort type. Provides three ushort fields packed
- * into a single 64bit field with 64bit alignment.
+ * into a single 64 bit field with 64 bit alignment.
*/
typedef ushort ushort3 __attribute__((ext_vector_type(3)));
/**
* Vector version of the basic ushort type. Provides four ushort fields packed
- * into a single 64bit field with 64bit alignment.
+ * into a single 64 bit field with 64 bit alignment.
*/
typedef ushort ushort4 __attribute__((ext_vector_type(4)));
/**
* Vector version of the basic uint type. Provides two uint fields packed into a
- * single 64bit field with 64bit alignment.
+ * single 64 bit field with 64 bit alignment.
*/
typedef uint uint2 __attribute__((ext_vector_type(2)));
/**
* Vector version of the basic uint type. Provides three uint fields packed into
- * a single 128bit field with 128bit alignment.
+ * a single 128 bit field with 128 bit alignment.
*/
typedef uint uint3 __attribute__((ext_vector_type(3)));
/**
* Vector version of the basic uint type. Provides four uint fields packed into
- * a single 128bit field with 128bit alignment.
+ * a single 128 bit field with 128 bit alignment.
*/
typedef uint uint4 __attribute__((ext_vector_type(4)));
/**
* Vector version of the basic ulong type. Provides two ulong fields packed into
- * a single 128bit field with 128bit alignment.
+ * a single 128 bit field with 128 bit alignment.
*/
typedef ulong ulong2 __attribute__((ext_vector_type(2)));
/**
* Vector version of the basic ulong type. Provides three ulong fields packed
- * into a single 256bit field with 256bit alignment.
+ * into a single 256 bit field with 256 bit alignment.
*/
typedef ulong ulong3 __attribute__((ext_vector_type(3)));
/**
* Vector version of the basic ulong type. Provides four ulong fields packed
- * into a single 256bit field with 256bit alignment.
+ * into a single 256 bit field with 256 bit alignment.
*/
typedef ulong ulong4 __attribute__((ext_vector_type(4)));
/**
* Vector version of the basic char type. Provides two char fields packed into a
- * single 16bit field with 16bit alignment.
+ * single 16 bit field with 16 bit alignment.
*/
typedef char char2 __attribute__((ext_vector_type(2)));
/**
* Vector version of the basic char type. Provides three char fields packed into
- * a single 32bit field with 32bit alignment.
+ * a single 32 bit field with 32 bit alignment.
*/
typedef char char3 __attribute__((ext_vector_type(3)));
/**
* Vector version of the basic char type. Provides four char fields packed into
- * a single 32bit field with 32bit alignment.
+ * a single 32 bit field with 32 bit alignment.
*/
typedef char char4 __attribute__((ext_vector_type(4)));
/**
* Vector version of the basic short type. Provides two short fields packed into
- * a single 32bit field with 32bit alignment.
+ * a single 32 bit field with 32 bit alignment.
*/
typedef short short2 __attribute__((ext_vector_type(2)));
/**
* Vector version of the basic short type. Provides three short fields packed
- * into a single 64bit field with 64bit alignment.
+ * into a single 64 bit field with 64 bit alignment.
*/
typedef short short3 __attribute__((ext_vector_type(3)));
/**
* Vector version of the basic short type. Provides four short fields packed
- * into a single 64bit field with 64bit alignment.
+ * into a single 64 bit field with 64 bit alignment.
*/
typedef short short4 __attribute__((ext_vector_type(4)));
/**
* Vector version of the basic int type. Provides two int fields packed into a
- * single 64bit field with 64bit alignment.
+ * single 64 bit field with 64 bit alignment.
*/
typedef int int2 __attribute__((ext_vector_type(2)));
/**
* Vector version of the basic int type. Provides three int fields packed into a
- * single 128bit field with 128bit alignment.
+ * single 128 bit field with 128 bit alignment.
*/
typedef int int3 __attribute__((ext_vector_type(3)));
/**
* Vector version of the basic int type. Provides two four fields packed into a
- * single 128bit field with 128bit alignment.
+ * single 128 bit field with 128 bit alignment.
*/
typedef int int4 __attribute__((ext_vector_type(4)));
/**
* Vector version of the basic long type. Provides two long fields packed into a
- * single 128bit field with 128bit alignment.
+ * single 128 bit field with 128 bit alignment.
*/
typedef long long2 __attribute__((ext_vector_type(2)));
/**
* Vector version of the basic long type. Provides three long fields packed into
- * a single 256bit field with 256bit alignment.
+ * a single 256 bit field with 256 bit alignment.
*/
typedef long long3 __attribute__((ext_vector_type(3)));
/**
* Vector version of the basic long type. Provides four long fields packed into
- * a single 256bit field with 256bit alignment.
+ * a single 256 bit field with 256 bit alignment.
*/
typedef long long4 __attribute__((ext_vector_type(4)));
@@ -369,8 +369,6 @@
/**
* \brief Enum for selecting cube map faces
- *
- * Used todo-alexst
*/
typedef enum {
RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X = 0,
diff --git a/libs/utils/Threads.cpp b/libs/utils/Threads.cpp
index d18c0a2..02c380b 100644
--- a/libs/utils/Threads.cpp
+++ b/libs/utils/Threads.cpp
@@ -368,6 +368,41 @@
return rc;
}
+int androidGetThreadSchedulingGroup(pid_t tid)
+{
+ int ret = ANDROID_TGROUP_DEFAULT;
+
+#if defined(HAVE_PTHREADS)
+ // convention is to not call get/set_sched_policy methods if disabled by property
+ pthread_once(&gDoSchedulingGroupOnce, checkDoSchedulingGroup);
+ if (gDoSchedulingGroup) {
+ SchedPolicy policy;
+ // get_sched_policy does not support tid == 0
+ if (tid == 0) {
+ tid = androidGetTid();
+ }
+ if (get_sched_policy(tid, &policy) < 0) {
+ ret = INVALID_OPERATION;
+ } else {
+ switch (policy) {
+ case SP_BACKGROUND:
+ ret = ANDROID_TGROUP_BG_NONINTERACT;
+ break;
+ case SP_FOREGROUND:
+ ret = ANDROID_TGROUP_FG_BOOST;
+ break;
+ default:
+ // should not happen, as enum SchedPolicy does not have any other values
+ ret = INVALID_OPERATION;
+ break;
+ }
+ }
+ }
+#endif
+
+ return ret;
+}
+
namespace android {
/*
diff --git a/media/libmediaplayerservice/StagefrightPlayer.cpp b/media/libmediaplayerservice/StagefrightPlayer.cpp
index 40e055c..cd4b1ef 100644
--- a/media/libmediaplayerservice/StagefrightPlayer.cpp
+++ b/media/libmediaplayerservice/StagefrightPlayer.cpp
@@ -72,16 +72,14 @@
status_t StagefrightPlayer::setVideoSurface(const sp<Surface> &surface) {
LOGV("setVideoSurface");
- mPlayer->setSurface(surface);
- return OK;
+ return mPlayer->setSurface(surface);
}
status_t StagefrightPlayer::setVideoSurfaceTexture(
const sp<ISurfaceTexture> &surfaceTexture) {
LOGV("setVideoSurfaceTexture");
- mPlayer->setSurfaceTexture(surfaceTexture);
- return OK;
+ return mPlayer->setSurfaceTexture(surfaceTexture);
}
status_t StagefrightPlayer::prepare() {
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index bc42a42..142dda0 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -1152,22 +1152,26 @@
return (mFlags & PLAYING) || (mFlags & CACHE_UNDERRUN);
}
-void AwesomePlayer::setSurface(const sp<Surface> &surface) {
+status_t AwesomePlayer::setSurface(const sp<Surface> &surface) {
Mutex::Autolock autoLock(mLock);
mSurface = surface;
- setNativeWindow_l(surface);
+ return setNativeWindow_l(surface);
}
-void AwesomePlayer::setSurfaceTexture(const sp<ISurfaceTexture> &surfaceTexture) {
+status_t AwesomePlayer::setSurfaceTexture(const sp<ISurfaceTexture> &surfaceTexture) {
Mutex::Autolock autoLock(mLock);
mSurface.clear();
+
+ status_t err;
if (surfaceTexture != NULL) {
- setNativeWindow_l(new SurfaceTextureClient(surfaceTexture));
+ err = setNativeWindow_l(new SurfaceTextureClient(surfaceTexture));
} else {
- setNativeWindow_l(NULL);
+ err = setNativeWindow_l(NULL);
}
+
+ return err;
}
void AwesomePlayer::shutdownVideoDecoder_l() {
@@ -1190,11 +1194,11 @@
LOGI("video decoder shutdown completed");
}
-void AwesomePlayer::setNativeWindow_l(const sp<ANativeWindow> &native) {
+status_t AwesomePlayer::setNativeWindow_l(const sp<ANativeWindow> &native) {
mNativeWindow = native;
if (mVideoSource == NULL) {
- return;
+ return OK;
}
LOGI("attempting to reconfigure to use new surface");
@@ -1206,7 +1210,12 @@
shutdownVideoDecoder_l();
- CHECK_EQ(initVideoDecoder(), (status_t)OK);
+ status_t err = initVideoDecoder();
+
+ if (err != OK) {
+ LOGE("failed to reinstantiate video decoder after surface change.");
+ return err;
+ }
if (mLastVideoTimeUs >= 0) {
mSeeking = SEEK;
@@ -1217,6 +1226,8 @@
if (wasPlaying) {
play_l();
}
+
+ return OK;
}
void AwesomePlayer::setAudioSink(
diff --git a/media/libstagefright/include/AwesomePlayer.h b/media/libstagefright/include/AwesomePlayer.h
index 14476d3..24cf77c 100644
--- a/media/libstagefright/include/AwesomePlayer.h
+++ b/media/libstagefright/include/AwesomePlayer.h
@@ -84,8 +84,8 @@
bool isPlaying() const;
- void setSurface(const sp<Surface> &surface);
- void setSurfaceTexture(const sp<ISurfaceTexture> &surfaceTexture);
+ status_t setSurface(const sp<Surface> &surface);
+ status_t setSurfaceTexture(const sp<ISurfaceTexture> &surfaceTexture);
void setAudioSink(const sp<MediaPlayerBase::AudioSink> &audioSink);
status_t setLooping(bool shouldLoop);
@@ -298,7 +298,7 @@
void postAudioSeekComplete_l();
void shutdownVideoDecoder_l();
- void setNativeWindow_l(const sp<ANativeWindow> &native);
+ status_t setNativeWindow_l(const sp<ANativeWindow> &native);
bool isStreamingHTTP() const;
void sendCacheStats();
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index e2d6c5f..b69a7c2 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -888,7 +888,8 @@
// Mark as handled
st.isHandled = true;
- if ((flags & Menu.FLAG_PERFORM_NO_CLOSE) == 0) {
+ // Only close down the menu if we don't have an action bar keeping it open.
+ if ((flags & Menu.FLAG_PERFORM_NO_CLOSE) == 0 && mActionBar == null) {
closePanel(st, true);
}
}
@@ -909,7 +910,10 @@
boolean res = st.menu.performIdentifierAction(id, flags);
- closePanel(st, true);
+ // Only close down the menu if we don't have an action bar keeping it open.
+ if (mActionBar == null) {
+ closePanel(st, true);
+ }
return res;
}
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index bfcf8e0..e39712e 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -2491,7 +2491,8 @@
bool resetNeeded = false;
if (!changes || (changes & (InputReaderConfiguration::CHANGE_DISPLAY_INFO
- | InputReaderConfiguration::CHANGE_POINTER_GESTURE_ENABLEMENT))) {
+ | InputReaderConfiguration::CHANGE_POINTER_GESTURE_ENABLEMENT
+ | InputReaderConfiguration::CHANGE_SHOW_TOUCHES))) {
// Configure device sources, surface dimensions, orientation and
// scaling factors.
configureSurface(when, &resetNeeded);
@@ -2523,17 +2524,17 @@
}
}
- if (getEventHub()->hasRelativeAxis(getDeviceId(), REL_X)
+ if (getEventHub()->hasInputProperty(getDeviceId(), INPUT_PROP_DIRECT)) {
+ // The device is a touch screen.
+ mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_SCREEN;
+ } else if (getEventHub()->hasInputProperty(getDeviceId(), INPUT_PROP_POINTER)) {
+ // The device is a pointing device like a track pad.
+ mParameters.deviceType = Parameters::DEVICE_TYPE_POINTER;
+ } else if (getEventHub()->hasRelativeAxis(getDeviceId(), REL_X)
|| getEventHub()->hasRelativeAxis(getDeviceId(), REL_Y)) {
// The device is a cursor device with a touch pad attached.
// By default don't use the touch pad to move the pointer.
mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_PAD;
- } else if (getEventHub()->hasInputProperty(getDeviceId(), INPUT_PROP_POINTER)) {
- // The device is a pointing device like a track pad.
- mParameters.deviceType = Parameters::DEVICE_TYPE_POINTER;
- } else if (getEventHub()->hasInputProperty(getDeviceId(), INPUT_PROP_DIRECT)) {
- // The device is a touch screen.
- mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_SCREEN;
} else {
// The device is a touch pad of unknown purpose.
mParameters.deviceType = Parameters::DEVICE_TYPE_POINTER;
@@ -2681,18 +2682,19 @@
bool deviceModeChanged;
if (mDeviceMode != oldDeviceMode) {
deviceModeChanged = true;
-
- if (mDeviceMode == DEVICE_MODE_POINTER) {
- if (mPointerController == NULL) {
- mPointerController = getPolicy()->obtainPointerController(getDeviceId());
- }
- } else {
- mPointerController.clear();
- }
-
mOrientedRanges.clear();
}
+ // Create pointer controller if needed.
+ if (mDeviceMode == DEVICE_MODE_POINTER ||
+ (mDeviceMode == DEVICE_MODE_DIRECT && mConfig.showTouches)) {
+ if (mPointerController == NULL) {
+ mPointerController = getPolicy()->obtainPointerController(getDeviceId());
+ }
+ } else {
+ mPointerController.clear();
+ }
+
bool orientationChanged = mSurfaceOrientation != orientation;
if (orientationChanged) {
mSurfaceOrientation = orientation;
@@ -3380,7 +3382,7 @@
cookPointerData();
// Dispatch the touches either directly or by translation through a pointer on screen.
- if (mPointerController != NULL) {
+ if (mDeviceMode == DEVICE_MODE_POINTER) {
for (BitSet32 idBits(mCurrentRawPointerData.touchingIdBits); !idBits.isEmpty(); ) {
uint32_t id = idBits.clearFirstMarkedBit();
const RawPointerData::Pointer& pointer = mCurrentRawPointerData.pointerForId(id);
@@ -3418,6 +3420,17 @@
dispatchPointerUsage(when, policyFlags, pointerUsage);
} else {
+ if (mDeviceMode == DEVICE_MODE_DIRECT
+ && mConfig.showTouches && mPointerController != NULL) {
+ mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_SPOT);
+ mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL);
+
+ mPointerController->setButtonState(mCurrentButtonState);
+ mPointerController->setSpots(mCurrentCookedPointerData.pointerCoords,
+ mCurrentCookedPointerData.idToIndex,
+ mCurrentCookedPointerData.touchingIdBits);
+ }
+
dispatchHoverExit(when, policyFlags);
dispatchTouches(when, policyFlags);
dispatchHoverEnterAndMove(when, policyFlags);
@@ -3442,7 +3455,7 @@
}
void TouchInputMapper::timeoutExpired(nsecs_t when) {
- if (mPointerController != NULL) {
+ if (mDeviceMode == DEVICE_MODE_POINTER) {
if (mPointerUsage == POINTER_USAGE_GESTURES) {
dispatchPointerGestures(when, 0 /*policyFlags*/, true /*isTimeout*/);
}
diff --git a/services/input/InputReader.h b/services/input/InputReader.h
index bad96df..cd3ea37 100644
--- a/services/input/InputReader.h
+++ b/services/input/InputReader.h
@@ -56,6 +56,9 @@
// The display size or orientation changed.
CHANGE_DISPLAY_INFO = 1 << 2,
+ // The visible touches option changed.
+ CHANGE_SHOW_TOUCHES = 1 << 3,
+
// All devices must be reopened.
CHANGE_MUST_REOPEN = 1 << 31,
};
@@ -140,6 +143,9 @@
// will cover this portion of the display diagonal.
float pointerGestureZoomSpeedRatio;
+ // True to show the location of touches on the touch screen as spots.
+ bool showTouches;
+
InputReaderConfiguration() :
virtualKeyQuietTime(0),
pointerVelocityControlParameters(1.0f, 500.0f, 3000.0f, 3.0f),
@@ -155,7 +161,8 @@
pointerGestureSwipeTransitionAngleCosine(0.2588f), // cosine of 75 degrees
pointerGestureSwipeMaxWidthRatio(0.25f),
pointerGestureMovementSpeedRatio(0.8f),
- pointerGestureZoomSpeedRatio(0.3f) { }
+ pointerGestureZoomSpeedRatio(0.3f),
+ showTouches(false) { }
bool getDisplayInfo(int32_t displayId, bool external,
int32_t* width, int32_t* height, int32_t* orientation) const;
diff --git a/services/java/com/android/server/wm/InputManager.java b/services/java/com/android/server/wm/InputManager.java
index c8b18c8..60333a3 100644
--- a/services/java/com/android/server/wm/InputManager.java
+++ b/services/java/com/android/server/wm/InputManager.java
@@ -94,6 +94,7 @@
private static native boolean nativeTransferTouchFocus(InputChannel fromChannel,
InputChannel toChannel);
private static native void nativeSetPointerSpeed(int speed);
+ private static native void nativeSetShowTouches(boolean enabled);
private static native String nativeDump();
private static native void nativeMonitor();
@@ -147,7 +148,10 @@
nativeStart();
registerPointerSpeedSettingObserver();
+ registerShowTouchesSettingObserver();
+
updatePointerSpeedFromSettings();
+ updateShowTouchesFromSettings();
}
public void setDisplaySize(int displayId, int width, int height,
@@ -454,6 +458,32 @@
return speed;
}
+ public void updateShowTouchesFromSettings() {
+ int setting = getShowTouchesSetting(0);
+ nativeSetShowTouches(setting != 0);
+ }
+
+ private void registerShowTouchesSettingObserver() {
+ mContext.getContentResolver().registerContentObserver(
+ Settings.System.getUriFor(Settings.System.SHOW_TOUCHES), true,
+ new ContentObserver(mWindowManagerService.mH) {
+ @Override
+ public void onChange(boolean selfChange) {
+ updateShowTouchesFromSettings();
+ }
+ });
+ }
+
+ private int getShowTouchesSetting(int defaultValue) {
+ int result = defaultValue;
+ try {
+ result = Settings.System.getInt(mContext.getContentResolver(),
+ Settings.System.SHOW_TOUCHES);
+ } catch (SettingNotFoundException snfe) {
+ }
+ return result;
+ }
+
public void dump(PrintWriter pw) {
String dumpStr = nativeDump();
if (dumpStr != null) {
diff --git a/services/jni/com_android_server_InputManager.cpp b/services/jni/com_android_server_InputManager.cpp
index f2a0a71..0a723e8 100644
--- a/services/jni/com_android_server_InputManager.cpp
+++ b/services/jni/com_android_server_InputManager.cpp
@@ -179,6 +179,7 @@
void setInputDispatchMode(bool enabled, bool frozen);
void setSystemUiVisibility(int32_t visibility);
void setPointerSpeed(int32_t speed);
+ void setShowTouches(bool enabled);
/* --- InputReaderPolicyInterface implementation --- */
@@ -233,6 +234,9 @@
// True if pointer gestures are enabled.
bool pointerGesturesEnabled;
+ // Show touches feature enable/disable.
+ bool showTouches;
+
// Sprite controller singleton, created on first use.
sp<SpriteController> spriteController;
@@ -276,6 +280,7 @@
mLocked.systemUiVisibility = ASYSTEM_UI_VISIBILITY_STATUS_BAR_VISIBLE;
mLocked.pointerSpeed = 0;
mLocked.pointerGesturesEnabled = true;
+ mLocked.showTouches = false;
}
sp<EventHub> eventHub = new EventHub();
@@ -431,6 +436,8 @@
* POINTER_SPEED_EXPONENT);
outConfig->pointerGesturesEnabled = mLocked.pointerGesturesEnabled;
+ outConfig->showTouches = mLocked.showTouches;
+
outConfig->setDisplayInfo(0, false /*external*/,
mLocked.displayWidth, mLocked.displayHeight, mLocked.displayOrientation);
outConfig->setDisplayInfo(0, true /*external*/,
@@ -678,6 +685,22 @@
InputReaderConfiguration::CHANGE_POINTER_SPEED);
}
+void NativeInputManager::setShowTouches(bool enabled) {
+ { // acquire lock
+ AutoMutex _l(mLock);
+
+ if (mLocked.showTouches == enabled) {
+ return;
+ }
+
+ LOGI("Setting show touches feature to %s.", enabled ? "enabled" : "disabled");
+ mLocked.showTouches = enabled;
+ } // release lock
+
+ mInputManager->getReader()->requestRefreshConfiguration(
+ InputReaderConfiguration::CHANGE_SHOW_TOUCHES);
+}
+
bool NativeInputManager::isScreenOn() {
return android_server_PowerManagerService_isScreenOn();
}
@@ -1276,6 +1299,15 @@
gNativeInputManager->setPointerSpeed(speed);
}
+static void android_server_InputManager_nativeSetShowTouches(JNIEnv* env,
+ jclass clazz, jboolean enabled) {
+ if (checkInputManagerUnitialized(env)) {
+ return;
+ }
+
+ gNativeInputManager->setShowTouches(enabled);
+}
+
static jstring android_server_InputManager_nativeDump(JNIEnv* env, jclass clazz) {
if (checkInputManagerUnitialized(env)) {
return NULL;
@@ -1343,6 +1375,8 @@
(void*) android_server_InputManager_nativeTransferTouchFocus },
{ "nativeSetPointerSpeed", "(I)V",
(void*) android_server_InputManager_nativeSetPointerSpeed },
+ { "nativeSetShowTouches", "(Z)V",
+ (void*) android_server_InputManager_nativeSetShowTouches },
{ "nativeDump", "()Ljava/lang/String;",
(void*) android_server_InputManager_nativeDump },
{ "nativeMonitor", "()V",
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index c6f7da2..4fc5e08 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -2524,23 +2524,11 @@
public boolean processMessage(Message message) {
if (DBG) Log.d(TAG, getName() + message.toString() + "\n");
switch (message.what) {
- case CMD_START_DRIVER:
- mWakeLock.acquire();
- WifiNative.startDriverCommand();
- mWakeLock.release();
- break;
- case WifiMonitor.SUPPLICANT_STATE_CHANGE_EVENT:
- SupplicantState state = handleSupplicantStateChange(message);
- /* A driver start causes supplicant to first report an INTERFACE_DISABLED
- * state before transitioning out of it for connection. Stay in
- * DriverStoppedState until we get an INTERFACE_DISABLED state and transition
- * to DriverStarting upon getting that
- * TODO: Fix this when the supplicant can be made to just transition out of
- * INTERFACE_DISABLED state when driver gets started
- */
- if (state == SupplicantState.INTERFACE_DISABLED) {
- transitionTo(mDriverStartingState);
- }
+ case CMD_START_DRIVER:
+ mWakeLock.acquire();
+ WifiNative.startDriverCommand();
+ mWakeLock.release();
+ transitionTo(mDriverStartingState);
break;
default:
return NOT_HANDLED;