Merge "Adding parseSizesList, getSupportedPreviewSizes to CameraParameters."
diff --git a/Android.mk b/Android.mk
index 696b117..e0bd348 100644
--- a/Android.mk
+++ b/Android.mk
@@ -362,6 +362,7 @@
-since ./frameworks/base/api/6.xml 6 \
-since ./frameworks/base/api/7.xml 7 \
-since ./frameworks/base/api/8.xml 8 \
+ -since ./frameworks/base/api/current.xml HC \
-error 1 -error 2 -warning 3 -error 4 -error 6 -error 8 \
-overview $(LOCAL_PATH)/core/java/overview.html
diff --git a/api/current.xml b/api/current.xml
index 22828c5..d87acf9 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -135660,9 +135660,9 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="c" type="android.content.Context">
+<parameter name="context" type="android.content.Context">
</parameter>
-<parameter name="s" type="java.lang.String">
+<parameter name="string" type="java.lang.String">
</parameter>
</method>
<method name="truncateHistory"
@@ -136046,7 +136046,7 @@
value=""url""
static="true"
final="true"
- deprecated="not deprecated"
+ deprecated="deprecated"
visibility="public"
>
</field>
@@ -189429,6 +189429,28 @@
visibility="public"
>
</method>
+<method name="getTranslationX"
+ return="float"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getTranslationY"
+ return="float"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getVerticalFadingEdgeLength"
return="int"
abstract="false"
@@ -189531,7 +189553,7 @@
</parameter>
</method>
<method name="getX"
- return="int"
+ return="float"
abstract="false"
native="false"
synchronized="false"
@@ -189542,7 +189564,7 @@
>
</method>
<method name="getY"
- return="int"
+ return="float"
abstract="false"
native="false"
synchronized="false"
@@ -190947,19 +190969,6 @@
<parameter name="resid" type="int">
</parameter>
</method>
-<method name="setBottom"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="bottom" type="int">
-</parameter>
-</method>
<method name="setClickable"
return="void"
abstract="false"
@@ -191168,19 +191177,6 @@
<parameter name="params" type="android.view.ViewGroup.LayoutParams">
</parameter>
</method>
-<method name="setLeft"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="left" type="int">
-</parameter>
-</method>
<method name="setLongClickable"
return="void"
abstract="false"
@@ -191423,19 +191419,6 @@
<parameter name="pressed" type="boolean">
</parameter>
</method>
-<method name="setRight"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="right" type="int">
-</parameter>
-</method>
<method name="setRotation"
return="void"
abstract="false"
@@ -191594,19 +191577,6 @@
<parameter name="tag" type="java.lang.Object">
</parameter>
</method>
-<method name="setTop"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="top" type="int">
-</parameter>
-</method>
<method name="setTouchDelegate"
return="void"
abstract="false"
@@ -191620,6 +191590,32 @@
<parameter name="delegate" type="android.view.TouchDelegate">
</parameter>
</method>
+<method name="setTranslationX"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="translationX" type="float">
+</parameter>
+</method>
+<method name="setTranslationY"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="translationY" type="float">
+</parameter>
+</method>
<method name="setVerticalFadingEdgeEnabled"
return="void"
abstract="false"
@@ -191695,7 +191691,7 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="x" type="int">
+<parameter name="x" type="float">
</parameter>
</method>
<method name="setY"
@@ -191708,7 +191704,7 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="y" type="int">
+<parameter name="y" type="float">
</parameter>
</method>
<method name="showContextMenu"
diff --git a/core/java/android/animation/Sequencer.java b/core/java/android/animation/Sequencer.java
index 84dbcc1..3278a3e 100644
--- a/core/java/android/animation/Sequencer.java
+++ b/core/java/android/animation/Sequencer.java
@@ -713,11 +713,7 @@
*/
public void after(long delay) {
// setup dummy Animator just to run the clock
- Animator anim = new Animator(delay, 0f, 1f);
- Node node = new Node(anim);
- mNodes.add(node);
- Dependency dependency = new Dependency(node, Dependency.AFTER);
- mCurrentNode.addDependency(dependency);
+ after(new Animator(delay, 0f, 1f));
}
}
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 4b312ec..ee91318 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -4178,7 +4178,10 @@
for (int i=0; i<N; i++) {
ManagedCursor mc = mManagedCursors.get(i);
if (mc.mReleased || mc.mUpdated) {
- mc.mCursor.requery();
+ if (!mc.mCursor.requery()) {
+ throw new IllegalStateException(
+ "trying to requery an already closed cursor");
+ }
mc.mReleased = false;
mc.mUpdated = false;
}
diff --git a/core/java/android/content/ContentQueryMap.java b/core/java/android/content/ContentQueryMap.java
index dbcb4a7..c955094 100644
--- a/core/java/android/content/ContentQueryMap.java
+++ b/core/java/android/content/ContentQueryMap.java
@@ -129,7 +129,9 @@
/** Requeries the cursor and reads the contents into the cache */
public void requery() {
mDirty = false;
- mCursor.requery();
+ if (!mCursor.requery()) {
+ throw new IllegalStateException("trying to requery an already closed cursor");
+ }
readCursorIntoCache();
setChanged();
notifyObservers();
diff --git a/core/java/android/provider/Browser.java b/core/java/android/provider/Browser.java
index 2fba1d79..991ce9e 100644
--- a/core/java/android/provider/Browser.java
+++ b/core/java/android/provider/Browser.java
@@ -22,17 +22,21 @@
import android.content.Intent;
import android.database.Cursor;
import android.database.DatabaseUtils;
+import android.graphics.BitmapFactory;
import android.net.Uri;
-import android.os.AsyncTask;
import android.util.Log;
import android.webkit.WebIconDatabase;
-import java.util.Date;
-
public class Browser {
private static final String LOGTAG = "browser";
- public static final Uri BOOKMARKS_URI =
- Uri.parse("content://browser/bookmarks");
+
+ /**
+ * A table containing both bookmarks and history items. The columns of the table are defined in
+ * {@link BookmarkColumns}. Reading this table requires the
+ * {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS} permission and writing to it
+ * requires the {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS} permission.
+ */
+ public static final Uri BOOKMARKS_URI = Uri.parse("content://browser/bookmarks");
/**
* The name of extra data when starting Browser with ACTION_VIEW or
@@ -49,12 +53,11 @@
* application.
* <p>
* The value is a unique identification string that will be used to
- * indentify the calling application. The Browser will attempt to reuse the
+ * identify the calling application. The Browser will attempt to reuse the
* same window each time the application launches the Browser with the same
* identifier.
*/
- public static final String EXTRA_APPLICATION_ID =
- "com.android.browser.application_id";
+ public static final String EXTRA_APPLICATION_ID = "com.android.browser.application_id";
/**
* The name of the extra data in the VIEW intent. The data are key/value
@@ -68,10 +71,17 @@
/* if you change column order you must also change indices
below */
public static final String[] HISTORY_PROJECTION = new String[] {
- BookmarkColumns._ID, BookmarkColumns.URL, BookmarkColumns.VISITS,
- BookmarkColumns.DATE, BookmarkColumns.BOOKMARK, BookmarkColumns.TITLE,
- BookmarkColumns.FAVICON, BookmarkColumns.THUMBNAIL,
- BookmarkColumns.TOUCH_ICON, BookmarkColumns.USER_ENTERED };
+ BookmarkColumns._ID, // 0
+ BookmarkColumns.URL, // 1
+ BookmarkColumns.VISITS, // 2
+ BookmarkColumns.DATE, // 3
+ BookmarkColumns.BOOKMARK, // 4
+ BookmarkColumns.TITLE, // 5
+ BookmarkColumns.FAVICON, // 6
+ BookmarkColumns.THUMBNAIL, // 7
+ BookmarkColumns.TOUCH_ICON, // 8
+ BookmarkColumns.USER_ENTERED, // 9
+ };
/* these indices dependent on HISTORY_PROJECTION */
public static final int HISTORY_PROJECTION_ID_INDEX = 0;
@@ -92,19 +102,33 @@
/* columns needed to determine whether to truncate history */
public static final String[] TRUNCATE_HISTORY_PROJECTION = new String[] {
- BookmarkColumns._ID, BookmarkColumns.DATE, };
+ BookmarkColumns._ID,
+ BookmarkColumns.DATE,
+ };
+
public static final int TRUNCATE_HISTORY_PROJECTION_ID_INDEX = 0;
/* truncate this many history items at a time */
public static final int TRUNCATE_N_OLDEST = 5;
- public static final Uri SEARCHES_URI =
- Uri.parse("content://browser/searches");
+ /**
+ * A table containing a log of browser searches. The columns of the table are defined in
+ * {@link SearchColumns}. Reading this table requires the
+ * {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS} permission and writing to it
+ * requires the {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS} permission.
+ */
+ public static final Uri SEARCHES_URI = Uri.parse("content://browser/searches");
- /* if you change column order you must also change indices
- below */
+ /**
+ * A projection of {@link #SEARCHES_URI} that contains {@link SearchColumns#_ID},
+ * {@link SearchColumns#SEARCH}, and {@link SearchColumns#DATE}.
+ */
public static final String[] SEARCHES_PROJECTION = new String[] {
- SearchColumns._ID, SearchColumns.SEARCH, SearchColumns.DATE };
+ // if you change column order you must also change indices below
+ SearchColumns._ID, // 0
+ SearchColumns.SEARCH, // 1
+ SearchColumns.DATE, // 2
+ };
/* these indices dependent on SEARCHES_PROJECTION */
public static final int SEARCHES_PROJECTION_SEARCH_INDEX = 1;
@@ -121,9 +145,10 @@
private static final int MAX_HISTORY_COUNT = 250;
/**
- * Open the AddBookmark activity to save a bookmark. Launch with
- * and/or url, which can be edited by the user before saving.
- * @param c Context used to launch the AddBookmark activity.
+ * Open an activity to save a bookmark. Launch with a title
+ * and/or a url, both of which can be edited by the user before saving.
+ *
+ * @param c Context used to launch the activity to add a bookmark.
* @param title Title for the bookmark. Can be null or empty string.
* @param url Url for the bookmark. Can be null or empty string.
*/
@@ -152,8 +177,15 @@
*/
public final static String EXTRA_SHARE_FAVICON = "share_favicon";
- public static final void sendString(Context c, String s) {
- sendString(c, s, c.getString(com.android.internal.R.string.sendText));
+ /**
+ * Sends the given string using an Intent with {@link Intent#ACTION_SEND} and a mime type
+ * of text/plain. The string is put into {@link Intent#EXTRA_TEXT}.
+ *
+ * @param context the context used to start the activity
+ * @param string the string to send
+ */
+ public static final void sendString(Context context, String string) {
+ sendString(context, string, context.getString(com.android.internal.R.string.sendText));
}
/**
@@ -181,20 +213,26 @@
}
/**
- * Return a cursor pointing to a list of all the bookmarks.
+ * Return a cursor pointing to a list of all the bookmarks. The cursor will have a single
+ * column, {@link BookmarkColumns#URL}.
+ * <p>
* Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS}
+ *
* @param cr The ContentResolver used to access the database.
*/
public static final Cursor getAllBookmarks(ContentResolver cr) throws
IllegalStateException {
return cr.query(BOOKMARKS_URI,
new String[] { BookmarkColumns.URL },
- "bookmark = 1", null, null);
+ BookmarkColumns.BOOKMARK + " = 1", null, null);
}
/**
- * Return a cursor pointing to a list of all visited site urls.
+ * Return a cursor pointing to a list of all visited site urls. The cursor will
+ * have a single column, {@link BookmarkColumns#URL}.
+ * <p>
* Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS}
+ *
* @param cr The ContentResolver used to access the database.
*/
public static final Cursor getAllVisitedUrls(ContentResolver cr) throws
@@ -266,7 +304,7 @@
*/
public static final void updateVisitedHistory(ContentResolver cr,
String url, boolean real) {
- long now = new Date().getTime();
+ long now = System.currentTimeMillis();
Cursor c = null;
try {
c = getVisitedLike(cr, url);
@@ -534,7 +572,7 @@
* @param search The string to add to the searches database.
*/
public static final void addSearchUrl(ContentResolver cr, String search) {
- long now = new Date().getTime();
+ long now = System.currentTimeMillis();
Cursor c = null;
try {
c = cr.query(
@@ -558,6 +596,7 @@
if (c != null) c.close();
}
}
+
/**
* Remove all searches from the search database.
* Requires {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS}
@@ -590,31 +629,90 @@
.bulkRequestIconForPageUrl(cr, where, listener);
}
+ /**
+ * Column definitions for the mixed bookmark and history items available
+ * at {@link #BOOKMARKS_URI}.
+ */
public static class BookmarkColumns implements BaseColumns {
+ /**
+ * The URL of the bookmark or history item.
+ * <p>Type: TEXT (URL)</p>
+ */
public static final String URL = "url";
+
+ /**
+ * The number of time the item has been visited.
+ * <p>Type: NUMBER</p>
+ */
public static final String VISITS = "visits";
+
+ /**
+ * The date the item was last visited, in milliseconds since the epoch.
+ * <p>Type: NUMBER (date in milliseconds since January 1, 1970)</p>
+ */
public static final String DATE = "date";
+
+ /**
+ * Flag indicating that an item is a bookmark. A value of 1 indicates a bookmark, a value
+ * of 0 indicates a history item.
+ * <p>Type: INTEGER (boolean)</p>
+ */
public static final String BOOKMARK = "bookmark";
+
+ /**
+ * The user visible title of the bookmark or history item.
+ * <p>Type: TEXT</p>
+ */
public static final String TITLE = "title";
+
+ /**
+ * The date the item created, in milliseconds since the epoch.
+ * <p>Type: NUMBER (date in milliseconds since January 1, 1970)</p>
+ */
public static final String CREATED = "created";
+
+ /**
+ * The favicon of the bookmark. Must decode via {@link BitmapFactory#decodeByteArray}.
+ * <p>Type: BLOB (image)</p>
+ */
public static final String FAVICON = "favicon";
+
/**
* @hide
*/
public static final String THUMBNAIL = "thumbnail";
+
/**
* @hide
*/
public static final String TOUCH_ICON = "touch_icon";
+
/**
* @hide
*/
public static final String USER_ENTERED = "user_entered";
}
+ /**
+ * Column definitions for the search history table, available at {@link #SEARCHES_URI}.
+ */
public static class SearchColumns implements BaseColumns {
+ /**
+ * Not used.
+ * @deprecated
+ */
+ @Deprecated
public static final String URL = "url";
+
+ /**
+ * The user entered search term.
+ */
public static final String SEARCH = "search";
+
+ /**
+ * The date the search was performed, in milliseconds since the epoch.
+ * <p>Type: NUMBER (date in milliseconds since January 1, 1970)</p>
+ */
public static final String DATE = "date";
}
}
diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java
index 41dfc00..227d94d 100644
--- a/core/java/android/provider/MediaStore.java
+++ b/core/java/android/provider/MediaStore.java
@@ -273,6 +273,13 @@
+ "/object/" + objectId);
}
+ // used for MTP GetObjectReferences and SetObjectReferences
+ public static final Uri getReferencesUri(String volumeName,
+ long objectId) {
+ return Uri.parse(CONTENT_AUTHORITY_SLASH + volumeName
+ + "/object/" + objectId + "/references");
+ }
+
/**
* Fields for master table for all media files.
* Table also contains MediaColumns._ID, DATA, SIZE and DATE_MODIFIED.
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 7666591d..7c644e4 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -1633,6 +1633,18 @@
private float mRotation = 0f;
/**
+ * The amount of translation of the object away from its left property (post-layout).
+ */
+ @ViewDebug.ExportedProperty
+ private float mTranslationX = 0f;
+
+ /**
+ * The amount of translation of the object away from its top property (post-layout).
+ */
+ @ViewDebug.ExportedProperty
+ private float mTranslationY = 0f;
+
+ /**
* The amount of scale in the x direction around the pivot point. A
* value of 1 means no scaling is applied.
*/
@@ -4885,7 +4897,8 @@
// transform-related properties have changed since the last time someone
// asked for the matrix; recalculate it with the current values
mMatrix.reset();
- mMatrix.setRotate(mRotation, mPivotX, mPivotY);
+ mMatrix.setTranslate(mTranslationX, mTranslationY);
+ mMatrix.preRotate(mRotation, mPivotX, mPivotY);
mMatrix.preScale(mScaleX, mScaleY, mPivotX, mPivotY);
mMatrixDirty = false;
mMatrixIsIdentity = mMatrix.isIdentity();
@@ -5108,43 +5121,6 @@
}
/**
- * Sets the top position of this view relative to its parent.
- *
- * @param top The top of this view, in pixels.
- */
- public final void setTop(int top) {
- if (top != mTop) {
- if (hasIdentityMatrix()) {
- final ViewParent p = mParent;
- if (p != null && mAttachInfo != null) {
- final Rect r = mAttachInfo.mTmpInvalRect;
- int minTop;
- int yLoc;
- if (top < mTop) {
- minTop = top;
- yLoc = top - mTop;
- } else {
- minTop = mTop;
- yLoc = 0;
- }
- r.set(0, yLoc, mRight - mLeft, mBottom - minTop);
- p.invalidateChild(this, r);
- }
- } else {
- // Double-invalidation is necessary to capture view's old and new areas
- invalidate();
- }
-
- mTop = top;
-
- if (!mMatrixIsIdentity) {
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate();
- }
- }
- }
-
- /**
* Bottom position of this view relative to its parent.
*
* @return The bottom of this view, in pixels.
@@ -5155,40 +5131,6 @@
}
/**
- * Sets the bottom position of this view relative to its parent.
- *
- * @param bottom The bottom of this view, in pixels.
- */
- public final void setBottom(int bottom) {
- if (bottom != mBottom) {
- if (hasIdentityMatrix()) {
- final ViewParent p = mParent;
- if (p != null && mAttachInfo != null) {
- final Rect r = mAttachInfo.mTmpInvalRect;
- int maxBottom;
- if (bottom < mBottom) {
- maxBottom = mBottom;
- } else {
- maxBottom = bottom;
- }
- r.set(0, 0, mRight - mLeft, maxBottom - mTop);
- p.invalidateChild(this, r);
- }
- } else {
- // Double-invalidation is necessary to capture view's old and new areas
- invalidate();
- }
-
- mBottom = bottom;
-
- if (!mMatrixIsIdentity) {
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate();
- }
- }
- }
-
- /**
* Left position of this view relative to its parent.
*
* @return The left edge of this view, in pixels.
@@ -5199,43 +5141,6 @@
}
/**
- * Sets the left position of this view relative to its parent.
- *
- * @param left The bottom of this view, in pixels.
- */
- public final void setLeft(int left) {
- if (left != mLeft) {
- if (hasIdentityMatrix()) {
- final ViewParent p = mParent;
- if (p != null && mAttachInfo != null) {
- final Rect r = mAttachInfo.mTmpInvalRect;
- int minLeft;
- int xLoc;
- if (left < mLeft) {
- minLeft = left;
- xLoc = left - mLeft;
- } else {
- minLeft = mLeft;
- xLoc = 0;
- }
- r.set(xLoc, 0, mRight - minLeft, mBottom - mTop);
- p.invalidateChild(this, r);
- }
- } else {
- // Double-invalidation is necessary to capture view's old and new areas
- invalidate();
- }
-
- mLeft = left;
-
- if (!mMatrixIsIdentity) {
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate();
- }
- }
- }
-
- /**
* Right position of this view relative to its parent.
*
* @return The right edge of this view, in pixels.
@@ -5246,79 +5151,109 @@
}
/**
- * Sets the right position of this view relative to its parent.
+ * The visual x position of this view, in pixels. This is equivalent to the
+ * {@link #setTranslationX(float) translationX} property plus the current
+ * {@link #getLeft() left} property.
*
- * @param right The bottom of this view, in pixels.
+ * @return The visual x position of this view, in pixels.
*/
- public final void setRight(int right) {
- if (right != mRight) {
- if (hasIdentityMatrix()) {
- final ViewParent p = mParent;
- if (p != null && mAttachInfo != null) {
- final Rect r = mAttachInfo.mTmpInvalRect;
- int maxRight;
- if (right < mRight) {
- maxRight = mRight;
- } else {
- maxRight = right;
- }
- r.set(0, 0, maxRight - mLeft, mBottom - mTop);
- p.invalidateChild(this, r);
- }
- } else {
- // Double-invalidation is necessary to capture view's old and new areas
- invalidate();
- }
+ public float getX() {
+ return mLeft + mTranslationX;
+ }
- mRight = right;
+ /**
+ * Sets the visual x position of this view, in pixels. This is equivalent to setting the
+ * {@link #setTranslationX(float) translationX} property to be the difference between
+ * the x value passed in and the current {@link #getLeft() left} property.
+ *
+ * @param x The visual x position of this view, in pixels.
+ */
+ public void setX(float x) {
+ setTranslationX(x - mLeft);
+ }
- if (!mMatrixIsIdentity) {
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate();
- }
+ /**
+ * The visual y position of this view, in pixels. This is equivalent to the
+ * {@link #setTranslationY(float) translationY} property plus the current
+ * {@link #getTop() top} property.
+ *
+ * @return The visual y position of this view, in pixels.
+ */
+ public float getY() {
+ return mTop + mTranslationY;
+ }
+
+ /**
+ * Sets the visual y position of this view, in pixels. This is equivalent to setting the
+ * {@link #setTranslationY(float) translationY} property to be the difference between
+ * the y value passed in and the current {@link #getTop() top} property.
+ *
+ * @param y The visual y position of this view, in pixels.
+ */
+ public void setY(float y) {
+ setTranslationY(y - mTop);
+ }
+
+
+ /**
+ * The horizontal location of this view relative to its {@link #getLeft() left} position.
+ * This position is post-layout, in addition to wherever the object's
+ * layout placed it.
+ *
+ * @return The horizontal position of this view relative to its left position, in pixels.
+ */
+ public float getTranslationX() {
+ return mTranslationX;
+ }
+
+ /**
+ * Sets the horizontal location of this view relative to its {@link #getLeft() left} position.
+ * This effectively positions the object post-layout, in addition to wherever the object's
+ * layout placed it.
+ *
+ * @param translationX The horizontal position of this view relative to its left position,
+ * in pixels.
+ */
+ public void setTranslationX(float translationX) {
+ if (mTranslationX != translationX) {
+ // Double-invalidation is necessary to capture view's old and new areas
+ invalidate();
+ mTranslationX = translationX;
+ mMatrixDirty = true;
+ mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
+ invalidate();
}
}
/**
- * The horizontal location of this view relative to its parent. This value is equivalent to the
- * {@link #getLeft() left} property.
+ * The horizontal location of this view relative to its {@link #getTop() top} position.
+ * This position is post-layout, in addition to wherever the object's
+ * layout placed it.
*
- * @return The horizontal position of this view, in pixels.
+ * @return The vertical position of this view relative to its top position,
+ * in pixels.
*/
- public int getX() {
- return mLeft;
+ public float getTranslationY() {
+ return mTranslationY;
}
/**
- * Sets the horizontal location of this view relative to its parent. Setting this value will
- * affect both the {@link #setLeft(int) left} and {@link #setRight(int) right} properties
- * of this view.
+ * Sets the vertical location of this view relative to its {@link #getTop() top} position.
+ * This effectively positions the object post-layout, in addition to wherever the object's
+ * layout placed it.
*
- * @param x The horizontal position of this view, in pixels.
+ * @param translationY The vertical position of this view relative to its top position,
+ * in pixels.
*/
- public void setX(int x) {
- offsetLeftAndRight(x - mLeft);
- }
-
- /**
- * The vertical location of this view relative to its parent. This value is equivalent to the
- * {@link #getTop() left} property.
- *
- * @return The vertical position of this view, in pixels.
- */
- public int getY() {
- return mTop;
- }
-
- /**
- * Sets the vertical location of this view relative to its parent. Setting this value will
- * affect both the {@link #setTop(int) left} and {@link #setBottom(int) right} properties
- * of this view.
- *
- * @param y The vertical position of this view, in pixels.
- */
- public void setY(int y) {
- offsetTopAndBottom(y - mTop);
+ public void setTranslationY(float translationY) {
+ if (mTranslationY != translationY) {
+ // Double-invalidation is necessary to capture view's old and new areas
+ invalidate();
+ mTranslationY = translationY;
+ mMatrixDirty = true;
+ mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
+ invalidate();
+ }
}
/**
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index a713efc..9da5637 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -1580,6 +1580,8 @@
}
}
+ concatMatrix |= !child.hasIdentityMatrix();
+
// Sets the flag as early as possible to allow draw() implementations
// to call invalidate() successfully when doing animations
child.mPrivateFlags |= DRAWN;
@@ -1744,6 +1746,7 @@
final View[] children = mChildren;
final int count = mChildrenCount;
for (int i = 0; i < count; i++) {
+
children[i].setSelected(selected);
}
}
diff --git a/core/tests/coretests/src/android/app/activity/LifecycleTest.java b/core/tests/coretests/src/android/app/activity/LifecycleTest.java
index 768a9a4..ed01fac5 100644
--- a/core/tests/coretests/src/android/app/activity/LifecycleTest.java
+++ b/core/tests/coretests/src/android/app/activity/LifecycleTest.java
@@ -18,10 +18,7 @@
import android.content.ComponentName;
import android.content.Intent;
-import android.test.FlakyTest;
-import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.SmallTest;
import android.test.suitebuilder.annotation.Suppress;
public class LifecycleTest extends ActivityTestsBase {
@@ -37,7 +34,7 @@
LaunchpadActivity.class));
}
- @LargeTest
+ @MediumTest
public void testBasic() throws Exception {
mIntent = mTopIntent;
runLaunchpad(LaunchpadActivity.LIFECYCLE_BASIC);
diff --git a/core/tests/coretests/src/android/app/activity/MetaDataTest.java b/core/tests/coretests/src/android/app/activity/MetaDataTest.java
index 214bc91..5b9c0e9 100644
--- a/core/tests/coretests/src/android/app/activity/MetaDataTest.java
+++ b/core/tests/coretests/src/android/app/activity/MetaDataTest.java
@@ -27,7 +27,6 @@
import android.content.res.XmlResourceParser;
import android.os.Bundle;
import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.frameworks.coretests.R;
import org.xmlpull.v1.XmlPullParser;
@@ -134,7 +133,7 @@
assertNull("Meta data returned when not requested", si.metaData);
}
- @MediumTest
+ @SmallTest
public void testProviderWithData() throws Exception {
ComponentName cn = new ComponentName(mContext, LocalProvider.class);
ProviderInfo pi = mContext.getPackageManager().resolveContentProvider(
diff --git a/core/tests/coretests/src/android/content/BrickDeniedTest.java b/core/tests/coretests/src/android/content/BrickDeniedTest.java
index c7d0b7a..3d246b4 100644
--- a/core/tests/coretests/src/android/content/BrickDeniedTest.java
+++ b/core/tests/coretests/src/android/content/BrickDeniedTest.java
@@ -16,13 +16,12 @@
package android.content;
-import android.content.Intent;
import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.SmallTest;
/** Test to make sure brick intents <b>don't</b> work without permission. */
public class BrickDeniedTest extends AndroidTestCase {
- @MediumTest
+ @SmallTest
public void testBrick() {
// Try both the old and new brick intent names. Neither should work,
// since this test application doesn't have the required permission.
diff --git a/core/tests/coretests/src/android/content/MemoryFileProviderTest.java b/core/tests/coretests/src/android/content/MemoryFileProviderTest.java
index 6708af6..62b4e7e 100644
--- a/core/tests/coretests/src/android/content/MemoryFileProviderTest.java
+++ b/core/tests/coretests/src/android/content/MemoryFileProviderTest.java
@@ -16,10 +16,11 @@
package android.content;
-import android.content.ContentResolver;
import android.net.Uri;
import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.SmallTest;
import java.io.InputStream;
import java.util.Arrays;
@@ -46,7 +47,7 @@
}
// tests that we don't leak file descriptors or virtual address space
- @MediumTest
+ @LargeTest
public void testClose() throws Exception {
ContentResolver resolver = getContext().getContentResolver();
// open enough file descriptors that we will crash something if we leak FDs
@@ -65,7 +66,7 @@
}
// tests that we haven't broken AssestFileDescriptors for normal files.
- @MediumTest
+ @SmallTest
public void testFile() throws Exception {
ContentResolver resolver = getContext().getContentResolver();
Uri uri = Uri.parse("content://android.content.MemoryFileProvider/file");
diff --git a/core/tests/coretests/src/android/content/SyncStorageEngineTest.java b/core/tests/coretests/src/android/content/SyncStorageEngineTest.java
index f840512..0b494a7 100644
--- a/core/tests/coretests/src/android/content/SyncStorageEngineTest.java
+++ b/core/tests/coretests/src/android/content/SyncStorageEngineTest.java
@@ -18,17 +18,19 @@
import com.android.internal.os.AtomicFile;
-import android.test.AndroidTestCase;
-import android.test.RenamingDelegatingContext;
-import android.test.suitebuilder.annotation.SmallTest;
-import android.test.mock.MockContext;
-import android.test.mock.MockContentResolver;
import android.accounts.Account;
import android.os.Bundle;
+import android.test.AndroidTestCase;
+import android.test.RenamingDelegatingContext;
+import android.test.mock.MockContentResolver;
+import android.test.mock.MockContext;
+import android.test.suitebuilder.annotation.LargeTest;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.SmallTest;
-import java.util.List;
import java.io.File;
import java.io.FileOutputStream;
+import java.util.List;
public class SyncStorageEngineTest extends AndroidTestCase {
@@ -57,7 +59,7 @@
/**
* Test that we can create, remove and retrieve periodic syncs
*/
- @SmallTest
+ @MediumTest
public void testPeriodics() throws Exception {
final Account account1 = new Account("a@example.com", "example.type");
final Account account2 = new Account("b@example.com", "example.type.2");
@@ -114,7 +116,7 @@
}
}
- @SmallTest
+ @LargeTest
public void testAuthorityPersistence() throws Exception {
final Account account1 = new Account("a@example.com", "example.type");
final Account account2 = new Account("b@example.com", "example.type.2");
@@ -197,7 +199,7 @@
assertEquals(0, engine.getIsSyncable(account2, authority2));
}
- @SmallTest
+ @MediumTest
public void testAuthorityParsing() throws Exception {
final Account account = new Account("account1", "type1");
final String authority1 = "auth1";
@@ -299,7 +301,7 @@
assertEquals(sync3s, syncs.get(0));
}
- @SmallTest
+ @MediumTest
public void testAuthorityRenaming() throws Exception {
final Account account1 = new Account("acc1", "type1");
final Account account2 = new Account("acc2", "type2");
diff --git a/core/tests/coretests/src/android/content/pm/AppCacheTest.java b/core/tests/coretests/src/android/content/pm/AppCacheTest.java
index dbb10b1..dd25220 100755
--- a/core/tests/coretests/src/android/content/pm/AppCacheTest.java
+++ b/core/tests/coretests/src/android/content/pm/AppCacheTest.java
@@ -16,32 +16,25 @@
package android.content.pm;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.IPackageDataObserver;
-import android.content.pm.IPackageStatsObserver;
-import android.content.pm.PackageStats;
-import android.content.pm.IPackageManager;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.os.StatFs;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
-import android.test.suitebuilder.annotation.Suppress;
import android.util.Log;
-import android.os.Handler;
-import android.os.RemoteException;
-import android.os.ServiceManager;
-import android.os.StatFs;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
public class AppCacheTest extends AndroidTestCase {
private static final boolean localLOGV = false;
@@ -627,7 +620,8 @@
}
}
- @SmallTest
+ // TODO: flaky test, omit from LargeTest for now
+ //@LargeTest
public void testFreeStorage() throws Exception {
boolean TRACKING = true;
StatFs st = new StatFs("/data");
diff --git a/core/tests/coretests/src/android/content/pm/ComponentTest.java b/core/tests/coretests/src/android/content/pm/ComponentTest.java
index ebfbd68..f1a2a9b 100644
--- a/core/tests/coretests/src/android/content/pm/ComponentTest.java
+++ b/core/tests/coretests/src/android/content/pm/ComponentTest.java
@@ -16,6 +16,11 @@
package android.content.pm;
+import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
+import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
+import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
+import static android.content.pm.PackageManager.GET_DISABLED_COMPONENTS;
+
import com.android.frameworks.coretests.enabled_app.DisabledActivity;
import com.android.frameworks.coretests.enabled_app.DisabledProvider;
import com.android.frameworks.coretests.enabled_app.DisabledReceiver;
@@ -27,21 +32,9 @@
import android.content.ComponentName;
import android.content.Intent;
-import android.content.pm.ActivityInfo;
-import android.content.pm.ComponentInfo;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.test.suitebuilder.annotation.LargeTest;
+import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
-import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
-import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
-import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
-import static android.content.pm.PackageManager.GET_DISABLED_COMPONENTS;
-import android.content.pm.ProviderInfo;
-import android.content.pm.ResolveInfo;
-import android.content.pm.ServiceInfo;
-import android.test.AndroidTestCase;
import java.util.List;
@@ -134,7 +127,7 @@
assertNotNull(mContext);
}
- @MediumTest
+ @SmallTest
public void testResolveDisabledActivity() throws Exception {
mPackageManager.setComponentEnabledSetting(DISABLED_ACTIVITY_COMPONENTNAME,
COMPONENT_ENABLED_STATE_DEFAULT,
@@ -150,7 +143,7 @@
assertFalse(info2.activityInfo.enabled);
}
- @MediumTest
+ @SmallTest
public void testResolveEnabledActivity() throws Exception {
mPackageManager.setComponentEnabledSetting(ENABLED_ACTIVITY_COMPONENTNAME,
COMPONENT_ENABLED_STATE_DEFAULT,
@@ -183,7 +176,7 @@
assertFalse(info.activityInfo.enabled);
}
- @MediumTest
+ @SmallTest
public void testQueryEnabledActivity() throws Exception {
mPackageManager.setComponentEnabledSetting(ENABLED_ACTIVITY_COMPONENTNAME,
COMPONENT_ENABLED_STATE_DEFAULT,
@@ -218,7 +211,7 @@
assertFalse(activityInfo.enabled);
}
- @MediumTest
+ @SmallTest
public void testGetEnabledActivityInfo() throws Exception {
mPackageManager.setComponentEnabledSetting(ENABLED_ACTIVITY_COMPONENTNAME,
COMPONENT_ENABLED_STATE_DEFAULT,
@@ -253,7 +246,7 @@
assertEquals(1, infoList.size());
}
- @LargeTest
+ @MediumTest
public void testDisableActivity() throws Exception {
mPackageManager.setComponentEnabledSetting(ENABLED_ACTIVITY_COMPONENTNAME,
COMPONENT_ENABLED_STATE_DEFAULT,
@@ -281,7 +274,7 @@
assertEquals(0, infoList.size());
}
- @MediumTest
+ @SmallTest
public void testResolveDisabledService() throws Exception {
mPackageManager.setComponentEnabledSetting(DISABLED_SERVICE_COMPONENTNAME,
COMPONENT_ENABLED_STATE_DEFAULT,
@@ -297,7 +290,7 @@
assertFalse(info2.serviceInfo.enabled);
}
- @MediumTest
+ @SmallTest
public void testResolveEnabledService() throws Exception {
mPackageManager.setComponentEnabledSetting(ENABLED_SERVICE_COMPONENTNAME,
COMPONENT_ENABLED_STATE_DEFAULT,
@@ -310,7 +303,7 @@
assertTrue(info.serviceInfo.enabled);
}
- @MediumTest
+ @SmallTest
public void testQueryDisabledService() throws Exception {
mPackageManager.setComponentEnabledSetting(DISABLED_SERVICE_COMPONENTNAME,
COMPONENT_ENABLED_STATE_DEFAULT,
@@ -330,7 +323,7 @@
assertFalse(info.serviceInfo.enabled);
}
- @MediumTest
+ @SmallTest
public void testQueryEnabledService() throws Exception {
mPackageManager.setComponentEnabledSetting(ENABLED_SERVICE_COMPONENTNAME,
COMPONENT_ENABLED_STATE_DEFAULT,
@@ -365,7 +358,7 @@
assertFalse(serviceInfo.enabled);
}
- @MediumTest
+ @SmallTest
public void testGetEnabledServiceInfo() throws Exception {
mPackageManager.setComponentEnabledSetting(ENABLED_SERVICE_COMPONENTNAME,
COMPONENT_ENABLED_STATE_DEFAULT,
@@ -396,7 +389,7 @@
assertFalse(info2.serviceInfo.enabled);
}
- @LargeTest
+ @MediumTest
public void testDisableService() throws Exception {
mPackageManager.setComponentEnabledSetting(ENABLED_SERVICE_COMPONENTNAME,
COMPONENT_ENABLED_STATE_DEFAULT,
@@ -420,7 +413,7 @@
assertTrue(info3.serviceInfo.enabled);
}
- @MediumTest
+ @SmallTest
public void testQueryDisabledReceiver() throws Exception {
mPackageManager.setComponentEnabledSetting(DISABLED_RECEIVER_COMPONENTNAME,
COMPONENT_ENABLED_STATE_DEFAULT,
@@ -440,7 +433,7 @@
assertFalse(info.activityInfo.enabled);
}
- @MediumTest
+ @SmallTest
public void testQueryEnabledReceiver() throws Exception {
mPackageManager.setComponentEnabledSetting(ENABLED_RECEIVER_COMPONENTNAME,
COMPONENT_ENABLED_STATE_DEFAULT,
@@ -475,7 +468,7 @@
assertFalse(activityInfo.enabled);
}
- @MediumTest
+ @SmallTest
public void testGetEnabledReceiverInfo() throws Exception {
mPackageManager.setComponentEnabledSetting(ENABLED_RECEIVER_COMPONENTNAME,
COMPONENT_ENABLED_STATE_DEFAULT,
@@ -530,7 +523,7 @@
}
}
- @MediumTest
+ @SmallTest
public void testResolveEnabledProvider() throws Exception {
mPackageManager.setComponentEnabledSetting(ENABLED_PROVIDER_COMPONENTNAME,
COMPONENT_ENABLED_STATE_DEFAULT,
@@ -542,7 +535,7 @@
assertTrue(providerInfo.enabled);
}
- @MediumTest
+ @SmallTest
public void testResolveDisabledProvider() throws Exception {
mPackageManager.setComponentEnabledSetting(DISABLED_PROVIDER_COMPONENTNAME,
COMPONENT_ENABLED_STATE_DEFAULT,
@@ -594,7 +587,7 @@
assertNull(providerInfo2);
}
- @MediumTest
+ @SmallTest
public void testQueryEnabledProvider() throws Exception {
mPackageManager.setComponentEnabledSetting(ENABLED_PROVIDER_COMPONENTNAME,
COMPONENT_ENABLED_STATE_DEFAULT,
diff --git a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
index 1f2e97c..7c28516 100755
--- a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
+++ b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
@@ -23,22 +23,10 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.IPackageMoveObserver;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageParser;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.content.res.Resources.NotFoundException;
import android.net.Uri;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.LargeTest;
-import android.test.suitebuilder.annotation.Suppress;
-import android.util.DisplayMetrics;
-import android.util.Log;
import android.os.Environment;
import android.os.FileUtils;
import android.os.IBinder;
@@ -52,6 +40,7 @@
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.LargeTest;
import android.util.DisplayMetrics;
import android.util.Log;
@@ -575,17 +564,17 @@
return ip;
}
- @MediumTest
+ @LargeTest
public void testInstallNormalInternal() {
sampleInstallFromRawResource(0, true);
}
- @MediumTest
+ @LargeTest
public void testInstallFwdLockedInternal() {
sampleInstallFromRawResource(PackageManager.INSTALL_FORWARD_LOCK, true);
}
- @MediumTest
+ @LargeTest
public void testInstallSdcard() {
sampleInstallFromRawResource(PackageManager.INSTALL_EXTERNAL, true);
}
@@ -675,33 +664,33 @@
}
}
- @MediumTest
+ @LargeTest
public void testReplaceFailNormalInternal() {
sampleReplaceFromRawResource(0);
}
- @MediumTest
+ @LargeTest
public void testReplaceFailFwdLockedInternal() {
sampleReplaceFromRawResource(PackageManager.INSTALL_FORWARD_LOCK);
}
- @MediumTest
+ @LargeTest
public void testReplaceFailSdcard() {
sampleReplaceFromRawResource(PackageManager.INSTALL_EXTERNAL);
}
- @MediumTest
+ @LargeTest
public void testReplaceNormalInternal() {
sampleReplaceFromRawResource(PackageManager.INSTALL_REPLACE_EXISTING);
}
- @MediumTest
+ @LargeTest
public void testReplaceFwdLockedInternal() {
sampleReplaceFromRawResource(PackageManager.INSTALL_REPLACE_EXISTING |
PackageManager.INSTALL_FORWARD_LOCK);
}
- @MediumTest
+ @LargeTest
public void testReplaceSdcard() {
sampleReplaceFromRawResource(PackageManager.INSTALL_REPLACE_EXISTING |
PackageManager.INSTALL_EXTERNAL);
@@ -815,32 +804,32 @@
}
}
- @MediumTest
+ @LargeTest
public void testDeleteNormalInternal() {
deleteFromRawResource(0, 0);
}
- @MediumTest
+ @LargeTest
public void testDeleteFwdLockedInternal() {
deleteFromRawResource(PackageManager.INSTALL_FORWARD_LOCK, 0);
}
- @MediumTest
+ @LargeTest
public void testDeleteSdcard() {
deleteFromRawResource(PackageManager.INSTALL_EXTERNAL, 0);
}
- @MediumTest
+ @LargeTest
public void testDeleteNormalInternalRetainData() {
deleteFromRawResource(0, PackageManager.DONT_DELETE_DATA);
}
- @MediumTest
+ @LargeTest
public void testDeleteFwdLockedInternalRetainData() {
deleteFromRawResource(PackageManager.INSTALL_FORWARD_LOCK, PackageManager.DONT_DELETE_DATA);
}
- @MediumTest
+ @LargeTest
public void testDeleteSdcardRetainData() {
deleteFromRawResource(PackageManager.INSTALL_EXTERNAL, PackageManager.DONT_DELETE_DATA);
}
@@ -1040,7 +1029,7 @@
* (Use PackageManagerService private api for now)
* Make sure the installed package is available.
*/
- @MediumTest
+ @LargeTest
public void testMountSdNormalInternal() {
assertTrue(mountFromRawResource());
}
@@ -1071,31 +1060,31 @@
} catch (NameNotFoundException e) {}
}
- @MediumTest
+ @LargeTest
public void testManifestInstallLocationInternal() {
installFromRawResource("install.apk", R.raw.install_loc_internal,
0, true, false, -1, PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
}
- @MediumTest
+ @LargeTest
public void testManifestInstallLocationSdcard() {
installFromRawResource("install.apk", R.raw.install_loc_sdcard,
0, true, false, -1, PackageInfo.INSTALL_LOCATION_PREFER_EXTERNAL);
}
- @MediumTest
+ @LargeTest
public void testManifestInstallLocationAuto() {
installFromRawResource("install.apk", R.raw.install_loc_auto,
0, true, false, -1, PackageInfo.INSTALL_LOCATION_AUTO);
}
- @MediumTest
+ @LargeTest
public void testManifestInstallLocationUnspecified() {
installFromRawResource("install.apk", R.raw.install_loc_unspecified,
0, true, false, -1, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
}
- @MediumTest
+ @LargeTest
public void testManifestInstallLocationFwdLockedFlagSdcard() {
installFromRawResource("install.apk", R.raw.install_loc_unspecified,
PackageManager.INSTALL_FORWARD_LOCK |
@@ -1104,7 +1093,7 @@
PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
}
- @MediumTest
+ @LargeTest
public void testManifestInstallLocationFwdLockedSdcard() {
installFromRawResource("install.apk", R.raw.install_loc_sdcard,
PackageManager.INSTALL_FORWARD_LOCK, true, false,
@@ -1117,7 +1106,7 @@
* the package via flag to install on sdcard. Make sure the new flag overrides
* the old install location.
*/
- @MediumTest
+ @LargeTest
public void testReplaceFlagInternalSdcard() {
int iFlags = 0;
int rFlags = PackageManager.INSTALL_EXTERNAL;
@@ -1139,7 +1128,7 @@
* the package with no flags or manifest option and make sure the old
* install location is retained.
*/
- @MediumTest
+ @LargeTest
public void testReplaceFlagSdcardInternal() {
int iFlags = PackageManager.INSTALL_EXTERNAL;
int rFlags = 0;
@@ -1156,7 +1145,7 @@
}
}
- @MediumTest
+ @LargeTest
public void testManifestInstallLocationReplaceInternalSdcard() {
int iFlags = 0;
int iApk = R.raw.install_loc_internal;
@@ -1179,7 +1168,7 @@
}
}
- @MediumTest
+ @LargeTest
public void testManifestInstallLocationReplaceSdcardInternal() {
int iFlags = 0;
int iApk = R.raw.install_loc_sdcard;
@@ -1401,7 +1390,7 @@
fail, result);
}
- @MediumTest
+ @LargeTest
public void testMoveAppInternalToExternal() {
int installFlags = PackageManager.INSTALL_INTERNAL;
int moveFlags = PackageManager.MOVE_EXTERNAL_MEDIA;
@@ -1410,7 +1399,7 @@
sampleMoveFromRawResource(installFlags, moveFlags, fail, result);
}
- @MediumTest
+ @LargeTest
public void testMoveAppInternalToInternal() {
int installFlags = PackageManager.INSTALL_INTERNAL;
int moveFlags = PackageManager.MOVE_INTERNAL;
@@ -1419,7 +1408,7 @@
sampleMoveFromRawResource(installFlags, moveFlags, fail, result);
}
- @MediumTest
+ @LargeTest
public void testMoveAppExternalToExternal() {
int installFlags = PackageManager.INSTALL_EXTERNAL;
int moveFlags = PackageManager.MOVE_EXTERNAL_MEDIA;
@@ -1427,7 +1416,7 @@
int result = PackageManager.MOVE_FAILED_INVALID_LOCATION;
sampleMoveFromRawResource(installFlags, moveFlags, fail, result);
}
- @MediumTest
+ @LargeTest
public void testMoveAppExternalToInternal() {
int installFlags = PackageManager.INSTALL_EXTERNAL;
int moveFlags = PackageManager.MOVE_INTERNAL;
@@ -1435,7 +1424,7 @@
int result = PackageManager.MOVE_SUCCEEDED;
sampleMoveFromRawResource(installFlags, moveFlags, fail, result);
}
- @MediumTest
+ @LargeTest
public void testMoveAppForwardLocked() {
int installFlags = PackageManager.INSTALL_FORWARD_LOCK;
int moveFlags = PackageManager.MOVE_EXTERNAL_MEDIA;
@@ -1443,7 +1432,7 @@
int result = PackageManager.MOVE_FAILED_FORWARD_LOCKED;
sampleMoveFromRawResource(installFlags, moveFlags, fail, result);
}
- @MediumTest
+ @LargeTest
public void testMoveAppFailInternalToExternalDelete() {
int installFlags = 0;
int moveFlags = PackageManager.MOVE_EXTERNAL_MEDIA;
@@ -1477,7 +1466,7 @@
* Test that an install error code is returned when media is unmounted
* and package installed on sdcard via package manager flag.
*/
- @MediumTest
+ @LargeTest
public void testInstallSdcardUnmount() {
boolean origState = getMediaState();
try {
@@ -1502,7 +1491,7 @@
* Unmount sdcard. Try installing an app with manifest option to install
* on sdcard. Make sure it gets installed on internal flash.
*/
- @MediumTest
+ @LargeTest
public void testInstallManifestSdcardUnmount() {
boolean origState = getMediaState();
try {
@@ -1534,14 +1523,14 @@
/*
* Install an app on internal flash
*/
- @MediumTest
+ @LargeTest
public void testFlagI() {
sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, true);
}
/*
* Install an app on sdcard.
*/
- @MediumTest
+ @LargeTest
public void testFlagE() {
sampleInstallFromRawResource(PackageManager.INSTALL_EXTERNAL, true);
}
@@ -1549,14 +1538,14 @@
/*
* Install an app on sdcard.
*/
- @MediumTest
+ @LargeTest
public void testFlagF() {
sampleInstallFromRawResource(PackageManager.INSTALL_FORWARD_LOCK, true);
}
/*
* Install an app with both internal and external flags set. should fail
*/
- @MediumTest
+ @LargeTest
public void testFlagIE() {
installFromRawResource("install.apk", R.raw.install,
PackageManager.INSTALL_EXTERNAL | PackageManager.INSTALL_INTERNAL,
@@ -1568,7 +1557,7 @@
/*
* Install an app with both internal and external flags set. should fail
*/
- @MediumTest
+ @LargeTest
public void testFlagIF() {
sampleInstallFromRawResource(PackageManager.INSTALL_FORWARD_LOCK |
PackageManager.INSTALL_INTERNAL, true);
@@ -1576,7 +1565,7 @@
/*
* Install an app with both internal and external flags set. should fail
*/
- @MediumTest
+ @LargeTest
public void testFlagEF() {
installFromRawResource("install.apk", R.raw.install,
PackageManager.INSTALL_FORWARD_LOCK | PackageManager.INSTALL_EXTERNAL,
@@ -1587,7 +1576,7 @@
/*
* Install an app with both internal and external flags set. should fail
*/
- @MediumTest
+ @LargeTest
public void testFlagIEF() {
installFromRawResource("install.apk", R.raw.install,
PackageManager.INSTALL_FORWARD_LOCK | PackageManager.INSTALL_INTERNAL |
@@ -1600,7 +1589,7 @@
* Install an app with both internal and manifest option set.
* should install on internal.
*/
- @MediumTest
+ @LargeTest
public void testFlagIManifestI() {
installFromRawResource("install.apk", R.raw.install_loc_internal,
PackageManager.INSTALL_INTERNAL,
@@ -1612,7 +1601,7 @@
* Install an app with both internal and manifest preference for
* preferExternal. Should install on internal.
*/
- @MediumTest
+ @LargeTest
public void testFlagIManifestE() {
installFromRawResource("install.apk", R.raw.install_loc_sdcard,
PackageManager.INSTALL_INTERNAL,
@@ -1624,7 +1613,7 @@
* Install an app with both internal and manifest preference for
* auto. should install internal.
*/
- @MediumTest
+ @LargeTest
public void testFlagIManifestA() {
installFromRawResource("install.apk", R.raw.install_loc_auto,
PackageManager.INSTALL_INTERNAL,
@@ -1636,7 +1625,7 @@
* Install an app with both external and manifest option set.
* should install externally.
*/
- @MediumTest
+ @LargeTest
public void testFlagEManifestI() {
installFromRawResource("install.apk", R.raw.install_loc_internal,
PackageManager.INSTALL_EXTERNAL,
@@ -1648,7 +1637,7 @@
* Install an app with both external and manifest preference for
* preferExternal. Should install externally.
*/
- @MediumTest
+ @LargeTest
public void testFlagEManifestE() {
installFromRawResource("install.apk", R.raw.install_loc_sdcard,
PackageManager.INSTALL_EXTERNAL,
@@ -1660,7 +1649,7 @@
* Install an app with both external and manifest preference for
* auto. should install on external media.
*/
- @MediumTest
+ @LargeTest
public void testFlagEManifestA() {
installFromRawResource("install.apk", R.raw.install_loc_auto,
PackageManager.INSTALL_EXTERNAL,
@@ -1672,7 +1661,7 @@
* Install an app with fwd locked flag set and install location set to
* internal. should install internally.
*/
- @MediumTest
+ @LargeTest
public void testFlagFManifestI() {
installFromRawResource("install.apk", R.raw.install_loc_internal,
PackageManager.INSTALL_EXTERNAL,
@@ -1684,7 +1673,7 @@
* Install an app with fwd locked flag set and install location set to
* preferExternal. should install internally.
*/
- @MediumTest
+ @LargeTest
public void testFlagFManifestE() {
installFromRawResource("install.apk", R.raw.install_loc_sdcard,
PackageManager.INSTALL_EXTERNAL,
@@ -1696,7 +1685,7 @@
* Install an app with fwd locked flag set and install location set to
* auto. should install internally.
*/
- @MediumTest
+ @LargeTest
public void testFlagFManifestA() {
installFromRawResource("install.apk", R.raw.install_loc_auto,
PackageManager.INSTALL_EXTERNAL,
@@ -1711,7 +1700,7 @@
* location should be honoured.
* testFlagI/E/F/ExistingI/E -
*/
- @MediumTest
+ @LargeTest
public void testFlagIExistingI() {
int iFlags = PackageManager.INSTALL_INTERNAL;
int rFlags = PackageManager.INSTALL_INTERNAL | PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1728,7 +1717,7 @@
false, -1,
-1);
}
- @MediumTest
+ @LargeTest
public void testFlagIExistingE() {
int iFlags = PackageManager.INSTALL_EXTERNAL;
int rFlags = PackageManager.INSTALL_INTERNAL | PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1745,7 +1734,7 @@
false, -1,
-1);
}
- @MediumTest
+ @LargeTest
public void testFlagEExistingI() {
int iFlags = PackageManager.INSTALL_INTERNAL;
int rFlags = PackageManager.INSTALL_EXTERNAL | PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1762,7 +1751,7 @@
false, -1,
-1);
}
- @MediumTest
+ @LargeTest
public void testFlagEExistingE() {
int iFlags = PackageManager.INSTALL_EXTERNAL;
int rFlags = PackageManager.INSTALL_EXTERNAL | PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1779,7 +1768,7 @@
false, -1,
-1);
}
- @MediumTest
+ @LargeTest
public void testFlagFExistingI() {
int iFlags = PackageManager.INSTALL_INTERNAL;
int rFlags = PackageManager.INSTALL_FORWARD_LOCK | PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1796,7 +1785,7 @@
false, -1,
-1);
}
- @MediumTest
+ @LargeTest
public void testFlagFExistingE() {
int iFlags = PackageManager.INSTALL_EXTERNAL;
int rFlags = PackageManager.INSTALL_FORWARD_LOCK | PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1820,7 +1809,7 @@
* public void testManifestI/E/A
* TODO out of memory fall back behaviour.
*/
- @MediumTest
+ @LargeTest
public void testManifestI() {
installFromRawResource("install.apk", R.raw.install_loc_internal,
0,
@@ -1828,7 +1817,7 @@
false, -1,
PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
}
- @MediumTest
+ @LargeTest
public void testManifestE() {
installFromRawResource("install.apk", R.raw.install_loc_sdcard,
0,
@@ -1836,7 +1825,7 @@
false, -1,
PackageInfo.INSTALL_LOCATION_PREFER_EXTERNAL);
}
- @MediumTest
+ @LargeTest
public void testManifestA() {
installFromRawResource("install.apk", R.raw.install_loc_auto,
0,
@@ -1851,7 +1840,7 @@
* TODO add out of memory fall back behaviour.
* testManifestI/E/AExistingI/E
*/
- @MediumTest
+ @LargeTest
public void testManifestIExistingI() {
int iFlags = PackageManager.INSTALL_INTERNAL;
int rFlags = PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1868,7 +1857,7 @@
false, -1,
PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
}
- @MediumTest
+ @LargeTest
public void testManifestIExistingE() {
int iFlags = PackageManager.INSTALL_EXTERNAL;
int rFlags = PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1885,7 +1874,7 @@
false, -1,
PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
}
- @MediumTest
+ @LargeTest
public void testManifestEExistingI() {
int iFlags = PackageManager.INSTALL_INTERNAL;
int rFlags = PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1902,7 +1891,7 @@
false, -1,
PackageInfo.INSTALL_LOCATION_PREFER_EXTERNAL);
}
- @MediumTest
+ @LargeTest
public void testManifestEExistingE() {
int iFlags = PackageManager.INSTALL_EXTERNAL;
int rFlags = PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1919,7 +1908,7 @@
false, -1,
PackageInfo.INSTALL_LOCATION_PREFER_EXTERNAL);
}
- @MediumTest
+ @LargeTest
public void testManifestAExistingI() {
int iFlags = PackageManager.INSTALL_INTERNAL;
int rFlags = PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1936,7 +1925,7 @@
false, -1,
PackageInfo.INSTALL_LOCATION_AUTO);
}
- @MediumTest
+ @LargeTest
public void testManifestAExistingE() {
int iFlags = PackageManager.INSTALL_EXTERNAL;
int rFlags = PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1993,37 +1982,37 @@
setInstallLoc(origSetting);
}
}
- @MediumTest
+ @LargeTest
public void testExistingIUserI() {
int userSetting = PackageHelper.APP_INSTALL_INTERNAL;
int iFlags = PackageManager.INSTALL_INTERNAL;
setExistingXUserX(userSetting, iFlags, PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
}
- @MediumTest
+ @LargeTest
public void testExistingIUserE() {
int userSetting = PackageHelper.APP_INSTALL_EXTERNAL;
int iFlags = PackageManager.INSTALL_INTERNAL;
setExistingXUserX(userSetting, iFlags, PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
}
- @MediumTest
+ @LargeTest
public void testExistingIUserA() {
int userSetting = PackageHelper.APP_INSTALL_AUTO;
int iFlags = PackageManager.INSTALL_INTERNAL;
setExistingXUserX(userSetting, iFlags, PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
}
- @MediumTest
+ @LargeTest
public void testExistingEUserI() {
int userSetting = PackageHelper.APP_INSTALL_INTERNAL;
int iFlags = PackageManager.INSTALL_EXTERNAL;
setExistingXUserX(userSetting, iFlags, PackageInfo.INSTALL_LOCATION_PREFER_EXTERNAL);
}
- @MediumTest
+ @LargeTest
public void testExistingEUserE() {
int userSetting = PackageHelper.APP_INSTALL_EXTERNAL;
int iFlags = PackageManager.INSTALL_EXTERNAL;
setExistingXUserX(userSetting, iFlags, PackageInfo.INSTALL_LOCATION_PREFER_EXTERNAL);
}
- @MediumTest
+ @LargeTest
public void testExistingEUserA() {
int userSetting = PackageHelper.APP_INSTALL_AUTO;
int iFlags = PackageManager.INSTALL_EXTERNAL;
@@ -2066,19 +2055,19 @@
setInstallLoc(origSetting);
}
}
- @MediumTest
+ @LargeTest
public void testUserI() {
int userSetting = PackageHelper.APP_INSTALL_INTERNAL;
int iloc = getExpectedInstallLocation(userSetting);
setUserX(true, userSetting, iloc);
}
- @MediumTest
+ @LargeTest
public void testUserE() {
int userSetting = PackageHelper.APP_INSTALL_EXTERNAL;
int iloc = getExpectedInstallLocation(userSetting);
setUserX(true, userSetting, iloc);
}
- @MediumTest
+ @LargeTest
public void testUserA() {
int userSetting = PackageHelper.APP_INSTALL_AUTO;
int iloc = getExpectedInstallLocation(userSetting);
@@ -2088,19 +2077,19 @@
* The following set of tests turn on/off the basic
* user setting for turning on install location.
*/
- @MediumTest
+ @LargeTest
public void testUserPrefOffUserI() {
int userSetting = PackageHelper.APP_INSTALL_INTERNAL;
int iloc = PackageInfo.INSTALL_LOCATION_UNSPECIFIED;
setUserX(false, userSetting, iloc);
}
- @MediumTest
+ @LargeTest
public void testUserPrefOffUserE() {
int userSetting = PackageHelper.APP_INSTALL_EXTERNAL;
int iloc = PackageInfo.INSTALL_LOCATION_UNSPECIFIED;
setUserX(false, userSetting, iloc);
}
- @MediumTest
+ @LargeTest
public void testUserPrefOffA() {
int userSetting = PackageHelper.APP_INSTALL_AUTO;
int iloc = PackageInfo.INSTALL_LOCATION_UNSPECIFIED;
@@ -2277,7 +2266,7 @@
/*
* Ensure that permissions are properly declared.
*/
- @MediumTest
+ @LargeTest
public void testInstallOnSdPermissionsUnmount() {
InstallParams ip = null;
boolean origMediaState = getMediaState();
@@ -2309,7 +2298,7 @@
* Please note that this test is very closely tied to the framework's
* naming convention for secure containers.
*/
- @MediumTest
+ @LargeTest
public void testInstallSdcardStaleContainer() {
boolean origMediaState = getMediaState();
try {
@@ -2351,7 +2340,7 @@
* The app is then re-installed on internal storage. The sdcard is mounted
* and verified that the re-installation on internal storage takes precedence.
*/
- @MediumTest
+ @LargeTest
public void testInstallSdcardStaleContainerReinstall() {
boolean origMediaState = getMediaState();
try {
@@ -2429,7 +2418,7 @@
* Test that an app signed with two certificates can be upgraded by the
* same app signed with two certificates.
*/
- @MediumTest
+ @LargeTest
public void testReplaceMatchAllCerts() {
replaceCerts(APP1_CERT1_CERT2, APP1_CERT1_CERT2, true, false, -1);
}
@@ -2438,7 +2427,7 @@
* Test that an app signed with two certificates cannot be upgraded
* by an app signed with a different certificate.
*/
- @MediumTest
+ @LargeTest
public void testReplaceMatchNoCerts1() {
replaceCerts(APP1_CERT1_CERT2, APP1_CERT3, true, true,
PackageManager.INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES);
@@ -2447,7 +2436,7 @@
* Test that an app signed with two certificates cannot be upgraded
* by an app signed with a different certificate.
*/
- @MediumTest
+ @LargeTest
public void testReplaceMatchNoCerts2() {
replaceCerts(APP1_CERT1_CERT2, APP1_CERT3_CERT4, true, true,
PackageManager.INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES);
@@ -2456,7 +2445,7 @@
* Test that an app signed with two certificates cannot be upgraded by
* an app signed with a subset of initial certificates.
*/
- @MediumTest
+ @LargeTest
public void testReplaceMatchSomeCerts1() {
replaceCerts(APP1_CERT1_CERT2, APP1_CERT1, true, true,
PackageManager.INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES);
@@ -2465,7 +2454,7 @@
* Test that an app signed with two certificates cannot be upgraded by
* an app signed with the last certificate.
*/
- @MediumTest
+ @LargeTest
public void testReplaceMatchSomeCerts2() {
replaceCerts(APP1_CERT1_CERT2, APP1_CERT2, true, true,
PackageManager.INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES);
@@ -2474,7 +2463,7 @@
* Test that an app signed with a certificate can be upgraded by app
* signed with a superset of certificates.
*/
- @MediumTest
+ @LargeTest
public void testReplaceMatchMoreCerts() {
replaceCerts(APP1_CERT1, APP1_CERT1_CERT2, true, true,
PackageManager.INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES);
@@ -2484,7 +2473,7 @@
* signed with a superset of certificates. Then verify that the an app
* signed with the original set of certs cannot upgrade the new one.
*/
- @MediumTest
+ @LargeTest
public void testReplaceMatchMoreCertsReplaceSomeCerts() {
InstallParams ip = replaceCerts(APP1_CERT1, APP1_CERT1_CERT2, false, true,
PackageManager.INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES);
@@ -2508,37 +2497,37 @@
private void checkSignatures(int apk1, int apk2, int expMatchResult) {
checkSharedSignatures(apk1, apk2, true, false, -1, expMatchResult);
}
- @MediumTest
+ @LargeTest
public void testCheckSignaturesAllMatch() {
int apk1 = APP1_CERT1_CERT2;
int apk2 = APP2_CERT1_CERT2;
checkSignatures(apk1, apk2, PackageManager.SIGNATURE_MATCH);
}
- @MediumTest
+ @LargeTest
public void testCheckSignaturesNoMatch() {
int apk1 = APP1_CERT1;
int apk2 = APP2_CERT2;
checkSignatures(apk1, apk2, PackageManager.SIGNATURE_NO_MATCH);
}
- @MediumTest
+ @LargeTest
public void testCheckSignaturesSomeMatch1() {
int apk1 = APP1_CERT1_CERT2;
int apk2 = APP2_CERT1;
checkSignatures(apk1, apk2, PackageManager.SIGNATURE_NO_MATCH);
}
- @MediumTest
+ @LargeTest
public void testCheckSignaturesSomeMatch2() {
int apk1 = APP1_CERT1_CERT2;
int apk2 = APP2_CERT2;
checkSignatures(apk1, apk2, PackageManager.SIGNATURE_NO_MATCH);
}
- @MediumTest
+ @LargeTest
public void testCheckSignaturesMoreMatch() {
int apk1 = APP1_CERT1;
int apk2 = APP2_CERT1_CERT2;
checkSignatures(apk1, apk2, PackageManager.SIGNATURE_NO_MATCH);
}
- @MediumTest
+ @LargeTest
public void testCheckSignaturesUnknown() {
int apk1 = APP1_CERT1_CERT2;
int apk2 = APP2_CERT1_CERT2;
@@ -2567,7 +2556,7 @@
}
}
}
- @MediumTest
+ @LargeTest
public void testInstallNoCertificates() {
int apk1 = APP1_UNSIGNED;
String apk1Name = "install1.apk";
@@ -2620,7 +2609,7 @@
}
}
}
- @MediumTest
+ @LargeTest
public void testCheckSignaturesSharedAllMatch() {
int apk1 = SHARED1_CERT1_CERT2;
int apk2 = SHARED2_CERT1_CERT2;
@@ -2629,7 +2618,7 @@
int expMatchResult = PackageManager.SIGNATURE_MATCH;
checkSharedSignatures(apk1, apk2, true, fail, retCode, expMatchResult);
}
- @MediumTest
+ @LargeTest
public void testCheckSignaturesSharedNoMatch() {
int apk1 = SHARED1_CERT1;
int apk2 = SHARED2_CERT2;
@@ -2641,7 +2630,7 @@
/*
* Test that an app signed with cert1 and cert2 cannot be replaced when signed with cert1 alone.
*/
- @MediumTest
+ @LargeTest
public void testCheckSignaturesSharedSomeMatch1() {
int apk1 = SHARED1_CERT1_CERT2;
int apk2 = SHARED2_CERT1;
@@ -2653,7 +2642,7 @@
/*
* Test that an app signed with cert1 and cert2 cannot be replaced when signed with cert2 alone.
*/
- @MediumTest
+ @LargeTest
public void testCheckSignaturesSharedSomeMatch2() {
int apk1 = SHARED1_CERT1_CERT2;
int apk2 = SHARED2_CERT2;
@@ -2662,7 +2651,7 @@
int expMatchResult = -1;
checkSharedSignatures(apk1, apk2, true, fail, retCode, expMatchResult);
}
- @MediumTest
+ @LargeTest
public void testCheckSignaturesSharedUnknown() {
int apk1 = SHARED1_CERT1_CERT2;
int apk2 = SHARED2_CERT1_CERT2;
@@ -2688,7 +2677,7 @@
}
}
- @MediumTest
+ @LargeTest
public void testReplaceFirstSharedMatchAllCerts() {
int apk1 = SHARED1_CERT1;
int apk2 = SHARED2_CERT1;
@@ -2696,7 +2685,7 @@
checkSignatures(apk1, apk2, PackageManager.SIGNATURE_MATCH);
replaceCerts(apk1, rapk1, true, false, -1);
}
- @MediumTest
+ @LargeTest
public void testReplaceSecondSharedMatchAllCerts() {
int apk1 = SHARED1_CERT1;
int apk2 = SHARED2_CERT1;
@@ -2704,7 +2693,7 @@
checkSignatures(apk1, apk2, PackageManager.SIGNATURE_MATCH);
replaceCerts(apk2, rapk2, true, false, -1);
}
- @MediumTest
+ @LargeTest
public void testReplaceFirstSharedMatchSomeCerts() {
int apk1 = SHARED1_CERT1_CERT2;
int apk2 = SHARED2_CERT1_CERT2;
@@ -2715,7 +2704,7 @@
installFromRawResource("install.apk", rapk1, PackageManager.INSTALL_REPLACE_EXISTING, true,
fail, retCode, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
}
- @MediumTest
+ @LargeTest
public void testReplaceSecondSharedMatchSomeCerts() {
int apk1 = SHARED1_CERT1_CERT2;
int apk2 = SHARED2_CERT1_CERT2;
@@ -2726,7 +2715,7 @@
installFromRawResource("install.apk", rapk2, PackageManager.INSTALL_REPLACE_EXISTING, true,
fail, retCode, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
}
- @MediumTest
+ @LargeTest
public void testReplaceFirstSharedMatchNoCerts() {
int apk1 = SHARED1_CERT1;
int apk2 = SHARED2_CERT1;
@@ -2737,7 +2726,7 @@
installFromRawResource("install.apk", rapk1, PackageManager.INSTALL_REPLACE_EXISTING, true,
fail, retCode, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
}
- @MediumTest
+ @LargeTest
public void testReplaceSecondSharedMatchNoCerts() {
int apk1 = SHARED1_CERT1;
int apk2 = SHARED2_CERT1;
@@ -2748,7 +2737,7 @@
installFromRawResource("install.apk", rapk2, PackageManager.INSTALL_REPLACE_EXISTING, true,
fail, retCode, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
}
- @MediumTest
+ @LargeTest
public void testReplaceFirstSharedMatchMoreCerts() {
int apk1 = SHARED1_CERT1;
int apk2 = SHARED2_CERT1;
@@ -2759,7 +2748,7 @@
installFromRawResource("install.apk", rapk1, PackageManager.INSTALL_REPLACE_EXISTING, true,
fail, retCode, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
}
- @MediumTest
+ @LargeTest
public void testReplaceSecondSharedMatchMoreCerts() {
int apk1 = SHARED1_CERT1;
int apk2 = SHARED2_CERT1;
diff --git a/core/tests/coretests/src/android/os/FileObserverTest.java b/core/tests/coretests/src/android/os/FileObserverTest.java
index ca4e0d6..93e27af 100644
--- a/core/tests/coretests/src/android/os/FileObserverTest.java
+++ b/core/tests/coretests/src/android/os/FileObserverTest.java
@@ -19,9 +19,8 @@
import com.google.android.collect.Lists;
import com.google.android.collect.Maps;
-import android.os.FileObserver;
import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
+import android.test.suitebuilder.annotation.MediumTest;
import android.util.Log;
import java.io.File;
@@ -69,7 +68,7 @@
}
}
- @LargeTest
+ @MediumTest
public void testRun() throws Exception {
// make file changes and wait for them
assertTrue(mTestFile.exists());
diff --git a/core/tests/coretests/src/android/os/HierarchicalStateMachineTest.java b/core/tests/coretests/src/android/os/HierarchicalStateMachineTest.java
index 639372b2..6820987 100644
--- a/core/tests/coretests/src/android/os/HierarchicalStateMachineTest.java
+++ b/core/tests/coretests/src/android/os/HierarchicalStateMachineTest.java
@@ -16,23 +16,15 @@
package android.os;
-import junit.framework.TestCase;
-
-import android.os.Debug;
-import android.os.HandlerThread;
-import android.os.Looper;
-import android.os.Message;
-import android.os.SystemClock;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import android.util.Log;
-
-import com.android.internal.util.HierarchicalStateMachine;
import com.android.internal.util.HierarchicalState;
+import com.android.internal.util.HierarchicalStateMachine;
import com.android.internal.util.ProcessedMessages;
-import java.util.ArrayList;
-import java.util.Arrays;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.SmallTest;
+import android.util.Log;
+
+import junit.framework.TestCase;
/**
* Test for HierarchicalStateMachine.
@@ -449,7 +441,7 @@
private int mExitCount;
}
- @SmallTest
+ @MediumTest
public void testStateMachine1() throws Exception {
StateMachine1 sm1 = new StateMachine1("sm1");
sm1.start();
@@ -554,7 +546,7 @@
private boolean mDidExit = false;
}
- @SmallTest
+ @MediumTest
public void testStateMachine2() throws Exception {
StateMachine2 sm2 = new StateMachine2("sm2");
sm2.start();
@@ -646,7 +638,7 @@
private ChildState mChildState = new ChildState();
}
- @SmallTest
+ @MediumTest
public void testStateMachine3() throws Exception {
StateMachine3 sm3 = new StateMachine3("sm3");
sm3.start();
@@ -739,7 +731,7 @@
private ChildState2 mChildState2 = new ChildState2();
}
- @SmallTest
+ @MediumTest
public void testStateMachine4() throws Exception {
StateMachine4 sm4 = new StateMachine4("sm4");
sm4.start();
@@ -1013,7 +1005,7 @@
private int mChildState5ExitCount = 0;
}
- @SmallTest
+ @MediumTest
public void testStateMachine5() throws Exception {
StateMachine5 sm5 = new StateMachine5("sm5");
sm5.start();
@@ -1141,7 +1133,7 @@
private long mArrivalTimeMsg2;
}
- @SmallTest
+ @MediumTest
public void testStateMachine6() throws Exception {
long sentTimeMsg2;
final int DELAY_TIME = 250;
@@ -1251,7 +1243,7 @@
private long mArrivalTimeMsg3;
}
- @SmallTest
+ @MediumTest
public void testStateMachine7() throws Exception {
long sentTimeMsg2;
final int SM7_DELAY_FUDGE = 20;
@@ -1403,7 +1395,7 @@
private static int sharedCounter = 0;
private static Object waitObject = new Object();
- @SmallTest
+ @MediumTest
public void testStateMachineSharedThread() throws Exception {
if (DBG) Log.d(TAG, "testStateMachineSharedThread E");
@@ -1448,7 +1440,7 @@
if (DBG) Log.d(TAG, "testStateMachineSharedThread X");
}
- @SmallTest
+ @MediumTest
public void testHsm1() throws Exception {
if (DBG) Log.d(TAG, "testHsm1 E");
diff --git a/core/tests/coretests/src/android/os/PerformanceCollectorTest.java b/core/tests/coretests/src/android/os/PerformanceCollectorTest.java
index a382239..7533c84 100644
--- a/core/tests/coretests/src/android/os/PerformanceCollectorTest.java
+++ b/core/tests/coretests/src/android/os/PerformanceCollectorTest.java
@@ -16,11 +16,8 @@
package android.os;
-import android.os.Bundle;
-import android.os.Parcelable;
-import android.os.PerformanceCollector;
-import android.os.Process;
import android.os.PerformanceCollector.PerformanceResultsWriter;
+import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
import java.lang.reflect.Field;
@@ -56,7 +53,7 @@
assertEquals(2, snapshot.size());
}
- @SmallTest
+ @MediumTest
public void testEndSnapshotNoWriter() throws Exception {
mPerfCollector.beginSnapshot("testEndSnapshotNoWriter");
workForRandomLongPeriod();
@@ -116,7 +113,7 @@
assertEquals(2, snapshot.size());
}
- @SmallTest
+ @MediumTest
public void testEndSnapshot() throws Exception {
MockPerformanceResultsWriter writer = new MockPerformanceResultsWriter();
mPerfCollector.setPerformanceResultsWriter(writer);
@@ -232,7 +229,7 @@
assertEquals("Hello World", results.getString("testAddMeasurementStringNonEmpty"));
}
- @SmallTest
+ @MediumTest
public void testSimpleSequence() throws Exception {
MockPerformanceResultsWriter writer = new MockPerformanceResultsWriter();
mPerfCollector.setPerformanceResultsWriter(writer);
@@ -264,7 +261,7 @@
verifyTimingBundle(timing, labels);
}
- @SmallTest
+ @MediumTest
public void testLongSequence() throws Exception {
MockPerformanceResultsWriter writer = new MockPerformanceResultsWriter();
mPerfCollector.setPerformanceResultsWriter(writer);
@@ -350,7 +347,7 @@
* Verify that snapshotting and timing do not interfere w/ each other,
* by staggering calls to snapshot and timing functions.
*/
- @SmallTest
+ @MediumTest
public void testOutOfOrderSequence() {
MockPerformanceResultsWriter writer = new MockPerformanceResultsWriter();
mPerfCollector.setPerformanceResultsWriter(writer);
diff --git a/core/tests/coretests/src/android/os/PowerManagerTest.java b/core/tests/coretests/src/android/os/PowerManagerTest.java
index e089b3e..9893c16 100644
--- a/core/tests/coretests/src/android/os/PowerManagerTest.java
+++ b/core/tests/coretests/src/android/os/PowerManagerTest.java
@@ -17,9 +17,8 @@
package android.os;
import android.content.Context;
-import android.os.PowerManager;
import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.SmallTest;
public class PowerManagerTest extends AndroidTestCase {
@@ -39,7 +38,7 @@
*
* @throws Exception
*/
- @MediumTest
+ @SmallTest
public void testPreconditions() throws Exception {
assertNotNull(mPm);
}
@@ -49,7 +48,7 @@
*
* @throws Exception
*/
- @MediumTest
+ @SmallTest
public void testNewWakeLock() throws Exception {
PowerManager.WakeLock wl = mPm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "FULL_WAKE_LOCK");
doTestWakeLock(wl);
@@ -74,7 +73,7 @@
*
* @throws Exception
*/
- @MediumTest
+ @SmallTest
public void testBadNewWakeLock() throws Exception {
final int badFlags = PowerManager.SCREEN_BRIGHT_WAKE_LOCK
diff --git a/core/tests/coretests/src/android/text/HtmlTest.java b/core/tests/coretests/src/android/text/HtmlTest.java
index c07d212..b2298f7 100644
--- a/core/tests/coretests/src/android/text/HtmlTest.java
+++ b/core/tests/coretests/src/android/text/HtmlTest.java
@@ -19,7 +19,6 @@
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Typeface;
-import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
import android.text.style.ForegroundColorSpan;
import android.text.style.QuoteSpan;
@@ -36,7 +35,7 @@
public class HtmlTest extends TestCase {
- @MediumTest
+ @SmallTest
public void testSingleTagOnWhileString() {
Spanned spanned = Html.fromHtml("<b>hello</b>");
Object[] spans = spanned.getSpans(-1, 100, Object.class);
@@ -46,7 +45,7 @@
assertEquals(5, spanned.getSpanEnd(span));
}
- @MediumTest
+ @SmallTest
public void testEmptyFontTag() {
Spanned spanned = Html.fromHtml("Hello <font color=\"#ff00ff00\"></font>");
Object[] spans = spanned.getSpans(0, 100, Object.class);
@@ -54,7 +53,7 @@
}
/** Tests that the parser can handle mal-formed HTML. */
- @MediumTest
+ @SmallTest
public void testBadHtml() {
Spanned spanned = Html.fromHtml("Hello <b>b<i>bi</b>i</i>");
Object[] spans = spanned.getSpans(0, 100, Object.class);
@@ -69,13 +68,13 @@
assertEquals(10, spanned.getSpanEnd(spans[2]));
}
- @MediumTest
+ @SmallTest
public void testSymbols() {
String spanned = Html.fromHtml("© > <").toString();
assertEquals("\u00a9 > <", spanned);
}
- @MediumTest
+ @SmallTest
public void testColor() throws Exception {
Spanned s;
ForegroundColorSpan[] colors;
@@ -95,7 +94,7 @@
assertEquals(0, colors.length);
}
- @MediumTest
+ @SmallTest
public void testResourceColor() throws Exception {
ColorStateList c =
Resources.getSystem().getColorStateList(android.R.color.primary_text_dark);
diff --git a/core/tests/coretests/src/android/text/util/LinkifyTest.java b/core/tests/coretests/src/android/text/util/LinkifyTest.java
index 99c6501..444eb0c 100644
--- a/core/tests/coretests/src/android/text/util/LinkifyTest.java
+++ b/core/tests/coretests/src/android/text/util/LinkifyTest.java
@@ -17,10 +17,8 @@
package android.text.util;
import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
import android.text.method.LinkMovementMethod;
-import android.text.util.Linkify;
import android.widget.TextView;
/**
@@ -39,7 +37,7 @@
assertTrue(tv.getUrls().length == 0);
}
- @MediumTest
+ @SmallTest
public void testNormal() throws Exception {
TextView tv;
diff --git a/core/tests/coretests/src/android/util/MonthDisplayHelperTest.java b/core/tests/coretests/src/android/util/MonthDisplayHelperTest.java
index 5207ad9..55da665 100644
--- a/core/tests/coretests/src/android/util/MonthDisplayHelperTest.java
+++ b/core/tests/coretests/src/android/util/MonthDisplayHelperTest.java
@@ -16,13 +16,11 @@
package android.util;
-import junit.framework.TestCase;
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import android.test.suitebuilder.annotation.SmallTest;
import java.util.Calendar;
-import android.test.suitebuilder.annotation.SmallTest;
-import android.test.suitebuilder.annotation.MediumTest;
+
+import junit.framework.TestCase;
/**
* Unit tests for {@link MonthDisplayHelper}.
@@ -42,7 +40,7 @@
new MonthDisplayHelper(2007, Calendar.SEPTEMBER).getFirstDayOfMonth());
}
- @MediumTest
+ @SmallTest
public void testNumberOfDaysInCurrentMonth() {
assertEquals(30,
new MonthDisplayHelper(2007, Calendar.SEPTEMBER).getNumberOfDaysInMonth());
diff --git a/core/tests/coretests/src/android/view/FocusFinderTest.java b/core/tests/coretests/src/android/view/FocusFinderTest.java
index 186689f..6f1dd7c 100644
--- a/core/tests/coretests/src/android/view/FocusFinderTest.java
+++ b/core/tests/coretests/src/android/view/FocusFinderTest.java
@@ -18,7 +18,6 @@
import android.graphics.Rect;
import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
public class FocusFinderTest extends AndroidTestCase {
@@ -239,7 +238,7 @@
* A non-candidate (even a much closer one) is always a worse choice
* than a real candidate.
*/
- @MediumTest
+ @SmallTest
public void testSomeCandidateBetterThanNonCandidate() {
Rect src = new Rect(0, 0, 50, 50); // (left, top, right, bottom)
diff --git a/core/tests/coretests/src/android/view/accessibility/RecycleAccessibilityEventTest.java b/core/tests/coretests/src/android/view/accessibility/RecycleAccessibilityEventTest.java
index df8d836..bbf1696 100644
--- a/core/tests/coretests/src/android/view/accessibility/RecycleAccessibilityEventTest.java
+++ b/core/tests/coretests/src/android/view/accessibility/RecycleAccessibilityEventTest.java
@@ -14,8 +14,7 @@
package android.view.accessibility;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.view.accessibility.AccessibilityEvent;
+import android.test.suitebuilder.annotation.SmallTest;
import junit.framework.TestCase;
@@ -39,7 +38,7 @@
/**
* If an {@link AccessibilityEvent} is marshaled/unmarshaled correctly
*/
- @MediumTest
+ @SmallTest
public void testAccessibilityEventViewTextChangedType() {
AccessibilityEvent first =
AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED);
diff --git a/core/tests/coretests/src/android/widget/RadioGroupPreCheckedTest.java b/core/tests/coretests/src/android/widget/RadioGroupPreCheckedTest.java
index 855caae..1ab3628 100644
--- a/core/tests/coretests/src/android/widget/RadioGroupPreCheckedTest.java
+++ b/core/tests/coretests/src/android/widget/RadioGroupPreCheckedTest.java
@@ -16,23 +16,22 @@
package android.widget;
-import android.test.TouchUtils;
-import android.widget.RadioButton;
-import android.widget.RadioGroup;
import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase2;
+import android.test.TouchUtils;
import android.test.suitebuilder.annotation.LargeTest;
+import android.test.suitebuilder.annotation.MediumTest;
/**
* Exercises {@link android.widget.RadioGroup}'s check feature.
*/
public class RadioGroupPreCheckedTest extends ActivityInstrumentationTestCase2<RadioGroupActivity> {
public RadioGroupPreCheckedTest() {
- super("com.android.frameworks.coretests", RadioGroupActivity.class);
+ super(RadioGroupActivity.class);
}
- @LargeTest
+ @MediumTest
public void testRadioButtonPreChecked() throws Exception {
final RadioGroupActivity activity = getActivity();
diff --git a/core/tests/coretests/src/android/widget/gridview/touch/GridTouchStackFromBottomManyTest.java b/core/tests/coretests/src/android/widget/gridview/touch/GridTouchStackFromBottomManyTest.java
index f8e6ae7..9a8d307 100644
--- a/core/tests/coretests/src/android/widget/gridview/touch/GridTouchStackFromBottomManyTest.java
+++ b/core/tests/coretests/src/android/widget/gridview/touch/GridTouchStackFromBottomManyTest.java
@@ -67,7 +67,7 @@
mGridView.getListPaddingTop(), firstChild.getTop());
}
- @MediumTest
+ @LargeTest
public void testScrollToBottom() {
TouchUtils.scrollToBottom(this, mGridView);
diff --git a/core/tests/coretests/src/android/widget/listview/arrowscroll/ListInterleaveFocusablesTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListInterleaveFocusablesTest.java
index 6238dab..ec8ab7e 100644
--- a/core/tests/coretests/src/android/widget/listview/arrowscroll/ListInterleaveFocusablesTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListInterleaveFocusablesTest.java
@@ -16,22 +16,20 @@
package android.widget.listview.arrowscroll;
-import android.test.ActivityInstrumentationTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
+import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.MediumTest;
-import android.widget.ListView;
+import android.util.ListUtil;
import android.view.KeyEvent;
import android.view.View;
-
+import android.widget.ListView;
import android.widget.listview.ListInterleaveFocusables;
-import android.util.ListUtil;
-public class ListInterleaveFocusablesTest extends ActivityInstrumentationTestCase<ListInterleaveFocusables> {
+public class ListInterleaveFocusablesTest extends ActivityInstrumentationTestCase2<ListInterleaveFocusables> {
private ListView mListView;
private ListUtil mListUtil;
public ListInterleaveFocusablesTest() {
- super("com.android.frameworks.coretests", ListInterleaveFocusables.class);
+ super(ListInterleaveFocusables.class);
}
@Override
@@ -42,7 +40,7 @@
mListUtil = new ListUtil(mListView, getInstrumentation());
}
- @LargeTest
+ @MediumTest
public void testPreconditions() {
assertEquals(7, mListView.getChildCount());
assertTrue(mListView.getChildAt(1).isFocusable());
diff --git a/core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfItemsTallerThanScreenTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfItemsTallerThanScreenTest.java
index 59609422..6805b72 100644
--- a/core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfItemsTallerThanScreenTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfItemsTallerThanScreenTest.java
@@ -16,16 +16,15 @@
package android.widget.listview.arrowscroll;
-import android.test.ActivityInstrumentationTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
+import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.MediumTest;
-import android.widget.ListView;
-import android.view.View;
import android.view.KeyEvent;
+import android.view.View;
+import android.widget.ListView;
import android.widget.listview.ListOfItemsTallerThanScreen;
public class ListOfItemsTallerThanScreenTest
- extends ActivityInstrumentationTestCase<ListOfItemsTallerThanScreen> {
+ extends ActivityInstrumentationTestCase2<ListOfItemsTallerThanScreen> {
private ListView mListView;
private ListOfItemsTallerThanScreen mActivity;
@@ -38,7 +37,7 @@
}
public ListOfItemsTallerThanScreenTest() {
- super("com.android.frameworks.coretests", ListOfItemsTallerThanScreen.class);
+ super(ListOfItemsTallerThanScreen.class);
}
@MediumTest
@@ -126,7 +125,7 @@
1, mListView.getChildCount());
}
- @LargeTest
+ @MediumTest
public void testScrollDownToLastItem() {
final int numItems = mListView.getAdapter().getCount();
diff --git a/core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfShortShortTallShortShortTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfShortShortTallShortShortTest.java
index a5d4906..5aa27b2 100644
--- a/core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfShortShortTallShortShortTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfShortShortTallShortShortTest.java
@@ -16,20 +16,19 @@
package android.widget.listview.arrowscroll;
-import android.test.ActivityInstrumentationTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
+import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.MediumTest;
+import android.util.ListUtil;
import android.view.KeyEvent;
import android.widget.ListView;
import android.widget.listview.ListOfShortShortTallShortShort;
-import android.util.ListUtil;
-public class ListOfShortShortTallShortShortTest extends ActivityInstrumentationTestCase<ListOfShortShortTallShortShort> {
+public class ListOfShortShortTallShortShortTest extends ActivityInstrumentationTestCase2<ListOfShortShortTallShortShort> {
private ListView mListView;
private ListUtil mListUtil;
public ListOfShortShortTallShortShortTest() {
- super("com.android.frameworks.coretests", ListOfShortShortTallShortShort.class);
+ super(ListOfShortShortTallShortShort.class);
}
@Override
@@ -68,7 +67,7 @@
1, mListView.getChildCount());
}
- @LargeTest
+ @MediumTest
public void testFadeInTwoBottomItems() {
// put 2nd item selected
sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
@@ -89,7 +88,7 @@
mListView.getChildAt(2).getBottom() >= mListUtil.getListBottom());
}
- @LargeTest
+ @MediumTest
public void testFadeOutBottomTwoItems() throws Exception {
mListUtil.arrowScrollToSelectedPosition(4);
@@ -110,7 +109,7 @@
1, mListView.getChildCount());
}
- @LargeTest
+ @MediumTest
public void testFadeInTopTwoItems() throws Exception {
mListUtil.arrowScrollToSelectedPosition(4);
diff --git a/core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithScreenOfNoSelectablesTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithScreenOfNoSelectablesTest.java
index 8071650..b68631a 100644
--- a/core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithScreenOfNoSelectablesTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithScreenOfNoSelectablesTest.java
@@ -16,21 +16,19 @@
package android.widget.listview.arrowscroll;
-import android.widget.listview.ListWithScreenOfNoSelectables;
-
-import android.test.ActivityInstrumentationTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
+import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ListView;
+import android.widget.listview.ListWithScreenOfNoSelectables;
-public class ListWithScreenOfNoSelectablesTest extends ActivityInstrumentationTestCase<ListWithScreenOfNoSelectables> {
+public class ListWithScreenOfNoSelectablesTest extends ActivityInstrumentationTestCase2<ListWithScreenOfNoSelectables> {
private ListView mListView;
public ListWithScreenOfNoSelectablesTest() {
- super("com.android.frameworks.coretests", ListWithScreenOfNoSelectables.class);
+ super(ListWithScreenOfNoSelectables.class);
}
@Override
@@ -56,7 +54,7 @@
@MediumTest
public void testGoFromSelectedViewExistsToNoSelectedViewExists() {
- // go down untile first (and only selectable) item is off screen
+ // go down until first (and only selectable) item is off screen
View first = mListView.getChildAt(0);
while (first.getParent() != null) {
sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
@@ -67,7 +65,7 @@
assertNull("selected view", mListView.getSelectedView());
}
- @LargeTest
+ @MediumTest
public void testPanDownAcrossUnselectableChildrenToBottom() {
final int lastPosition = mListView.getCount() - 1;
final int maxDowns = 20;
diff --git a/media/java/android/media/MtpDatabase.java b/media/java/android/media/MtpDatabase.java
index 1b82d39..37f9f2c 100644
--- a/media/java/android/media/MtpDatabase.java
+++ b/media/java/android/media/MtpDatabase.java
@@ -22,7 +22,10 @@
import android.database.Cursor;
import android.net.Uri;
import android.os.RemoteException;
+import android.provider.MediaStore.Audio;
+import android.provider.MediaStore.MediaColumns;
import android.provider.MediaStore.MtpObjects;
+import android.provider.Mtp;
import android.util.Log;
/**
@@ -120,7 +123,33 @@
private void endSendObject(String path, int handle, int format, boolean succeeded) {
if (succeeded) {
- Uri uri = mMediaScanner.scanMtpFile(path, mVolumeName, handle, format);
+ // handle abstract playlists separately
+ // they do not exist in the file system so don't use the media scanner here
+ if (format == Mtp.Object.FORMAT_ABSTRACT_AV_PLAYLIST) {
+ // Strip Windows Media Player file extension
+ if (path.endsWith(".pla")) {
+ path = path.substring(0, path.length() - 4);
+ }
+
+ // extract name from path
+ String name = path;
+ int lastSlash = name.lastIndexOf('/');
+ if (lastSlash >= 0) {
+ name = name.substring(lastSlash + 1);
+ }
+
+ ContentValues values = new ContentValues(1);
+ values.put(Audio.Playlists.DATA, path);
+ values.put(Audio.Playlists.NAME, name);
+ values.put(MediaColumns.MEDIA_SCANNER_NEW_OBJECT_ID, handle);
+ try {
+ Uri uri = mMediaProvider.insert(Audio.Playlists.EXTERNAL_CONTENT_URI, values);
+ } catch (RemoteException e) {
+ Log.e(TAG, "RemoteException in endSendObject", e);
+ }
+ } else {
+ Uri uri = mMediaScanner.scanMtpFile(path, mVolumeName, handle, format);
+ }
} else {
deleteFile(handle);
}
@@ -338,6 +367,53 @@
}
}
+ private int[] getObjectReferences(int handle) {
+ Log.d(TAG, "getObjectReferences for: " + handle);
+ Uri uri = MtpObjects.getReferencesUri(mVolumeName, handle);
+ Cursor c = null;
+ try {
+ c = mMediaProvider.query(uri, ID_PROJECTION, null, null, null);
+ if (c == null) {
+ return null;
+ }
+ int count = c.getCount();
+ if (count > 0) {
+ int[] result = new int[count];
+ for (int i = 0; i < count; i++) {
+ c.moveToNext();
+ result[i] = c.getInt(0);
+ }
+ return result;
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "RemoteException in getObjectList", e);
+ } finally {
+ if (c != null) {
+ c.close();
+ }
+ }
+ return null;
+ }
+
+ private int setObjectReferences(int handle, int[] references) {
+ Uri uri = MtpObjects.getReferencesUri(mVolumeName, handle);
+ int count = references.length;
+ ContentValues[] valuesList = new ContentValues[count];
+ for (int i = 0; i < count; i++) {
+ ContentValues values = new ContentValues();
+ values.put(MtpObjects.ObjectColumns._ID, references[i]);
+ valuesList[i] = values;
+ }
+ try {
+ if (count == mMediaProvider.bulkInsert(uri, valuesList)) {
+ return MTP_RESPONSE_OK;
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "RemoteException in setObjectReferences", e);
+ }
+ return MTP_RESPONSE_GENERAL_ERROR;
+ }
+
// used by the JNI code
private int mNativeContext;
diff --git a/media/jni/android_media_MtpDatabase.cpp b/media/jni/android_media_MtpDatabase.cpp
index 5ab0a55..d4539fe 100644
--- a/media/jni/android_media_MtpDatabase.cpp
+++ b/media/jni/android_media_MtpDatabase.cpp
@@ -44,6 +44,8 @@
static jmethodID method_getObjectInfo;
static jmethodID method_getObjectFilePath;
static jmethodID method_deleteFile;
+static jmethodID method_getObjectReferences;
+static jmethodID method_setObjectReferences;
static jfieldID field_context;
MtpDatabase* getMtpDatabase(JNIEnv *env, jobject database) {
@@ -98,6 +100,11 @@
virtual MtpResponseCode deleteFile(MtpObjectHandle handle);
bool getPropertyInfo(MtpObjectProperty property, int& type);
+
+ virtual MtpObjectHandleList* getObjectReferences(MtpObjectHandle handle);
+
+ virtual MtpResponseCode setObjectReferences(MtpObjectHandle handle,
+ MtpObjectHandleList* references);
};
MyMtpDatabase::MyMtpDatabase(JNIEnv *env, jobject client)
@@ -344,6 +351,37 @@
return false;
}
+MtpObjectHandleList* MyMtpDatabase::getObjectReferences(MtpObjectHandle handle) {
+ JNIEnv* env = AndroidRuntime::getJNIEnv();
+ jintArray array = (jintArray)env->CallObjectMethod(mDatabase, method_getObjectReferences,
+ (jint)handle);
+ if (!array)
+ return NULL;
+ MtpObjectHandleList* list = new MtpObjectHandleList();
+ jint* handles = env->GetIntArrayElements(array, 0);
+ jsize length = env->GetArrayLength(array);
+ for (int i = 0; i < length; i++)
+ list->push(handles[i]);
+ env->ReleaseIntArrayElements(array, handles, 0);
+ return list;
+}
+
+MtpResponseCode MyMtpDatabase::setObjectReferences(MtpObjectHandle handle, MtpObjectHandleList* references) {
+ JNIEnv* env = AndroidRuntime::getJNIEnv();
+ int count = references->size();
+ jintArray array = env->NewIntArray(count);
+ if (!array) {
+ LOGE("out of memory in setObjectReferences");
+ return false;
+ }
+ jint* handles = env->GetIntArrayElements(array, 0);
+ for (int i = 0; i < count; i++)
+ handles[i] = (*references)[i];
+ env->ReleaseIntArrayElements(array, handles, 0);
+ return env->CallIntMethod(mDatabase, method_setObjectReferences,
+ (jint)handle, array);
+}
+
// ----------------------------------------------------------------------------
static void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) {
@@ -442,6 +480,16 @@
LOGE("Can't find deleteFile");
return -1;
}
+ method_getObjectReferences = env->GetMethodID(clazz, "getObjectReferences", "(I)[I");
+ if (method_getObjectReferences == NULL) {
+ LOGE("Can't find getObjectReferences");
+ return -1;
+ }
+ method_setObjectReferences = env->GetMethodID(clazz, "setObjectReferences", "(I[I)I");
+ if (method_setObjectReferences == NULL) {
+ LOGE("Can't find setObjectReferences");
+ return -1;
+ }
field_context = env->GetFieldID(clazz, "mNativeContext", "I");
if (field_context == NULL) {
LOGE("Can't find MtpDatabase.mNativeContext");
diff --git a/media/jni/android_media_MtpServer.cpp b/media/jni/android_media_MtpServer.cpp
index eddad57..1ef2c58 100644
--- a/media/jni/android_media_MtpServer.cpp
+++ b/media/jni/android_media_MtpServer.cpp
@@ -36,6 +36,7 @@
// ----------------------------------------------------------------------------
static jfieldID field_context;
+static Mutex sMutex;
// in android_media_MtpDatabase.cpp
extern MtpDatabase* getMtpDatabase(JNIEnv *env, jobject database);
@@ -53,63 +54,80 @@
private:
MtpDatabase* mDatabase;
MtpServer* mServer;
- String8 mStoragePath;
- bool mDone;
- Mutex mMutex;
+ String8 mStoragePath;
+ bool mDone;
+ jobject mJavaServer;
public:
- MtpThread(MtpDatabase* database, const char* storagePath)
- : mDatabase(database), mServer(NULL), mStoragePath(storagePath), mDone(false)
+ MtpThread(MtpDatabase* database, const char* storagePath, jobject javaServer)
+ : mDatabase(database),
+ mServer(NULL),
+ mStoragePath(storagePath),
+ mDone(false),
+ mJavaServer(javaServer)
{
}
virtual bool threadLoop() {
- int fd = open("/dev/mtp_usb", O_RDWR);
- printf("open returned %d\n", fd);
- if (fd < 0) {
- LOGE("could not open MTP driver\n");
- return false;
+ while (1) {
+ int fd = open("/dev/mtp_usb", O_RDWR);
+ printf("open returned %d\n", fd);
+ if (fd < 0) {
+ LOGE("could not open MTP driver\n");
+ break;
+ }
+
+ sMutex.lock();
+ mServer = new MtpServer(fd, mDatabase, AID_SDCARD_RW, 0664, 0775);
+ mServer->addStorage(mStoragePath);
+ sMutex.unlock();
+
+ LOGD("MtpThread mServer->run");
+ mServer->run();
+ close(fd);
+
+ sMutex.lock();
+ delete mServer;
+ mServer = NULL;
+ if (mDone)
+ goto done;
+ sMutex.unlock();
+ // wait a bit before retrying
+ sleep(1);
}
- mMutex.lock();
- mServer = new MtpServer(fd, mDatabase, AID_SDCARD_RW, 0664, 0775);
- mServer->addStorage(mStoragePath);
- mMutex.unlock();
+ sMutex.lock();
+done:
+ JNIEnv* env = AndroidRuntime::getJNIEnv();
+ env->SetIntField(mJavaServer, field_context, 0);
+ env->DeleteGlobalRef(mJavaServer);
+ sMutex.unlock();
- LOGD("MtpThread mServer->run");
- mServer->run();
- close(fd);
-
- mMutex.lock();
- delete mServer;
- mServer = NULL;
- mMutex.unlock();
-
- bool done = mDone;
- if (done)
- delete this;
- LOGD("threadLoop returning %s", (done ? "false" : "true"));
- return !done;
+ LOGD("threadLoop returning");
+ return false;
}
- void setDone() { mDone = true; }
+ void setDone() {
+ LOGD("setDone");
+ mDone = true;
+ }
void sendObjectAdded(MtpObjectHandle handle) {
- mMutex.lock();
+ sMutex.lock();
if (mServer)
mServer->sendObjectAdded(handle);
else
LOGE("sendObjectAdded called while disconnected\n");
- mMutex.unlock();
+ sMutex.unlock();
}
void sendObjectRemoved(MtpObjectHandle handle) {
- mMutex.lock();
+ sMutex.lock();
if (mServer)
mServer->sendObjectRemoved(handle);
else
LOGE("sendObjectRemoved called while disconnected\n");
- mMutex.unlock();
+ sMutex.unlock();
}
};
@@ -124,7 +142,7 @@
MtpDatabase* database = getMtpDatabase(env, javaDatabase);
const char *storagePathStr = env->GetStringUTFChars(storagePath, NULL);
- MtpThread* thread = new MtpThread(database, storagePathStr);
+ MtpThread* thread = new MtpThread(database, storagePathStr, env->NewGlobalRef(thiz));
env->SetIntField(thiz, field_context, (int)thread);
env->ReleaseStringUTFChars(storagePath, storagePathStr);
@@ -153,11 +171,11 @@
{
#ifdef HAVE_ANDROID_OS
LOGD("stop\n");
+ sMutex.lock();
MtpThread *thread = (MtpThread *)env->GetIntField(thiz, field_context);
- if (thread) {
+ if (thread)
thread->setDone();
- env->SetIntField(thiz, field_context, 0);
- }
+ sMutex.unlock();
#endif
}
diff --git a/media/mtp/MtpDatabase.h b/media/mtp/MtpDatabase.h
index bbbbc38..02bb0d9 100644
--- a/media/mtp/MtpDatabase.h
+++ b/media/mtp/MtpDatabase.h
@@ -61,7 +61,14 @@
virtual MtpResponseCode getObjectFilePath(MtpObjectHandle handle,
MtpString& filePath,
int64_t& fileLength) = 0;
+
virtual MtpResponseCode deleteFile(MtpObjectHandle handle) = 0;
+
+ virtual MtpObjectHandleList* getObjectReferences(MtpObjectHandle handle) = 0;
+
+ virtual MtpResponseCode setObjectReferences(MtpObjectHandle handle,
+ MtpObjectHandleList* references) = 0;
+
};
}; // namespace android
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp
index 50a839e..5f5cadf 100644
--- a/media/mtp/MtpServer.cpp
+++ b/media/mtp/MtpServer.cpp
@@ -68,8 +68,8 @@
// MTP_OPERATION_GET_OBJECT_PROP_DESC,
MTP_OPERATION_GET_OBJECT_PROP_VALUE,
// MTP_OPERATION_SET_OBJECT_PROP_VALUE,
-// MTP_OPERATION_GET_OBJECT_REFERENCES,
-// MTP_OPERATION_SET_OBJECT_REFERENCES,
+ MTP_OPERATION_GET_OBJECT_REFERENCES,
+ MTP_OPERATION_SET_OBJECT_REFERENCES,
// MTP_OPERATION_SKIP,
};
@@ -111,11 +111,11 @@
MTP_FORMAT_MP2,
MTP_FORMAT_3GP_CONTAINER,
// MTP_FORMAT_ABSTRACT_AUDIO_ALBUM,
- // MTP_FORMAT_ABSTRACT_AV_PLAYLIST,
- // MTP_FORMAT_WPL_PLAYLIST,
- // MTP_FORMAT_M3U_PLAYLIST,
+ MTP_FORMAT_ABSTRACT_AV_PLAYLIST,
+ MTP_FORMAT_WPL_PLAYLIST,
+ MTP_FORMAT_M3U_PLAYLIST,
// MTP_FORMAT_MPL_PLAYLIST,
- // MTP_FORMAT_PLS_PLAYLIST,
+ MTP_FORMAT_PLS_PLAYLIST,
};
MtpServer::MtpServer(int fd, MtpDatabase* database,
@@ -175,7 +175,8 @@
mRequest.dump();
// FIXME need to generalize this
- bool dataIn = (operation == MTP_OPERATION_SEND_OBJECT_INFO);
+ bool dataIn = (operation == MTP_OPERATION_SEND_OBJECT_INFO
+ || operation == MTP_OPERATION_SET_OBJECT_REFERENCES);
if (dataIn) {
int ret = mData.read(fd);
if (ret < 0) {
@@ -311,6 +312,12 @@
case MTP_OPERATION_GET_NUM_OBJECTS:
response = doGetNumObjects();
break;
+ case MTP_OPERATION_GET_OBJECT_REFERENCES:
+ response = doGetObjectReferences();
+ break;
+ case MTP_OPERATION_SET_OBJECT_REFERENCES:
+ response = doSetObjectReferences();
+ break;
case MTP_OPERATION_GET_OBJECT_PROP_VALUE:
response = doGetObjectPropValue();
break;
@@ -477,6 +484,30 @@
}
}
+MtpResponseCode MtpServer::doGetObjectReferences() {
+ if (!mSessionOpen)
+ return MTP_RESPONSE_SESSION_NOT_OPEN;
+ MtpStorageID handle = mRequest.getParameter(1);
+ MtpObjectHandleList* handles = mDatabase->getObjectReferences(handle);
+ if (!handles) {
+ mData.putEmptyArray();
+ return MTP_RESPONSE_INVALID_OBJECT_HANDLE;
+ }
+ mData.putAUInt32(handles);
+ delete handles;
+ return MTP_RESPONSE_OK;
+}
+
+MtpResponseCode MtpServer::doSetObjectReferences() {
+ if (!mSessionOpen)
+ return MTP_RESPONSE_SESSION_NOT_OPEN;
+ MtpStorageID handle = mRequest.getParameter(1);
+ MtpObjectHandleList* references = mData.getAUInt32();
+ MtpResponseCode result = mDatabase->setObjectReferences(handle, references);
+ delete references;
+ return result;
+}
+
MtpResponseCode MtpServer::doGetObjectPropValue() {
MtpObjectHandle handle = mRequest.getParameter(1);
MtpObjectProperty property = mRequest.getParameter(2);
diff --git a/media/mtp/MtpServer.h b/media/mtp/MtpServer.h
index 9ed1c84..19ccf24 100644
--- a/media/mtp/MtpServer.h
+++ b/media/mtp/MtpServer.h
@@ -95,6 +95,8 @@
MtpResponseCode doGetObjectPropsSupported();
MtpResponseCode doGetObjectHandles();
MtpResponseCode doGetNumObjects();
+ MtpResponseCode doGetObjectReferences();
+ MtpResponseCode doSetObjectReferences();
MtpResponseCode doGetObjectPropValue();
MtpResponseCode doGetObjectInfo();
MtpResponseCode doGetObject();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
index 973c50d..6bb5e8f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
@@ -22,6 +22,7 @@
import com.android.internal.statusbar.StatusBarNotification;
+import java.util.Comparator;
import java.util.ArrayList;
/**
@@ -43,30 +44,35 @@
}
}
private final ArrayList<Entry> mEntries = new ArrayList<Entry>();
+ private final Comparator<Entry> mEntryCmp = new Comparator<Entry>() {
+ public int compare(Entry a, Entry b) {
+ return (int)(a.notification.notification.when - b.notification.notification.when);
+ }
+ };
public int size() {
return mEntries.size();
}
- public Entry getEntryAt(int index) {
- return mEntries.get(index);
- }
-
- public int findEntry(IBinder key) {
- final int N = mEntries.size();
- for (int i=0; i<N; i++) {
- Entry entry = mEntries.get(i);
- if (entry.key == key) {
- return i;
+ public Entry findByKey(IBinder key) {
+ for (Entry e : mEntries) {
+ if (e.key == key) {
+ return e;
}
}
- return -1;
+ return null;
}
public int add(Entry entry) {
- final int index = chooseIndex(entry.notification.notification.when);
- mEntries.add(index, entry);
- return index;
+ int i;
+ int N = mEntries.size();
+ for (i=0; i<N; i++) {
+ if (mEntryCmp.compare(mEntries.get(i), entry) > 0) {
+ break;
+ }
+ }
+ mEntries.add(i, entry);
+ return i;
}
public int add(IBinder key, StatusBarNotification notification, View row, View content,
@@ -82,36 +88,19 @@
}
public Entry remove(IBinder key) {
- final int N = mEntries.size();
- for (int i=0; i<N; i++) {
- Entry entry = mEntries.get(i);
- if (entry.key == key) {
- mEntries.remove(i);
- return entry;
- }
+ Entry e = findByKey(key);
+ if (e != null) {
+ mEntries.remove(e);
}
- return null;
- }
-
- private int chooseIndex(final long when) {
- final int N = mEntries.size();
- for (int i=0; i<N; i++) {
- Entry entry = mEntries.get(i);
- if (entry.notification.notification.when > when) {
- return i;
- }
- }
- return N;
+ return e;
}
/**
* Return whether there are any visible items (i.e. items without an error).
*/
public boolean hasVisibleItems() {
- final int N = mEntries.size();
- for (int i=0; i<N; i++) {
- Entry entry = mEntries.get(i);
- if (entry.expanded != null) { // the view successfully inflated
+ for (Entry e : mEntries) {
+ if (e.expanded != null) { // the view successfully inflated
return true;
}
}
@@ -122,11 +111,9 @@
* Return whether there are any clearable items (that aren't errors).
*/
public boolean hasClearableItems() {
- final int N = mEntries.size();
- for (int i=0; i<N; i++) {
- Entry entry = mEntries.get(i);
- if (entry.expanded != null) { // the view successfully inflated
- if ((entry.notification.notification.flags & Notification.FLAG_NO_CLEAR) == 0) {
+ for (Entry e : mEntries) {
+ if (e.expanded != null) { // the view successfully inflated
+ if ((e.notification.notification.flags & Notification.FLAG_NO_CLEAR) == 0) {
return true;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java
index eff9a1d..5add6de 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java
@@ -353,7 +353,7 @@
if (immersive) {
if ((notification.notification.flags & Notification.FLAG_HIGH_PRIORITY) != 0) {
Slog.d(TAG, "Presenting high-priority notification in immersive activity");
- // @@@ special new transient ticker mode
+ // special new transient ticker mode
// 1. Populate mIntruderAlertView
ImageView alertIcon = (ImageView) mIntruderAlertView.findViewById(R.id.alertIcon);
@@ -399,18 +399,17 @@
Slog.d(TAG, "updateNotification key=" + key + " notification=" + notification);
NotificationData oldList;
- int oldIndex = mOngoing.findEntry(key);
- if (oldIndex >= 0) {
+ NotificationData.Entry oldEntry = mOngoing.findByKey(key);
+ if (oldEntry != null) {
oldList = mOngoing;
} else {
- oldIndex = mLatest.findEntry(key);
- if (oldIndex < 0) {
+ oldEntry = mLatest.findByKey(key);
+ if (oldEntry == null) {
Slog.w(TAG, "updateNotification for unknown key: " + key);
return;
}
oldList = mLatest;
}
- final NotificationData.Entry oldEntry = oldList.getEntryAt(oldIndex);
final StatusBarNotification oldNotification = oldEntry.notification;
final RemoteViews oldContentView = oldNotification.notification.contentView;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java
index 76969d7..9d643d8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java
@@ -49,7 +49,7 @@
import com.android.systemui.R;
public class TabletStatusBarService extends StatusBarService {
- public static final boolean DEBUG = true;
+ public static final boolean DEBUG = false;
public static final String TAG = "TabletStatusBar";
View mStatusBarView;
@@ -195,15 +195,13 @@
public void updateNotification(IBinder key, StatusBarNotification notification) {
if (DEBUG) Slog.d(TAG, "updateNotification(" + key + " -> " + notification + ") // TODO");
- NotificationData oldList = mHaps;
-
- int oldIndex = oldList.findEntry(key);
- if (oldIndex < 0) {
+
+ final NotificationData.Entry oldEntry = mHaps.findByKey(key);
+ if (oldEntry == null) {
Slog.w(TAG, "updateNotification for unknown key: " + key);
return;
}
- final NotificationData.Entry oldEntry = oldList.getEntryAt(oldIndex);
final StatusBarNotification oldNotification = oldEntry.notification;
final RemoteViews oldContentView = oldNotification.notification.contentView;
diff --git a/services/java/com/android/server/am/UsageStatsService.java b/services/java/com/android/server/am/UsageStatsService.java
index 1b9e1c7..3f15d0a 100644
--- a/services/java/com/android/server/am/UsageStatsService.java
+++ b/services/java/com/android/server/am/UsageStatsService.java
@@ -44,6 +44,9 @@
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
/**
* This service collects the statistics associated with usage
@@ -88,11 +91,13 @@
private boolean mIsResumed;
private File mFile;
private String mFileLeaf;
- //private File mBackupFile;
- private long mLastWriteElapsedTime;
private File mDir;
- private Calendar mCal;
- private int mLastWriteDay;
+
+ private Calendar mCal; // guarded by itself
+
+ private final AtomicInteger mLastWriteDay = new AtomicInteger(-1);
+ private final AtomicLong mLastWriteElapsedTime = new AtomicLong(0);
+ private final AtomicBoolean mUnforcedDiskWriteRunning = new AtomicBoolean(false);
static class TimeStats {
int count;
@@ -241,31 +246,33 @@
mFileLeaf = getCurrentDateStr(FILE_PREFIX);
mFile = new File(mDir, mFileLeaf);
readStatsFromFile();
- mLastWriteElapsedTime = SystemClock.elapsedRealtime();
+ mLastWriteElapsedTime.set(SystemClock.elapsedRealtime());
// mCal was set by getCurrentDateStr(), want to use that same time.
- mLastWriteDay = mCal.get(Calendar.DAY_OF_YEAR);
+ mLastWriteDay.set(mCal.get(Calendar.DAY_OF_YEAR));
}
/*
* Utility method to convert date into string.
*/
private String getCurrentDateStr(String prefix) {
- mCal.setTimeInMillis(System.currentTimeMillis());
StringBuilder sb = new StringBuilder();
- if (prefix != null) {
- sb.append(prefix);
+ synchronized (mCal) {
+ mCal.setTimeInMillis(System.currentTimeMillis());
+ if (prefix != null) {
+ sb.append(prefix);
+ }
+ sb.append(mCal.get(Calendar.YEAR));
+ int mm = mCal.get(Calendar.MONTH) - Calendar.JANUARY +1;
+ if (mm < 10) {
+ sb.append("0");
+ }
+ sb.append(mm);
+ int dd = mCal.get(Calendar.DAY_OF_MONTH);
+ if (dd < 10) {
+ sb.append("0");
+ }
+ sb.append(dd);
}
- sb.append(mCal.get(Calendar.YEAR));
- int mm = mCal.get(Calendar.MONTH) - Calendar.JANUARY +1;
- if (mm < 10) {
- sb.append("0");
- }
- sb.append(mm);
- int dd = mCal.get(Calendar.DAY_OF_MONTH);
- if (dd < 10) {
- sb.append("0");
- }
- sb.append(dd);
return sb.toString();
}
@@ -360,23 +367,56 @@
file.delete();
}
}
-
- private void writeStatsToFile(boolean force) {
- synchronized (mFileLock) {
+
+ /**
+ * Conditionally start up a disk write if it's been awhile, or the
+ * day has rolled over.
+ *
+ * This is called indirectly from user-facing actions (when
+ * 'force' is false) so it tries to be quick, without writing to
+ * disk directly or acquiring heavy locks.
+ *
+ * @params force do an unconditional, synchronous stats flush
+ * to disk on the current thread.
+ */
+ private void writeStatsToFile(final boolean force) {
+ int curDay;
+ synchronized (mCal) {
mCal.setTimeInMillis(System.currentTimeMillis());
- final int curDay = mCal.get(Calendar.DAY_OF_YEAR);
- // Determine if the day changed... note that this will be wrong
- // if the year has changed but we are in the same day of year...
- // we can probably live with this.
- final boolean dayChanged = curDay != mLastWriteDay;
- long currElapsedTime = SystemClock.elapsedRealtime();
- if (!force) {
- if (((currElapsedTime-mLastWriteElapsedTime) < FILE_WRITE_INTERVAL) &&
- (!dayChanged)) {
- // wait till the next update
- return;
- }
+ curDay = mCal.get(Calendar.DAY_OF_YEAR);
+ }
+ final boolean dayChanged = curDay != mLastWriteDay.get();
+
+ // Determine if the day changed... note that this will be wrong
+ // if the year has changed but we are in the same day of year...
+ // we can probably live with this.
+ final long currElapsedTime = SystemClock.elapsedRealtime();
+
+ // Fast common path, without taking the often-contentious
+ // mFileLock.
+ if (!force) {
+ if (!dayChanged &&
+ (currElapsedTime - mLastWriteElapsedTime.get()) < FILE_WRITE_INTERVAL) {
+ // wait till the next update
+ return;
}
+ if (mUnforcedDiskWriteRunning.compareAndSet(false, true)) {
+ new Thread("UsageStatsService_DiskWriter") {
+ public void run() {
+ try {
+ Slog.d(TAG, "Disk writer thread starting.");
+ writeStatsToFile(true);
+ } finally {
+ mUnforcedDiskWriteRunning.set(false);
+ Slog.d(TAG, "Disk writer thread ending.");
+ }
+ }
+ }.start();
+ }
+ return;
+ }
+
+ synchronized (mFileLock) {
// Get the most recent file
mFileLeaf = getCurrentDateStr(FILE_PREFIX);
// Copy current file to back up
@@ -395,10 +435,10 @@
try {
// Write mStats to file
- writeStatsFLOCK();
- mLastWriteElapsedTime = currElapsedTime;
+ writeStatsFLOCK(mFile);
+ mLastWriteElapsedTime.set(currElapsedTime);
if (dayChanged) {
- mLastWriteDay = curDay;
+ mLastWriteDay.set(curDay);
// clear stats
synchronized (mStats) {
mStats.clear();
@@ -418,10 +458,11 @@
}
}
}
+ Slog.d(TAG, "Dumped usage stats.");
}
- private void writeStatsFLOCK() throws IOException {
- FileOutputStream stream = new FileOutputStream(mFile);
+ private void writeStatsFLOCK(File file) throws IOException {
+ FileOutputStream stream = new FileOutputStream(file);
try {
Parcel out = Parcel.obtain();
writeStatsToParcelFLOCK(out);