summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/animation/LayoutTransition.java9
-rw-r--r--core/java/android/database/CursorWindow.java18
-rw-r--r--core/java/android/database/sqlite/SQLiteDatabase.java28
-rw-r--r--core/java/android/database/sqlite/SQLiteDebug.java24
-rw-r--r--core/java/android/database/sqlite/SQLiteQuery.java20
-rw-r--r--core/java/android/hardware/Camera.java21
-rw-r--r--core/java/android/os/Build.java7
-rw-r--r--core/java/android/os/INetworkManagementService.aidl12
-rw-r--r--core/java/android/provider/Settings.java7
-rw-r--r--core/java/android/widget/PopupWindow.java3
10 files changed, 110 insertions, 39 deletions
diff --git a/core/java/android/animation/LayoutTransition.java b/core/java/android/animation/LayoutTransition.java
index f383af9..7f0ea99 100644
--- a/core/java/android/animation/LayoutTransition.java
+++ b/core/java/android/animation/LayoutTransition.java
@@ -657,6 +657,15 @@ public class LayoutTransition {
*/
private void setupChangeAnimation(final ViewGroup parent, final int changeReason,
Animator baseAnimator, final long duration, final View child) {
+
+ // If we already have a listener for this child, then we've already set up the
+ // changing animation we need. Multiple calls for a child may occur when several
+ // add/remove operations are run at once on a container; each one will trigger
+ // changes for the existing children in the container.
+ if (layoutChangeListenerMap.get(child) != null) {
+ return;
+ }
+
// Make a copy of the appropriate animation
final Animator anim = baseAnimator.clone();
diff --git a/core/java/android/database/CursorWindow.java b/core/java/android/database/CursorWindow.java
index 380236b4..a1be121 100644
--- a/core/java/android/database/CursorWindow.java
+++ b/core/java/android/database/CursorWindow.java
@@ -55,6 +55,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
public int mWindowPtr;
private int mStartPos;
+ private final String mName;
private final CloseGuard mCloseGuard = CloseGuard.get();
@@ -85,6 +86,8 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
private static native boolean nativePutDouble(int windowPtr, double value, int row, int column);
private static native boolean nativePutNull(int windowPtr, int row, int column);
+ private static native String nativeGetName(int windowPtr);
+
/**
* Creates a new empty cursor window and gives it a name.
* <p>
@@ -100,6 +103,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
*/
public CursorWindow(String name, boolean localWindow) {
mStartPos = 0;
+ mName = name;
mWindowPtr = nativeCreate(name, sCursorWindowSize, localWindow);
if (mWindowPtr == 0) {
throw new CursorWindowAllocationException("Cursor window allocation of " +
@@ -130,6 +134,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
throw new CursorWindowAllocationException("Cursor window could not be "
+ "created from binder.");
}
+ mName = nativeGetName(mWindowPtr);
mCloseGuard.open("close");
}
@@ -157,6 +162,14 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
}
/**
+ * Gets the name of this cursor window.
+ * @hide
+ */
+ public String getName() {
+ return mName;
+ }
+
+ /**
* Closes the cursor window and frees its underlying resources when all other
* remaining references have been released.
*/
@@ -778,4 +791,9 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
String s = (buff.length() > 980) ? buff.substring(0, 980) : buff.toString();
return "# Open Cursors=" + total + s;
}
+
+ @Override
+ public String toString() {
+ return getName() + " {" + Integer.toHexString(mWindowPtr) + "}";
+ }
}
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index 00d7ce8..f990be6 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -306,10 +306,6 @@ public class SQLiteDatabase extends SQLiteClosable {
/** Used to find out where this object was created in case it never got closed. */
private final Throwable mStackTrace;
- // System property that enables logging of slow queries. Specify the threshold in ms.
- private static final String LOG_SLOW_QUERIES_PROPERTY = "db.log.slow_query_threshold";
- private final int mSlowQueryThreshold;
-
/** stores the list of statement ids that need to be finalized by sqlite */
private final ArrayList<Integer> mClosedStatementIds = new ArrayList<Integer>();
@@ -1559,11 +1555,6 @@ public class SQLiteDatabase extends SQLiteClosable {
String editTable) {
verifyDbIsOpen();
BlockGuard.getThreadPolicy().onReadFromDisk();
- long timeStart = 0;
-
- if (false || mSlowQueryThreshold != -1) {
- timeStart = System.currentTimeMillis();
- }
SQLiteDatabase db = getDbConnection(sql);
SQLiteCursorDriver driver = new SQLiteDirectCursorDriver(db, sql, editTable);
@@ -1574,24 +1565,6 @@ public class SQLiteDatabase extends SQLiteClosable {
cursorFactory != null ? cursorFactory : mFactory,
selectionArgs);
} finally {
- if (false || mSlowQueryThreshold != -1) {
-
- // Force query execution
- int count = -1;
- if (cursor != null) {
- count = cursor.getCount();
- }
-
- long duration = System.currentTimeMillis() - timeStart;
-
- if (false || duration >= mSlowQueryThreshold) {
- Log.v(SQLiteCursor.TAG,
- "query (" + duration + " ms): " + driver.toString() + ", args are "
- + (selectionArgs != null
- ? TextUtils.join(",", selectionArgs)
- : "<null>") + ", count is " + count);
- }
- }
releaseDbConnection(db);
}
return cursor;
@@ -1967,7 +1940,6 @@ public class SQLiteDatabase extends SQLiteClosable {
setMaxSqlCacheSize(DEFAULT_SQL_CACHE_SIZE);
mFlags = flags;
mPath = path;
- mSlowQueryThreshold = SystemProperties.getInt(LOG_SLOW_QUERIES_PROPERTY, -1);
mStackTrace = new DatabaseObjectNotClosedException().fillInStackTrace();
mFactory = factory;
mPrograms = new WeakHashMap<SQLiteClosable,Object>();
diff --git a/core/java/android/database/sqlite/SQLiteDebug.java b/core/java/android/database/sqlite/SQLiteDebug.java
index 9496079..cc057e0 100644
--- a/core/java/android/database/sqlite/SQLiteDebug.java
+++ b/core/java/android/database/sqlite/SQLiteDebug.java
@@ -18,6 +18,8 @@ package android.database.sqlite;
import java.util.ArrayList;
+import android.os.Build;
+import android.os.SystemProperties;
import android.util.Log;
/**
@@ -65,6 +67,28 @@ public final class SQLiteDebug {
Log.isLoggable("SQLiteLockStackTrace", Log.VERBOSE);
/**
+ * True to enable database performance testing instrumentation.
+ * @hide
+ */
+ public static final boolean DEBUG_LOG_SLOW_QUERIES = Build.IS_DEBUGGABLE;
+
+ /**
+ * Determines whether a query should be logged.
+ *
+ * Reads the "db.log.slow_query_threshold" system property, which can be changed
+ * by the user at any time. If the value is zero, then all queries will
+ * be considered slow. If the value does not exist, then no queries will
+ * be considered slow.
+ *
+ * This value can be changed dynamically while the system is running.
+ * @hide
+ */
+ public static final boolean shouldLogSlowQuery(long elapsedTimeMillis) {
+ int slowQueryMillis = SystemProperties.getInt("db.log.slow_query_threshold", -1);
+ return slowQueryMillis >= 0 && elapsedTimeMillis > slowQueryMillis;
+ }
+
+ /**
* Contains statistics about the active pagers in the current process.
*
* @see #getPagerStats(PagerStats)
diff --git a/core/java/android/database/sqlite/SQLiteQuery.java b/core/java/android/database/sqlite/SQLiteQuery.java
index 7db0914..faf6cba 100644
--- a/core/java/android/database/sqlite/SQLiteQuery.java
+++ b/core/java/android/database/sqlite/SQLiteQuery.java
@@ -18,6 +18,7 @@ package android.database.sqlite;
import android.database.CursorWindow;
import android.os.SystemClock;
+import android.text.TextUtils;
import android.util.Log;
/**
@@ -32,6 +33,7 @@ public class SQLiteQuery extends SQLiteProgram {
private static native int nativeFillWindow(int databasePtr, int statementPtr, int windowPtr,
int startPos, int offsetParam);
+
private static native int nativeColumnCount(int statementPtr);
private static native String nativeColumnName(int statementPtr, int columnIndex);
@@ -80,8 +82,24 @@ public class SQLiteQuery extends SQLiteProgram {
acquireReference();
try {
window.acquireReference();
+ int startPos = window.getStartPosition();
int numRows = nativeFillWindow(nHandle, nStatement, window.mWindowPtr,
- window.getStartPosition(), mOffsetIndex);
+ startPos, mOffsetIndex);
+ if (SQLiteDebug.DEBUG_LOG_SLOW_QUERIES) {
+ long elapsed = SystemClock.uptimeMillis() - timeStart;
+ if (SQLiteDebug.shouldLogSlowQuery(elapsed)) {
+ Log.d(TAG, "fillWindow took " + elapsed
+ + " ms: window=\"" + window
+ + "\", startPos=" + startPos
+ + ", offset=" + mOffsetIndex
+ + ", filledRows=" + window.getNumRows()
+ + ", countedRows=" + numRows
+ + ", query=\"" + mSql + "\""
+ + ", args=[" + (mBindArgs != null ?
+ TextUtils.join(", ", mBindArgs.values()) : "")
+ + "]");
+ }
+ }
mDatabase.logTimeStat(mSql, timeStart);
return numRows;
} catch (IllegalStateException e){
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index caad6fd..68f0247 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -1687,15 +1687,18 @@ public class Camera {
* aggressive than {@link #FOCUS_MODE_CONTINUOUS_VIDEO}. Auto focus
* starts when the parameter is set.
*
- * <p>If applications call {@link #autoFocus(AutoFocusCallback)} in this
- * mode, the focus callback will immediately return with a boolean that
- * indicates whether the focus is sharp or not. The apps can then decide
- * if they want to take a picture immediately or to change the focus
- * mode to auto, and run a full autofocus cycle. The focus position is
- * locked after autoFocus call. If applications want to resume the
- * continuous focus, cancelAutoFocus must be called. Restarting the
- * preview will not resume the continuous autofocus. To stop continuous
- * focus, applications should change the focus mode to other modes.
+ * <p>Applications can call {@link #autoFocus(AutoFocusCallback)} in
+ * this mode. If the autofocus is in the middle of scanning, the focus
+ * callback will return when it completes. If the autofocus is not
+ * scanning, the focus callback will immediately return with a boolean
+ * that indicates whether the focus is sharp or not. The apps can then
+ * decide if they want to take a picture immediately or to change the
+ * focus mode to auto, and run a full autofocus cycle. The focus
+ * position is locked after autoFocus call. If applications want to
+ * resume the continuous focus, cancelAutoFocus must be called.
+ * Restarting the preview will not resume the continuous autofocus. To
+ * stop continuous focus, applications should change the focus mode to
+ * other modes.
*
* @see #FOCUS_MODE_CONTINUOUS_VIDEO
*/
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 5faab36..17a882d 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -326,6 +326,13 @@ public class Build {
public static final String HOST = getString("ro.build.host");
/**
+ * Returns true if we are running a debug build such as "user-debug" or "eng".
+ * @hide
+ */
+ public static final boolean IS_DEBUGGABLE =
+ SystemProperties.getInt("ro.debuggable", 0) == 1;
+
+ /**
* Returns the version string for the radio firmware. May return
* null (if, for instance, the radio is not currently on).
*/
diff --git a/core/java/android/os/INetworkManagementService.aidl b/core/java/android/os/INetworkManagementService.aidl
index be87946..6ecc640 100644
--- a/core/java/android/os/INetworkManagementService.aidl
+++ b/core/java/android/os/INetworkManagementService.aidl
@@ -105,6 +105,18 @@ interface INetworkManagementService
void removeRoute(String iface, in RouteInfo route);
/**
+ * Add the specified route to a secondary interface
+ * This will go into a special route table to be accessed
+ * via ip rules
+ */
+ void addSecondaryRoute(String iface, in RouteInfo route);
+
+ /**
+ * Remove the specified secondary route.
+ */
+ void removeSecondaryRoute(String iface, in RouteInfo route);
+
+ /**
* Shuts down the service
*/
void shutdown();
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 5754e60..a0652f7 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -3620,6 +3620,13 @@ public final class Settings {
"pdp_watchdog_max_pdp_reset_fail_count";
/**
+ * The number of milliseconds to delay when checking for data stalls
+ * @hide
+ */
+ public static final String DATA_STALL_ALARM_DELAY_IN_MS =
+ "data_stall_alarm_delay_in_ms";
+
+ /**
* The interval in milliseconds at which to check gprs registration
* after the first registration mismatch of gprs and voice service,
* to detect possible data network registration problems.
diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java
index 8ba7bee..5fa4ad0 100644
--- a/core/java/android/widget/PopupWindow.java
+++ b/core/java/android/widget/PopupWindow.java
@@ -1248,6 +1248,8 @@ public class PopupWindow {
*/
public void dismiss() {
if (isShowing() && mPopupView != null) {
+ mIsShowing = false;
+
unregisterForScrollChanged();
try {
@@ -1257,7 +1259,6 @@ public class PopupWindow {
((ViewGroup) mPopupView).removeView(mContentView);
}
mPopupView = null;
- mIsShowing = false;
if (mOnDismissListener != null) {
mOnDismissListener.onDismiss();