Merge "LayoutLib: Misc javadoc fixes."
diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java
index c398e98..e69e664 100644
--- a/core/java/android/app/Dialog.java
+++ b/core/java/android/app/Dialog.java
@@ -25,7 +25,6 @@
import android.content.DialogInterface;
import android.graphics.drawable.Drawable;
import android.net.Uri;
-import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@@ -101,6 +100,7 @@
private boolean mCreated = false;
private boolean mShowing = false;
+ private boolean mCanceled = false;
private final Thread mUiThread;
private final Handler mHandler = new Handler();
@@ -244,6 +244,8 @@
return;
}
+ mCanceled = false;
+
if (!mCreated) {
dispatchOnCreate(null);
}
@@ -997,7 +999,8 @@
* also call your {@link DialogInterface.OnCancelListener} (if registered).
*/
public void cancel() {
- if (mCancelMessage != null) {
+ if (!mCanceled && mCancelMessage != null) {
+ mCanceled = true;
// Obtain a new message so this dialog can be re-used
Message.obtain(mCancelMessage).sendToTarget();
}
diff --git a/core/java/android/nfc/technology/IsoDep.java b/core/java/android/nfc/technology/IsoDep.java
index 118bff7..52a453fa 100644
--- a/core/java/android/nfc/technology/IsoDep.java
+++ b/core/java/android/nfc/technology/IsoDep.java
@@ -64,19 +64,4 @@
* 3B only
*/
public byte[] getAttrib() { return mAttrib; }
-
- /**
- * Attempts to select the given application on the tag. Note that this only works
- * if the tag supports ISO7816-4, which not all IsoDep tags support. If the tag doesn't
- * support ISO7816-4 this will throw {@link UnsupportedOperationException}.
- *
- * This method requires that you call {@link #connect} before calling it.
- *
- * @throws IOException, UnsupportedOperationException
- */
- public void selectAid(byte[] aid) throws IOException, UnsupportedOperationException {
- checkConnected();
-
- throw new UnsupportedOperationException();
- }
}
diff --git a/core/java/android/nfc/technology/MifareClassic.java b/core/java/android/nfc/technology/MifareClassic.java
index 8a9ebf1..799f0a78 100644
--- a/core/java/android/nfc/technology/MifareClassic.java
+++ b/core/java/android/nfc/technology/MifareClassic.java
@@ -205,6 +205,15 @@
return getBlockCount(sector) * 16;
}
+ public int getTotalBlockCount() {
+ int totalBlocks = 0;
+ for (int sec = 0; sec < getSectorCount(); sec++) {
+ totalBlocks += getSectorSize(sec);
+ }
+
+ return totalBlocks;
+ }
+
public int getBlockCount(int sector) {
if (sector >= getSectorCount()) {
throw new IllegalArgumentException("this card only has " + getSectorCount() +
@@ -343,9 +352,27 @@
checkConnected();
byte addr = (byte) block;
- byte[] incr_cmd = { (byte) 0xC0, (byte) block };
+ byte[] decr_cmd = { (byte) 0xC0, (byte) block };
- transceive(incr_cmd);
+ transceive(decr_cmd);
+ }
+
+ public void transfer(int block) throws IOException {
+ checkConnected();
+
+ byte addr = (byte) block;
+ byte[] trans_cmd = { (byte) 0xB0, (byte) block };
+
+ transceive(trans_cmd);
+ }
+
+ public void restore(int block) throws IOException {
+ checkConnected();
+
+ byte addr = (byte) block;
+ byte[] rest_cmd = { (byte) 0xC2, (byte) block };
+
+ transceive(rest_cmd);
}
/**
diff --git a/core/java/android/nfc/technology/Ndef.java b/core/java/android/nfc/technology/Ndef.java
index 53db0c5..05872fe 100644
--- a/core/java/android/nfc/technology/Ndef.java
+++ b/core/java/android/nfc/technology/Ndef.java
@@ -54,9 +54,22 @@
/** @hide */
public static final String EXTRA_NDEF_CARDSTATE = "ndefcardstate";
+ /** @hide */
+ public static final String EXTRA_NDEF_TYPE = "ndeftype";
+
+ //TODO: consider removing OTHER entirely - and not allowing Ndef to
+ // enumerate for tag types outside of (NFC Forum 1-4, MifareClassic)
+ public static final int OTHER = -1;
+ public static final int NFC_FORUM_TYPE_1 = 1;
+ public static final int NFC_FORUM_TYPE_2 = 2;
+ public static final int NFC_FORUM_TYPE_3 = 3;
+ public static final int NFC_FORUM_TYPE_4 = 4;
+ public static final int MIFARE_CLASSIC = 105;
+
private final int mMaxNdefSize;
private final int mCardState;
private final NdefMessage mNdefMsg;
+ private final int mNdefType;
/**
* Internal constructor, to be used by NfcAdapter
@@ -68,6 +81,7 @@
mMaxNdefSize = extras.getInt(EXTRA_NDEF_MAXLENGTH);
mCardState = extras.getInt(EXTRA_NDEF_CARDSTATE);
mNdefMsg = extras.getParcelable(EXTRA_NDEF_MSG);
+ mNdefType = extras.getInt(EXTRA_NDEF_TYPE);
} else {
throw new NullPointerException("NDEF tech extras are null.");
}
@@ -92,6 +106,24 @@
}
/**
+ * Get NDEF tag type.
+ * <p>Returns one of {@link #NFC_FORUM_TYPE_1}, {@link #NFC_FORUM_TYPE_2},
+ * {@link #NFC_FORUM_TYPE_3}, {@link #NFC_FORUM_TYPE_4},
+ * {@link #MIFARE_CLASSIC} or {@link #OTHER}.
+ * <p>Platforms of this API revision will always return one of the above
+ * values. Platforms at future API revisions may return other values, which
+ * can be treated as {@link #OTHER} by applications targeting this API.
+ * <p>Android devices with NFC support must always correctly enumerate
+ * NFC Forum tag types, and may optionally enumerate
+ * {@link #MIFARE_CLASSIC} since it requires proprietary technology.
+ * Devices that cannot enumerate {@link #MIFARE_CLASSIC} will use
+ * {@link #OTHER} instead.
+ */
+ public int getType() {
+ return mNdefType;
+ }
+
+ /**
* Get maximum NDEF message size in bytes
*/
public int getMaxSize() {
diff --git a/core/java/android/nfc/technology/NfcB.java b/core/java/android/nfc/technology/NfcB.java
index 64cb08a..de528f8 100644
--- a/core/java/android/nfc/technology/NfcB.java
+++ b/core/java/android/nfc/technology/NfcB.java
@@ -44,6 +44,7 @@
public NfcB(NfcAdapter adapter, Tag tag, Bundle extras)
throws RemoteException {
super(adapter, tag, TagTechnology.NFC_B);
+ mAtqb = extras.getByteArray(EXTRA_ATQB);
}
/**
diff --git a/core/java/android/nfc/technology/NfcV.java b/core/java/android/nfc/technology/NfcV.java
index 9b6a16a..460de6a 100644
--- a/core/java/android/nfc/technology/NfcV.java
+++ b/core/java/android/nfc/technology/NfcV.java
@@ -36,8 +36,27 @@
* permission.
*/
public final class NfcV extends BasicTagTechnology {
+ /** @hide */
+ public static final String EXTRA_RESP_FLAGS = "respflags";
+
+ /** @hide */
+ public static final String EXTRA_DSFID = "dsfid";
+
+ private byte mRespFlags;
+ private byte mDsfId;
+
public NfcV(NfcAdapter adapter, Tag tag, Bundle extras)
throws RemoteException {
super(adapter, tag, TagTechnology.NFC_V);
+ mRespFlags = extras.getByte(EXTRA_RESP_FLAGS);
+ mDsfId = extras.getByte(EXTRA_DSFID);
+ }
+
+ public byte getResponseFlags() {
+ return mRespFlags;
+ }
+
+ public byte getDsfId() {
+ return mDsfId;
}
}
diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java
index 7ad0390..69bc479 100644
--- a/core/java/android/widget/NumberPicker.java
+++ b/core/java/android/widget/NumberPicker.java
@@ -743,11 +743,13 @@
mSelectorElementHeight = mTextSize + selectorTextGapHeight;
}
- if (!mWrapSelectorWheel && y > 0 && selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX] <= mMinValue) {
+ if (!mWrapSelectorWheel && y > 0
+ && selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX] <= mMinValue) {
mCurrentScrollOffset = mInitialScrollOffset;
return;
}
- if (!mWrapSelectorWheel && y < 0 && selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX] >= mMaxValue) {
+ if (!mWrapSelectorWheel && y < 0
+ && selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX] >= mMaxValue) {
mCurrentScrollOffset = mInitialScrollOffset;
return;
}
@@ -1534,7 +1536,16 @@
class AdjustScrollerCommand implements Runnable {
public void run() {
mPreviousScrollerY = 0;
+ if (mInitialScrollOffset == mCurrentScrollOffset) {
+ showInputControls();
+ updateInputTextView();
+ return;
+ }
+ // adjust to the closest value
int deltaY = mInitialScrollOffset - mCurrentScrollOffset;
+ if (Math.abs(deltaY) > mSelectorElementHeight / 2) {
+ deltaY += (deltaY > 0) ? -mSelectorElementHeight : mSelectorElementHeight;
+ }
float delayCoef = (float) Math.abs(deltaY) / (float) mTextSize;
int duration = (int) (delayCoef * SELECTOR_ADJUSTMENT_DURATION_MILLIS);
mAdjustScroller.startScroll(0, 0, 0, deltaY, duration);
diff --git a/core/java/com/android/internal/app/RingtonePickerActivity.java b/core/java/com/android/internal/app/RingtonePickerActivity.java
index 5569ffe..719847e 100644
--- a/core/java/com/android/internal/app/RingtonePickerActivity.java
+++ b/core/java/com/android/internal/app/RingtonePickerActivity.java
@@ -204,7 +204,7 @@
*/
private int addStaticItem(ListView listView, int textResId) {
TextView textView = (TextView) getLayoutInflater().inflate(
- com.android.internal.R.layout.select_dialog_singlechoice, listView, false);
+ com.android.internal.R.layout.select_dialog_singlechoice_holo, listView, false);
textView.setText(textResId);
listView.addHeaderView(textView);
mStaticItemCount++;
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java
index ccec32a..1d9276a 100644
--- a/core/java/com/android/internal/widget/ActionBarView.java
+++ b/core/java/com/android/internal/widget/ActionBarView.java
@@ -135,6 +135,9 @@
public ActionBarView(Context context, AttributeSet attrs) {
super(context, attrs);
+ // Background is always provided by the container.
+ setBackgroundResource(0);
+
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ActionBar);
ApplicationInfo appInfo = context.getApplicationInfo();
diff --git a/libs/rs/rsScriptC.h b/libs/rs/rsScriptC.h
index 4cb5ade..ce9358e 100644
--- a/libs/rs/rsScriptC.h
+++ b/libs/rs/rsScriptC.h
@@ -22,7 +22,7 @@
#include "RenderScriptEnv.h"
namespace bcc {
-class BCCscript;
+class Script;
}
// ---------------------------------------------------------------------------
@@ -48,7 +48,7 @@
Program_t mProgram;
- bcc::BCCscript* mBccScript;
+ bcc::Script* mBccScript;
const Allocation *ptrToAllocation(const void *) const;
diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java
index e8beeb5..7506bb1 100644
--- a/telephony/java/com/android/internal/telephony/RIL.java
+++ b/telephony/java/com/android/internal/telephony/RIL.java
@@ -375,23 +375,26 @@
case EVENT_WAKE_LOCK_TIMEOUT:
// Haven't heard back from the last request. Assume we're
// not getting a response and release the wake lock.
- // TODO should we clean up mRequestList and mRequestPending
synchronized (mWakeLock) {
if (mWakeLock.isHeld()) {
- if (RILJ_LOGD) {
- synchronized (mRequestsList) {
- int count = mRequestsList.size();
- Log.d(LOG_TAG, "WAKE_LOCK_TIMEOUT " +
- " mReqPending=" + mRequestMessagesPending +
- " mRequestList=" + count);
-
- for (int i = 0; i < count; i++) {
- rr = mRequestsList.get(i);
- Log.d(LOG_TAG, i + ": [" + rr.mSerial + "] " +
- requestToString(rr.mRequest));
-
- }
- }
+ // The timer of WAKE_LOCK_TIMEOUT is reset with each
+ // new send request. So when WAKE_LOCK_TIMEOUT occurs
+ // all requests in mRequestList already waited at
+ // least DEFAULT_WAKE_LOCK_TIMEOUT but no response.
+ // Therefore all should be treated as lost requests.
+ // Those lost requests return GENERIC_FAILURE and
+ // request list is cleared.
+ //
+ // Note: mRequestMessagesPending shows how many
+ // requests are waiting to be sent (and before
+ // to be added in request list) since star the
+ // timer. It should be
+ // zero here since all request should already
+ // be put in request list while TIMEOUT occurs.
+ clearRequestsList(GENERIC_FAILURE, true);
+ if (mRequestMessagesPending != 0) {
+ Log.e(LOG_TAG, "ERROR: mReqPending is NOT 0 at TIMEOUT, "
+ + "mReqPending = " + mRequestMessagesPending);
}
mWakeLock.release();
}
@@ -563,15 +566,7 @@
RILRequest.resetSerial();
// Clear request list on close
- synchronized (mRequestsList) {
- for (int i = 0, sz = mRequestsList.size() ; i < sz ; i++) {
- RILRequest rr = mRequestsList.get(i);
- rr.onError(RADIO_NOT_AVAILABLE, null);
- rr.release();
- }
-
- mRequestsList.clear();
- }
+ clearRequestsList(RADIO_NOT_AVAILABLE, false);
}} catch (Throwable tr) {
Log.e(LOG_TAG,"Uncaught exception", tr);
}
@@ -2047,6 +2042,34 @@
releaseWakeLockIfDone();
}
+ /**
+ * Release each request in mReqeustsList then clear the list
+ * @param error is the RIL_Errno sent back
+ * @param loggable true means to print all requests in mRequestslist
+ */
+ private void clearRequestsList(int error, boolean loggable) {
+ RILRequest rr;
+ synchronized (mRequestsList) {
+ int count = mRequestsList.size();
+ if (RILJ_LOGD && loggable) {
+ Log.d(LOG_TAG, "WAKE_LOCK_TIMEOUT " +
+ " mReqPending=" + mRequestMessagesPending +
+ " mRequestList=" + count);
+ }
+
+ for (int i = 0; i < count ; i++) {
+ rr = mRequestsList.get(i);
+ if (RILJ_LOGD && loggable) {
+ Log.d(LOG_TAG, i + ": [" + rr.mSerial + "] " +
+ requestToString(rr.mRequest));
+ }
+ rr.onError(error, null);
+ rr.release();
+ }
+ mRequestsList.clear();
+ }
+ }
+
private RILRequest findAndRemoveRequestFromList(int serial) {
synchronized (mRequestsList) {
for (int i = 0, s = mRequestsList.size() ; i < s ; i++) {