diff options
36 files changed, 501 insertions, 274 deletions
diff --git a/api/current.xml b/api/current.xml index fb3b998..3b9ab1a 100644 --- a/api/current.xml +++ b/api/current.xml @@ -93863,7 +93863,7 @@ type="android.net.SSLCertificateSocketFactory" static="false" final="false" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > <parameter name="handshakeTimeoutMillis" type="int"> @@ -95963,7 +95963,7 @@ type="android.net.http.SslCertificate" static="false" final="false" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > <parameter name="issuedTo" type="java.lang.String"> @@ -96030,7 +96030,7 @@ synchronized="false" static="false" final="false" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > </method> @@ -96052,7 +96052,7 @@ synchronized="false" static="false" final="false" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > </method> @@ -172464,7 +172464,7 @@ abstract="false" static="false" final="false" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > <constructor name="EventLogTags" @@ -202795,7 +202795,7 @@ synchronized="true" static="false" final="false" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > </method> @@ -203341,7 +203341,7 @@ synchronized="true" static="false" final="false" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > <parameter name="flag" type="boolean"> @@ -205466,7 +205466,7 @@ synchronized="false" static="false" final="false" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > <parameter name="view" type="android.webkit.WebView"> @@ -213999,7 +213999,7 @@ synchronized="false" static="false" final="false" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > </method> @@ -411704,7 +411704,7 @@ abstract="true" static="false" final="false" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > <method name="getLength" @@ -412193,7 +412193,7 @@ abstract="true" static="false" final="false" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > <method name="characters" @@ -412408,7 +412408,7 @@ abstract="false" static="false" final="false" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > <implements name="org.xml.sax.DTDHandler"> @@ -412875,7 +412875,7 @@ abstract="true" static="false" final="false" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > <method name="parse" @@ -414307,7 +414307,7 @@ abstract="false" static="false" final="false" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > <implements name="org.xml.sax.AttributeList"> @@ -415796,7 +415796,7 @@ abstract="false" static="false" final="false" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > <method name="makeParser" diff --git a/core/java/android/hardware/SensorEvent.java b/core/java/android/hardware/SensorEvent.java index 98bf632..32ff3b3 100644 --- a/core/java/android/hardware/SensorEvent.java +++ b/core/java/android/hardware/SensorEvent.java @@ -111,6 +111,27 @@ public class SensorEvent { * This can be achieved by applying a <i>high-pass</i> filter. Conversely, a * <i>low-pass</i> filter can be used to isolate the force of gravity. * </p> + * + * <pre class="prettyprint"> + * + * public void onSensorChanged(SensorEvent event) + * { + * // alpha is calculated as t / (t + dT) + * // with t, the low-pass filter's time-constant + * // and dT, the event delivery rate + * + * final float alpha = 0.8; + * + * gravity[0] = alpha * gravity[0] + (1 - alpha) * event.data[0]; + * gravity[1] = alpha * gravity[1] + (1 - alpha) * event.data[1]; + * gravity[2] = alpha * gravity[2] + (1 - alpha) * event.data[2]; + * + * linear_acceleration[0] = event.data[0] - gravity[0]; + * linear_acceleration[1] = event.data[1] - gravity[1]; + * linear_acceleration[2] = event.data[2] - gravity[2]; + * } + * </pre> + * * <p> * <u>Examples</u>: * <ul> @@ -143,8 +164,41 @@ public class SensorEvent { * standard mathematical definition of positive rotation and does not agree with the * definition of roll given earlier. * + * <ul> + * <p> + * values[0]: Angular speed around the x-axis + * </p> + * <p> + * values[1]: Angular speed around the y-axis + * </p> + * <p> + * values[2]: Angular speed around the z-axis + * </p> + * </ul> + * <p> + * Typically the output of the gyroscope is integrated over time to calculate + * an angle, for example: + * </p> + * <pre class="prettyprint"> + * private static final float NS2S = 1.0f / 1000000000.0f; + * private float timestamp; + * public void onSensorChanged(SensorEvent event) + * { + * if (timestamp != 0) { + * final float dT = (event.timestamp - timestamp) * NS2S; + * angle[0] += event.data[0] * dT; + * angle[1] += event.data[1] * dT; + * angle[2] += event.data[2] * dT; + * } + * timestamp = event.timestamp; + * } + * </pre> + * + * <p>In practice, the gyroscope noise and offset will introduce some errors which need + * to be compensated for. This is usually done using the information from other + * sensors, but is beyond the scope of this document.</p> + * * <h4>{@link android.hardware.Sensor#TYPE_LIGHT Sensor.TYPE_LIGHT}:</h4> - * * <ul> * <p> * values[0]: Ambient light level in SI lux units diff --git a/core/java/android/net/SSLCertificateSocketFactory.java b/core/java/android/net/SSLCertificateSocketFactory.java index b822b27..63ac21f 100644 --- a/core/java/android/net/SSLCertificateSocketFactory.java +++ b/core/java/android/net/SSLCertificateSocketFactory.java @@ -102,6 +102,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { private final boolean mSecure; /** @deprecated Use {@link #getDefault(int)} instead. */ + @Deprecated public SSLCertificateSocketFactory(int handshakeTimeoutMillis) { this(handshakeTimeoutMillis, null, true); } diff --git a/core/java/android/net/http/SslCertificate.java b/core/java/android/net/http/SslCertificate.java index c29926c..30f25a2 100644 --- a/core/java/android/net/http/SslCertificate.java +++ b/core/java/android/net/http/SslCertificate.java @@ -112,6 +112,7 @@ public class SslCertificate { * @param validNotAfter The not-after date from the certificate validity period in ISO 8601 format * @deprecated Use {@link #SslCertificate(String, String, Date, Date)} */ + @Deprecated public SslCertificate( String issuedTo, String issuedBy, String validNotBefore, String validNotAfter) { this(issuedTo, issuedBy, parseDate(validNotBefore), parseDate(validNotAfter)); @@ -157,6 +158,7 @@ public class SslCertificate { * * @deprecated Use {@link #getValidNotBeforeDate()} */ + @Deprecated public String getValidNotBefore() { return formatDate(mValidNotBefore); } @@ -175,6 +177,7 @@ public class SslCertificate { * * @deprecated Use {@link #getValidNotAfterDate()} */ + @Deprecated public String getValidNotAfter() { return formatDate(mValidNotAfter); } diff --git a/core/java/android/util/EventLogTags.java b/core/java/android/util/EventLogTags.java index 5cf5332..8c18417 100644 --- a/core/java/android/util/EventLogTags.java +++ b/core/java/android/util/EventLogTags.java @@ -29,6 +29,7 @@ import java.util.regex.Pattern; * @deprecated This class is no longer functional. * Use {@link android.util.EventLog} instead. */ +@Deprecated public class EventLogTags { public static class Description { public final int mTag; diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index acda3e1..6590497 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -6533,11 +6533,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility final int drawingCacheBackgroundColor = mDrawingCacheBackgroundColor; final boolean opaque = drawingCacheBackgroundColor != 0 || isOpaque(); - final boolean translucentWindow = attachInfo != null && attachInfo.mTranslucentWindow; + final boolean use32BitCache = attachInfo != null && attachInfo.mUse32BitDrawingCache; if (width <= 0 || height <= 0 || // Projected bitmap size in bytes - (width * height * (opaque && !translucentWindow ? 2 : 4) > + (width * height * (opaque && !use32BitCache ? 2 : 4) > ViewConfiguration.get(mContext).getScaledMaximumDrawingCacheSize())) { destroyDrawingCache(); return; @@ -6567,7 +6567,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility } else { // Optimization for translucent windows // If the window is translucent, use a 32 bits bitmap to benefit from memcpy() - quality = translucentWindow ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565; + quality = use32BitCache ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565; } // Try to cleanup memory @@ -6581,7 +6581,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility } else { mUnscaledDrawingCache = new SoftReference<Bitmap>(bitmap); } - if (opaque && translucentWindow) bitmap.setHasAlpha(false); + if (opaque && use32BitCache) bitmap.setHasAlpha(false); } catch (OutOfMemoryError e) { // If there is not enough memory to create the bitmap cache, just // ignore the issue as bitmap caches are not required to draw the @@ -9315,9 +9315,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility int mWindowTop; /** - * Indicates whether the window is translucent/transparent + * Indicates whether views need to use 32-bit drawing caches */ - boolean mTranslucentWindow; + boolean mUse32BitDrawingCache; /** * For windows that are full-screen but using insets to layout inside diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java index a039777..c58207e 100644 --- a/core/java/android/view/ViewRoot.java +++ b/core/java/android/view/ViewRoot.java @@ -754,7 +754,8 @@ public final class ViewRoot extends Handler implements ViewParent, // object is not initialized to its backing store, but soon it // will be (assuming the window is visible). attachInfo.mSurface = mSurface; - attachInfo.mTranslucentWindow = PixelFormat.formatHasAlpha(lp.format); + attachInfo.mUse32BitDrawingCache = PixelFormat.formatHasAlpha(lp.format) || + lp.format == PixelFormat.RGBX_8888; attachInfo.mHasWindowFocus = false; attachInfo.mWindowVisibility = viewVisibility; attachInfo.mRecomputeGlobalAttributes = false; diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java index da0c61b..4d70e7c 100644 --- a/core/java/android/webkit/WebSettings.java +++ b/core/java/android/webkit/WebSettings.java @@ -1029,6 +1029,7 @@ public class WebSettings { * @deprecated This method has been deprecated in favor of * {@link #setPluginState} */ + @Deprecated public synchronized void setPluginsEnabled(boolean flag) { setPluginState(PluginState.ON); } @@ -1211,6 +1212,7 @@ public class WebSettings { * @return True if plugins are enabled. * @deprecated This method has been replaced by {@link #getPluginState} */ + @Deprecated public synchronized boolean getPluginsEnabled() { return mPluginState == PluginState.ON; } diff --git a/core/java/android/webkit/WebViewClient.java b/core/java/android/webkit/WebViewClient.java index 02c7210..1f8eeba 100644 --- a/core/java/android/webkit/WebViewClient.java +++ b/core/java/android/webkit/WebViewClient.java @@ -89,6 +89,7 @@ public class WebViewClient { * @deprecated This method is no longer called. When the WebView encounters * a redirect loop, it will cancel the load. */ + @Deprecated public void onTooManyRedirects(WebView view, Message cancelMsg, Message continueMsg) { cancelMsg.sendToTarget(); diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java index 82b7c4f..e1a1894 100644 --- a/core/java/android/widget/ListView.java +++ b/core/java/android/widget/ListView.java @@ -3626,6 +3626,7 @@ public class ListView extends AbsListView { * * @deprecated Use {@link #getCheckedItemIds()} instead. */ + @Deprecated public long[] getCheckItemIds() { // Use new behavior that correctly handles stable ID mapping. if (mAdapter != null && mAdapter.hasStableIds()) { diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index b30b6b1..41c9736 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -3758,7 +3758,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener // - ExtractEditText does not call onFocus when it is displayed. Fixing this issue would // allow to test for hasSelection in onFocusChanged, which would trigger a // startTextSelectionMode here. TODO - if (selectionController != null && hasSelection()) { + if (this instanceof ExtractEditText && selectionController != null && hasSelection()) { startTextSelectionMode(); } @@ -4819,6 +4819,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } public void beginBatchEdit() { + mInBatchEditControllers = true; final InputMethodState ims = mInputMethodState; if (ims != null) { int nesting = ++ims.mBatchEditNesting; @@ -4841,6 +4842,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } public void endBatchEdit() { + mInBatchEditControllers = false; final InputMethodState ims = mInputMethodState; if (ims != null) { int nesting = --ims.mBatchEditNesting; @@ -6747,10 +6749,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener // Restore previous selection Selection.setSelection((Spannable)mText, prevStart, prevEnd); - if (mSelectionModifierCursorController != null && - !mSelectionModifierCursorController.isShowing()) { + if (hasSelectionController() && !getSelectionController().isShowing()) { // If the anchors aren't showing, revive them. - mSelectionModifierCursorController.show(); + getSelectionController().show(); } else { // Tapping inside the selection displays the cut/copy/paste context menu // as long as the anchors are already showing. @@ -6761,12 +6762,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener // Tapping outside stops selection mode, if any stopTextSelectionMode(); - if (mInsertionPointCursorController != null && mText.length() > 0) { - mInsertionPointCursorController.show(); + if (hasInsertionController() && mText.length() > 0) { + getInsertionController().show(); } } - } else if (hasSelection() && mSelectionModifierCursorController != null) { - mSelectionModifierCursorController.show(); + } else if (hasSelection() && hasSelectionController()) { + getSelectionController().show(); } } @@ -6800,11 +6801,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener public boolean onTouchEvent(MotionEvent event) { final int action = event.getActionMasked(); if (action == MotionEvent.ACTION_DOWN) { - if (mInsertionPointCursorController != null) { - mInsertionPointCursorController.onTouchEvent(event); + if (hasInsertionController()) { + getInsertionController().onTouchEvent(event); } - if (mSelectionModifierCursorController != null) { - mSelectionModifierCursorController.onTouchEvent(event); + if (hasSelectionController()) { + getSelectionController().onTouchEvent(event); } // Reset this state; it will be re-set if super.onTouchEvent @@ -6826,11 +6827,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } if ((mMovement != null || onCheckIsTextEditor()) && mText instanceof Spannable && mLayout != null) { - if (mInsertionPointCursorController != null) { - mInsertionPointCursorController.onTouchEvent(event); + if (hasInsertionController()) { + getInsertionController().onTouchEvent(event); } - if (mSelectionModifierCursorController != null) { - mSelectionModifierCursorController.onTouchEvent(event); + if (hasSelectionController()) { + getSelectionController().onTouchEvent(event); } boolean handled = false; @@ -6892,19 +6893,15 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } // TODO Add an extra android:cursorController flag to disable the controller? - if (windowSupportsHandles && mCursorVisible && mLayout != null) { - if (mInsertionPointCursorController == null) { - mInsertionPointCursorController = new InsertionPointCursorController(); - } - } else { + mInsertionControllerEnabled = windowSupportsHandles && mCursorVisible && mLayout != null; + mSelectionControllerEnabled = windowSupportsHandles && textCanBeSelected() && + mLayout != null; + + if (!mInsertionControllerEnabled) { mInsertionPointCursorController = null; } - if (windowSupportsHandles && textCanBeSelected() && mLayout != null) { - if (mSelectionModifierCursorController == null) { - mSelectionModifierCursorController = new SelectionModifierCursorController(); - } - } else { + if (!mSelectionControllerEnabled) { // Stop selection mode if the controller becomes unavailable. stopTextSelectionMode(); mSelectionModifierCursorController = null; @@ -7535,10 +7532,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener case ID_SELECT_ALL: Selection.setSelection((Spannable) mText, 0, mText.length()); startTextSelectionMode(); + getSelectionController().show(); return true; case ID_START_SELECTING_TEXT: startTextSelectionMode(); + getSelectionController().show(); return true; case ID_CUT: @@ -7648,7 +7647,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener private void startTextSelectionMode() { if (!mIsInTextSelectionMode) { - if (mSelectionModifierCursorController == null) { + if (!hasSelectionController()) { Log.w(LOG_TAG, "TextView has no selection controller. Action mode cancelled."); return; } @@ -7658,7 +7657,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } selectCurrentWord(); - mSelectionModifierCursorController.show(); mIsInTextSelectionMode = true; } } @@ -7837,6 +7835,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener return true; } + if (isInBatchEditMode()) { + return false; + } + final int extendedPaddingTop = getExtendedPaddingTop(); final int extendedPaddingBottom = getExtendedPaddingBottom(); final int compoundPaddingLeft = getCompoundPaddingLeft(); @@ -7876,7 +7878,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener mPositionY = y - TextView.this.mScrollY; if (isPositionVisible()) { int[] coords = null; - if (mContainer.isShowing()){ + if (mContainer.isShowing()) { coords = mTempCoords; TextView.this.getLocationInWindow(coords); mContainer.update(coords[0] + mPositionX, coords[1] + mPositionY, @@ -8065,6 +8067,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } public void show() { + if (isInBatchEditMode()) { + return; + } + mIsShowing = true; updatePosition(); mStartHandle.show(); @@ -8128,6 +8134,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } public void updatePosition() { + if (!isShowing()) { + return; + } + final int selectionStart = getSelectionStart(); final int selectionEnd = getSelectionEnd(); @@ -8288,6 +8298,62 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener return getOffsetForHorizontal(line, x); } + /** + * @return True if this view supports insertion handles. + */ + boolean hasInsertionController() { + return mInsertionControllerEnabled; + } + + /** + * @return True if this view supports selection handles. + */ + boolean hasSelectionController() { + return mSelectionControllerEnabled; + } + + CursorController getInsertionController() { + if (!mInsertionControllerEnabled) { + return null; + } + + if (mInsertionPointCursorController == null) { + mInsertionPointCursorController = new InsertionPointCursorController(); + + final ViewTreeObserver observer = getViewTreeObserver(); + if (observer != null) { + observer.addOnTouchModeChangeListener(mInsertionPointCursorController); + } + } + + return mInsertionPointCursorController; + } + + CursorController getSelectionController() { + if (!mSelectionControllerEnabled) { + return null; + } + + if (mSelectionModifierCursorController == null) { + mSelectionModifierCursorController = new SelectionModifierCursorController(); + + final ViewTreeObserver observer = getViewTreeObserver(); + if (observer != null) { + observer.addOnTouchModeChangeListener(mSelectionModifierCursorController); + } + } + + return mSelectionModifierCursorController; + } + + boolean isInBatchEditMode() { + final InputMethodState ims = mInputMethodState; + if (ims != null) { + return ims.mBatchEditNesting > 0; + } + return mInBatchEditControllers; + } + @ViewDebug.ExportedProperty private CharSequence mText; private CharSequence mTransformed; @@ -8319,6 +8385,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener // Cursor Controllers. Null when disabled. private CursorController mInsertionPointCursorController; private CursorController mSelectionModifierCursorController; + private boolean mInsertionControllerEnabled; + private boolean mSelectionControllerEnabled; + private boolean mInBatchEditControllers; private boolean mIsInTextSelectionMode = false; // These are needed to desambiguate a long click. If the long click comes from ones of these, we // select from the current cursor position. Otherwise, select from long pressed position. diff --git a/core/java/android/widget/VideoView.java b/core/java/android/widget/VideoView.java index 531d9fe..b169c93 100644 --- a/core/java/android/widget/VideoView.java +++ b/core/java/android/widget/VideoView.java @@ -27,7 +27,6 @@ import android.media.Metadata; import android.media.MediaPlayer.OnCompletionListener; import android.media.MediaPlayer.OnErrorListener; import android.net.Uri; -import android.os.PowerManager; import android.util.AttributeSet; import android.util.Log; import android.view.KeyEvent; @@ -35,7 +34,7 @@ import android.view.MotionEvent; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; -import android.widget.MediaController.*; +import android.widget.MediaController.MediaPlayerControl; import java.io.IOException; import java.util.Map; @@ -462,6 +461,10 @@ public class VideoView extends SurfaceView implements MediaPlayerControl { } start(); if (mMediaController != null) { + if (mMediaController.isShowing()) { + // ensure the controller will get repositioned later + mMediaController.hide(); + } mMediaController.show(); } } diff --git a/core/jni/android_nfc.h b/core/jni/android_nfc.h index df660f2..de0ddde 100644 --- a/core/jni/android_nfc.h +++ b/core/jni/android_nfc.h @@ -22,8 +22,17 @@ #ifndef __ANDROID_NFC_H__ #define __ANDROID_NFC_H__ +#define LOG_TAG "NdefMessage" +#include <utils/Log.h> + extern "C" { +#if 0 + #define TRACE(...) LOG(LOG_DEBUG, "NdefMessage", __VA_ARGS__) +#else + #define TRACE(...) +#endif + typedef struct phFriNfc_NdefRecord { uint8_t Flags; uint8_t Tnf; diff --git a/core/jni/android_nfc_NdefMessage.cpp b/core/jni/android_nfc_NdefMessage.cpp index eaf989d..9beef2a 100644 --- a/core/jni/android_nfc_NdefMessage.cpp +++ b/core/jni/android_nfc_NdefMessage.cpp @@ -14,8 +14,6 @@ * limitations under the License. */ -#define LOG_TAG "NdefMessage" - #include <stdlib.h> #include "jni.h" @@ -23,8 +21,6 @@ #include "android_nfc.h" -#include <utils/Log.h> - namespace android { static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o, @@ -53,7 +49,7 @@ static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o, return -1; /* Get the number of records in the message so we can allocate buffers */ - LOGD("phFriNfc_NdefRecord_GetRecords(NULL)"); + TRACE("phFriNfc_NdefRecord_GetRecords(NULL)"); status = phFriNfc_NdefRecord_GetRecords((uint8_t *)raw_msg, (uint32_t)raw_msg_size, NULL, NULL, &num_of_records); @@ -62,9 +58,7 @@ static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o, LOGE("phFriNfc_NdefRecord_GetRecords(NULL) returned 0x%04x", status); goto end; } - LOGD("phFriNfc_NdefRecord_GetRecords(NULL) returned 0x%04x", status); - - LOGD("found %d records in message", num_of_records); + TRACE("phFriNfc_NdefRecord_GetRecords(NULL) returned 0x%04x, with %d records", status, num_of_records); is_chunked = (uint8_t*)malloc(num_of_records); if (is_chunked == NULL) @@ -74,7 +68,7 @@ static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o, goto end; /* Now, actually retrieve records position in message */ - LOGD("phFriNfc_NdefRecord_GetRecords()"); + TRACE("phFriNfc_NdefRecord_GetRecords()"); status = phFriNfc_NdefRecord_GetRecords((uint8_t *)raw_msg, (uint32_t)raw_msg_size, records, is_chunked, &num_of_records); @@ -83,7 +77,7 @@ static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o, LOGE("phFriNfc_NdefRecord_GetRecords() returned 0x%04x", status); goto end; } - LOGD("phFriNfc_NdefRecord_GetRecords() returned 0x%04x", status); + TRACE("phFriNfc_NdefRecord_GetRecords() returned 0x%04x, with %d records", status, num_of_records); /* Build NDEF records array */ record_cls = e->FindClass("android/nfc/NdefRecord"); @@ -94,13 +88,11 @@ static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o, ctor = e->GetMethodID(record_cls, "<init>", "(S[B[B[B)V"); - LOGD("NFC_Number of records = %d\n", num_of_records); - for (i = 0; i < num_of_records; i++) { jbyteArray type, id, payload; jobject new_record; - LOGD("phFriNfc_NdefRecord_Parse()"); + TRACE("phFriNfc_NdefRecord_Parse()"); status = phFriNfc_NdefRecord_Parse(&record, records[i]); @@ -108,7 +100,7 @@ static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o, LOGE("phFriNfc_NdefRecord_Parse() returned 0x%04x", status); goto end; } - LOGD("phFriNfc_NdefRecord_Parse() returned 0x%04x", status); + TRACE("phFriNfc_NdefRecord_Parse() returned 0x%04x", status); type = e->NewByteArray(record.TypeLength); if (type == NULL) { diff --git a/core/jni/android_nfc_NdefRecord.cpp b/core/jni/android_nfc_NdefRecord.cpp index 0a3a519..a7a80c8 100644 --- a/core/jni/android_nfc_NdefRecord.cpp +++ b/core/jni/android_nfc_NdefRecord.cpp @@ -54,7 +54,7 @@ static jbyteArray android_nfc_NdefRecord_generate( if (buf == NULL) goto end; - LOGD("phFriNfc_NdefRecord_Generate()"); + TRACE("phFriNfc_NdefRecord_Generate()"); status = phFriNfc_NdefRecord_Generate(&record, buf, buf_size, &record_size); @@ -63,7 +63,7 @@ static jbyteArray android_nfc_NdefRecord_generate( LOGE("phFriNfc_NdefRecord_Generate() returned 0x%04x", status); goto end; } - LOGD("phFriNfc_NdefRecord_Generate() returned 0x%04x", status); + TRACE("phFriNfc_NdefRecord_Generate() returned 0x%04x", status); result = e->NewByteArray(record_size); if (result == NULL) @@ -104,13 +104,13 @@ static jint android_nfc_NdefRecord_parseNdefRecord(JNIEnv *e, jobject o, goto clean_and_return; } - LOGD("phFriNfc_NdefRecord_Parse()"); + TRACE("phFriNfc_NdefRecord_Parse()"); status = phFriNfc_NdefRecord_Parse(&record, (uint8_t *)raw_record); if (status) { LOGE("phFriNfc_NdefRecord_Parse() returned 0x%04x", status); goto clean_and_return; } - LOGD("phFriNfc_NdefRecord_Parse() returned 0x%04x", status); + TRACE("phFriNfc_NdefRecord_Parse() returned 0x%04x", status); /* Set TNF field */ mTnf = e->GetFieldID(record_cls, "mTnf", "S"); diff --git a/core/res/res/drawable-hdpi/textfield_pressed.9.png b/core/res/res/drawable-hdpi/textfield_pressed.9.png Binary files differindex 296d3da..6537be0 100755..100644 --- a/core/res/res/drawable-hdpi/textfield_pressed.9.png +++ b/core/res/res/drawable-hdpi/textfield_pressed.9.png diff --git a/core/res/res/drawable-mdpi/textfield_pressed.9.png b/core/res/res/drawable-mdpi/textfield_pressed.9.png Binary files differindex 6d03e1e..9524fec 100644 --- a/core/res/res/drawable-mdpi/textfield_pressed.9.png +++ b/core/res/res/drawable-mdpi/textfield_pressed.9.png diff --git a/docs/html/resources/resources_toc.cs b/docs/html/resources/resources_toc.cs index 735a00e..117ecfb 100644 --- a/docs/html/resources/resources_toc.cs +++ b/docs/html/resources/resources_toc.cs @@ -202,7 +202,7 @@ </a></li> <li><a href="<?cs var:toroot ?>resources/samples/BackupRestore/index.html"> <span class="en">Backup and Restore</span> - </a> <span class="new">new!</span></li> + </a></li> <li><a href="<?cs var:toroot ?>resources/samples/BluetoothChat/index.html"> <span class="en">Bluetooth Chat</span> </a></li> @@ -235,7 +235,7 @@ </a></li> <li><a href="<?cs var:toroot ?>resources/samples/SearchableDictionary/index.html"> <span class="en">Searchable Dictionary v2</span> - </a> <span class="new">new!</span></li> + </a></li> <li><a href="<?cs var:toroot ?>resources/samples/SipDemo/index.html"> <span class="en">SIP Demo</span> </a> <span class="new">new!</span></li> @@ -247,16 +247,16 @@ </a></li> <li><a href="<?cs var:toroot ?>resources/samples/Spinner/index.html"> <span class="en">Spinner</span> - </a> <span class="new">new!</span></li> + </a></li> <li><a href="<?cs var:toroot ?>resources/samples/SpinnerTest/index.html"> <span class="en">SpinnerTest</span> - </a> <span class="new">new!</span></li> + </a></li> <li><a href="<?cs var:toroot ?>resources/samples/TicTacToeLib/index.html"> <span class="en">TicTacToeLib</span> - </a> <span class="new">new!</span></li> + </a></li> <li><a href="<?cs var:toroot ?>resources/samples/TicTacToeMain/index.html"> <span class="en">TicTacToeMain</span> - </a> <span class="new">new!</span></li> + </a></li> <li><a href="<?cs var:toroot ?>resources/samples/Wiktionary/index.html"> <span class="en">Wiktionary</span> </a></li> diff --git a/docs/html/sdk/eclipse-adt.jd b/docs/html/sdk/eclipse-adt.jd index 632fa4b..c3afebd 100644 --- a/docs/html/sdk/eclipse-adt.jd +++ b/docs/html/sdk/eclipse-adt.jd @@ -22,7 +22,6 @@ adt.zip.checksum=7deff0c9b25940a74cea7a0815a3bc36 </ol> </li> <li><a href="#updating">Updating the ADT Plugin</a></li> - <li><a href="#uninstalling">Uninstalling the ADT Plugin</a></li> </ol> </div> @@ -52,9 +51,6 @@ href="#installing">Installing the ADT Plugin</a>, below. </p> how to update ADT to the latest version or how to uninstall it, if necessary. </p> -<p class="caution"><strong>Caution:</strong> There are known issues with the ADT plugin running with -Eclipse 3.6. Please stay on 3.5 until further notice.</p> - <h2 id="notes">Revisions</h2> <p>The sections below provide notes about successive releases of @@ -103,12 +99,54 @@ padding: .25em 1em; <div class="toggleable opened"> <a href="#" onclick="return toggleDiv(this)"> <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-img" height="9px" width="9px" /> -ADT 0.9.9</a> <em>(September 2010)</em> +ADT 8.0</a> <em>(November 2010)</em> <div class="toggleme"> +<dl> + +<dt>Dependencies:</dt> +<p><p>ADT 8.0 is designed for use with SDK Tools r8. If you haven't +already installed SDK Tools r8 into your SDK, use the Android SDK and AVD Manager to do +so.</p></dd> + +<dt>General notes:</dt> +<dd> +<ul> + <li>New version number scheme that follows the SDK Tools revision number. The major version +number for your ADT plugin should now always match the revision number of your SDK Tools. For +example, ADT 8.x is for SDK Tools r8.</li> + <li>Support for true debug build. You no longer need to change the value of the + <code>debuggable</code> attribute in the Android Manifest. + <p>Incremental builds automatically insert <code>debuggable="true"</code>, but if you perform + "export signed/unsigned application package", ADT does <em>not</em> insert it. + If you manually set <code>debuggable="true"</code> in the manifest file, then release builds will + actually create a debug build (it does not remove it if you placed it there).</p></li> + <li>Automatic <a href="{@docRoot}guide/developing/tools/proguard.html">Proguard</a> support in +release builds. For it to work, you need to have a <code>proguard.config</code> + property in the <code>default.properties</code> file that points to a proguard config file.</li> + <li>Completely rewritten Visual Layout Editor. (This is still a work in progress.) Now includes: + <ul> + <li>Full drag and drop from palette to layout for all Layout classes.</li> + <li>Move widgets inside a Layout view, from one Layout view to another and from one layout file to another.</li> + <li>Contextual menu with enum/flag type properties.</li> + <li>New zoom controls.</li> + </ul></li> + <li>New HierarchyViewer plug-in integrated in Eclipse.</li> + <li>Android launch configurations don't recompile the whole workspace on launch anymore.</li> + <li><code>android.jar</code> source and javadoc location can now be configured.</li> </ul> </dd> +</dl> + </div> +</div> + + +<div class="toggleable closed"> + <a href="#" onclick="return toggleDiv(this)"> + <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-img" height="9px" width="9px" /> +ADT 0.9.9</a> <em>(September 2010)</em> + <div class="toggleme"> <dl> @@ -355,12 +393,15 @@ revision 3.</li> </div> </div> + + <h2 id="installing">Installing the ADT Plugin</h2> <p>The sections below provide instructions on how to download and install ADT into your Eclipse environment. If you encounter problems, see the <a href="#troubleshooting">Troubleshooting</a> section.</p> + <h3 id="preparing">Preparing Your Development Computer</h3> <p>ADT is a plugin for the Eclipse IDE. Before you can install or use ADT, @@ -379,7 +420,8 @@ location: "http://www.eclipse.org/downloads/">http://www.eclipse.org/downloads/</a> </p> -<p>A Java or RCP version of Eclipse is recommended.</p></li> +<p>For Eclipse 3.5 or newer, the "Eclipse Classic" version is recommended. Otherwise, a Java or RCP +version of Eclipse is recommended.</p></li> </ul> <p>Additionally, before you can configure or use ADT, you must install the @@ -403,54 +445,51 @@ these steps to download the ADT plugin and install it in your Eclipse environment. </p> <table style="font-size:100%"> -<tr><th>Eclipse 3.4 (Ganymede)</th><th>Eclipse 3.5 (Galileo)</th></tr> +<tr><th>Eclipse 3.5 (Galileo) and 3.6 (Helios)</th><th>Eclipse 3.4 (Ganymede)</th></tr> <tr> <td width="45%"> -<!-- 3.4 steps --> +<!-- 3.5+ steps --> <ol> - <li>Start Eclipse, then select <strong>Help</strong> > <strong>Software Updates...</strong>. - In the dialog that appears, click the <strong>Available Software</strong> tab. </li> - <li>Click <strong>Add Site...</strong> </li> - <li>In the Add Site dialog that appears, enter this URL in the "Location" field: - <pre style="margin-left:0">https://dl-ssl.google.com/android/eclipse/</pre> + <li>Start Eclipse, then select <strong>Help</strong> > <strong>Install New +Software...</strong>.</li> + <li>Click <strong>Add</strong>, in the top-right corner.</li> + <li>In the Add Repository dialog that appears, enter "ADT Plugin" for the <em>Name</em> and the +following URL for the <em>Location</em>: + <pre>https://dl-ssl.google.com/android/eclipse/</pre> <p>Note: If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" (https is preferred for security reasons).</p> <p>Click <strong>OK</strong>.</p></li> - <li>Back in the Available Software view, you should see the plugin listed by the URL, - with "Developer Tools" nested within it. Select the checkbox next to - Developer Tools and click <strong>Install...</strong></li> - <li>On the subsequent Install window, "Android DDMS" and "Android Development Tools" - should both be checked. Click <strong>Next</strong>. </li> - <li>Read and accept the license agreement, then click <strong>Finish</strong>.</li> - <li>Restart Eclipse. </li> + <li>In the Available Software dialog, select +the checkbox next to Developer Tools and click <strong>Next</strong>.</li> + <li>In the next window, you'll see a list of the tools to be downloaded. Click +<strong>Next</strong>. </li> + <li>Read and accept the license agreements, then click <strong>Finish</strong>.</li> + <li>When the installation completes, restart Eclipse. </li> </ol> </td> -<td> -<!-- 3.5 steps --> +<td width="50%"> + +<!-- 3.4 steps --> <ol> - <li>Start Eclipse, then select <strong>Help</strong> > <strong>Install - New Software</strong>. </li> - <li>In the Available Software dialog, click <strong>Add...</strong>.</li> - <li>In the Add Site dialog that appears, enter a name for the remote site - (for example, "Android Plugin") in the "Name" field. - <p>In the "Location" field, enter this URL:</p> + <li>Start Eclipse, then select <strong>Help</strong> > <strong>Software Updates...</strong>. +In the dialog that appears, click the <strong>Available Software</strong> tab.</li> + <li>Click <strong>Add Site</strong>.</li> + <li>In the Add Site dialog that appears, enter this URL in the "Location" field: <pre>https://dl-ssl.google.com/android/eclipse/</pre> <p>Note: If you have trouble acquiring the plugin, you can try using "http" in the URL, instead of "https" (https is preferred for security reasons).</p> <p>Click <strong>OK</strong>.</p> </li> - <li>Back in the Available Software view, you should now see "Developer - Tools" added to the list. Select the checkbox next to Developer Tools, - which will automatically select the nested tools Android DDMS and Android - Development Tools. - Click <strong>Next</strong>. </li> - <li>In the resulting Install Details dialog, the Android DDMS and Android - Development Tools features are listed. Click <strong>Next</strong> to - read and accept the license agreement and install any dependencies, - then click <strong>Finish</strong>. </li> - <li>Restart Eclipse. </li> + <li>Back in the Available Software view, you should see the plugin listed by the URL, + with "Developer Tools" nested within it. Select the checkbox next to Developer Tools, + which will automatically select the nested tools. Then click + <strong>Install</strong></li> + <li>On the subsequent Install window, all of the included tools + should be checked. Click <strong>Next</strong>. </li> + <li>Read and accept the license agreements, then click <strong>Finish</strong>.</li> + <li>When the installation completes, restart Eclipse. </li> </ol> </td> @@ -488,7 +527,7 @@ try changing the remote site URL to use http, rather than https. That is, set the Location for the remote site to: <pre>http://dl-ssl.google.com/android/eclipse/</pre></li> <li>If you are behind a firewall (such as a corporate firewall), make sure that -you have properly configured your proxy settings in Eclipse. In Eclipse 3.3/3.4, +you have properly configured your proxy settings in Eclipse. In Eclipse, you can configure proxy information from the main Eclipse menu in <strong>Window</strong> (on Mac OS X, <strong>Eclipse</strong>) > <strong>Preferences</strong> > <strong>General</strong> > <strong>Network @@ -525,7 +564,7 @@ manually install it:</p> instructions</a> (above).</li> <li>In the Add Site dialog, click <strong>Archive</strong>.</li> <li>Browse and select the downloaded zip file.</li> - <li>In Eclipse 3.5 only, enter a name for the local update site (e.g., + <li>Enter a name for the local update site (e.g., "Android Plugin") in the "Name" field.</li> <li>Click <strong>OK</strong>. <li>Follow the remaining procedures as listed for @@ -581,37 +620,32 @@ Eclipse Installed Software window using <strong>Help</strong> to install it. </p> <table style="font-size:100%"> -<tr><th>Eclipse 3.4 (Ganymede)</th><th>Eclipse 3.5 (Galileo)</th></tr> +<tr><th>Eclipse 3.5 (Galileo) and 3.6 (Helios)</th><th>Eclipse 3.4 (Ganymede)</th></tr> <tr> -<td width="50%"> -<!-- 3.4 steps --> +<td> +<!-- 3.5+ steps --> <ol> - <li>Select <strong>Help</strong> > <strong>Software Updates</strong>.</li> - <li>Select the <strong>Available Software</strong> tab.</li> - <li>Select the checkboxes next to Android DDMS and Android Developer Tools, - then click <strong>Update</strong>.</li> - <li>In the resulting Available Updates dialog, ensure that both Android DDMS - and Android Development Tools are selected, then click - <strong>Next</strong>.</li> + <li>Select <strong>Help</strong> > <strong>Check for Updates</strong>. + <p>If there are no updates available, a dialog will say so and you're done.</p></li> + <li>If there are updates available, select Android DDMS, Android Development Tools, + and Android Hierarchy Viewer, then click <strong>Next</strong>.</li> + <li>In the Update Details dialog, click <strong>Next</strong>.</li> <li>Read and accept the license agreement and then click <strong>Finish</strong>. This will download and install the latest version of Android DDMS and Android Development Tools.</li> <li>Restart Eclipse.</li> </ol> </td> -<td> -<!-- 3.5 steps --> + +<td width="50%"> +<!-- 3.4 steps --> <ol> - <li>Select <strong>Help</strong> > <strong>Check for Updates</strong>. </li> - <li>In the resulting Available Updates dialog, locate the Android DDMS and - Android Development Tools features in the list and ensure that the checkboxes - next to them are selected. Click <strong>Next</strong>. - <p>If the Available Updates dialog does not list Android DDMS and Android - Development tools, make sure that you have set up a remote update site - for them, as described in - <a href="#installing">Installing the ADT Plugin</a>. - </p></li> - <li>In the Update Details dialog, click <strong>Next</strong>.</li> + <li>Select <strong>Help</strong> > <strong>Software Updates</strong>.</li> + <li>Select the <strong>Available Software</strong> tab.</li> + <li>If there are updates available, select Android DDMS, Android Development Tools, + and Android Hierarchy Viewer, then click <strong>Update</strong>.</li> + <li>In the resulting Available Updates dialog, ensure that each of the listed tools + are selected, then click <strong>Next</strong>.</li> <li>Read and accept the license agreement and then click <strong>Finish</strong>. This will download and install the latest version of Android DDMS and Android Development Tools.</li> @@ -629,38 +663,3 @@ href="#uninstalling">Uninstalling the ADT Plugin</a>, below. To reinstall the plugin, follow the instructions in <a href="#installing">Installing the ADT Plugin</a>, above.</p> - -<h2 id="uninstalling">Uninstalling the ADT plugin</h2> - -<p>If you encounter problems when installing or updating ADT, you -can try removing the existing ADT plugin and then performing a fresh -installation. To remove ADT, follow these steps: </p> - -<table style="font-size:100%"> -<tr><th>Eclipse 3.4 (Ganymede)</th><th>Eclipse 3.5 (Galileo)</th></tr> -<tr> -<td width="50%"> -<!-- 3.4 steps --> -<ol> - <li>Select <strong>Help</strong> > <strong>Software Updates</strong> > - <strong>Manage Configuration</strong>. </li> - <li>Expand the list in the left panel to reveal the installed tools.</li> - <li>Right-click "Android Editors" and click <strong>Uninstall</strong>. Click <strong>OK</strong> - to confirm.</li> - <li>Restart Eclipse. - <p>(Do not uninstall "Android Development Tools".)</p></li> -</ol> -</td> -<td> -<!-- 3.5 steps --> -<ol> - <li>Select <strong>Help</strong> > <strong>Install New Software</strong>.</li> - <li>In the "Details" panel, click the "What is already installed?" link.</li> - <li>In the <strong>Eclipse Installation Details</strong> dialog, select "Android DDMS" and "Android Development Tools" and then click <strong>Uninstall</strong>.</li> - <li>In the next window, confirm that the ADT features are selected for uninstall and then click <strong>Finish</strong> to uninstall.</li> - <li>Restart Eclipse.</li> -</ol> -</td> -</tr> -</table> - diff --git a/docs/html/sdk/index.jd b/docs/html/sdk/index.jd index 2812ae8..3dda5ee 100644 --- a/docs/html/sdk/index.jd +++ b/docs/html/sdk/index.jd @@ -19,52 +19,15 @@ sdk.linux_checksum=TODO @jd:body +<p>Here's an overview of the steps you must follow to set up the Android SDK:</p> -<h2 id="quickstart">Quick Start</h2> +<ol> + <li>Prepare your development computer and ensure it meets the system requirements.</li> + <li>Install the SDK starter package from the table above.</li> + <li>Install the ADT Plugin for Eclipse (if you'll be developing in Eclipse).</li> + <li>Add Android platforms and other components to your SDK.</li> + <li>Explore the contents of the Android SDK (optional).</li> +</ol> -<p><strong>1. Prepare your development computer</strong></p> - -<p>Read the <a href="{@docRoot}sdk/requirements.html">System Requirements</a> -document and make sure that your development computer meets the hardware and -software requirements for the Android SDK. Install any additional software -needed before downloading the Android SDK. In particular, you may need to -install the <a href="http://java.sun.com/javase/downloads/index.jsp">JDK</a> - (version 5 or 6 required) and <a href="http://www.eclipse.org/downloads/">Eclipse</a> - (version 3.4 or 3.5, needed only if you want develop using the ADT Plugin). - -<p><strong>2. Download and install the SDK starter package</strong></p> - -<p>Download a starter package from the table above onto your development computer. -If you're using Windows, we recommend that you download the installer (the {@code .exe} file), -which will launch a Wizard to guide you through the installation and check your computer for -required software. Otherwise, download the SDK starter package ({@code .zip} or {@code .tgz}) -appropriate for your system, unpack it to a safe location, then add the location to your PATH -environment variable. </p> - -<p><strong>3. Install the ADT Plugin for Eclipse</strong></p> - -<p>If you are developing in Eclipse, add a new remote update site with the URL -<code>https://dl-ssl.google.com/android/eclipse/</code>. Install the Android -Development Tools (ADT) Plugin from that site, restart Eclipse, and set the "Android" -preferences in Eclipse to point to the Android SDK directory (installed in the previous step). For -detailed instructions to setup Eclipse, see <a href="{@docRoot}sdk/eclipse-adt.html">ADT Plugin -for Eclipse</a>.</p> - -<p><strong>4. Add Android platforms and other components to your SDK</strong></p> - -<p>Launch the <em>Android SDK and AVD Manager</em> by executing {@code SDK Manager.exe} (Windows) or -{@code android} (Mac/Linux) from the SDK's {@code tools/} directory (if you used the Windows -installer, this is launched for you when the Wizard is complete). Add some Android platforms -(such as Android 1.6 and Android 2.3) and other components (such as documentation) to your SDK. If -you aren't sure what to add, see <a -href="installing.html#which">Recommended Components</a></p> - -<p><strong>Done!</strong></p> - -<p>To write your first Android application, see the <a -href="{@docRoot}resources/tutorials/hello-world.html">Hello World</a> tutorial. Also see <a -href="{@docRoot}sdk/installing.html#NextSteps">Next -Steps</a> for other suggestions about how to get started.</p> - -<p>For a more detailed guide to installing and setting up the SDK, read <a +<p>To get started, download the appropriate package from the table above, then read the guide to <a href="installing.html">Installing the SDK</a>.</p> diff --git a/docs/html/sdk/installing.jd b/docs/html/sdk/installing.jd index 5b5c4f4..2f19181 100644 --- a/docs/html/sdk/installing.jd +++ b/docs/html/sdk/installing.jd @@ -58,7 +58,7 @@ function toggleDiv(link) { <ol> <li><a href="#which">Recommended Components</a></li> </ol></li> - <li><a href="#sdkContents">5. Exploring the SDK</a></li> + <li><a href="#sdkContents">5. Exploring the SDK (Optional)</a></li> <li><a href="#NextSteps">Next Steps</a></li> <li><a href="#troubleshooting">Troubleshooting</a></li> </ol> @@ -112,7 +112,7 @@ RCP version of Eclipse is recommended.</p> development environment—it includes only the core SDK Tools, which you can use to download the rest of the SDK components (such as the latest Android platform).</p> -<p>You can get the latest version of the SDK starter package from the <a +<p>If you haven't already, get the latest version of the SDK starter package from the <a href="{@docRoot}sdk/index.html">SDK download page</a>.</p> <p>If you downloaded a {@code .zip} or {@code .tgz} package (instead of the SDK installer), unpack @@ -379,10 +379,10 @@ you with the components you've just installed.</p> href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a> document. </p> -<h2 id="sdkContents">Step 5. Exploring the SDK</h2> +<h2 id="sdkContents">Step 5. Exploring the SDK (Optional)</h2> <p>Once you've installed the SDK and downloaded the platforms, documentation, -and add-ons that you need, open the SDK directory and take a look at what's +and add-ons that you need, we suggest that you open the SDK directory and take a look at what's inside.</p> <p>The table below describes the full SDK directory contents, with components diff --git a/docs/html/sdk/ndk/index.jd b/docs/html/sdk/ndk/index.jd index 11e6642..0f36345 100644 --- a/docs/html/sdk/ndk/index.jd +++ b/docs/html/sdk/ndk/index.jd @@ -84,34 +84,56 @@ padding: .25em 1em; <dd> <ul> + + <li>A new toolchain (based on GCC 4.4.3), which generates better code, and can also now +be used as a standalone cross-compiler, for people who want to build their stuff with +<code>./configure && make</code>. See +docs/STANDALONE-TOOLCHAIN.html for the details. The binaries for GCC 4.4.0 are still provided, +but the 4.2.1 binaries were removed.</li> + + <li>Support for prebuilt static and shared libraries (docs/PREBUILTS.html), module +exports and imports to make sharing and reuse of third-party modules much easier +(docs/IMPORT-MODULE.html explains why).</li> + + <li>A C++ STL implementation (based on STLport) is now provided as a helper module. It +can be used either as a static or shared library (details and usage exemple under +sources/android/stlport/README). <strong>Note:</strong> For now, C++ Exceptions and RTTI are still +not supported.</li> + + <li>Improvements to the <code>cpufeatures</code> helper library to deal with buggy +kernel that incorrectly report they run on an ARMv7 CPU (while the device really is an ARMv6). We +recommend developers that use it to simply rebuild their applications to benefit from it, then +upload to Market.</li> + <li>Adds support for native activities, which allows you to write completely native applications.</li> <li>Adds an EGL library that lets you create and manage OpenGL ES textures and services.</li> - <li>Provides an interface that lets you write a native text-to-speech engine.</li> - <li>Adds native support for the following: <ul> - <li>the input subsystem (such as the keyboard and touch screen)</li> + <li>Input subsystem (such as the keyboard and touch screen)</li> - <li>the window and surface subsystem.</li> + <li>Window and surface subsystem</li> - <li>audio APIs based on the OpenSL ES standard that support playback and recording - as well as control over platform audio effects.</li> + <li>Audio APIs based on the OpenSL ES standard that support playback and recording + as well as control over platform audio effects</li> - <li>event loop APIs to wait for things such as input and sensor events.</li> + <li>Event loop APIs to wait for things such as input and sensor events</li> - <li>accessing assets packaged in an <code>.apk</code> file.</li> + <li>Access to assets packaged in the <code>.apk</code></li> - <li>accessing sensor data (accelerometer, compass, gyroscope, etc).</li> - - <li>provides sample applications, <code>native-plasma</code> and - <code>native-activity</code>, to demonstrate how to write a native activity.</li> + <li>Access to sensor data (accelerometer, compass, gyroscope, etc.)</li> </ul> </li> + + <li>New sample applications, <code>native-plasma</code> and + <code>native-activity</code>, to demonstrate how to write a native activity.</li> + + <li>Plus many bugfixes and other small improvements; see docs/CHANGES.html for a more +detailed list of changes.</li> </ul> </dd> </dl> diff --git a/docs/html/sdk/requirements.jd b/docs/html/sdk/requirements.jd index 7b11654..3679d44 100644 --- a/docs/html/sdk/requirements.jd +++ b/docs/html/sdk/requirements.jd @@ -8,7 +8,7 @@ Android applications using the Android SDK. </p> <ul> <li>Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit)</li> <li>Mac OS X 10.5.8 or later (x86 only)</li> - <li>Linux (tested on Linux Ubuntu Hardy Heron) + <li>Linux (tested on Linux Ubuntu Hardy Heron and Lucid Lynx) <ul> <li>64-bit distributions must be capable of running 32-bit applications. For information about how to add support for 32-bit applications, see @@ -22,10 +22,7 @@ installation notes</a>.</li> <h4 style="margin-top:.25em"><em>Eclipse IDE</em></h4> <ul> - <li>Eclipse 3.4 (Ganymede) or 3.5 (Galileo) - <p class="caution"><strong>Caution:</strong> There are known issues with the ADT plugin -running with Eclipse 3.6. Please stay on 3.5 until further notice.</p> - </li> + <li>Eclipse 3.4 (Ganymede) or greater</li> <li>Eclipse <a href="http://www.eclipse.org/jdt">JDT</a> plugin (included in most Eclipse IDE packages) </li> <li>If you need to install or update Eclipse, you can download it from <a @@ -35,23 +32,22 @@ href="http://www.eclipse.org/downloads/">http://www.eclipse.org/downloads/</a>. developing Android applications, we recommend that you install one of these packages: </p> <ul> - <li>Eclipse IDE for Java EE Developers</li> <li>Eclipse IDE for Java Developers</li> - <li>Eclipse for RCP/Plug-in Developers</li> <li>Eclipse Classic (versions 3.5.1 and higher)</li> + <li>Eclipse IDE for Java EE Developers</li> </ul> </li> - <li><a href="http://java.sun.com/javase/downloads/index.jsp">JDK 5 or JDK + <li><a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">JDK 5 or JDK 6</a> (JRE alone is not sufficient)</li> <li><a href="eclipse-adt.html">Android Development Tools plugin</a> -(optional)</li> +(recommended)</li> <li><strong>Not</strong> compatible with Gnu Compiler for Java (gcj)</li> </ul> <h4><em>Other development environments or IDEs</em></h4> <ul> - <li><a href="http://java.sun.com/javase/downloads/index.jsp">JDK 5 or JDK + <li><a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">JDK 5 or JDK 6</a> (JRE alone is not sufficient)</li> <li><a href="http://ant.apache.org/">Apache Ant</a> 1.6.5 or later for Linux and Mac, 1.7 or later for Windows</li> @@ -75,7 +71,12 @@ particular, note that some Linux distributions may include JDK 1.4 or Gnu Compil </tr> <tr> <td>SDK Tools</td> -<td>50 MB</td> +<td>35 MB</td> +<td>Required.</td> +</tr> +<tr> +<td>SDK Platform-tools</td> +<td>6 MB</td> <td>Required.</td> </tr> <tr> diff --git a/docs/html/sdk/sdk_toc.cs b/docs/html/sdk/sdk_toc.cs index ecc69c2..7ccb7a0 100644 --- a/docs/html/sdk/sdk_toc.cs +++ b/docs/html/sdk/sdk_toc.cs @@ -93,7 +93,7 @@ <span style="display:none" class="zh-TW"></span> </h2> <ul> - <li><a href="<?cs var:toroot ?>sdk/eclipse-adt.html">ADT 0.9.9 + <li><a href="<?cs var:toroot ?>sdk/eclipse-adt.html">ADT 8.0 <span style="display:none" class="de"></span> <span style="display:none" class="es"></span> <span style="display:none" class="fr"></span> @@ -115,7 +115,8 @@ <span style="display:none" class="zh-TW"></span> </h2> <ul> - <li><a href="<?cs var:toroot ?>sdk/ndk/index.html">Download the Android NDK, r5</a></li> + <li><a href="<?cs var:toroot ?>sdk/ndk/index.html">Download the Android NDK, r5</a> + <span class="new">new!</span></li> <li><a href="<?cs var:toroot ?>sdk/ndk/overview.html">What is the NDK?</a></li> </ul> </li> diff --git a/include/private/media/VideoFrame.h b/include/private/media/VideoFrame.h index 9c35274ba..3aff0c6 100644 --- a/include/private/media/VideoFrame.h +++ b/include/private/media/VideoFrame.h @@ -120,6 +120,7 @@ public: uint32_t mDisplayHeight; uint32_t mSize; // Number of bytes in mData uint8_t* mData; // Actual binary data + int32_t mRotationAngle; // rotation angle, clockwise }; }; // namespace android diff --git a/media/java/android/media/CamcorderProfile.java b/media/java/android/media/CamcorderProfile.java index a27df57..4004c76 100644 --- a/media/java/android/media/CamcorderProfile.java +++ b/media/java/android/media/CamcorderProfile.java @@ -16,6 +16,9 @@ package android.media; +import android.hardware.Camera; +import android.hardware.Camera.CameraInfo; + /** * The CamcorderProfile class is used to retrieve the * predefined camcorder profile settings for camcorder applications. @@ -119,12 +122,21 @@ public class CamcorderProfile public int audioChannels; /** - * Returns the camcorder profile for the default camera at the given - * quality level. + * Returns the camcorder profile for the first back-facing camera on the + * device at the given quality level. If the device has no back-facing + * camera, this returns null. * @param quality the target quality level for the camcorder profile */ public static CamcorderProfile get(int quality) { - return get(0, quality); + int numberOfCameras = Camera.getNumberOfCameras(); + CameraInfo cameraInfo = new CameraInfo(); + for (int i = 0; i < numberOfCameras; i++) { + Camera.getCameraInfo(i, cameraInfo); + if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) { + return get(i, quality); + } + } + return null; } /** diff --git a/media/java/android/media/CameraProfile.java b/media/java/android/media/CameraProfile.java index 6a0be08..905e2d2 100644 --- a/media/java/android/media/CameraProfile.java +++ b/media/java/android/media/CameraProfile.java @@ -16,6 +16,9 @@ package android.media; +import android.hardware.Camera; +import android.hardware.Camera.CameraInfo; + import java.util.Arrays; import java.util.HashMap; @@ -46,12 +49,21 @@ public class CameraProfile /** * Returns a pre-defined still image capture (jpeg) quality level * used for the given quality level in the Camera application for - * the default camera. + * the first back-facing camera on the device. If the device has no + * back-facing camera, this returns 0. * * @param quality The target quality level */ public static int getJpegEncodingQualityParameter(int quality) { - return getJpegEncodingQualityParameter(0, quality); + int numberOfCameras = Camera.getNumberOfCameras(); + CameraInfo cameraInfo = new CameraInfo(); + for (int i = 0; i < numberOfCameras; i++) { + Camera.getCameraInfo(i, cameraInfo); + if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) { + return getJpegEncodingQualityParameter(i, quality); + } + } + return 0; } /** diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java index c102de4..ecabae8 100644 --- a/media/java/android/media/MediaRecorder.java +++ b/media/java/android/media/MediaRecorder.java @@ -286,7 +286,7 @@ public class MediaRecorder /** * Sets the orientation hint for output video playback. - * This method should be called before start(). This method will not + * This method should be called before prepare(). This method will not * trigger the source video frame to rotate during video recording, but to * add a composition matrix containing the rotation angle in the output * video if the output format is OutputFormat.THREE_GPP or diff --git a/media/jni/android_media_MediaMetadataRetriever.cpp b/media/jni/android_media_MediaMetadataRetriever.cpp index efea802..63e9dc8 100644 --- a/media/jni/android_media_MediaMetadataRetriever.cpp +++ b/media/jni/android_media_MediaMetadataRetriever.cpp @@ -36,6 +36,7 @@ struct fields_t { jfieldID context; jclass bitmapClazz; jmethodID bitmapConstructor; + jmethodID createBitmapMethod; }; static fields_t fields; @@ -174,6 +175,41 @@ static jobject android_media_MediaMetadataRetriever_captureFrame(JNIEnv *env, jo return NULL; } + jobject matrix = NULL; + if (videoFrame->mRotationAngle != 0) { + LOGD("Create a rotation matrix: %d degrees", videoFrame->mRotationAngle); + jclass matrixClazz = env->FindClass("android/graphics/Matrix"); + if (matrixClazz == NULL) { + jniThrowException(env, "java/lang/RuntimeException", + "Can't find android/graphics/Matrix"); + return NULL; + } + jmethodID matrixConstructor = + env->GetMethodID(matrixClazz, "<init>", "()V"); + if (matrixConstructor == NULL) { + jniThrowException(env, "java/lang/RuntimeException", + "Can't find Matrix constructor"); + return NULL; + } + matrix = + env->NewObject(matrixClazz, matrixConstructor); + if (matrix == NULL) { + LOGE("Could not create a Matrix object"); + return NULL; + } + + LOGV("Rotate the matrix: %d degrees", videoFrame->mRotationAngle); + jmethodID setRotateMethod = + env->GetMethodID(matrixClazz, "setRotate", "(F)V"); + if (setRotateMethod == NULL) { + jniThrowException(env, "java/lang/RuntimeException", + "Can't find Matrix setRotate method"); + return NULL; + } + env->CallVoidMethod(matrix, setRotateMethod, 1.0 * videoFrame->mRotationAngle); + env->DeleteLocalRef(matrixClazz); + } + // Create a SkBitmap to hold the pixels SkBitmap *bitmap = new SkBitmap(); if (bitmap == NULL) { @@ -191,7 +227,19 @@ static jobject android_media_MediaMetadataRetriever_captureFrame(JNIEnv *env, jo // Since internally SkBitmap uses reference count to manage the reference to // its pixels, it is important that the pixels (along with SkBitmap) be // available after creating the Bitmap is returned to Java app. - return env->NewObject(fields.bitmapClazz, fields.bitmapConstructor, (int) bitmap, true, NULL, -1); + jobject jSrcBitmap = env->NewObject(fields.bitmapClazz, + fields.bitmapConstructor, (int) bitmap, true, NULL, -1); + + LOGV("Return a new bitmap constructed with the rotation matrix"); + return env->CallStaticObjectMethod( + fields.bitmapClazz, fields.createBitmapMethod, + jSrcBitmap, // source Bitmap + 0, // x + 0, // y + videoFrame->mDisplayWidth, // width + videoFrame->mDisplayHeight, // height + matrix, // transform matrix + false); // filter } static jbyteArray android_media_MediaMetadataRetriever_extractAlbumArt(JNIEnv *env, jobject thiz) @@ -291,6 +339,15 @@ static void android_media_MediaMetadataRetriever_native_init(JNIEnv *env) jniThrowException(env, "java/lang/RuntimeException", "Can't find Bitmap constructor"); return; } + fields.createBitmapMethod = + env->GetStaticMethodID(fields.bitmapClazz, "createBitmap", + "(Landroid/graphics/Bitmap;IIIILandroid/graphics/Matrix;Z)" + "Landroid/graphics/Bitmap;"); + if (fields.createBitmapMethod == NULL) { + jniThrowException(env, "java/lang/RuntimeException", + "Can't find Bitmap.createBitmap method"); + return; + } } static void android_media_MediaMetadataRetriever_native_setup(JNIEnv *env, jobject thiz) diff --git a/media/libmediaplayerservice/MetadataRetrieverClient.cpp b/media/libmediaplayerservice/MetadataRetrieverClient.cpp index ca229fa..39fce81 100644 --- a/media/libmediaplayerservice/MetadataRetrieverClient.cpp +++ b/media/libmediaplayerservice/MetadataRetrieverClient.cpp @@ -253,6 +253,8 @@ sp<IMemory> MetadataRetrieverClient::captureFrame() frameCopy->mDisplayWidth = frame->mDisplayWidth; frameCopy->mDisplayHeight = frame->mDisplayHeight; frameCopy->mSize = frame->mSize; + frameCopy->mRotationAngle = frame->mRotationAngle; + LOGV("rotation: %d", frameCopy->mRotationAngle); frameCopy->mData = (uint8_t *)frameCopy + sizeof(VideoFrame); memcpy(frameCopy->mData, frame->mData, frame->mSize); delete frame; // Fix memory leakage diff --git a/media/libstagefright/StagefrightMetadataRetriever.cpp b/media/libstagefright/StagefrightMetadataRetriever.cpp index a800a93..9b2dec9 100644 --- a/media/libstagefright/StagefrightMetadataRetriever.cpp +++ b/media/libstagefright/StagefrightMetadataRetriever.cpp @@ -191,6 +191,11 @@ static VideoFrame *extractVideoFrameWithCodecFlags( CHECK(meta->findInt32(kKeyWidth, &width)); CHECK(meta->findInt32(kKeyHeight, &height)); + int32_t rotationAngle; + if (!trackMeta->findInt32(kKeyRotation, &rotationAngle)) { + rotationAngle = 0; // By default, no rotation + } + VideoFrame *frame = new VideoFrame; frame->mWidth = width; frame->mHeight = height; @@ -198,6 +203,7 @@ static VideoFrame *extractVideoFrameWithCodecFlags( frame->mDisplayHeight = height; frame->mSize = width * height * 2; frame->mData = new uint8_t[frame->mSize]; + frame->mRotationAngle = rotationAngle; int32_t srcFormat; CHECK(meta->findInt32(kKeyColorFormat, &srcFormat)); diff --git a/opengl/include/EGL/eglplatform.h b/opengl/include/EGL/eglplatform.h index 25d7697..bfac71b 100644 --- a/opengl/include/EGL/eglplatform.h +++ b/opengl/include/EGL/eglplatform.h @@ -78,18 +78,7 @@ typedef int EGLNativeDisplayType; typedef void *EGLNativeWindowType; typedef void *EGLNativePixmapType; -#elif defined(__unix__) && !defined(ANDROID) - -/* X11 (tentative) */ -#include <X11/Xlib.h> -#include <X11/Xutil.h> - -typedef Display *EGLNativeDisplayType; -typedef Pixmap EGLNativePixmapType; -typedef Window EGLNativeWindowType; - - -#elif defined(ANDROID) +#elif defined(__ANDROID__) || defined(ANDROID) #include <android/native_window.h> @@ -99,6 +88,16 @@ typedef struct ANativeWindow* EGLNativeWindowType; typedef struct egl_native_pixmap_t* EGLNativePixmapType; typedef void* EGLNativeDisplayType; +#elif defined(__unix__) + +/* X11 (tentative) */ +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +typedef Display *EGLNativeDisplayType; +typedef Pixmap EGLNativePixmapType; +typedef Window EGLNativeWindowType; + #else #error "Platform not recognized" #endif diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp index 2d1a278..ab260d5 100644 --- a/opengl/libs/EGL/egl.cpp +++ b/opengl/libs/EGL/egl.cpp @@ -407,6 +407,10 @@ static const extention_map_t gExtentionMap[] = { (__eglMustCastToProperFunctionPointerType)&eglDestroyImageKHR }, { "eglSetSwapRectangleANDROID", (__eglMustCastToProperFunctionPointerType)&eglSetSwapRectangleANDROID }, + { "glEGLImageTargetTexture2DOES", + (__eglMustCastToProperFunctionPointerType)NULL }, + { "glEGLImageTargetRenderbufferStorageOES", + (__eglMustCastToProperFunctionPointerType)NULL }, }; extern const __eglMustCastToProperFunctionPointerType gExtensionForwarders[MAX_NUMBER_OF_GL_EXTENSIONS]; diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp index e204e04..c9ab992 100644 --- a/services/sensorservice/SensorService.cpp +++ b/services/sensorservice/SensorService.cpp @@ -175,10 +175,11 @@ status_t SensorService::dump(int fd, const Vector<String16>& args) for (size_t i=0 ; i<mSensorList.size() ; i++) { const Sensor& s(mSensorList[i]); const sensors_event_t& e(mLastEventSeen.valueFor(s.getHandle())); - snprintf(buffer, SIZE, "%s (vendor=%s, handle=%d, last=<%5.1f,%5.1f,%5.1f>)\n", + snprintf(buffer, SIZE, "%s (vendor=%s, handle=%d, maxRate=%.2fHz, last=<%5.1f,%5.1f,%5.1f>)\n", s.getName().string(), s.getVendor().string(), s.getHandle(), + s.getMinDelay() ? (1000000.0f / s.getMinDelay()) : 0.0f, e.data[0], e.data[1], e.data[2]); result.append(buffer); } diff --git a/services/sensorservice/SensorService.h b/services/sensorservice/SensorService.h index 9f37799..dfb1c0e 100644 --- a/services/sensorservice/SensorService.h +++ b/services/sensorservice/SensorService.h @@ -49,8 +49,8 @@ class SensorService : { friend class BinderService<SensorService>; - static const nsecs_t MINIMUM_EVENTS_PERIOD = 10000000; // 10ms - static const nsecs_t DEFAULT_EVENTS_PERIOD = 200000000; // 200 ms + static const nsecs_t MINIMUM_EVENTS_PERIOD = 1000000; // 1000 Hz + static const nsecs_t DEFAULT_EVENTS_PERIOD = 200000000; // 5 Hz SensorService(); virtual ~SensorService(); diff --git a/services/sensorservice/tests/sensorservicetest.cpp b/services/sensorservice/tests/sensorservicetest.cpp index 42bf983..aea1062 100644 --- a/services/sensorservice/tests/sensorservicetest.cpp +++ b/services/sensorservice/tests/sensorservicetest.cpp @@ -27,15 +27,25 @@ int receiver(int fd, int events, void* data) sp<SensorEventQueue> q((SensorEventQueue*)data); ssize_t n; ASensorEvent buffer[8]; + + static nsecs_t oldTimeStamp = 0; + while ((n = q->read(buffer, 8)) > 0) { for (int i=0 ; i<n ; i++) { - if (buffer[i].type == Sensor::TYPE_ACCELEROMETER) { + if (buffer[i].type == Sensor::TYPE_GYROSCOPE) { printf("time=%lld, value=<%5.1f,%5.1f,%5.1f>\n", buffer[i].timestamp, buffer[i].acceleration.x, buffer[i].acceleration.y, buffer[i].acceleration.z); } + + if (oldTimeStamp) { + float t = float(buffer[i].timestamp - oldTimeStamp) / s2ns(1); + printf("%f ms (%f Hz)\n", t*1000, 1.0/t); + } + oldTimeStamp = buffer[i].timestamp; + } } if (n<0 && n != -EAGAIN) { @@ -56,7 +66,7 @@ int main(int argc, char** argv) sp<SensorEventQueue> q = mgr.createEventQueue(); printf("queue=%p\n", q.get()); - Sensor const* accelerometer = mgr.getDefaultSensor(Sensor::TYPE_ACCELEROMETER); + Sensor const* accelerometer = mgr.getDefaultSensor(Sensor::TYPE_GYROSCOPE); printf("accelerometer=%p (%s)\n", accelerometer, accelerometer->getName().string()); q->enableSensor(accelerometer); |
