summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/accounts/AccountManagerService.java16
-rw-r--r--core/java/android/app/Dialog.java2
-rw-r--r--core/java/android/bluetooth/BluetoothDeviceProfileState.java1
-rw-r--r--core/java/android/content/res/AssetManager.java1
-rw-r--r--core/java/android/nfc/ApduList.aidl19
-rw-r--r--core/java/android/nfc/ApduList.java68
-rwxr-xr-xcore/java/android/nfc/INfcAdapterExtras.aidl6
-rw-r--r--core/java/android/os/BatteryStats.java1
-rw-r--r--core/java/android/os/Looper.java3
-rw-r--r--core/java/android/os/Process.java2
-rw-r--r--core/java/android/os/RecoverySystem.java25
-rw-r--r--core/java/android/speech/RecognitionService.java14
-rw-r--r--core/java/android/text/Layout.java2
-rw-r--r--core/java/android/text/TextUtils.java12
-rw-r--r--core/java/android/text/method/MultiTapKeyListener.java8
-rw-r--r--core/java/android/text/style/DrawableMarginSpan.java3
-rw-r--r--core/java/android/text/util/Rfc822Tokenizer.java4
-rwxr-xr-x[-rw-r--r--]core/java/android/view/GestureDetector.java11
-rwxr-xr-x[-rw-r--r--]core/java/android/view/ViewConfiguration.java17
-rw-r--r--core/java/android/webkit/CacheManager.java8
-rw-r--r--core/java/android/widget/PopupWindow.java4
-rw-r--r--core/java/android/widget/ScrollView.java6
-rw-r--r--core/java/com/android/internal/os/BatteryStatsImpl.java2
23 files changed, 182 insertions, 53 deletions
diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java
index 894e196..93983a6 100644
--- a/core/java/android/accounts/AccountManagerService.java
+++ b/core/java/android/accounts/AccountManagerService.java
@@ -1786,22 +1786,6 @@ public class AccountManagerService
}
}
- private String getMetaValue(String key) {
- synchronized (mCacheLock) {
- final SQLiteDatabase db = mOpenHelper.getReadableDatabase();
- Cursor c = db.query(TABLE_META,
- new String[]{META_VALUE}, META_KEY + "=?", new String[]{key}, null, null, null);
- try {
- if (c.moveToNext()) {
- return c.getString(0);
- }
- return null;
- } finally {
- c.close();
- }
- }
- }
-
public IBinder onBind(Intent intent) {
return asBinder();
}
diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java
index 087753b..82186dd 100644
--- a/core/java/android/app/Dialog.java
+++ b/core/java/android/app/Dialog.java
@@ -931,7 +931,7 @@ public class Dialog implements DialogInterface, Window.Callback,
// associate search with owner activity
final ComponentName appName = getAssociatedActivity();
- if (appName != null) {
+ if (appName != null && searchManager.getSearchableInfo(appName) != null) {
searchManager.startSearch(null, false, appName, null, false);
dismiss();
return true;
diff --git a/core/java/android/bluetooth/BluetoothDeviceProfileState.java b/core/java/android/bluetooth/BluetoothDeviceProfileState.java
index 6f3a2e7..56f236d 100644
--- a/core/java/android/bluetooth/BluetoothDeviceProfileState.java
+++ b/core/java/android/bluetooth/BluetoothDeviceProfileState.java
@@ -679,7 +679,6 @@ public final class BluetoothDeviceProfileState extends StateMachine {
@Override
public boolean processMessage(Message message) {
log("IncomingA2dp State->Processing Message: " + message.what);
- Message deferMsg = new Message();
switch(message.what) {
case CONNECT_HFP_OUTGOING:
deferMessage(message);
diff --git a/core/java/android/content/res/AssetManager.java b/core/java/android/content/res/AssetManager.java
index e279f64..fc6761d 100644
--- a/core/java/android/content/res/AssetManager.java
+++ b/core/java/android/content/res/AssetManager.java
@@ -235,6 +235,7 @@ public final class AssetManager {
StringBlock[] blocks = mStringBlocks;
if (blocks == null) {
ensureStringBlocks();
+ blocks = mStringBlocks;
}
outValue.string = blocks[block].get(outValue.data);
return true;
diff --git a/core/java/android/nfc/ApduList.aidl b/core/java/android/nfc/ApduList.aidl
new file mode 100644
index 0000000..f6236b2
--- /dev/null
+++ b/core/java/android/nfc/ApduList.aidl
@@ -0,0 +1,19 @@
+/*
+ * 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.nfc;
+
+parcelable ApduList; \ No newline at end of file
diff --git a/core/java/android/nfc/ApduList.java b/core/java/android/nfc/ApduList.java
new file mode 100644
index 0000000..85b0547
--- /dev/null
+++ b/core/java/android/nfc/ApduList.java
@@ -0,0 +1,68 @@
+package android.nfc;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @hide
+ */
+public class ApduList implements Parcelable {
+
+ private ArrayList<byte[]> commands = new ArrayList<byte[]>();
+
+ public ApduList() {
+ }
+
+ public void add(byte[] command) {
+ commands.add(command);
+ }
+
+ public List<byte[]> get() {
+ return commands;
+ }
+
+ public static final Parcelable.Creator<ApduList> CREATOR =
+ new Parcelable.Creator<ApduList>() {
+ @Override
+ public ApduList createFromParcel(Parcel in) {
+ return new ApduList(in);
+ }
+
+ @Override
+ public ApduList[] newArray(int size) {
+ return new ApduList[size];
+ }
+ };
+
+ private ApduList(Parcel in) {
+ int count = in.readInt();
+
+ for (int i = 0 ; i < count ; i++) {
+
+ int length = in.readInt();
+ byte[] cmd = new byte[length];
+ in.readByteArray(cmd);
+ commands.add(cmd);
+ }
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(commands.size());
+
+ for (byte[] cmd : commands) {
+ dest.writeInt(cmd.length);
+ dest.writeByteArray(cmd);
+ }
+ }
+}
+
+
diff --git a/core/java/android/nfc/INfcAdapterExtras.aidl b/core/java/android/nfc/INfcAdapterExtras.aidl
index ab5c1a6..8677a50 100755
--- a/core/java/android/nfc/INfcAdapterExtras.aidl
+++ b/core/java/android/nfc/INfcAdapterExtras.aidl
@@ -16,8 +16,10 @@
package android.nfc;
+import android.nfc.ApduList;
import android.os.Bundle;
+
/**
* {@hide}
*/
@@ -26,5 +28,7 @@ interface INfcAdapterExtras {
Bundle close();
Bundle transceive(in byte[] data_in);
int getCardEmulationRoute();
- void setCardEmulationRoute(int route);
+ void setCardEmulationRoute(int route);
+ void registerTearDownApdus(String packageName, in ApduList apdu);
+ void unregisterTearDownApdus(String packageName);
}
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index 90e2e79..1d6bc4e 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -1883,7 +1883,6 @@ public abstract class BatteryStats implements Parcelable {
final int NU = uidStats.size();
boolean didPid = false;
long nowRealtime = SystemClock.elapsedRealtime();
- StringBuilder sb = new StringBuilder(64);
for (int i=0; i<NU; i++) {
Uid uid = uidStats.valueAt(i);
SparseArray<? extends Uid.Pid> pids = uid.getPidStats();
diff --git a/core/java/android/os/Looper.java b/core/java/android/os/Looper.java
index 8204e3c..ccf642c 100644
--- a/core/java/android/os/Looper.java
+++ b/core/java/android/os/Looper.java
@@ -141,7 +141,8 @@ public class Looper {
Log.wtf("Looper", "Thread identity changed from 0x"
+ Long.toHexString(ident) + " to 0x"
+ Long.toHexString(newIdent) + " while dispatching to "
- + msg.target + " " + msg.callback + " what=" + msg.what);
+ + msg.target.getClass().getName() + " "
+ + msg.callback + " what=" + msg.what);
}
msg.recycle();
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index 0c6ab9e..2bfada0 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -95,7 +95,7 @@ public class Process {
* Defines the UID/GID for the NFC service process.
* @hide
*/
- public static final int NFC_UID = 1022;
+ public static final int NFC_UID = 1025;
/**
* Defines the GID for the group that allows write access to the internal media storage.
diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java
index 4991914..c1dd911 100644
--- a/core/java/android/os/RecoverySystem.java
+++ b/core/java/android/os/RecoverySystem.java
@@ -16,6 +16,11 @@
package android.os;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
@@ -37,9 +42,6 @@ import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
-import android.content.Context;
-import android.util.Log;
-
import org.apache.harmony.security.asn1.BerInputStream;
import org.apache.harmony.security.pkcs7.ContentInfo;
import org.apache.harmony.security.pkcs7.SignedData;
@@ -336,8 +338,21 @@ public class RecoverySystem {
* @throws IOException if writing the recovery command file
* fails, or if the reboot itself fails.
*/
- public static void rebootWipeUserData(Context context)
- throws IOException {
+ public static void rebootWipeUserData(Context context) throws IOException {
+ final ConditionVariable condition = new ConditionVariable();
+
+ Intent intent = new Intent("android.intent.action.MASTER_CLEAR_NOTIFICATION");
+ context.sendOrderedBroadcast(intent, android.Manifest.permission.MASTER_CLEAR,
+ new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ condition.open();
+ }
+ }, null, 0, null, null);
+
+ // Block until the ordered broadcast has completed.
+ condition.block();
+
bootCommand(context, "--wipe_data");
}
diff --git a/core/java/android/speech/RecognitionService.java b/core/java/android/speech/RecognitionService.java
index 75a5ed5..32b2d8f 100644
--- a/core/java/android/speech/RecognitionService.java
+++ b/core/java/android/speech/RecognitionService.java
@@ -68,6 +68,8 @@ public abstract class RecognitionService extends Service {
private static final int MSG_CANCEL = 3;
+ private static final int MSG_RESET = 4;
+
private final Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
@@ -81,6 +83,10 @@ public abstract class RecognitionService extends Service {
break;
case MSG_CANCEL:
dispatchCancel((IRecognitionListener) msg.obj);
+ break;
+ case MSG_RESET:
+ dispatchClearCallback();
+ break;
}
}
};
@@ -128,6 +134,10 @@ public abstract class RecognitionService extends Service {
}
}
+ private void dispatchClearCallback() {
+ mCurrentCallback = null;
+ }
+
private class StartListeningArgs {
public final Intent mIntent;
@@ -241,7 +251,7 @@ public abstract class RecognitionService extends Service {
* @param error code is defined in {@link SpeechRecognizer}
*/
public void error(int error) throws RemoteException {
- mCurrentCallback = null;
+ Message.obtain(mHandler, MSG_RESET).sendToTarget();
mListener.onError(error);
}
@@ -278,7 +288,7 @@ public abstract class RecognitionService extends Service {
* {@link SpeechRecognizer#RESULTS_RECOGNITION} as a parameter
*/
public void results(Bundle results) throws RemoteException {
- mCurrentCallback = null;
+ Message.obtain(mHandler, MSG_RESET).sendToTarget();
mListener.onResults(results);
}
diff --git a/core/java/android/text/Layout.java b/core/java/android/text/Layout.java
index 1e4cca9..4107c5a 100644
--- a/core/java/android/text/Layout.java
+++ b/core/java/android/text/Layout.java
@@ -1170,7 +1170,7 @@ public abstract class Layout {
if (h2 < 0.5f)
h2 = 0.5f;
- if (h1 == h2) {
+ if (Float.compare(h1, h2) == 0) {
dest.moveTo(h1, top);
dest.lineTo(h1, bottom);
} else {
diff --git a/core/java/android/text/TextUtils.java b/core/java/android/text/TextUtils.java
index d5010c6..cdb7228 100644
--- a/core/java/android/text/TextUtils.java
+++ b/core/java/android/text/TextUtils.java
@@ -624,10 +624,16 @@ public class TextUtils {
public CharSequence createFromParcel(Parcel p) {
int kind = p.readInt();
- if (kind == 1)
- return p.readString();
+ String string = p.readString();
+ if (string == null) {
+ return null;
+ }
+
+ if (kind == 1) {
+ return string;
+ }
- SpannableString sp = new SpannableString(p.readString());
+ SpannableString sp = new SpannableString(string);
while (true) {
kind = p.readInt();
diff --git a/core/java/android/text/method/MultiTapKeyListener.java b/core/java/android/text/method/MultiTapKeyListener.java
index 6d94788..2a739fa 100644
--- a/core/java/android/text/method/MultiTapKeyListener.java
+++ b/core/java/android/text/method/MultiTapKeyListener.java
@@ -116,7 +116,7 @@ public class MultiTapKeyListener extends BaseKeyListener
content.replace(selStart, selEnd,
String.valueOf(current).toUpperCase());
removeTimeouts(content);
- Timeout t = new Timeout(content);
+ new Timeout(content); // for its side effects
return true;
}
@@ -124,7 +124,7 @@ public class MultiTapKeyListener extends BaseKeyListener
content.replace(selStart, selEnd,
String.valueOf(current).toLowerCase());
removeTimeouts(content);
- Timeout t = new Timeout(content);
+ new Timeout(content); // for its side effects
return true;
}
@@ -140,7 +140,7 @@ public class MultiTapKeyListener extends BaseKeyListener
content.replace(selStart, selEnd, val, ix, ix + 1);
removeTimeouts(content);
- Timeout t = new Timeout(content);
+ new Timeout(content); // for its side effects
return true;
}
@@ -206,7 +206,7 @@ public class MultiTapKeyListener extends BaseKeyListener
}
removeTimeouts(content);
- Timeout t = new Timeout(content);
+ new Timeout(content); // for its side effects
// Set up the callback so we can remove the timeout if the
// cursor moves.
diff --git a/core/java/android/text/style/DrawableMarginSpan.java b/core/java/android/text/style/DrawableMarginSpan.java
index 3c471a5..c2564d5 100644
--- a/core/java/android/text/style/DrawableMarginSpan.java
+++ b/core/java/android/text/style/DrawableMarginSpan.java
@@ -50,9 +50,6 @@ implements LeadingMarginSpan, LineHeightSpan
int dw = mDrawable.getIntrinsicWidth();
int dh = mDrawable.getIntrinsicHeight();
- if (dir < 0)
- x -= dw;
-
// XXX What to do about Paint?
mDrawable.setBounds(ix, itop, ix+dw, itop+dh);
mDrawable.draw(c);
diff --git a/core/java/android/text/util/Rfc822Tokenizer.java b/core/java/android/text/util/Rfc822Tokenizer.java
index 69cf93c..68334e4 100644
--- a/core/java/android/text/util/Rfc822Tokenizer.java
+++ b/core/java/android/text/util/Rfc822Tokenizer.java
@@ -256,7 +256,7 @@ public class Rfc822Tokenizer implements MultiAutoCompleteTextView.Tokenizer {
if (c == '"') {
i++;
break;
- } else if (c == '\\') {
+ } else if (c == '\\' && i + 1 < len) {
i += 2;
} else {
i++;
@@ -275,7 +275,7 @@ public class Rfc822Tokenizer implements MultiAutoCompleteTextView.Tokenizer {
} else if (c == '(') {
level++;
i++;
- } else if (c == '\\') {
+ } else if (c == '\\' && i + 1 < len) {
i += 2;
} else {
i++;
diff --git a/core/java/android/view/GestureDetector.java b/core/java/android/view/GestureDetector.java
index c1e1049..79b3d42 100644..100755
--- a/core/java/android/view/GestureDetector.java
+++ b/core/java/android/view/GestureDetector.java
@@ -193,10 +193,8 @@ public class GestureDetector {
}
}
- // TODO: ViewConfiguration
- private int mBiggerTouchSlopSquare = 20 * 20;
-
private int mTouchSlopSquare;
+ private int mLargeTouchSlopSquare;
private int mDoubleTapSlopSquare;
private int mMinimumFlingVelocity;
private int mMaximumFlingVelocity;
@@ -384,10 +382,11 @@ public class GestureDetector {
mIgnoreMultitouch = ignoreMultitouch;
// Fallback to support pre-donuts releases
- int touchSlop, doubleTapSlop;
+ int touchSlop, largeTouchSlop, doubleTapSlop;
if (context == null) {
//noinspection deprecation
touchSlop = ViewConfiguration.getTouchSlop();
+ largeTouchSlop = touchSlop + 2;
doubleTapSlop = ViewConfiguration.getDoubleTapSlop();
//noinspection deprecation
mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
@@ -395,11 +394,13 @@ public class GestureDetector {
} else {
final ViewConfiguration configuration = ViewConfiguration.get(context);
touchSlop = configuration.getScaledTouchSlop();
+ largeTouchSlop = configuration.getScaledLargeTouchSlop();
doubleTapSlop = configuration.getScaledDoubleTapSlop();
mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();
}
mTouchSlopSquare = touchSlop * touchSlop;
+ mLargeTouchSlopSquare = largeTouchSlop * largeTouchSlop;
mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
}
@@ -534,7 +535,7 @@ public class GestureDetector {
mHandler.removeMessages(SHOW_PRESS);
mHandler.removeMessages(LONG_PRESS);
}
- if (distance > mBiggerTouchSlopSquare) {
+ if (distance > mLargeTouchSlopSquare) {
mAlwaysInBiggerTapRegion = false;
}
} else if ((Math.abs(scrollX) >= 1) || (Math.abs(scrollY) >= 1)) {
diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java
index 739758c..2a74eb7 100644..100755
--- a/core/java/android/view/ViewConfiguration.java
+++ b/core/java/android/view/ViewConfiguration.java
@@ -129,6 +129,12 @@ public class ViewConfiguration {
private static final int TOUCH_SLOP = 16;
/**
+ * Distance a touch can wander before we think the user is the first touch
+ * in a sequence of double tap
+ */
+ private static final int LARGE_TOUCH_SLOP = 18;
+
+ /**
* Distance a touch can wander before we think the user is attempting a paged scroll
* (in dips)
*/
@@ -183,6 +189,7 @@ public class ViewConfiguration {
private final int mMaximumFlingVelocity;
private final int mScrollbarSize;
private final int mTouchSlop;
+ private final int mLargeTouchSlop;
private final int mPagingTouchSlop;
private final int mDoubleTapSlop;
private final int mWindowTouchSlop;
@@ -204,6 +211,7 @@ public class ViewConfiguration {
mMaximumFlingVelocity = MAXIMUM_FLING_VELOCITY;
mScrollbarSize = SCROLL_BAR_SIZE;
mTouchSlop = TOUCH_SLOP;
+ mLargeTouchSlop = LARGE_TOUCH_SLOP;
mPagingTouchSlop = PAGING_TOUCH_SLOP;
mDoubleTapSlop = DOUBLE_TAP_SLOP;
mWindowTouchSlop = WINDOW_TOUCH_SLOP;
@@ -240,6 +248,7 @@ public class ViewConfiguration {
mMaximumFlingVelocity = (int) (density * MAXIMUM_FLING_VELOCITY + 0.5f);
mScrollbarSize = (int) (density * SCROLL_BAR_SIZE + 0.5f);
mTouchSlop = (int) (sizeAndDensity * TOUCH_SLOP + 0.5f);
+ mLargeTouchSlop = (int) (sizeAndDensity * LARGE_TOUCH_SLOP + 0.5f);
mPagingTouchSlop = (int) (sizeAndDensity * PAGING_TOUCH_SLOP + 0.5f);
mDoubleTapSlop = (int) (sizeAndDensity * DOUBLE_TAP_SLOP + 0.5f);
mWindowTouchSlop = (int) (sizeAndDensity * WINDOW_TOUCH_SLOP + 0.5f);
@@ -416,6 +425,14 @@ public class ViewConfiguration {
}
/**
+ * @return Distance a touch can wander before we think the user is the first touch
+ * in a sequence of double tap
+ */
+ public int getScaledLargeTouchSlop() {
+ return mLargeTouchSlop;
+ }
+
+ /**
* @return Distance a touch can wander before we think the user is scrolling a full page
* in dips
*/
diff --git a/core/java/android/webkit/CacheManager.java b/core/java/android/webkit/CacheManager.java
index 3ce0730..e21a02e 100644
--- a/core/java/android/webkit/CacheManager.java
+++ b/core/java/android/webkit/CacheManager.java
@@ -857,6 +857,7 @@ public final class CacheManager {
String cacheControl = headers.getCacheControl();
if (cacheControl != null) {
String[] controls = cacheControl.toLowerCase().split("[ ,;]");
+ boolean noCache = false;
for (int i = 0; i < controls.length; i++) {
if (NO_STORE.equals(controls[i])) {
return null;
@@ -867,7 +868,12 @@ public final class CacheManager {
// can only be used in CACHE_MODE_CACHE_ONLY case
if (NO_CACHE.equals(controls[i])) {
ret.expires = 0;
- } else if (controls[i].startsWith(MAX_AGE)) {
+ noCache = true;
+ // if cache control = no-cache has been received, ignore max-age
+ // header, according to http spec:
+ // If a request includes the no-cache directive, it SHOULD NOT
+ // include min-fresh, max-stale, or max-age.
+ } else if (controls[i].startsWith(MAX_AGE) && !noCache) {
int separator = controls[i].indexOf('=');
if (separator < 0) {
separator = controls[i].indexOf(':');
diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java
index 72b70bc..de32c2b 100644
--- a/core/java/android/widget/PopupWindow.java
+++ b/core/java/android/widget/PopupWindow.java
@@ -1489,6 +1489,10 @@ public class PopupWindow {
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
+ if (getKeyDispatcherState() == null) {
+ return super.dispatchKeyEvent(event);
+ }
+
if (event.getAction() == KeyEvent.ACTION_DOWN
&& event.getRepeatCount() == 0) {
KeyEvent.DispatcherState state = getKeyDispatcherState();
diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java
index 4b4f5f2..ade3a0a 100644
--- a/core/java/android/widget/ScrollView.java
+++ b/core/java/android/widget/ScrollView.java
@@ -873,7 +873,7 @@ public class ScrollView extends FrameLayout {
int count = getChildCount();
if (count > 0) {
View view = getChildAt(count - 1);
- mTempRect.bottom = view.getBottom();
+ mTempRect.bottom = view.getBottom() + mPaddingBottom;
mTempRect.top = mTempRect.bottom - height;
}
}
@@ -949,9 +949,7 @@ public class ScrollView extends FrameLayout {
} else if (direction == View.FOCUS_DOWN) {
if (getChildCount() > 0) {
int daBottom = getChildAt(0).getBottom();
-
- int screenBottom = getScrollY() + getHeight();
-
+ int screenBottom = getScrollY() + getHeight() - mPaddingBottom;
if (daBottom - screenBottom < maxJump) {
scrollDelta = daBottom - screenBottom;
}
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index d86504d..2847cf3 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -4708,7 +4708,7 @@ public final class BatteryStatsImpl extends BatteryStats {
mHistory = mHistoryEnd = mHistoryCache = null;
mHistoryBaseTime = 0;
long time;
- while ((time=in.readLong()) >= 0) {
+ while (in.dataAvail() > 0 && (time=in.readLong()) >= 0) {
HistoryItem rec = new HistoryItem(time, in);
addHistoryRecordLocked(rec);
if (rec.time > mHistoryBaseTime) {