Merge "NativeDaemonConnector: Cleanup socket code and use a proper exception Signed-off-by: San Mehat <san@google.com>"
diff --git a/Android.mk b/Android.mk
index 7717c76..f225ecd8 100644
--- a/Android.mk
+++ b/Android.mk
@@ -399,7 +399,7 @@
## SDK version identifiers used in the published docs
# major[.minor] version for current SDK. (full releases only)
-framework_docs_SDK_VERSION:=2.0.1
+framework_docs_SDK_VERSION:=2.1
# release version (ie "Release x") (full releases only)
framework_docs_SDK_REL_ID:=1
# name of current SDK directory (full releases only)
diff --git a/api/8.xml b/api/8.xml
index d5e5fc9..a07537c 100644
--- a/api/8.xml
+++ b/api/8.xml
@@ -173386,573 +173386,6 @@
</parameter>
</method>
</class>
-<class name="CallbackProxy"
- extends="android.os.Handler"
- abstract="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility=""
->
-<constructor name="CallbackProxy"
- type="android.webkit.CallbackProxy"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="context" type="android.content.Context">
-</parameter>
-<parameter name="w" type="android.webkit.WebView">
-</parameter>
-</constructor>
-<method name="addMessageToConsole"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="message" type="java.lang.String">
-</parameter>
-<parameter name="lineNumber" type="int">
-</parameter>
-<parameter name="sourceID" type="java.lang.String">
-</parameter>
-</method>
-<method name="createWindow"
- return="android.webkit.WebView"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="dialog" type="boolean">
-</parameter>
-<parameter name="userGesture" type="boolean">
-</parameter>
-</method>
-<method name="doUpdateVisitedHistory"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-<parameter name="isReload" type="boolean">
-</parameter>
-</method>
-<method name="getBackForwardList"
- return="android.webkit.WebBackForwardList"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="getProgress"
- return="int"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="getVisitedHistory"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="callback" type="android.webkit.ValueCallback<java.lang.String[]>">
-</parameter>
-</method>
-<method name="getWebChromeClient"
- return="android.webkit.WebChromeClient"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="onCloseWindow"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="window" type="android.webkit.WebView">
-</parameter>
-</method>
-<method name="onDownloadStart"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-<parameter name="userAgent" type="java.lang.String">
-</parameter>
-<parameter name="contentDisposition" type="java.lang.String">
-</parameter>
-<parameter name="mimetype" type="java.lang.String">
-</parameter>
-<parameter name="contentLength" type="long">
-</parameter>
-</method>
-<method name="onExceededDatabaseQuota"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-<parameter name="databaseIdentifier" type="java.lang.String">
-</parameter>
-<parameter name="currentQuota" type="long">
-</parameter>
-<parameter name="estimatedSize" type="long">
-</parameter>
-<parameter name="totalUsedQuota" type="long">
-</parameter>
-<parameter name="quotaUpdater" type="android.webkit.WebStorage.QuotaUpdater">
-</parameter>
-</method>
-<method name="onFormResubmission"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="dontResend" type="android.os.Message">
-</parameter>
-<parameter name="resend" type="android.os.Message">
-</parameter>
-</method>
-<method name="onGeolocationPermissionsHidePrompt"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="onGeolocationPermissionsShowPrompt"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="origin" type="java.lang.String">
-</parameter>
-<parameter name="callback" type="android.webkit.GeolocationPermissions.Callback">
-</parameter>
-</method>
-<method name="onJsAlert"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-<parameter name="message" type="java.lang.String">
-</parameter>
-</method>
-<method name="onJsBeforeUnload"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-<parameter name="message" type="java.lang.String">
-</parameter>
-</method>
-<method name="onJsConfirm"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-<parameter name="message" type="java.lang.String">
-</parameter>
-</method>
-<method name="onJsPrompt"
- return="java.lang.String"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-<parameter name="message" type="java.lang.String">
-</parameter>
-<parameter name="defaultValue" type="java.lang.String">
-</parameter>
-</method>
-<method name="onJsTimeout"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="onLoadResource"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-</method>
-<method name="onPageFinished"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-</method>
-<method name="onPageStarted"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-<parameter name="favicon" type="android.graphics.Bitmap">
-</parameter>
-</method>
-<method name="onProgressChanged"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="newProgress" type="int">
-</parameter>
-</method>
-<method name="onReachedMaxAppCacheSize"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="spaceNeeded" type="long">
-</parameter>
-<parameter name="totalUsedQuota" type="long">
-</parameter>
-<parameter name="quotaUpdater" type="android.webkit.WebStorage.QuotaUpdater">
-</parameter>
-</method>
-<method name="onReceivedError"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="errorCode" type="int">
-</parameter>
-<parameter name="description" type="java.lang.String">
-</parameter>
-<parameter name="failingUrl" type="java.lang.String">
-</parameter>
-</method>
-<method name="onReceivedHttpAuthRequest"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="handler" type="android.webkit.HttpAuthHandler">
-</parameter>
-<parameter name="hostName" type="java.lang.String">
-</parameter>
-<parameter name="realmName" type="java.lang.String">
-</parameter>
-</method>
-<method name="onReceivedIcon"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="icon" type="android.graphics.Bitmap">
-</parameter>
-</method>
-<method name="onReceivedTitle"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="title" type="java.lang.String">
-</parameter>
-</method>
-<method name="onRequestFocus"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="onSavePassword"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="schemePlusHost" type="java.lang.String">
-</parameter>
-<parameter name="username" type="java.lang.String">
-</parameter>
-<parameter name="password" type="java.lang.String">
-</parameter>
-<parameter name="resumeMsg" type="android.os.Message">
-</parameter>
-</method>
-<method name="onScaleChanged"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="oldScale" type="float">
-</parameter>
-<parameter name="newScale" type="float">
-</parameter>
-</method>
-<method name="onTooManyRedirects"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="cancelMsg" type="android.os.Message">
-</parameter>
-<parameter name="continueMsg" type="android.os.Message">
-</parameter>
-</method>
-<method name="onUnhandledKeyEvent"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="event" type="android.view.KeyEvent">
-</parameter>
-</method>
-<method name="setDownloadListener"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="client" type="android.webkit.DownloadListener">
-</parameter>
-</method>
-<method name="setWebChromeClient"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="client" type="android.webkit.WebChromeClient">
-</parameter>
-</method>
-<method name="setWebViewClient"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="client" type="android.webkit.WebViewClient">
-</parameter>
-</method>
-<method name="shouldOverrideUrlLoading"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-</method>
-<method name="uiOverrideKeyEvent"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="event" type="android.view.KeyEvent">
-</parameter>
-</method>
-<method name="uiOverrideUrlLoading"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="overrideUrl" type="java.lang.String">
-</parameter>
-</method>
-</class>
<class name="CookieManager"
extends="java.lang.Object"
abstract="false"
@@ -174438,16 +173871,6 @@
visibility="protected"
>
</method>
-<field name="mProxy"
- type="android.webkit.CallbackProxy"
- transient="false"
- volatile="false"
- static="false"
- final="true"
- deprecated="not deprecated"
- visibility="protected"
->
-</field>
<field name="mResult"
type="boolean"
transient="false"
diff --git a/api/current.xml b/api/current.xml
index b03f826..f560014 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -17644,6 +17644,17 @@
<exception name="SecurityException" type="java.lang.SecurityException">
</exception>
</method>
+<method name="isUserAMonkey"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="killBackgroundProcesses"
return="void"
abstract="false"
@@ -20457,7 +20468,7 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="mode" type="int">
+<parameter name="quality" type="int">
</parameter>
</method>
<method name="getPasswordMinimumLength"
@@ -20473,7 +20484,7 @@
<parameter name="admin" type="android.content.ComponentName">
</parameter>
</method>
-<method name="getPasswordMode"
+<method name="getPasswordQuality"
return="int"
abstract="false"
native="false"
@@ -20592,7 +20603,7 @@
<parameter name="length" type="int">
</parameter>
</method>
-<method name="setPasswordMode"
+<method name="setPasswordQuality"
return="void"
abstract="false"
native="false"
@@ -20604,7 +20615,7 @@
>
<parameter name="admin" type="android.content.ComponentName">
</parameter>
-<parameter name="mode" type="int">
+<parameter name="quality" type="int">
</parameter>
</method>
<method name="wipeData"
@@ -20664,40 +20675,40 @@
visibility="public"
>
</field>
-<field name="PASSWORD_MODE_ALPHANUMERIC"
+<field name="PASSWORD_QUALITY_ALPHANUMERIC"
type="int"
transient="false"
volatile="false"
- value="3000"
+ value="196608"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
-<field name="PASSWORD_MODE_NUMERIC"
+<field name="PASSWORD_QUALITY_NUMERIC"
type="int"
transient="false"
volatile="false"
- value="2000"
+ value="131072"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
-<field name="PASSWORD_MODE_SOMETHING"
+<field name="PASSWORD_QUALITY_SOMETHING"
type="int"
transient="false"
volatile="false"
- value="1000"
+ value="65536"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
-<field name="PASSWORD_MODE_UNSPECIFIED"
+<field name="PASSWORD_QUALITY_UNSPECIFIED"
type="int"
transient="false"
volatile="false"
@@ -52371,6 +52382,25 @@
<exception name="SQLException" type="android.database.SQLException">
</exception>
</method>
+<method name="insertWithOnConflict"
+ return="long"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="table" type="java.lang.String">
+</parameter>
+<parameter name="nullColumnHack" type="java.lang.String">
+</parameter>
+<parameter name="initialValues" type="android.content.ContentValues">
+</parameter>
+<parameter name="conflictAlgorithm" type="int">
+</parameter>
+</method>
<method name="isDbLockedByCurrentThread"
return="boolean"
abstract="false"
@@ -52806,6 +52836,27 @@
<parameter name="whereArgs" type="java.lang.String[]">
</parameter>
</method>
+<method name="updateWithOnConflict"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="table" type="java.lang.String">
+</parameter>
+<parameter name="values" type="android.content.ContentValues">
+</parameter>
+<parameter name="whereClause" type="java.lang.String">
+</parameter>
+<parameter name="whereArgs" type="java.lang.String[]">
+</parameter>
+<parameter name="conflictAlgorithm" type="int">
+</parameter>
+</method>
<method name="yieldIfContended"
return="boolean"
abstract="false"
@@ -52897,6 +52948,81 @@
>
</field>
</class>
+<class name="SQLiteDatabase.ConflictAlgorithm"
+ extends="java.lang.Object"
+ abstract="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<field name="ABORT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="FAIL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="IGNORE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="NONE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="REPLACE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ROLLBACK"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
<interface name="SQLiteDatabase.CursorFactory"
abstract="true"
static="true"
@@ -70067,6 +70193,17 @@
visibility="public"
>
</method>
+<method name="getFocalLength"
+ return="float"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getFocusMode"
return="java.lang.String"
abstract="false"
@@ -70078,6 +70215,17 @@
visibility="public"
>
</method>
+<method name="getHorizontalViewAngle"
+ return="float"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getInt"
return="int"
abstract="false"
@@ -70234,6 +70382,17 @@
visibility="public"
>
</method>
+<method name="getSupportedJpegThumbnailSizes"
+ return="java.util.List<android.hardware.Camera.Size>"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getSupportedPictureFormats"
return="java.util.List<java.lang.Integer>"
abstract="false"
@@ -70311,6 +70470,17 @@
visibility="public"
>
</method>
+<method name="getVerticalViewAngle"
+ return="float"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getWhiteBalance"
return="java.lang.String"
abstract="false"
@@ -72158,7 +72328,7 @@
type="float"
transient="false"
volatile="false"
- value="0.001f"
+ value="0.0010f"
static="true"
final="true"
deprecated="not deprecated"
@@ -77862,17 +78032,6 @@
visibility="public"
>
</method>
-<method name="isEnabled"
- return="boolean"
- abstract="true"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
<method name="removeListener"
return="void"
abstract="true"
@@ -83660,6 +83819,122 @@
</parameter>
</method>
</class>
+<class name="ThumbnailUtils"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="ThumbnailUtils"
+ type="android.media.ThumbnailUtils"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<method name="createImageThumbnail"
+ return="android.graphics.Bitmap"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="cr" type="android.content.ContentResolver">
+</parameter>
+<parameter name="filePath" type="java.lang.String">
+</parameter>
+<parameter name="uri" type="android.net.Uri">
+</parameter>
+<parameter name="origId" type="long">
+</parameter>
+<parameter name="kind" type="int">
+</parameter>
+<parameter name="saveMini" type="boolean">
+</parameter>
+</method>
+<method name="createVideoThumbnail"
+ return="android.graphics.Bitmap"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="filePath" type="java.lang.String">
+</parameter>
+</method>
+<method name="extractMiniThumb"
+ return="android.graphics.Bitmap"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="source" type="android.graphics.Bitmap">
+</parameter>
+<parameter name="width" type="int">
+</parameter>
+<parameter name="height" type="int">
+</parameter>
+<parameter name="recycle" type="boolean">
+</parameter>
+</method>
+<field name="MINI_THUMB_TARGET_SIZE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="96"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="NO_RECYCLE_INPUT"
+ type="boolean"
+ transient="false"
+ volatile="false"
+ value="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="RECYCLE_INPUT"
+ type="boolean"
+ transient="false"
+ volatile="false"
+ value="true"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="THUMBNAIL_TARGET_SIZE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="320"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
<class name="ToneGenerator"
extends="java.lang.Object"
abstract="false"
@@ -178437,6 +178712,17 @@
visibility="public"
>
</field>
+<field name="FLAG_ALLOW_LOCK_WHILE_SCREEN_ON"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="FLAG_ALT_FOCUSABLE_IM"
type="int"
transient="false"
@@ -185604,573 +185890,6 @@
</parameter>
</method>
</class>
-<class name="CallbackProxy"
- extends="android.os.Handler"
- abstract="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility=""
->
-<constructor name="CallbackProxy"
- type="android.webkit.CallbackProxy"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="context" type="android.content.Context">
-</parameter>
-<parameter name="w" type="android.webkit.WebView">
-</parameter>
-</constructor>
-<method name="addMessageToConsole"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="message" type="java.lang.String">
-</parameter>
-<parameter name="lineNumber" type="int">
-</parameter>
-<parameter name="sourceID" type="java.lang.String">
-</parameter>
-</method>
-<method name="createWindow"
- return="android.webkit.WebView"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="dialog" type="boolean">
-</parameter>
-<parameter name="userGesture" type="boolean">
-</parameter>
-</method>
-<method name="doUpdateVisitedHistory"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-<parameter name="isReload" type="boolean">
-</parameter>
-</method>
-<method name="getBackForwardList"
- return="android.webkit.WebBackForwardList"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="getProgress"
- return="int"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="getVisitedHistory"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="callback" type="android.webkit.ValueCallback<java.lang.String[]>">
-</parameter>
-</method>
-<method name="getWebChromeClient"
- return="android.webkit.WebChromeClient"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="onCloseWindow"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="window" type="android.webkit.WebView">
-</parameter>
-</method>
-<method name="onDownloadStart"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-<parameter name="userAgent" type="java.lang.String">
-</parameter>
-<parameter name="contentDisposition" type="java.lang.String">
-</parameter>
-<parameter name="mimetype" type="java.lang.String">
-</parameter>
-<parameter name="contentLength" type="long">
-</parameter>
-</method>
-<method name="onExceededDatabaseQuota"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-<parameter name="databaseIdentifier" type="java.lang.String">
-</parameter>
-<parameter name="currentQuota" type="long">
-</parameter>
-<parameter name="estimatedSize" type="long">
-</parameter>
-<parameter name="totalUsedQuota" type="long">
-</parameter>
-<parameter name="quotaUpdater" type="android.webkit.WebStorage.QuotaUpdater">
-</parameter>
-</method>
-<method name="onFormResubmission"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="dontResend" type="android.os.Message">
-</parameter>
-<parameter name="resend" type="android.os.Message">
-</parameter>
-</method>
-<method name="onGeolocationPermissionsHidePrompt"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="onGeolocationPermissionsShowPrompt"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="origin" type="java.lang.String">
-</parameter>
-<parameter name="callback" type="android.webkit.GeolocationPermissions.Callback">
-</parameter>
-</method>
-<method name="onJsAlert"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-<parameter name="message" type="java.lang.String">
-</parameter>
-</method>
-<method name="onJsBeforeUnload"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-<parameter name="message" type="java.lang.String">
-</parameter>
-</method>
-<method name="onJsConfirm"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-<parameter name="message" type="java.lang.String">
-</parameter>
-</method>
-<method name="onJsPrompt"
- return="java.lang.String"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-<parameter name="message" type="java.lang.String">
-</parameter>
-<parameter name="defaultValue" type="java.lang.String">
-</parameter>
-</method>
-<method name="onJsTimeout"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="onLoadResource"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-</method>
-<method name="onPageFinished"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-</method>
-<method name="onPageStarted"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-<parameter name="favicon" type="android.graphics.Bitmap">
-</parameter>
-</method>
-<method name="onProgressChanged"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="newProgress" type="int">
-</parameter>
-</method>
-<method name="onReachedMaxAppCacheSize"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="spaceNeeded" type="long">
-</parameter>
-<parameter name="totalUsedQuota" type="long">
-</parameter>
-<parameter name="quotaUpdater" type="android.webkit.WebStorage.QuotaUpdater">
-</parameter>
-</method>
-<method name="onReceivedError"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="errorCode" type="int">
-</parameter>
-<parameter name="description" type="java.lang.String">
-</parameter>
-<parameter name="failingUrl" type="java.lang.String">
-</parameter>
-</method>
-<method name="onReceivedHttpAuthRequest"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="handler" type="android.webkit.HttpAuthHandler">
-</parameter>
-<parameter name="hostName" type="java.lang.String">
-</parameter>
-<parameter name="realmName" type="java.lang.String">
-</parameter>
-</method>
-<method name="onReceivedIcon"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="icon" type="android.graphics.Bitmap">
-</parameter>
-</method>
-<method name="onReceivedTitle"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="title" type="java.lang.String">
-</parameter>
-</method>
-<method name="onRequestFocus"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="onSavePassword"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="schemePlusHost" type="java.lang.String">
-</parameter>
-<parameter name="username" type="java.lang.String">
-</parameter>
-<parameter name="password" type="java.lang.String">
-</parameter>
-<parameter name="resumeMsg" type="android.os.Message">
-</parameter>
-</method>
-<method name="onScaleChanged"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="oldScale" type="float">
-</parameter>
-<parameter name="newScale" type="float">
-</parameter>
-</method>
-<method name="onTooManyRedirects"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="cancelMsg" type="android.os.Message">
-</parameter>
-<parameter name="continueMsg" type="android.os.Message">
-</parameter>
-</method>
-<method name="onUnhandledKeyEvent"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="event" type="android.view.KeyEvent">
-</parameter>
-</method>
-<method name="setDownloadListener"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="client" type="android.webkit.DownloadListener">
-</parameter>
-</method>
-<method name="setWebChromeClient"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="client" type="android.webkit.WebChromeClient">
-</parameter>
-</method>
-<method name="setWebViewClient"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="client" type="android.webkit.WebViewClient">
-</parameter>
-</method>
-<method name="shouldOverrideUrlLoading"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-</method>
-<method name="uiOverrideKeyEvent"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="event" type="android.view.KeyEvent">
-</parameter>
-</method>
-<method name="uiOverrideUrlLoading"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="overrideUrl" type="java.lang.String">
-</parameter>
-</method>
-</class>
<class name="CookieManager"
extends="java.lang.Object"
abstract="false"
@@ -186656,16 +186375,6 @@
visibility="protected"
>
</method>
-<field name="mProxy"
- type="android.webkit.CallbackProxy"
- transient="false"
- volatile="false"
- static="false"
- final="true"
- deprecated="not deprecated"
- visibility="protected"
->
-</field>
<field name="mResult"
type="boolean"
transient="false"
@@ -209680,7 +209389,7 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="t" type="T">
+<parameter name="arg0" type="T">
</parameter>
</method>
</interface>
@@ -340575,7 +340284,7 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="f" type="java.io.File">
+<parameter name="uri" type="java.lang.String">
</parameter>
<exception name="IOException" type="java.io.IOException">
</exception>
@@ -340592,7 +340301,7 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="uri" type="java.lang.String">
+<parameter name="f" type="java.io.File">
</parameter>
<exception name="IOException" type="java.io.IOException">
</exception>
diff --git a/common/java/com/android/common/speech/LoggingEvents.java b/common/java/com/android/common/speech/LoggingEvents.java
new file mode 100644
index 0000000..3b3ecb8
--- /dev/null
+++ b/common/java/com/android/common/speech/LoggingEvents.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.android.common.speech;
+
+/**
+ * Logging event constants used for Voice Search and VoiceIME. These are the
+ * keys and values of extras to be specified in logging broadcast intents.
+ * This class is used by clients of the android.speech APIs to log how the
+ * user interacts with the IME settings and speech recognition result.
+ */
+public class LoggingEvents {
+ // The name of the broadcast intent for logging.
+ public static final String ACTION_LOG_EVENT = "com.android.common.speech.LOG_EVENT";
+
+ // The extra key used for the name of the app being logged.
+ public static final String EXTRA_APP_NAME = "app_name";
+
+ // The extra key used for the name of the app issuing the VoiceSearch
+ // or VoiceIME request
+ public static final String EXTRA_CALLING_APP_NAME = "";
+
+ // The extra key used for the event value. The possible event values depend
+ // on the app being logged for, and are defined in the subclasses below.
+ public static final String EXTRA_EVENT = "extra_event";
+
+ // The extra key used to log the time in milliseconds at which the EXTRA_EVENT
+ // occurred in the client.
+ public static final String EXTRA_TIMESTAMP = "timestamp";
+
+ // The extra key used (with a boolean value of 'true') as a way to trigger a
+ // flush of the log events to the server.
+ public static final String EXTRA_FLUSH = "flush";
+
+ /**
+ * Logging event constants for voice search. Below are the extra values for
+ * {@link LoggingEvents#EXTRA_EVENT}, clustered with keys to additional
+ * extras for some events that need to be included as additional fields in
+ * the event. Note that this is not representative of *all* voice search
+ * events - only the ones that need to be reported from outside the voice
+ * search app, such as from Browser.
+ */
+ public class VoiceSearch {
+ // The app name to be used for logging VoiceSearch events.
+ public static final String APP_NAME = "googlemobile";
+
+ public static final int RETRY = 0;
+
+ public static final int N_BEST_REVEAL = 1;
+
+ public static final int N_BEST_CHOOSE = 2;
+ public static final String EXTRA_N_BEST_CHOOSE_INDEX = "index"; // value should be int
+
+ public static final int QUERY_UPDATED = 3;
+ public static final String EXTRA_QUERY_UPDATED_VALUE = "value"; // value should be String
+ }
+
+ /**
+ * Logging event constants for VoiceIME. Below are the extra values for
+ * {@link LoggingEvents#EXTRA_EVENT}, clustered with keys to additional
+ * extras for some events that need to be included as additional fields in
+ * the event.
+ */
+ public class VoiceIme {
+ // The app name to be used for logging VoiceIME events.
+ public static final String APP_NAME = "voiceime";
+
+ public static final int KEYBOARD_WARNING_DIALOG_SHOWN = 0;
+
+ public static final int KEYBOARD_WARNING_DIALOG_DISMISSED = 1;
+
+ public static final int KEYBOARD_WARNING_DIALOG_OK = 2;
+
+ public static final int KEYBOARD_WARNING_DIALOG_CANCEL = 3;
+
+ public static final int SETTINGS_WARNING_DIALOG_SHOWN = 4;
+
+ public static final int SETTINGS_WARNING_DIALOG_DISMISSED = 5;
+
+ public static final int SETTINGS_WARNING_DIALOG_OK = 6;
+
+ public static final int SETTINGS_WARNING_DIALOG_CANCEL = 7;
+
+ public static final int SWIPE_HINT_DISPLAYED = 8;
+
+ public static final int PUNCTUATION_HINT_DISPLAYED = 9;
+
+ public static final int CANCEL_DURING_LISTENING = 10;
+
+ public static final int CANCEL_DURING_WORKING = 11;
+
+ public static final int CANCEL_DURING_ERROR = 12;
+
+ public static final int ERROR = 13;
+ public static final String EXTRA_ERROR_CODE = "code"; // value should be int
+
+ public static final int START = 14;
+ public static final String EXTRA_START_LOCALE = "locale"; // value should be String
+ public static final String EXTRA_START_SWIPE = "swipe"; // value should be boolean
+
+ public static final int VOICE_INPUT_DELIVERED = 15;
+
+ public static final int N_BEST_CHOOSE = 16;
+ public static final String EXTRA_N_BEST_CHOOSE_INDEX = "index"; // value should be int
+
+ public static final int TEXT_MODIFIED = 17;
+
+ public static final int INPUT_ENDED = 18;
+
+ public static final int VOICE_INPUT_SETTING_ENABLED = 19;
+
+ public static final int VOICE_INPUT_SETTING_DISABLED = 20;
+
+ public static final int IME_TEXT_ACCEPTED = 21;
+ }
+
+}
diff --git a/common/java/com/android/common/userhappiness/UserHappinessSignals.java b/common/java/com/android/common/userhappiness/UserHappinessSignals.java
new file mode 100644
index 0000000..347bdaa
--- /dev/null
+++ b/common/java/com/android/common/userhappiness/UserHappinessSignals.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.android.common.userhappiness;
+
+import android.content.Intent;
+import android.content.Context;
+import com.android.common.speech.LoggingEvents;
+
+/**
+ * Metrics for User Happiness are recorded here. Each app can define when to
+ * call these User Happiness metrics.
+ */
+public class UserHappinessSignals {
+
+ /**
+ * Log when a user "accepted" IME text. Each application can define what
+ * it means to "accept" text. In the case of Gmail, pressing the "Send"
+ * button indicates text acceptance. We broadcast this information to
+ * VoiceSearch LoggingEvents and use it to aggregate VoiceIME Happiness Metrics
+ */
+ public static void userAcceptedImeText(Context context) {
+ // Create a Voice IME Logging intent.
+ Intent i = new Intent(LoggingEvents.ACTION_LOG_EVENT);
+ i.putExtra(LoggingEvents.EXTRA_APP_NAME, LoggingEvents.VoiceIme.APP_NAME);
+ i.putExtra(LoggingEvents.EXTRA_EVENT, LoggingEvents.VoiceIme.IME_TEXT_ACCEPTED);
+ i.putExtra(LoggingEvents.EXTRA_CALLING_APP_NAME, context.getPackageName());
+ i.putExtra(LoggingEvents.EXTRA_TIMESTAMP, System.currentTimeMillis());
+ context.sendBroadcast(i);
+ }
+
+}
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 932ad53..e8ab51fd 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -957,4 +957,15 @@
return null;
}
+ /**
+ * Returns "true" if the user interface is currently being messed with
+ * by a monkey.
+ */
+ public static boolean isUserAMonkey() {
+ try {
+ return ActivityManagerNative.getDefault().isUserAMonkey();
+ } catch (RemoteException e) {
+ }
+ return false;
+ }
}
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 09b88ee..2e39c10 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -1178,6 +1178,14 @@
int enterAnim = data.readInt();
int exitAnim = data.readInt();
overridePendingTransition(token, packageName, enterAnim, exitAnim);
+ reply.writeNoException();
+ return true;
+ }
+
+ case IS_USER_A_MONKEY_TRANSACTION: {
+ data.enforceInterface(IActivityManager.descriptor);
+ reply.writeInt(isUserAMonkey() ? 1 : 0);
+ reply.writeNoException();
return true;
}
}
@@ -2598,5 +2606,17 @@
reply.recycle();
}
+ public boolean isUserAMonkey() throws RemoteException {
+ Parcel data = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ data.writeInterfaceToken(IActivityManager.descriptor);
+ mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
+ reply.readException();
+ boolean res = reply.readInt() != 0;
+ data.recycle();
+ reply.recycle();
+ return res;
+ }
+
private IBinder mRemote;
}
diff --git a/core/java/android/app/ApplicationContext.java b/core/java/android/app/ApplicationContext.java
index fe05393..6c65bd8 100644
--- a/core/java/android/app/ApplicationContext.java
+++ b/core/java/android/app/ApplicationContext.java
@@ -71,6 +71,7 @@
import android.os.Binder;
import android.os.Bundle;
import android.os.DropBoxManager;
+import android.os.Environment;
import android.os.FileUtils;
import android.os.Handler;
import android.os.IBinder;
@@ -80,6 +81,7 @@
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.os.StatFs;
import android.os.Vibrator;
import android.os.FileUtils.FileStatus;
import android.telephony.TelephonyManager;
@@ -2537,6 +2539,76 @@
return PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
}
+ // Constants related to app heuristics
+ // No-installation limit for internal flash: 10% or less space available
+ private static final double LOW_NAND_FLASH_TRESHOLD = 0.1;
+
+ // SD-to-internal app size threshold: currently set to 1 MB
+ private static final long INSTALL_ON_SD_THRESHOLD = (1024 * 1024);
+
+ @Override
+ public int recommendAppInstallLocation(ApplicationInfo appInfo, Uri packageURI) {
+ // Initial implementation:
+ // Package size = code size + cache size + data size
+ // If code size > 1 MB, install on SD card.
+ // Else install on internal NAND flash, unless space on NAND is less than 10%
+
+ if ((packageURI == null) || (appInfo == null)) {
+ return INSTALL_PARSE_FAILED_NOT_APK;
+ }
+
+ StatFs internalFlashStats = new StatFs(Environment.getDataDirectory().getPath());
+ StatFs sdcardStats = new StatFs(Environment.getExternalStorageDirectory().getPath());
+
+ long totalInternalFlashSize = (long)internalFlashStats.getBlockCount() *
+ (long)internalFlashStats.getBlockSize();
+ long availInternalFlashSize = (long)internalFlashStats.getAvailableBlocks() *
+ (long)internalFlashStats.getBlockSize();
+ long availSDSize = (long)sdcardStats.getAvailableBlocks() *
+ (long)sdcardStats.getBlockSize();
+
+ double pctNandFree = (double)availInternalFlashSize / (double)totalInternalFlashSize;
+
+ final String archiveFilePath = packageURI.getPath();
+ File apkFile = new File(archiveFilePath);
+ long pkgLen = apkFile.length();
+
+ // Consider application flags preferences as well...
+ boolean installOnlyOnSD = ((appInfo.flags & PackageManager.INSTALL_ON_SDCARD) != 0);
+
+ // These are not very precise measures, but I guess it is hard to estimate sizes
+ // before installing the package.
+ // As a shortcut, I am assuming that the package fits on NAND flash if the available
+ // space is three times that of the APK size. For SD, we only worry about the APK size.
+ // Since packages are downloaded into SD, this might not even be necessary.
+ boolean fitsOnSD = (pkgLen < availSDSize) && ((2 * pkgLen) < availInternalFlashSize);
+ boolean fitsOnInternalFlash = ((pkgLen * 3) < availInternalFlashSize);
+
+ // Does not fit, recommend no installation.
+ if (!fitsOnSD && !fitsOnInternalFlash) {
+ return INSTALL_FAILED_INSUFFICIENT_STORAGE;
+ }
+
+ if (pkgLen < (INSTALL_ON_SD_THRESHOLD) && fitsOnInternalFlash && !(installOnlyOnSD)) {
+ // recommend internal NAND likely
+ if (pctNandFree < LOW_NAND_FLASH_TRESHOLD) {
+ // Low space on NAND (<10%) - install on SD
+ return INSTALL_ON_SDCARD;
+ }
+ return INSTALL_ON_INTERNAL_FLASH;
+ } else {
+ if (fitsOnSD) {
+ // Recommend SD card
+ return INSTALL_ON_SDCARD;
+ } else if (fitsOnInternalFlash && (pctNandFree >= LOW_NAND_FLASH_TRESHOLD) &&
+ !(installOnlyOnSD)) {
+ return INSTALL_ON_INTERNAL_FLASH;
+ } else {
+ return INSTALL_FAILED_INSUFFICIENT_STORAGE;
+ }
+ }
+ }
+
private final ApplicationContext mContext;
private final IPackageManager mPM;
diff --git a/core/java/android/app/BackupAgent.java b/core/java/android/app/BackupAgent.java
index 2a58677..35b6fed 100644
--- a/core/java/android/app/BackupAgent.java
+++ b/core/java/android/app/BackupAgent.java
@@ -19,6 +19,7 @@
import android.app.IBackupAgent;
import android.backup.BackupDataInput;
import android.backup.BackupDataOutput;
+import android.backup.IBackupManager;
import android.content.Context;
import android.content.ContextWrapper;
import android.os.Binder;
@@ -94,12 +95,9 @@
// ----- Core implementation -----
-
- /**
- * Returns the private interface called by the backup system. Applications will
- * not typically override this.
- */
- public IBinder onBind() {
+
+ /** @hide */
+ public final IBinder onBind() {
return mBinder;
}
@@ -116,9 +114,10 @@
public void doBackup(ParcelFileDescriptor oldState,
ParcelFileDescriptor data,
- ParcelFileDescriptor newState) throws RemoteException {
+ ParcelFileDescriptor newState,
+ int token, IBackupManager callbackBinder) throws RemoteException {
// Ensure that we're running with the app's normal permission level
- long token = Binder.clearCallingIdentity();
+ long ident = Binder.clearCallingIdentity();
if (DEBUG) Log.v(TAG, "doBackup() invoked");
BackupDataOutput output = new BackupDataOutput(data.getFileDescriptor());
@@ -131,14 +130,20 @@
Log.d(TAG, "onBackup (" + BackupAgent.this.getClass().getName() + ") threw", ex);
throw ex;
} finally {
- Binder.restoreCallingIdentity(token);
+ Binder.restoreCallingIdentity(ident);
+ try {
+ callbackBinder.opComplete(token);
+ } catch (RemoteException e) {
+ // we'll time out anyway, so we're safe
+ }
}
}
public void doRestore(ParcelFileDescriptor data, int appVersionCode,
- ParcelFileDescriptor newState) throws RemoteException {
+ ParcelFileDescriptor newState,
+ int token, IBackupManager callbackBinder) throws RemoteException {
// Ensure that we're running with the app's normal permission level
- long token = Binder.clearCallingIdentity();
+ long ident = Binder.clearCallingIdentity();
if (DEBUG) Log.v(TAG, "doRestore() invoked");
BackupDataInput input = new BackupDataInput(data.getFileDescriptor());
@@ -151,7 +156,12 @@
Log.d(TAG, "onRestore (" + BackupAgent.this.getClass().getName() + ") threw", ex);
throw ex;
} finally {
- Binder.restoreCallingIdentity(token);
+ Binder.restoreCallingIdentity(ident);
+ try {
+ callbackBinder.opComplete(token);
+ } catch (RemoteException e) {
+ // we'll time out anyway, so we're safe
+ }
}
}
}
diff --git a/core/java/android/app/DeviceAdmin.java b/core/java/android/app/DeviceAdmin.java
index b9a84b7..ecbad01 100644
--- a/core/java/android/app/DeviceAdmin.java
+++ b/core/java/android/app/DeviceAdmin.java
@@ -34,15 +34,13 @@
* {@link android.Manifest.permission#BIND_DEVICE_ADMIN} permission. A typical
* manifest entry would look like:</p>
*
- * <pre>{@include development/samples/ApiDemos/AndroidManifest.xml
- * device_admin_declaration}</pre>
+ * {@sample development/samples/ApiDemos/AndroidManifest.xml device_admin_declaration}
*
* <p>The meta-data referenced here provides addition information specific
* to the device administrator, as parsed by the {@link DeviceAdminInfo} class.
* A typical file would be:</p>
*
- * <pre>{@include development/samples/ApiDemos/res/xml/sample_device_admin.xml
- * meta_data}</pre>
+ * {@sample development/samples/ApiDemos/res/xml/sample_device_admin.xml meta_data}
*/
public class DeviceAdmin extends BroadcastReceiver {
private static String TAG = "DevicePolicy";
diff --git a/core/java/android/app/DeviceAdminInfo.java b/core/java/android/app/DeviceAdminInfo.java
index 50b342b..ab9c44f 100644
--- a/core/java/android/app/DeviceAdminInfo.java
+++ b/core/java/android/app/DeviceAdminInfo.java
@@ -50,7 +50,7 @@
/**
* A type of policy that this device admin can use: limit the passwords
- * that the user can select, via {@link DevicePolicyManager#setPasswordMode}
+ * that the user can select, via {@link DevicePolicyManager#setPasswordQuality}
* and {@link DevicePolicyManager#setPasswordMinimumLength}.
*
* <p>To control this policy, the device admin must have a "limit-password"
diff --git a/core/java/android/app/DevicePolicyManager.java b/core/java/android/app/DevicePolicyManager.java
index 779db3a..08cdd05 100644
--- a/core/java/android/app/DevicePolicyManager.java
+++ b/core/java/android/app/DevicePolicyManager.java
@@ -88,7 +88,7 @@
/**
* Activity action: have the user enter a new password. This activity
- * should be launched after using {@link #setPasswordMode(ComponentName, int)}
+ * should be launched after using {@link #setPasswordQuality(ComponentName, int)}
* or {@link #setPasswordMinimumLength(ComponentName, int)} to have the
* user enter a new password that meets the current requirements. You can
* use {@link #isActivePasswordSufficient()} to determine whether you need
@@ -149,32 +149,33 @@
}
/**
- * Constant for {@link #setPasswordMode}: the policy has no requirements
- * for the password. Note that mode constants are ordered so that higher
+ * Constant for {@link #setPasswordQuality}: the policy has no requirements
+ * for the password. Note that quality constants are ordered so that higher
* values are more restrictive.
*/
- public static final int PASSWORD_MODE_UNSPECIFIED = 0;
+ public static final int PASSWORD_QUALITY_UNSPECIFIED = 0;
/**
- * Constant for {@link #setPasswordMode}: the policy requires some kind
- * of password, but doesn't care what it is. Note that mode constants
+ * Constant for {@link #setPasswordQuality}: the policy requires some kind
+ * of password, but doesn't care what it is. Note that quality constants
* are ordered so that higher values are more restrictive.
*/
- public static final int PASSWORD_MODE_SOMETHING = 1000;
+ public static final int PASSWORD_QUALITY_SOMETHING = 0x10000;
/**
- * Constant for {@link #setPasswordMode}: the user must have at least a
- * numeric password. Note that mode constants are ordered so that higher
- * values are more restrictive.
+ * Constant for {@link #setPasswordQuality}: the user must have entered a
+ * password containing at least numeric characters. Note that quality
+ * constants are ordered so that higher values are more restrictive.
*/
- public static final int PASSWORD_MODE_NUMERIC = 2000;
+ public static final int PASSWORD_QUALITY_NUMERIC = 0x20000;
/**
- * Constant for {@link #setPasswordMode}: the user must have at least an
- * alphanumeric password. Note that mode constants are ordered so that higher
- * values are more restrictive.
+ * Constant for {@link #setPasswordQuality}: the user must have entered a
+ * password containing at least <em>both></em> numeric <em>and</em>
+ * alphabeter (or other symbol) characters. Note that quality constants are
+ * ordered so that higher values are more restrictive.
*/
- public static final int PASSWORD_MODE_ALPHANUMERIC = 3000;
+ public static final int PASSWORD_QUALITY_ALPHANUMERIC = 0x30000;
/**
* Called by an application that is administering the device to set the
@@ -185,8 +186,8 @@
* take place immediately. To prompt the user for a new password, use
* {@link #ACTION_SET_NEW_PASSWORD} after setting this value.
*
- * <p>Mode constants are ordered so that higher values are more restrictive;
- * thus the highest requested mode constant (between the policy set here,
+ * <p>Quality constants are ordered so that higher values are more restrictive;
+ * thus the highest requested quality constant (between the policy set here,
* the user's preference, and any other considerations) is the one that
* is in effect.
*
@@ -195,14 +196,14 @@
* this method; if it has not, a security exception will be thrown.
*
* @param admin Which {@link DeviceAdmin} this request is associated with.
- * @param mode The new desired mode. One of
- * {@link #PASSWORD_MODE_UNSPECIFIED}, {@link #PASSWORD_MODE_SOMETHING},
- * {@link #PASSWORD_MODE_NUMERIC}, or {@link #PASSWORD_MODE_ALPHANUMERIC}.
+ * @param quality The new desired quality. One of
+ * {@link #PASSWORD_QUALITY_UNSPECIFIED}, {@link #PASSWORD_QUALITY_SOMETHING},
+ * {@link #PASSWORD_QUALITY_NUMERIC}, or {@link #PASSWORD_QUALITY_ALPHANUMERIC}.
*/
- public void setPasswordMode(ComponentName admin, int mode) {
+ public void setPasswordQuality(ComponentName admin, int quality) {
if (mService != null) {
try {
- mService.setPasswordMode(admin, mode);
+ mService.setPasswordQuality(admin, quality);
} catch (RemoteException e) {
Log.w(TAG, "Failed talking with device policy service", e);
}
@@ -210,20 +211,20 @@
}
/**
- * Retrieve the current minimum password mode for all admins
+ * Retrieve the current minimum password quality for all admins
* or a particular one.
* @param admin The name of the admin component to check, or null to aggregate
* all admins.
*/
- public int getPasswordMode(ComponentName admin) {
+ public int getPasswordQuality(ComponentName admin) {
if (mService != null) {
try {
- return mService.getPasswordMode(admin);
+ return mService.getPasswordQuality(admin);
} catch (RemoteException e) {
Log.w(TAG, "Failed talking with device policy service", e);
}
}
- return PASSWORD_MODE_UNSPECIFIED;
+ return PASSWORD_QUALITY_UNSPECIFIED;
}
/**
@@ -235,8 +236,8 @@
* take place immediately. To prompt the user for a new password, use
* {@link #ACTION_SET_NEW_PASSWORD} after setting this value. This
* constraint is only imposed if the administrator has also requested either
- * {@link #PASSWORD_MODE_NUMERIC} or {@link #PASSWORD_MODE_ALPHANUMERIC}
- * with {@link #setPasswordMode}.
+ * {@link #PASSWORD_QUALITY_NUMERIC} or {@link #PASSWORD_QUALITY_ALPHANUMERIC}
+ * with {@link #setPasswordQuality}.
*
* <p>The calling device admin must have requested
* {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call
@@ -275,18 +276,18 @@
/**
* Return the maximum password length that the device supports for a
- * particular password mode.
- * @param mode The mode being interrogated.
+ * particular password quality.
+ * @param quality The quality being interrogated.
* @return Returns the maximum length that the user can enter.
*/
- public int getPasswordMaximumLength(int mode) {
+ public int getPasswordMaximumLength(int quality) {
// Kind-of arbitrary.
return 16;
}
/**
* Determine whether the current password the user has set is sufficient
- * to meet the policy requirements (mode, minimum length) that have been
+ * to meet the policy requirements (quality, minimum length) that have been
* requested.
*
* <p>The calling device admin must have requested
@@ -368,14 +369,15 @@
}
/**
- * Force a new password on the user. This takes effect immediately. The
- * given password must meet the current password minimum length constraint
- * or it will be rejected. The given password will be accepted regardless
- * of the current password mode, automatically adjusting the password mode
- * higher if needed to meet the requirements of all active administrators.
- * (The string you give here is acceptable for any mode;
- * if it contains only digits, that is still an acceptable alphanumeric
- * password.)
+ * Force a new password on the user. This takes effect immediately.
+ * The given password must be sufficient for the
+ * current password quality and length constraints as returned by
+ * {@link #getPasswordQuality(ComponentName)} and
+ * {@link #getPasswordMinimumLength(ComponentName)}; if it does not meet
+ * these constraints, then it will be rejected and false returned. Note
+ * that the password may be a stronger quality (containing alphanumeric
+ * characters when the requested quality is only numeric), in which case
+ * the currently active quality will be increased to match.
*
* <p>The calling device admin must have requested
* {@link DeviceAdminInfo#USES_POLICY_RESET_PASSWORD} to be able to call
@@ -531,10 +533,10 @@
/**
* @hide
*/
- public void setActivePasswordState(int mode, int length) {
+ public void setActivePasswordState(int quality, int length) {
if (mService != null) {
try {
- mService.setActivePasswordState(mode, length);
+ mService.setActivePasswordState(quality, length);
} catch (RemoteException e) {
Log.w(TAG, "Failed talking with device policy service", e);
}
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index 016d465..86f28bf 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -288,6 +288,8 @@
public void overridePendingTransition(IBinder token, String packageName,
int enterAnim, int exitAnim) throws RemoteException;
+ public boolean isUserAMonkey() throws RemoteException;
+
/*
* Private non-Binder interfaces
*/
@@ -450,4 +452,5 @@
int OVERRIDE_PENDING_TRANSITION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+100;
int HANDLE_APPLICATION_WTF_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+101;
int KILL_BACKGROUND_PROCESSES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+102;
+ int IS_USER_A_MONKEY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+103;
}
diff --git a/core/java/android/app/IBackupAgent.aidl b/core/java/android/app/IBackupAgent.aidl
index 9b0550f..0de6ad9 100644
--- a/core/java/android/app/IBackupAgent.aidl
+++ b/core/java/android/app/IBackupAgent.aidl
@@ -16,6 +16,7 @@
package android.app;
+import android.backup.IBackupManager;
import android.os.ParcelFileDescriptor;
/**
@@ -25,7 +26,7 @@
*
* {@hide}
*/
-interface IBackupAgent {
+oneway interface IBackupAgent {
/**
* Request that the app perform an incremental backup.
*
@@ -39,10 +40,18 @@
*
* @param newState Read-write file, empty when onBackup() is called,
* where the new state blob is to be recorded.
+ *
+ * @param token Opaque token identifying this transaction. This must
+ * be echoed back to the backup service binder once the new
+ * data has been written to the data and newState files.
+ *
+ * @param callbackBinder Binder on which to indicate operation completion,
+ * passed here as a convenience to the agent.
*/
void doBackup(in ParcelFileDescriptor oldState,
in ParcelFileDescriptor data,
- in ParcelFileDescriptor newState);
+ in ParcelFileDescriptor newState,
+ int token, IBackupManager callbackBinder);
/**
* Restore an entire data snapshot to the application.
@@ -58,7 +67,15 @@
* @param newState Read-write file, empty when onRestore() is called,
* that is to be written with the state description that holds after
* the restore has been completed.
+ *
+ * @param token Opaque token identifying this transaction. This must
+ * be echoed back to the backup service binder once the agent is
+ * finished restoring the application based on the restore data
+ * contents.
+ *
+ * @param callbackBinder Binder on which to indicate operation completion,
+ * passed here as a convenience to the agent.
*/
void doRestore(in ParcelFileDescriptor data, int appVersionCode,
- in ParcelFileDescriptor newState);
+ in ParcelFileDescriptor newState, int token, IBackupManager callbackBinder);
}
diff --git a/core/java/android/app/IDevicePolicyManager.aidl b/core/java/android/app/IDevicePolicyManager.aidl
index 8d804f9..ae5c4bf 100644
--- a/core/java/android/app/IDevicePolicyManager.aidl
+++ b/core/java/android/app/IDevicePolicyManager.aidl
@@ -25,8 +25,8 @@
* {@hide}
*/
interface IDevicePolicyManager {
- void setPasswordMode(in ComponentName who, int mode);
- int getPasswordMode(in ComponentName who);
+ void setPasswordQuality(in ComponentName who, int quality);
+ int getPasswordQuality(in ComponentName who);
void setPasswordMinimumLength(in ComponentName who, int length);
int getPasswordMinimumLength(in ComponentName who);
@@ -52,7 +52,7 @@
void getRemoveWarning(in ComponentName policyReceiver, in RemoteCallback result);
void removeActiveAdmin(in ComponentName policyReceiver);
- void setActivePasswordState(int mode, int length);
+ void setActivePasswordState(int quality, int length);
void reportFailedPasswordAttempt();
void reportSuccessfulPasswordAttempt();
}
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index 3dfbe71..ec9f3b4 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -903,15 +903,14 @@
if (mSearchable == null) {
return;
}
+ SearchableInfo searchable = mSearchable;
+ // First stop the existing search before starting voice search, or else we'll end
+ // up showing the search dialog again once we return to the app.
+ cancel();
try {
- // First stop the existing search before starting voice search, or else we'll end
- // up showing the search dialog again once we return to the app.
- ((SearchManager) getContext().getSystemService(Context.SEARCH_SERVICE)).
- stopSearch();
-
- if (mSearchable.getVoiceSearchLaunchWebSearch()) {
+ if (searchable.getVoiceSearchLaunchWebSearch()) {
getContext().startActivity(mVoiceWebSearchIntent);
- } else if (mSearchable.getVoiceSearchLaunchRecognizer()) {
+ } else if (searchable.getVoiceSearchLaunchRecognizer()) {
Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent);
getContext().startActivity(appSearchIntent);
}
diff --git a/core/java/android/app/Service.java b/core/java/android/app/Service.java
index c4e1877..8ec5bd4 100644
--- a/core/java/android/app/Service.java
+++ b/core/java/android/app/Service.java
@@ -292,8 +292,8 @@
* callback in that case. The <code>handleCommand</code> method is implemented by
* you as appropriate:
*
- * <pre>{@include development/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java
- * start_compatibility}</pre>
+ * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java
+ * start_compatibility}
*
* @param intent The Intent supplied to {@link android.content.Context#startService},
* as given. This may be null if the service is being restarted after
@@ -474,8 +474,8 @@
* level 5, you can use the following model to call the the older {@link #setForeground}
* or this modern method as appropriate:
*
- * <pre>{@include development/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java
- * foreground_compatibility}</pre>
+ * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java
+ * foreground_compatibility}
*
* @param id The identifier for this notification as per
* {@link NotificationManager#notify(int, Notification)
diff --git a/core/java/android/backup/IBackupManager.aidl b/core/java/android/backup/IBackupManager.aidl
index 9d181be..cb775f7 100644
--- a/core/java/android/backup/IBackupManager.aidl
+++ b/core/java/android/backup/IBackupManager.aidl
@@ -130,4 +130,14 @@
* @return An interface to the restore session, or null on error.
*/
IRestoreSession beginRestoreSession(String transportID);
+
+ /**
+ * Notify the backup manager that a BackupAgent has completed the operation
+ * corresponding to the given token.
+ *
+ * @param token The transaction token passed to a BackupAgent's doBackup() or
+ * doRestore() method.
+ * {@hide}
+ */
+ void opComplete(int token);
}
diff --git a/core/java/android/backup/RestoreSession.java b/core/java/android/backup/RestoreSession.java
index 119fc52..6b35fe8 100644
--- a/core/java/android/backup/RestoreSession.java
+++ b/core/java/android/backup/RestoreSession.java
@@ -21,6 +21,7 @@
import android.backup.RestoreSet;
import android.content.Context;
import android.os.Handler;
+import android.os.Message;
import android.os.RemoteException;
import android.util.Log;
@@ -109,70 +110,51 @@
/*
* We wrap incoming binder calls with a private class implementation that
- * redirects them into main-thread actions. This accomplishes two things:
- * first, it ensures that the app's code is run on their own main thread,
- * never with system Binder identity; and second, it serializes the restore
+ * redirects them into main-thread actions. This serializes the restore
* progress callbacks nicely within the usual main-thread lifecycle pattern.
*/
private class RestoreObserverWrapper extends IRestoreObserver.Stub {
final Handler mHandler;
final RestoreObserver mAppObserver;
+ static final int MSG_RESTORE_STARTING = 1;
+ static final int MSG_UPDATE = 2;
+ static final int MSG_RESTORE_FINISHED = 3;
+
RestoreObserverWrapper(Context context, RestoreObserver appObserver) {
- mHandler = new Handler(context.getMainLooper());
+ mHandler = new Handler(context.getMainLooper()) {
+ @Override
+ public void handleMessage(Message msg) {
+ switch (msg.what) {
+ case MSG_RESTORE_STARTING:
+ mAppObserver.restoreStarting(msg.arg1);
+ break;
+ case MSG_UPDATE:
+ mAppObserver.onUpdate(msg.arg1);
+ break;
+ case MSG_RESTORE_FINISHED:
+ mAppObserver.restoreFinished(msg.arg1);
+ break;
+ }
+ }
+ };
mAppObserver = appObserver;
}
- // Wrap the IRestoreObserver -> RestoreObserver callthrough in Runnables
- // posted to the app's main thread looper.
- class RestoreStartingRunnable implements Runnable {
- int mNumPackages;
-
- RestoreStartingRunnable(int numPackages) {
- mNumPackages = numPackages;
- }
-
- public void run() {
- mAppObserver.restoreStarting(mNumPackages);
- }
- }
-
- class OnUpdateRunnable implements Runnable {
- int mNowRestoring;
-
- OnUpdateRunnable(int nowRestoring) {
- mNowRestoring = nowRestoring;
- }
-
- public void run() {
- mAppObserver.onUpdate(mNowRestoring);
- }
- }
-
- class RestoreFinishedRunnable implements Runnable {
- int mError;
-
- RestoreFinishedRunnable(int error) {
- mError = error;
- }
-
- public void run() {
- mAppObserver.restoreFinished(mError);
- }
- }
-
- // The actual redirection code is quite simple using just the
- // above Runnable subclasses
+ // Binder calls into this object just enqueue on the main-thread handler
public void restoreStarting(int numPackages) {
- mHandler.post(new RestoreStartingRunnable(numPackages));
+ mHandler.sendMessage(
+ mHandler.obtainMessage(MSG_RESTORE_STARTING, numPackages, 0));
}
public void onUpdate(int nowBeingRestored) {
- mHandler.post(new OnUpdateRunnable(nowBeingRestored));
+ mHandler.sendMessage(
+ mHandler.obtainMessage(MSG_UPDATE, nowBeingRestored, 0));
}
public void restoreFinished(int error) {
- mHandler.post(new RestoreFinishedRunnable(error));
+ mHandler.sendMessage(
+ mHandler.obtainMessage(MSG_RESTORE_FINISHED, error, 0));
}
}
}
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index bc59c94..1e45f17 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -27,6 +27,8 @@
import android.content.res.XmlResourceParser;
import android.graphics.drawable.Drawable;
import android.net.Uri;
+import android.os.Environment;
+import android.os.StatFs;
import android.util.AndroidException;
import android.util.DisplayMetrics;
@@ -259,6 +261,13 @@
public static final int INSTALL_ON_SDCARD = 0x00000008;
/**
+ * Convenience flag parameter to indicate that this package has to be installed
+ * on internal flash.
+ * @hide
+ */
+ public static final int INSTALL_ON_INTERNAL_FLASH = 0x00000000;
+
+ /**
* Flag parameter for
* {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate
* that you don't want to kill the app containing the component. Be careful when you set this
@@ -602,7 +611,23 @@
*/
@SdkConstant(SdkConstantType.FEATURE)
public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
-
+
+ /**
+ * Determines best place to install an application: either SD or internal FLASH.
+ * Tweak the algorithm for best results.
+ * @param appInfo ApplicationInfo object og the package to install.
+ * Call utility method to obtain.
+ * @param packageURI URI identifying the package's APK file.
+ * @return <code>INSTALL_ON_INTERNAL_FLASH</code> if it is best to install package on internal
+ * storage, <code>INSTALL_ON_SDCARD</code> if it is best to install package on SD card,
+ * and <code>INSTALL_FAILED_INSUFFICIENT_STORAGE</code> if insufficient space to safely install
+ * the application. <code>INSTALL_PARSE_FAILED_NOT_APK</code> Is returned if any input
+ * parameter is <code>null</code>.
+ * This recommendation does take into account the package's own flags.
+ * @hide
+ */
+ public abstract int recommendAppInstallLocation(ApplicationInfo appInfo, Uri packageURI);
+
/**
* Retrieve overall information about an application package that is
* installed on the system.
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index 82490bb..e4b0191 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -65,9 +65,8 @@
/**
* Algorithms used in ON CONFLICT clause
* http://www.sqlite.org/lang_conflict.html
- * @hide
*/
- public enum ConflictAlgorithm {
+ public static final class ConflictAlgorithm {
/**
* When a constraint violation occurs, an immediate ROLLBACK occurs,
* thus ending the current transaction, and the command aborts with a
@@ -75,14 +74,14 @@
* (other than the implied transaction that is created on every command)
* then this algorithm works the same as ABORT.
*/
- ROLLBACK("ROLLBACK"),
+ public static final int ROLLBACK = 1;
/**
* When a constraint violation occurs,no ROLLBACK is executed
* so changes from prior commands within the same transaction
* are preserved. This is the default behavior.
*/
- ABORT("ABORT"),
+ public static final int ABORT = 2;
/**
* When a constraint violation occurs, the command aborts with a return
@@ -90,7 +89,7 @@
* the command made prior to encountering the constraint violation
* are preserved and are not backed out.
*/
- FAIL("FAIL"),
+ public static final int FAIL = 3;
/**
* When a constraint violation occurs, the one row that contains
@@ -99,7 +98,7 @@
* after the row that contained the constraint violation continue to be
* inserted or updated normally. No error is returned.
*/
- IGNORE("IGNORE"),
+ public static final int IGNORE = 4;
/**
* When a UNIQUE constraint violation occurs, the pre-existing rows that
@@ -114,15 +113,16 @@
* it does not invoke delete triggers on those rows.
* This behavior might change in a future release.
*/
- REPLACE("REPLACE");
+ public static final int REPLACE = 5;
- private final String mValue;
- ConflictAlgorithm(String value) {
- mValue = value;
- }
- public String value() {
- return mValue;
- }
+ /**
+ * use the following when no conflict action is specified.
+ */
+ public static final int NONE = 0;
+ private static final String[] VALUES = new String[]
+ {"", " OR ROLLBACK ", " OR ABORT ", " OR FAIL ", " OR IGNORE ", " OR REPLACE "};
+
+ private ConflictAlgorithm() {} // disable instantiation of this class
}
/**
@@ -290,6 +290,10 @@
@Override
protected void onAllReferencesReleased() {
if (isOpen()) {
+ if (SQLiteDebug.DEBUG_CAPTURE_SQL) {
+ Log.d(TAG, "captured_sql|" + mPath + "|DETACH DATABASE " +
+ getDatabaseName(mPath) + ";");
+ }
if (SQLiteDebug.DEBUG_SQL_CACHE) {
mTimeClosed = getTime();
}
@@ -1334,7 +1338,7 @@
*/
public long insert(String table, String nullColumnHack, ContentValues values) {
try {
- return insertWithOnConflict(table, nullColumnHack, values, null);
+ return insertWithOnConflict(table, nullColumnHack, values, ConflictAlgorithm.NONE);
} catch (SQLException e) {
Log.e(TAG, "Error inserting " + values, e);
return -1;
@@ -1356,7 +1360,7 @@
*/
public long insertOrThrow(String table, String nullColumnHack, ContentValues values)
throws SQLException {
- return insertWithOnConflict(table, nullColumnHack, values, null);
+ return insertWithOnConflict(table, nullColumnHack, values, ConflictAlgorithm.NONE);
}
/**
@@ -1408,12 +1412,14 @@
* @param initialValues this map contains the initial column values for the
* row. The keys should be the column names and the values the
* column values
- * @param algorithm {@link ConflictAlgorithm} for insert conflict resolver
- * @return the row ID of the newly inserted row, or -1 if an error occurred
- * @hide
+ * @param conflictAlgorithm {@link ConflictAlgorithm} for insert conflict resolver
+ * @return the row ID of the newly inserted row
+ * OR the primary key of the existing row if the input param 'conflictAlgorithm' =
+ * {@link ConflictAlgorithm#IGNORE}
+ * OR -1 if any error
*/
public long insertWithOnConflict(String table, String nullColumnHack,
- ContentValues initialValues, ConflictAlgorithm algorithm) {
+ ContentValues initialValues, int conflictAlgorithm) {
if (!isOpen()) {
throw new IllegalStateException("database not open");
}
@@ -1421,10 +1427,7 @@
// Measurements show most sql lengths <= 152
StringBuilder sql = new StringBuilder(152);
sql.append("INSERT");
- if (algorithm != null) {
- sql.append(" OR ");
- sql.append(algorithm.value());
- }
+ sql.append(ConflictAlgorithm.VALUES[conflictAlgorithm]);
sql.append(" INTO ");
sql.append(table);
// Measurements show most values lengths < 40
@@ -1548,7 +1551,7 @@
* @return the number of rows affected
*/
public int update(String table, ContentValues values, String whereClause, String[] whereArgs) {
- return updateWithOnConflict(table, values, whereClause, whereArgs, null);
+ return updateWithOnConflict(table, values, whereClause, whereArgs, ConflictAlgorithm.NONE);
}
/**
@@ -1559,12 +1562,11 @@
* valid value that will be translated to NULL.
* @param whereClause the optional WHERE clause to apply when updating.
* Passing null will update all rows.
- * @param algorithm {@link ConflictAlgorithm} for update conflict resolver
+ * @param conflictAlgorithm {@link ConflictAlgorithm} for update conflict resolver
* @return the number of rows affected
- * @hide
*/
public int updateWithOnConflict(String table, ContentValues values,
- String whereClause, String[] whereArgs, ConflictAlgorithm algorithm) {
+ String whereClause, String[] whereArgs, int conflictAlgorithm) {
if (!isOpen()) {
throw new IllegalStateException("database not open");
}
@@ -1575,12 +1577,7 @@
StringBuilder sql = new StringBuilder(120);
sql.append("UPDATE ");
- if (algorithm != null) {
- sql.append("OR ");
- sql.append(algorithm.value());
- sql.append(" ");
- }
-
+ sql.append(ConflictAlgorithm.VALUES[conflictAlgorithm]);
sql.append(table);
sql.append(" SET ");
@@ -1655,6 +1652,9 @@
*/
public void execSQL(String sql) throws SQLException {
long timeStart = Debug.threadCpuTimeNanos();
+ if (SQLiteDebug.DEBUG_CAPTURE_SQL) {
+ Log.v(TAG, SQLiteDebug.captureSql(this.getPath(), sql, null));
+ }
lock();
try {
native_execSQL(sql);
@@ -1680,7 +1680,9 @@
if (bindArgs == null) {
throw new IllegalArgumentException("Empty bindArgs");
}
-
+ if (SQLiteDebug.DEBUG_CAPTURE_SQL) {
+ Log.v(TAG, SQLiteDebug.captureSql(this.getPath(), sql, bindArgs));
+ }
long timeStart = Debug.threadCpuTimeNanos();
lock();
SQLiteStatement statement = null;
@@ -1739,6 +1741,10 @@
mLeakedException = new IllegalStateException(path +
" SQLiteDatabase created and never closed");
mFactory = factory;
+ if (SQLiteDebug.DEBUG_CAPTURE_SQL) {
+ Log.d(TAG, "captured_sql|" + mPath + "|ATTACH DATABASE '" + mPath +
+ "' as " + getDatabaseName(mPath) + ";");
+ }
dbopen(mPath, mFlags);
if (SQLiteDebug.DEBUG_SQL_CACHE) {
mTimeOpened = getTime();
@@ -1748,6 +1754,10 @@
setLocale(Locale.getDefault());
} catch (RuntimeException e) {
Log.e(TAG, "Failed to setLocale() when constructing, closing the database", e);
+ if (SQLiteDebug.DEBUG_CAPTURE_SQL) {
+ Log.d(TAG, "captured_sql|" + mPath + "|DETACH DATABASE " +
+ getDatabaseName(mPath) + ";");
+ }
dbclose();
if (SQLiteDebug.DEBUG_SQL_CACHE) {
mTimeClosed = getTime();
@@ -1760,6 +1770,20 @@
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS ").format(System.currentTimeMillis());
}
+ private String getDatabaseName(String path) {
+ if (path == null || path.trim().length() == 0) {
+ return "db not specified?";
+ }
+
+ if (path.equalsIgnoreCase(":memory:")) {
+ return "memorydb";
+ }
+ String[] tokens = path.split("/");
+ String[] lastNodeTokens = tokens[tokens.length - 1].split("\\.", 2);
+ return (lastNodeTokens.length == 1) ? lastNodeTokens[0]
+ : lastNodeTokens[0] + lastNodeTokens[1];
+ }
+
/**
* return whether the DB is opened as read only.
* @return true if DB is opened as read only
diff --git a/core/java/android/database/sqlite/SQLiteDebug.java b/core/java/android/database/sqlite/SQLiteDebug.java
index d4d3059..b12034a 100644
--- a/core/java/android/database/sqlite/SQLiteDebug.java
+++ b/core/java/android/database/sqlite/SQLiteDebug.java
@@ -16,12 +16,11 @@
package android.database.sqlite;
-import android.util.Config;
import android.util.Log;
/**
* Provides debugging info about all SQLite databases running in the current process.
- *
+ *
* {@hide}
*/
public final class SQLiteDebug {
@@ -38,6 +37,13 @@
Log.isLoggable("SQLiteCompiledSql", Log.VERBOSE);
/**
+ * Controls the capturing and printing of complete sql statement including the bind args and
+ * the database name.
+ */
+ public static final boolean DEBUG_CAPTURE_SQL =
+ Log.isLoggable("SQLiteCaptureSql", Log.VERBOSE);
+
+ /**
* Controls the stack trace reporting of active cursors being
* finalized.
*/
@@ -45,20 +51,20 @@
Log.isLoggable("SQLiteCursorClosing", Log.VERBOSE);
/**
- * Controls the tracking of time spent holding the database lock.
+ * Controls the tracking of time spent holding the database lock.
*/
public static final boolean DEBUG_LOCK_TIME_TRACKING =
Log.isLoggable("SQLiteLockTime", Log.VERBOSE);
/**
- * Controls the printing of stack traces when tracking the time spent holding the database lock.
+ * Controls the printing of stack traces when tracking the time spent holding the database lock.
*/
public static final boolean DEBUG_LOCK_TIME_TRACKING_STACK_TRACE =
Log.isLoggable("SQLiteLockStackTrace", Log.VERBOSE);
/**
* Contains statistics about the active pagers in the current process.
- *
+ *
* @see #getPagerStats(PagerStats)
*/
public static class PagerStats {
@@ -82,13 +88,13 @@
* @return The size of the SQLite heap in bytes.
*/
public static native long getHeapSize();
-
+
/**
* Returns the amount of allocated memory in the SQLite heap.
* @return The allocated size in bytes.
*/
public static native long getHeapAllocatedSize();
-
+
/**
* Returns the amount of free memory in the SQLite heap.
* @return The freed size in bytes.
@@ -115,4 +121,62 @@
static synchronized void notifyActiveCursorFinalized() {
sNumActiveCursorsFinalized++;
}
+
+ /**
+ * returns a message containing the given database name (path) and the string built by
+ * replacing "?" characters in the given sql string with the corresponding
+ * positional values from the given param bindArgs.
+ *
+ * @param path the database name
+ * @param sql sql string with possibly "?" for bindargs
+ * @param bindArgs args for "?"s in the above string
+ * @return the String to be logged
+ */
+ /* package */ static String captureSql(String path, String sql, Object[] bindArgs) {
+ // how many bindargs in sql
+ sql = sql.trim();
+ String args[] = sql.split("\\?");
+ // how many "?"s in the given sql string?
+ int varArgsInSql = (sql.endsWith("?")) ? args.length : args.length - 1;
+
+ // how many bind args do we have in the given input param bindArgs
+ int bindArgsLen = (bindArgs == null) ? 0 : bindArgs.length;
+ if (varArgsInSql < bindArgsLen) {
+ return "too many bindArgs provided. " +
+ "# of bindArgs = " + bindArgsLen + ", # of varargs = " + varArgsInSql +
+ "; sql = " + sql;
+ }
+
+ // if there are no bindArgs, we are done. log the sql as is.
+ if (bindArgsLen == 0 && varArgsInSql == 0) {
+ return logSql(path, sql);
+ }
+
+ StringBuilder buf = new StringBuilder();
+
+ // take the supplied bindArgs and plug them into sql
+ for (int i = 0; i < bindArgsLen; i++) {
+ buf.append(args[i]);
+ buf.append(bindArgs[i]);
+ }
+
+ // does given sql have more varArgs than the supplied bindArgs
+ // if so, assign nulls to the extra varArgs in sql
+ for (int i = bindArgsLen; i < varArgsInSql; i ++) {
+ buf.append(args[i]);
+ buf.append("null");
+ }
+
+ // if there are any characters left in the given sql string AFTER the last "?"
+ // log them also. for example, if the given sql = "select * from test where a=? and b=1
+ // then the following code appends " and b=1" string to buf.
+ if (varArgsInSql < args.length) {
+ buf.append(args[varArgsInSql]);
+ }
+ return logSql(path, buf.toString());
+ }
+
+ private static String logSql(String path, String sql) {
+ return "captured_sql|" + path + "|" + sql + ";";
+ }
}
diff --git a/core/java/android/database/sqlite/SQLiteProgram.java b/core/java/android/database/sqlite/SQLiteProgram.java
index 00b0a86..1159c1d 100644
--- a/core/java/android/database/sqlite/SQLiteProgram.java
+++ b/core/java/android/database/sqlite/SQLiteProgram.java
@@ -16,6 +16,12 @@
package android.database.sqlite;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
import android.util.Log;
/**
@@ -47,6 +53,11 @@
*/
protected int nStatement = 0;
+ /**
+ * stores all bindargs for debugging purposes
+ */
+ private Map<Integer, String> mBindArgs = null;
+
/* package */ SQLiteProgram(SQLiteDatabase db, String sql) {
if (SQLiteDebug.DEBUG_SQL_STATEMENTS) {
Log.d(TAG, "processing sql: " + sql);
@@ -127,6 +138,9 @@
* @param index The 1-based index to the parameter to bind null to
*/
public void bindNull(int index) {
+ if (SQLiteDebug.DEBUG_CAPTURE_SQL) {
+ addToBindArgs(index, "null");
+ }
acquireReference();
try {
native_bind_null(index);
@@ -143,6 +157,9 @@
* @param value The value to bind
*/
public void bindLong(int index, long value) {
+ if (SQLiteDebug.DEBUG_CAPTURE_SQL) {
+ addToBindArgs(index, value + "");
+ }
acquireReference();
try {
native_bind_long(index, value);
@@ -159,6 +176,9 @@
* @param value The value to bind
*/
public void bindDouble(int index, double value) {
+ if (SQLiteDebug.DEBUG_CAPTURE_SQL) {
+ addToBindArgs(index, value + "");
+ }
acquireReference();
try {
native_bind_double(index, value);
@@ -175,6 +195,9 @@
* @param value The value to bind
*/
public void bindString(int index, String value) {
+ if (SQLiteDebug.DEBUG_CAPTURE_SQL) {
+ addToBindArgs(index, "'" + value + "'");
+ }
if (value == null) {
throw new IllegalArgumentException("the bind value at index " + index + " is null");
}
@@ -194,6 +217,9 @@
* @param value The value to bind
*/
public void bindBlob(int index, byte[] value) {
+ if (SQLiteDebug.DEBUG_CAPTURE_SQL) {
+ addToBindArgs(index, "blob");
+ }
if (value == null) {
throw new IllegalArgumentException("the bind value at index " + index + " is null");
}
@@ -209,6 +235,9 @@
* Clears all existing bindings. Unset bindings are treated as NULL.
*/
public void clearBindings() {
+ if (SQLiteDebug.DEBUG_CAPTURE_SQL) {
+ mBindArgs = null;
+ }
acquireReference();
try {
native_clear_bindings();
@@ -230,6 +259,39 @@
}
/**
+ * this method is called under the debug flag {@link SQLiteDebug.DEBUG_CAPTURE_SQL} only.
+ * it collects the bindargs as they are called by the callers the bind... methods in this
+ * class.
+ */
+ private void addToBindArgs(int index, String obj) {
+ if (mBindArgs == null) {
+ mBindArgs = new HashMap<Integer, String>();
+ }
+ mBindArgs.put(index, obj);
+ }
+
+ /**
+ * constructs all the bindargs in sequence and returns a String Array of the values.
+ * it uses the HashMap built up by the above method.
+ *
+ * @return the string array of bindArgs with the args arranged in sequence
+ */
+ /* package */ String[] getBindArgs() {
+ if (mBindArgs == null) {
+ return null;
+ }
+ Set<Integer> indexSet = mBindArgs.keySet();
+ ArrayList<Integer> indexList = new ArrayList<Integer>(indexSet);
+ Collections.sort(indexList);
+ int len = indexList.size();
+ String[] bindObjs = new String[len];
+ for (int i = 0; i < len; i++) {
+ bindObjs[i] = mBindArgs.get(indexList.get(i));
+ }
+ return bindObjs;
+ }
+
+ /**
* Compiles SQL into a SQLite program.
*
* <P>The database lock must be held when calling this method.
diff --git a/core/java/android/database/sqlite/SQLiteStatement.java b/core/java/android/database/sqlite/SQLiteStatement.java
index cc714ee..0cee3c5 100644
--- a/core/java/android/database/sqlite/SQLiteStatement.java
+++ b/core/java/android/database/sqlite/SQLiteStatement.java
@@ -17,7 +17,6 @@
package android.database.sqlite;
import android.os.Debug;
-import android.os.SystemClock;
import android.util.Log;
/**
@@ -56,6 +55,9 @@
if (SQLiteDebug.DEBUG_SQL_STATEMENTS) {
Log.v(TAG, "execute() for [" + mSql + "]");
}
+ if (SQLiteDebug.DEBUG_CAPTURE_SQL) {
+ Log.v(TAG, SQLiteDebug.captureSql(mDatabase.getPath(), mSql, getBindArgs()));
+ }
native_execute();
mDatabase.logTimeStat(mSql, timeStart);
} finally {
@@ -83,6 +85,9 @@
if (SQLiteDebug.DEBUG_SQL_STATEMENTS) {
Log.v(TAG, "executeInsert() for [" + mSql + "]");
}
+ if (SQLiteDebug.DEBUG_CAPTURE_SQL) {
+ Log.v(TAG, SQLiteDebug.captureSql(mDatabase.getPath(), mSql, getBindArgs()));
+ }
native_execute();
mDatabase.logTimeStat(mSql, timeStart);
return mDatabase.lastInsertRow();
@@ -109,6 +114,9 @@
if (SQLiteDebug.DEBUG_SQL_STATEMENTS) {
Log.v(TAG, "simpleQueryForLong() for [" + mSql + "]");
}
+ if (SQLiteDebug.DEBUG_CAPTURE_SQL) {
+ Log.v(TAG, SQLiteDebug.captureSql(mDatabase.getPath(), mSql, getBindArgs()));
+ }
long retValue = native_1x1_long();
mDatabase.logTimeStat(mSql, timeStart);
return retValue;
@@ -135,6 +143,9 @@
if (SQLiteDebug.DEBUG_SQL_STATEMENTS) {
Log.v(TAG, "simpleQueryForString() for [" + mSql + "]");
}
+ if (SQLiteDebug.DEBUG_CAPTURE_SQL) {
+ Log.v(TAG, SQLiteDebug.captureSql(mDatabase.getPath(), mSql, getBindArgs()));
+ }
String retValue = native_1x1_string();
mDatabase.logTimeStat(mSql, timeStart);
return retValue;
diff --git a/core/java/android/ddm/DdmHandleHeap.java b/core/java/android/ddm/DdmHandleHeap.java
index 95fa0a2..fa0fbbf 100644
--- a/core/java/android/ddm/DdmHandleHeap.java
+++ b/core/java/android/ddm/DdmHandleHeap.java
@@ -34,6 +34,7 @@
public static final int CHUNK_HPIF = type("HPIF");
public static final int CHUNK_HPSG = type("HPSG");
public static final int CHUNK_HPDU = type("HPDU");
+ public static final int CHUNK_HPDS = type("HPDS");
public static final int CHUNK_NHSG = type("NHSG");
public static final int CHUNK_HPGC = type("HPGC");
public static final int CHUNK_REAE = type("REAE");
@@ -53,6 +54,7 @@
DdmServer.registerHandler(CHUNK_HPIF, mInstance);
DdmServer.registerHandler(CHUNK_HPSG, mInstance);
DdmServer.registerHandler(CHUNK_HPDU, mInstance);
+ DdmServer.registerHandler(CHUNK_HPDS, mInstance);
DdmServer.registerHandler(CHUNK_NHSG, mInstance);
DdmServer.registerHandler(CHUNK_HPGC, mInstance);
DdmServer.registerHandler(CHUNK_REAE, mInstance);
@@ -86,6 +88,8 @@
return handleHPSGNHSG(request, false);
} else if (type == CHUNK_HPDU) {
return handleHPDU(request);
+ } else if (type == CHUNK_HPDS) {
+ return handleHPDS(request);
} else if (type == CHUNK_NHSG) {
return handleHPSGNHSG(request, true);
} else if (type == CHUNK_HPGC) {
@@ -167,7 +171,7 @@
result = -1;
} catch (IOException ioe) {
result = -1;
- } catch (RuntimeException ioe) {
+ } catch (RuntimeException re) {
result = -1;
}
@@ -177,6 +181,38 @@
}
/*
+ * Handle a "HeaP Dump Streaming" request.
+ *
+ * This tells the VM to create a heap dump and send it directly to
+ * DDMS. The dumps are large enough that we don't want to copy the
+ * data into a byte[] and send it from here.
+ */
+ private Chunk handleHPDS(Chunk request) {
+ ByteBuffer in = wrapChunk(request);
+ byte result;
+
+ /* get the filename for the output file */
+ if (Config.LOGD)
+ Log.d("ddm-heap", "Heap dump: [DDMS]");
+
+ String failMsg = null;
+ try {
+ Debug.dumpHprofDataDdms();
+ } catch (UnsupportedOperationException uoe) {
+ failMsg = "hprof dumps not supported in this VM";
+ } catch (RuntimeException re) {
+ failMsg = "Exception: " + re.getMessage();
+ }
+
+ if (failMsg != null) {
+ Log.w("ddm-heap", failMsg);
+ return createFailChunk(1, failMsg);
+ } else {
+ return null;
+ }
+ }
+
+ /*
* Handle a "HeaP Garbage Collection" request.
*/
private Chunk handleHPGC(Chunk request) {
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index abb74cd..47c2cac 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -658,6 +658,25 @@
width = w;
height = h;
}
+ /**
+ * Compares {@code obj} to this size.
+ *
+ * @param obj the object to compare this size with.
+ * @return {@code true} if the width and height of {@code obj} is the
+ * same as those of this size. {@code false} otherwise.
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof Size)) {
+ return false;
+ }
+ Size s = (Size) obj;
+ return width == s.width && height == s.height;
+ }
+ @Override
+ public int hashCode() {
+ return width * 32713 + height;
+ }
/** width of the picture */
public int width;
/** height of the picture */
@@ -685,6 +704,7 @@
private static final String KEY_PREVIEW_FRAME_RATE = "preview-frame-rate";
private static final String KEY_PICTURE_SIZE = "picture-size";
private static final String KEY_PICTURE_FORMAT = "picture-format";
+ private static final String KEY_JPEG_THUMBNAIL_SIZE = "jpeg-thumbnail-size";
private static final String KEY_JPEG_THUMBNAIL_WIDTH = "jpeg-thumbnail-width";
private static final String KEY_JPEG_THUMBNAIL_HEIGHT = "jpeg-thumbnail-height";
private static final String KEY_JPEG_THUMBNAIL_QUALITY = "jpeg-thumbnail-quality";
@@ -700,6 +720,9 @@
private static final String KEY_SCENE_MODE = "scene-mode";
private static final String KEY_FLASH_MODE = "flash-mode";
private static final String KEY_FOCUS_MODE = "focus-mode";
+ private static final String KEY_FOCAL_LENGTH = "focal-length";
+ private static final String KEY_HORIZONTAL_VIEW_ANGLE = "horizontal-view-angle";
+ private static final String KEY_VERTICAL_VIEW_ANGLE = "vertical-view-angle";
// Parameter key suffix for supported values.
private static final String SUPPORTED_VALUES_SUFFIX = "-values";
@@ -954,7 +977,9 @@
}
/**
- * Sets the dimensions for EXIF thumbnail in Jpeg picture.
+ * Sets the dimensions for EXIF thumbnail in Jpeg picture. If
+ * applications set both width and height to 0, EXIF will not contain
+ * thumbnail.
*
* @param width the width of the thumbnail, in pixels
* @param height the height of the thumbnail, in pixels
@@ -976,6 +1001,18 @@
}
/**
+ * Gets the supported jpeg thumbnail sizes.
+ *
+ * @return a List of Size object. This method will always return a list
+ * with at least two elements. Size 0,0 (no thumbnail) is always
+ * supported.
+ */
+ public List<Size> getSupportedJpegThumbnailSizes() {
+ String str = get(KEY_JPEG_THUMBNAIL_SIZE + SUPPORTED_VALUES_SUFFIX);
+ return splitSize(str);
+ }
+
+ /**
* Sets the quality of the EXIF thumbnail in Jpeg picture.
*
* @param quality the JPEG quality of the EXIF thumbnail. The range is 1
@@ -1473,6 +1510,36 @@
}
/**
+ * Gets the focal length (in millimeter) of the camera.
+ *
+ * @return the focal length. This method will always return a valid
+ * value.
+ */
+ public float getFocalLength() {
+ return Float.parseFloat(get(KEY_FOCAL_LENGTH));
+ }
+
+ /**
+ * Gets the horizontal angle of view in degrees.
+ *
+ * @return horizontal angle of view. This method will always return a
+ * valid value.
+ */
+ public float getHorizontalViewAngle() {
+ return Float.parseFloat(get(KEY_HORIZONTAL_VIEW_ANGLE));
+ }
+
+ /**
+ * Gets the vertical angle of view in degrees.
+ *
+ * @return vertical angle of view. This method will always return a
+ * valid value.
+ */
+ public float getVerticalViewAngle() {
+ return Float.parseFloat(get(KEY_VERTICAL_VIEW_ANGLE));
+ }
+
+ /**
* Gets current zoom value. This also works when smooth zoom is in
* progress.
*
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java
index 8e9b11b..9ee251e 100644
--- a/core/java/android/os/Debug.java
+++ b/core/java/android/os/Debug.java
@@ -726,6 +726,18 @@
}
/**
+ * Collect "hprof" and send it to DDMS. This will cause a GC.
+ *
+ * @throws UnsupportedOperationException if the VM was built without
+ * HPROF support.
+ *
+ * @hide
+ */
+ public static void dumpHprofDataDdms() {
+ VMDebug.dumpHprofDataDdms();
+ }
+
+ /**
* Returns the number of sent transactions from this process.
* @return The number of sent transactions or -1 if it could not read t.
*/
diff --git a/core/java/android/os/StorageEventListener.java b/core/java/android/os/StorageEventListener.java
new file mode 100644
index 0000000..f852f42
--- /dev/null
+++ b/core/java/android/os/StorageEventListener.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.os;
+
+/**
+ * Used for receiving notifications from the StorageManager
+ */
+public interface StorageEventListener {
+ /**
+ * Called when the ability to share a volume has changed.
+ * @param method the share-method which has changed.
+ * @param available true if the share is available.
+ */
+ public void onShareAvailabilityChanged(String method, boolean available);
+
+ /**
+ * Called when media has been inserted
+ * @param label the system defined label for the volume.
+ * @param path the filesystem path for the volume.
+ * @param major the major number of the device.
+ * @param minor the minor number of the device.
+ */
+ public void onMediaInserted(String label, String path, int major, int minor);
+
+ /**
+ * Called when media has been removed
+ * @param label the system defined label for the volume.
+ * @param path the filesystem path for the volume.
+ * @param major the major number of the device.
+ * @param minor the minor number of the device.
+ * @param clean the media was removed cleanly.
+ */
+ public void onMediaRemoved(String label, String path, int major, int minor, boolean clean);
+
+ /**
+ * Called when a volume has changed state
+ * @param label the system defined label for the volume.
+ * @param path the filesystem path for the volume.
+ * @param oldState the old state as returned by {@link android.os.Environment.getExternalStorageState()}.
+ * @param newState the old state as returned by {@link android.os.Environment.getExternalStorageState()}.
+ */
+ public void onVolumeStateChanged(String label, String path, String oldState, String newState);
+}
diff --git a/core/java/android/os/StorageManager.java b/core/java/android/os/StorageManager.java
new file mode 100644
index 0000000..764abe0
--- /dev/null
+++ b/core/java/android/os/StorageManager.java
@@ -0,0 +1,300 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.os;
+
+import android.content.Context;
+import android.os.Binder;
+import android.os.Bundle;
+import android.os.Looper;
+import android.os.Parcelable;
+import android.os.ParcelFileDescriptor;
+import android.os.Process;
+import android.os.RemoteException;
+import android.os.Handler;
+import android.os.Message;
+import android.os.ServiceManager;
+import android.os.IMountService;
+import android.os.IMountServiceListener;
+import android.util.Log;
+import android.util.SparseArray;
+
+import java.io.FileDescriptor;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * Class that lets you access the device's storage management functions. Get an instance of this
+ * class by calling {@link android.content.Context#getSystemService(java.lang.String)
+ * Context.getSystemService()} with an argument of {@link android.content.Context#STORAGE_SERVICE}.
+ */
+public class StorageManager
+{
+ private static final String TAG = "StorageManager";
+
+ /*
+ * Our internal MountService binder reference
+ */
+ private IMountService mMountService;
+
+ /*
+ * The looper target for callbacks
+ */
+ Looper mTgtLooper;
+
+ /*
+ * Target listener for binder callbacks
+ */
+ private MountServiceBinderListener mBinderListener;
+
+ /*
+ * *static* list of our listeners
+ */
+ static final ArrayList<ListenerDelegate> sListeners = new ArrayList<ListenerDelegate>();
+
+ private class MountServiceBinderListener extends IMountServiceListener.Stub {
+ public void onShareAvailabilityChanged(String method, boolean available) {
+ final int size = sListeners.size();
+ for (int i = 0; i < size; i++) {
+ sListeners.get(i).sendShareAvailabilityChanged(method, available);
+ }
+ }
+
+ public void onMediaInserted(String label, String path, int major, int minor) {
+ final int size = sListeners.size();
+ for (int i = 0; i < size; i++) {
+ sListeners.get(i).sendMediaInserted(label, path, major, minor);
+ }
+ }
+
+ public void onMediaRemoved(String label, String path, int major, int minor, boolean clean) {
+ final int size = sListeners.size();
+ for (int i = 0; i < size; i++) {
+ sListeners.get(i).sendMediaRemoved(label, path, major, minor, clean);
+ }
+ }
+
+ public void onVolumeStateChanged(String label, String path, String oldState, String newState) {
+ final int size = sListeners.size();
+ for (int i = 0; i < size; i++) {
+ sListeners.get(i).sendVolumeStateChanged(label, path, oldState, newState);
+ }
+ }
+ }
+
+ /**
+ * Private base class for messages sent between the callback thread
+ * and the target looper handler
+ */
+ private class StorageEvent {
+ public static final int EVENT_SHARE_AVAILABILITY_CHANGED = 1;
+ public static final int EVENT_MEDIA_INSERTED = 2;
+ public static final int EVENT_MEDIA_REMOVED = 3;
+ public static final int EVENT_VOLUME_STATE_CHANGED = 4;
+
+ private Message mMessage;
+
+ public StorageEvent(int what) {
+ mMessage = Message.obtain();
+ mMessage.what = what;
+ mMessage.obj = this;
+ }
+
+ public Message getMessage() {
+ return mMessage;
+ }
+ }
+
+ /**
+ * Message sent on a share availability change.
+ */
+ private class ShareAvailabilityChangedStorageEvent extends StorageEvent {
+ public String method;
+ public boolean available;
+
+ public ShareAvailabilityChangedStorageEvent(String m, boolean a) {
+ super(EVENT_SHARE_AVAILABILITY_CHANGED);
+ method = m;
+ available = a;
+ }
+ }
+
+ /**
+ * Message sent on media insertion
+ */
+ private class MediaInsertedStorageEvent extends StorageEvent {
+ public String label;
+ public String path;
+ public int major;
+ public int minor;
+
+ public MediaInsertedStorageEvent(String l, String p, int maj, int min) {
+ super(EVENT_MEDIA_INSERTED);
+ label = l;
+ path = p;
+ major = maj;
+ minor = min;
+ }
+ }
+
+ /**
+ * Message sent on media removal
+ */
+ private class MediaRemovedStorageEvent extends StorageEvent {
+ public String label;
+ public String path;
+ public int major;
+ public int minor;
+ public boolean clean;
+
+ public MediaRemovedStorageEvent(String l, String p, int maj, int min, boolean c) {
+ super(EVENT_MEDIA_REMOVED);
+ label = l;
+ path = p;
+ major = maj;
+ minor = min;
+ clean = c;
+ }
+ }
+
+ /**
+ * Message sent on volume state change
+ */
+ private class VolumeStateChangedStorageEvent extends StorageEvent {
+ public String label;
+ public String path;
+ public String oldState;
+ public String newState;
+
+ public VolumeStateChangedStorageEvent(String l, String p, String oldS, String newS) {
+ super(EVENT_VOLUME_STATE_CHANGED);
+ label = l;
+ path = p;
+ oldState = oldS;
+ newState = newS;
+ }
+ }
+
+ /**
+ * Private class containing sender and receiver code for StorageEvents
+ */
+ private class ListenerDelegate {
+ final StorageEventListener mStorageEventListener;
+ private final Handler mHandler;
+
+ ListenerDelegate(StorageEventListener listener) {
+ mStorageEventListener = listener;
+ mHandler = new Handler(mTgtLooper) {
+ @Override
+ public void handleMessage(Message msg) {
+ StorageEvent e = (StorageEvent) msg.obj;
+
+ if (msg.what == StorageEvent.EVENT_SHARE_AVAILABILITY_CHANGED) {
+ ShareAvailabilityChangedStorageEvent ev = (ShareAvailabilityChangedStorageEvent) e;
+ mStorageEventListener.onShareAvailabilityChanged(ev.method, ev.available);
+ } else if (msg.what == StorageEvent.EVENT_MEDIA_INSERTED) {
+ MediaInsertedStorageEvent ev = (MediaInsertedStorageEvent) e;
+ mStorageEventListener.onMediaInserted(ev.label, ev.path, ev.major, ev.minor);
+ } else if (msg.what == StorageEvent.EVENT_MEDIA_REMOVED) {
+ MediaRemovedStorageEvent ev = (MediaRemovedStorageEvent) e;
+ mStorageEventListener.onMediaRemoved(ev.label, ev.path, ev.major, ev.minor, ev.clean);
+ } else if (msg.what == StorageEvent.EVENT_VOLUME_STATE_CHANGED) {
+ VolumeStateChangedStorageEvent ev = (VolumeStateChangedStorageEvent) e;
+ mStorageEventListener.onVolumeStateChanged(ev.label, ev.path, ev.oldState, ev.newState);
+ } else {
+ Log.e(TAG, "Unsupported event " + msg.what);
+ }
+ }
+ };
+ }
+
+ StorageEventListener getListener() {
+ return mStorageEventListener;
+ }
+
+ void sendShareAvailabilityChanged(String method, boolean available) {
+ ShareAvailabilityChangedStorageEvent e = new ShareAvailabilityChangedStorageEvent(method, available);
+ mHandler.sendMessage(e.getMessage());
+ }
+
+ void sendMediaInserted(String label, String path, int major, int minor) {
+ MediaInsertedStorageEvent e = new MediaInsertedStorageEvent(label, path, major, minor);
+ mHandler.sendMessage(e.getMessage());
+ }
+
+ void sendMediaRemoved(String label, String path, int major, int minor, boolean clean) {
+ MediaRemovedStorageEvent e = new MediaRemovedStorageEvent(label, path, major, minor, clean);
+ mHandler.sendMessage(e.getMessage());
+ }
+
+ void sendVolumeStateChanged(String label, String path, String oldState, String newState) {
+ VolumeStateChangedStorageEvent e = new VolumeStateChangedStorageEvent(label, path, oldState, newState);
+ mHandler.sendMessage(e.getMessage());
+ }
+ }
+
+ /**
+ * {@hide}
+ */
+ public StorageManager(Looper tgtLooper) throws RemoteException {
+ mMountService = IMountService.Stub.asInterface(ServiceManager.getService("mount"));
+ mTgtLooper = tgtLooper;
+ mBinderListener = new MountServiceBinderListener();
+ mMountService.registerListener(mBinderListener);
+ }
+
+
+ /**
+ * Registers a {@link android.os.StorageEventListener StorageEventListener}.
+ *
+ * @param listener A {@link android.os.StorageEventListener StorageEventListener} object.
+ *
+ */
+ public void registerListener(StorageEventListener listener) {
+ if (listener == null) {
+ return;
+ }
+
+ synchronized (sListeners) {
+ sListeners.add(new ListenerDelegate(listener));
+ }
+ }
+
+ /**
+ * Unregisters a {@link android.os.StorageEventListener StorageEventListener}.
+ *
+ * @param listener A {@link android.os.StorageEventListener StorageEventListener} object.
+ *
+ */
+ public void unregisterListener(StorageEventListener listener) {
+ if (listener == null) {
+ return;
+ }
+ synchronized (sListeners) {
+ final int size = sListeners.size();
+ for (int i=0 ; i<size ; i++) {
+ ListenerDelegate l = sListeners.get(i);
+ if (l.getListener() == listener) {
+ sListeners.remove(i);
+ break;
+ }
+ }
+ }
+ }
+}
diff --git a/core/java/android/provider/Browser.java b/core/java/android/provider/Browser.java
index 0b1b16b..36255d0 100644
--- a/core/java/android/provider/Browser.java
+++ b/core/java/android/provider/Browser.java
@@ -56,29 +56,6 @@
"com.android.browser.application_id";
/**
- * The name of the extra data in the VIEW intent. The data is in boolean.
- * <p>
- * If the Browser is handling the intent and the setting for
- * USE_LOCATION_FOR_SERVICES is allow, the Browser will send the location in
- * the POST data if this extra data is presented and it is true.
- * <p>
- * pending api approval
- * @hide
- */
- public static final String EXTRA_APPEND_LOCATION = "com.android.browser.append_location";
-
- /**
- * The name of the extra data in the VIEW intent. The data is in the format of
- * a byte array.
- * <p>
- * Any value sent here will be passed in the http request to the provided url as post data.
- * <p>
- * pending api approval
- * @hide
- */
- public static final String EXTRA_POST_DATA = "com.android.browser.post_data";
-
- /**
* The name of the extra data in the VIEW intent. The data are key/value
* pairs in the format of Bundle. They will be sent in the HTTP request
* headers for the provided url. The keys can't be the standard HTTP headers
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index 16746d4..544e399 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -130,6 +130,57 @@
public static final String REQUESTING_PACKAGE_PARAM_KEY = "requesting_package";
/**
+ * @hide
+ */
+ public static final class Preferences {
+
+ /**
+ * A key in the {@link android.provider.Settings android.provider.Settings} provider
+ * that stores the preferred sorting order for contacts (by given name vs. by family name).
+ *
+ * @hide
+ */
+ public static final String SORT_ORDER = "android.contacts.SORT_ORDER";
+
+ /**
+ * The value for the SORT_ORDER key corresponding to sorting by given name first.
+ *
+ * @hide
+ */
+ public static final int SORT_ORDER_PRIMARY = 1;
+
+ /**
+ * The value for the SORT_ORDER key corresponding to sorting by family name first.
+ *
+ * @hide
+ */
+ public static final int SORT_ORDER_ALTERNATIVE = 2;
+
+ /**
+ * A key in the {@link android.provider.Settings android.provider.Settings} provider
+ * that stores the preferred display order for contacts (given name first vs. family
+ * name first).
+ *
+ * @hide
+ */
+ public static final String DISPLAY_ORDER = "android.contacts.DISPLAY_ORDER";
+
+ /**
+ * The value for the DISPLAY_ORDER key corresponding to showing the given name first.
+ *
+ * @hide
+ */
+ public static final int DISPLAY_ORDER_PRIMARY = 1;
+
+ /**
+ * The value for the DISPLAY_ORDER key corresponding to showing the family name first.
+ *
+ * @hide
+ */
+ public static final int DISPLAY_ORDER_ALTERNATIVE = 2;
+ }
+
+ /**
* @hide should be removed when users are updated to refer to SyncState
* @deprecated use SyncState instead
*/
@@ -551,8 +602,7 @@
/**
* Sort key based on the alternative representation of the full name,
* {@link #DISPLAY_NAME_ALTERNATIVE}. Thus for Western names,
- * it is the one using the "family name first" format for
- * Western names.
+ * it is the one using the "family name first" format.
*/
public static final String SORT_KEY_ALTERNATIVE = "sort_key_alt";
}
diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java
index 1b938ee..211bc0a 100644
--- a/core/java/android/provider/MediaStore.java
+++ b/core/java/android/provider/MediaStore.java
@@ -28,7 +28,7 @@
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.MiniThumbFile;
-import android.media.ThumbnailUtil;
+import android.media.ThumbnailUtils;
import android.net.Uri;
import android.os.Environment;
import android.os.ParcelFileDescriptor;
@@ -381,15 +381,15 @@
filePath = c.getString(1);
}
if (isVideo) {
- bitmap = ThumbnailUtil.createVideoThumbnail(filePath);
+ bitmap = ThumbnailUtils.createVideoThumbnail(filePath);
if (kind == MICRO_KIND && bitmap != null) {
- bitmap = ThumbnailUtil.extractMiniThumb(bitmap,
- ThumbnailUtil.MINI_THUMB_TARGET_SIZE,
- ThumbnailUtil.MINI_THUMB_TARGET_SIZE,
- ThumbnailUtil.RECYCLE_INPUT);
+ bitmap = ThumbnailUtils.extractMiniThumb(bitmap,
+ ThumbnailUtils.MINI_THUMB_TARGET_SIZE,
+ ThumbnailUtils.MINI_THUMB_TARGET_SIZE,
+ ThumbnailUtils.RECYCLE_INPUT);
}
} else {
- bitmap = ThumbnailUtil.createImageThumbnail(cr, filePath, uri, origId,
+ bitmap = ThumbnailUtils.createImageThumbnail(cr, filePath, uri, origId,
kind, false);
}
}
diff --git a/core/java/android/speech/RecognizerResultsIntent.java b/core/java/android/speech/RecognizerResultsIntent.java
new file mode 100644
index 0000000..882f213
--- /dev/null
+++ b/core/java/android/speech/RecognizerResultsIntent.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.speech;
+
+import java.util.ArrayList;
+
+/**
+ * Constants for intents related to showing speech recognition results.
+ *
+ * These constants should not be needed for normal utilization of speech recognition. They
+ * would only be called if you wanted to trigger a view of voice search results in your
+ * application, or implemented if you wanted to offer a different view for voice search results
+ * with your application.
+ *
+ * The standard behavior here for someone receiving an {@link #ACTION_VOICE_SEARCH_RESULTS} is to
+ * first retrieve the list of {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS}, and use any provided
+ * HTML for that result in {@link #EXTRA_VOICE_SEARCH_RESULT_HTML}, if available, to display
+ * the search results. If that is not available, then the corresponding url for that result in
+ * {@link #EXTRA_VOICE_SEARCH_RESULT_URLS} should be used. And if even that is not available,
+ * then a search url should be constructed from the actual recognition result string.
+ *
+ * @hide for making public in a later release
+ */
+public class RecognizerResultsIntent {
+ private RecognizerResultsIntent() {
+ // Not for instantiating.
+ }
+
+ /**
+ * Intent that can be sent by implementations of voice search to display the results of
+ * a search in, for example, a web browser.
+ *
+ * This intent should always be accompanied by at least
+ * {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS}, and optionally but recommended,
+ * {@link #EXTRA_VOICE_SEARCH_RESULT_URLS}, and sometimes
+ * {@link #EXTRA_VOICE_SEARCH_RESULT_HTML} and
+ * {@link #EXTRA_VOICE_SEARCH_RESULT_HTML_BASE_URLS}.
+ *
+ * These are parallel arrays, where a recognition result string at index N of
+ * {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS} should be accompanied by a url to use for
+ * searching based on that string at index N of {@link #EXTRA_VOICE_SEARCH_RESULT_URLS},
+ * and, possibly, the full html to display for that result at index N of
+ * {@link #EXTRA_VOICE_SEARCH_RESULT_HTML}. If full html is provided, a base url (or
+ * list of base urls) should be provided with {@link #EXTRA_VOICE_SEARCH_RESULT_HTML_BASE_URLS}.
+ *
+ * @hide for making public in a later release
+ */
+ public static final String ACTION_VOICE_SEARCH_RESULTS =
+ "android.speech.action.VOICE_SEARCH_RESULTS";
+
+ /**
+ * The key to an extra {@link ArrayList} of {@link String}s that contains the list of
+ * recognition alternates from voice search, in order from highest to lowest confidence.
+ *
+ * @hide for making public in a later release
+ */
+ public static final String EXTRA_VOICE_SEARCH_RESULT_STRINGS =
+ "android.speech.extras.VOICE_SEARCH_RESULT_STRINGS";
+
+ /**
+ * The key to an extra {@link ArrayList} of {@link String}s that contains the search urls
+ * to use, if available, for the recognition alternates provided in
+ * {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS}. This list should always be the same size as the
+ * one provided in {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS} - if a result cannot provide a
+ * search url, that entry in this ArrayList should be <code>null</code>, and the implementor of
+ * {@link #ACTION_VOICE_SEARCH_RESULTS} should execute a search of its own choosing,
+ * based on the recognition result string.
+ *
+ * @hide for making public in a later release
+ */
+ public static final String EXTRA_VOICE_SEARCH_RESULT_URLS =
+ "android.speech.extras.VOICE_SEARCH_RESULT_URLS";
+
+ /**
+ * The key to an extra {@link ArrayList} of {@link String}s that contains the html content to
+ * use, if available, for the recognition alternates provided in
+ * {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS}. This list should always be the same size as the
+ * one provided in {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS} - if a result cannot provide
+ * html, that entry in this list should be <code>null</code>, and the implementor of
+ * {@link #ACTION_VOICE_SEARCH_RESULTS} should back off to the corresponding url provided in
+ * {@link #EXTRA_VOICE_SEARCH_RESULT_URLS}, if available, or else should execute a search of
+ * its own choosing, based on the recognition result string.
+ *
+ * Currently this html content should be expected in the form of an "inline:" uri for the
+ * Browser. In the future this may change to a "content://" uri or some other identifier.
+ * Anyone who reads this extra should confirm that a result is in fact an "inline:" uri and
+ * back off to the urls or strings gracefully if it is not, thus maintaining future backwards
+ * compatibility if this changes.
+ *
+ * @hide not to be exposed immediately as the implementation details may change
+ */
+ public static final String EXTRA_VOICE_SEARCH_RESULT_HTML =
+ "android.speech.extras.VOICE_SEARCH_RESULT_HTML";
+
+ /**
+ * The key to an extra {@link ArrayList} of {@link String}s that contains the base url to
+ * assume when interpreting html provided in {@link #EXTRA_VOICE_SEARCH_RESULT_HTML}.
+ *
+ * A list of size 1 may be provided to apply the same base url to all html results.
+ * A list of the same size as {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS} may be provided
+ * to apply different base urls to each different html result in the
+ * {@link #EXTRA_VOICE_SEARCH_RESULT_HTML} list.
+ *
+ * @hide not to be exposed immediately as the implementation details may change
+ */
+ public static final String EXTRA_VOICE_SEARCH_RESULT_HTML_BASE_URLS =
+ "android.speech.extras.VOICE_SEARCH_RESULT_HTML_BASE_URLS";
+}
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index 8e15f89..0af31f05 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -369,6 +369,12 @@
*/
public int flags;
+ /** Window flag: as long as this window is visible to the user, allow
+ * the lock screen to activate while the screen is on.
+ * This can be used independently, or in combination with
+ * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
+ public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
+
/** Window flag: everything behind this window will be dimmed.
* Use {@link #dimAmount} to control the amount of dim. */
public static final int FLAG_DIM_BEHIND = 0x00000002;
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java
index 21577bf..7bc5cce 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -827,6 +827,12 @@
public void systemReady();
/**
+ * Called when userActivity is signalled in the power manager.
+ * This is safe to call from any thread, with any window manager locks held or not.
+ */
+ public void userActivity();
+
+ /**
* Called when we have finished booting and can now display the home
* screen to the user. This wilWl happen after systemReady(), and at
* this point the display is active.
diff --git a/core/java/android/webkit/CacheManager.java b/core/java/android/webkit/CacheManager.java
index 22dca3a..213eaa5 100644
--- a/core/java/android/webkit/CacheManager.java
+++ b/core/java/android/webkit/CacheManager.java
@@ -52,6 +52,7 @@
private static final String NO_STORE = "no-store";
private static final String NO_CACHE = "no-cache";
private static final String MAX_AGE = "max-age";
+ private static final String MANIFEST_MIME = "text/cache-manifest";
private static long CACHE_THRESHOLD = 6 * 1024 * 1024;
private static long CACHE_TRIM_AMOUNT = 2 * 1024 * 1024;
@@ -658,6 +659,15 @@
// if the contentLength is already larger than CACHE_MAX_SIZE, skip it
if (headers.getContentLength() > CACHE_MAX_SIZE) return null;
+ // The HTML 5 spec, section 6.9.4, step 7.3 of the application cache
+ // process states that HTTP caching rules are ignored for the
+ // purposes of the application cache download process.
+ // At this point we can't tell that if a file is part of this process,
+ // except for the manifest, which has its own mimeType.
+ // TODO: work out a way to distinguish all responses that are part of
+ // the application download process and skip them.
+ if (MANIFEST_MIME.equals(mimeType)) return null;
+
// TODO: if authenticated or secure, return null
CacheResult ret = new CacheResult();
ret.httpStatusCode = statusCode;
diff --git a/core/java/android/webkit/ContentLoader.java b/core/java/android/webkit/ContentLoader.java
index 19aa087..5eb54b0 100644
--- a/core/java/android/webkit/ContentLoader.java
+++ b/core/java/android/webkit/ContentLoader.java
@@ -31,7 +31,6 @@
class ContentLoader extends StreamLoader {
private String mUrl;
- private Context mContext;
private String mContentType;
/**
@@ -40,11 +39,9 @@
* @param rawUrl "content:" url pointing to content to be loaded. This url
* is the same url passed in to the WebView.
* @param loadListener LoadListener to pass the content to
- * @param context Context to use to access the asset.
*/
- ContentLoader(String rawUrl, LoadListener loadListener, Context context) {
+ ContentLoader(String rawUrl, LoadListener loadListener) {
super(loadListener);
- mContext = context;
/* strip off mimetype */
int mimeIndex = rawUrl.lastIndexOf('?');
@@ -81,7 +78,7 @@
try {
mDataStream = mContext.getContentResolver().openInputStream(uri);
- mHandler.status(1, 1, 0, "OK");
+ mHandler.status(1, 1, 200, "OK");
} catch (java.io.FileNotFoundException ex) {
mHandler.error(EventHandler.FILE_NOT_FOUND_ERROR, errString(ex));
return false;
@@ -112,11 +109,9 @@
*
* @param url "content:" url pointing to content to be loaded
* @param loadListener LoadListener to pass the content to
- * @param context Context to use to access the asset.
*/
- public static void requestUrl(String url, LoadListener loadListener,
- Context context) {
- ContentLoader loader = new ContentLoader(url, loadListener, context);
+ public static void requestUrl(String url, LoadListener loadListener) {
+ ContentLoader loader = new ContentLoader(url, loadListener);
loader.load();
}
diff --git a/core/java/android/webkit/DataLoader.java b/core/java/android/webkit/DataLoader.java
index 6c5d10d..2a68a5d8 100644
--- a/core/java/android/webkit/DataLoader.java
+++ b/core/java/android/webkit/DataLoader.java
@@ -16,6 +16,10 @@
package android.webkit;
+import android.net.http.EventHandler;
+
+import com.android.internal.R;
+
import java.io.ByteArrayInputStream;
import org.apache.harmony.luni.util.Base64;
@@ -49,14 +53,22 @@
} else {
data = url.getBytes();
}
- mDataStream = new ByteArrayInputStream(data);
- mContentLength = data.length;
+ if (data != null) {
+ mDataStream = new ByteArrayInputStream(data);
+ mContentLength = data.length;
+ }
}
@Override
protected boolean setupStreamAndSendStatus() {
- mHandler.status(1, 1, 0, "OK");
- return true;
+ if (mDataStream != null) {
+ mHandler.status(1, 1, 200, "OK");
+ return true;
+ } else {
+ mHandler.error(EventHandler.ERROR,
+ mContext.getString(R.string.httpError));
+ return false;
+ }
}
@Override
diff --git a/core/java/android/webkit/FileLoader.java b/core/java/android/webkit/FileLoader.java
index 974ccbf..e856cde 100644
--- a/core/java/android/webkit/FileLoader.java
+++ b/core/java/android/webkit/FileLoader.java
@@ -38,7 +38,6 @@
class FileLoader extends StreamLoader {
private String mPath; // Full path to the file to load
- private Context mContext; // Application context, used for asset/res loads
private int mType; // Indicates the type of the load
private boolean mAllowFileAccess; // Allow/block file system access
@@ -57,16 +56,14 @@
*
* @param url Full file url pointing to content to be loaded
* @param loadListener LoadListener to pass the content to
- * @param context Context to use to access the asset.
* @param asset true if url points to an asset.
* @param allowFileAccess true if this WebView is allowed to access files
* on the file system.
*/
- FileLoader(String url, LoadListener loadListener, Context context,
- int type, boolean allowFileAccess) {
+ FileLoader(String url, LoadListener loadListener, int type,
+ boolean allowFileAccess) {
super(loadListener);
mType = type;
- mContext = context;
mAllowFileAccess = allowFileAccess;
// clean the Url
@@ -174,7 +171,7 @@
mDataStream = new FileInputStream(mPath);
mContentLength = (new File(mPath)).length();
}
- mHandler.status(1, 1, 0, "OK");
+ mHandler.status(1, 1, 200, "OK");
} catch (java.io.FileNotFoundException ex) {
mHandler.error(EventHandler.FILE_NOT_FOUND_ERROR, errString(ex));
@@ -198,14 +195,13 @@
*
* @param url Full file url pointing to content to be loaded
* @param loadListener LoadListener to pass the content to
- * @param context Context to use to access the asset.
* @param asset true if url points to an asset.
* @param allowFileAccess true if this FileLoader can load files from the
* file system.
*/
public static void requestUrl(String url, LoadListener loadListener,
- Context context, int type, boolean allowFileAccess) {
- FileLoader loader = new FileLoader(url, loadListener, context, type,
+ int type, boolean allowFileAccess) {
+ FileLoader loader = new FileLoader(url, loadListener, type,
allowFileAccess);
loader.load();
}
diff --git a/core/java/android/webkit/FrameLoader.java b/core/java/android/webkit/FrameLoader.java
index 51f60c3..58eca38 100644
--- a/core/java/android/webkit/FrameLoader.java
+++ b/core/java/android/webkit/FrameLoader.java
@@ -141,22 +141,21 @@
return true;
}
if (URLUtil.isAssetUrl(url)) {
- FileLoader.requestUrl(url, loadListener, loadListener.getContext(),
- FileLoader.TYPE_ASSET, true);
+ FileLoader.requestUrl(url, loadListener, FileLoader.TYPE_ASSET,
+ true);
return true;
} else if (URLUtil.isResourceUrl(url)) {
- FileLoader.requestUrl(url, loadListener, loadListener.getContext(),
- FileLoader.TYPE_RES, true);
+ FileLoader.requestUrl(url, loadListener, FileLoader.TYPE_RES,
+ true);
return true;
} else if (URLUtil.isFileUrl(url)) {
- FileLoader.requestUrl(url, loadListener, loadListener.getContext(),
- FileLoader.TYPE_FILE, settings.getAllowFileAccess());
+ FileLoader.requestUrl(url, loadListener, FileLoader.TYPE_FILE,
+ settings.getAllowFileAccess());
return true;
} else if (URLUtil.isContentUrl(url)) {
// Send the raw url to the ContentLoader because it will do a
// permission check and the url has to match..
- ContentLoader.requestUrl(loadListener.url(), loadListener,
- loadListener.getContext());
+ ContentLoader.requestUrl(loadListener.url(), loadListener);
return true;
} else if (URLUtil.isDataUrl(url)) {
DataLoader.requestUrl(url, loadListener);
diff --git a/core/java/android/webkit/JsResult.java b/core/java/android/webkit/JsResult.java
index 0c86e0a..e61ab21 100644
--- a/core/java/android/webkit/JsResult.java
+++ b/core/java/android/webkit/JsResult.java
@@ -26,7 +26,10 @@
private boolean mTriedToNotifyBeforeReady;
// This is a basic result of a confirm or prompt dialog.
protected boolean mResult;
- // This is the caller of the prompt and is the object that is waiting.
+ /**
+ * This is the caller of the prompt and is the object that is waiting.
+ * @hide
+ */
protected final CallbackProxy mProxy;
// This is the default value of the result.
private final boolean mDefaultValue;
diff --git a/core/java/android/webkit/StreamLoader.java b/core/java/android/webkit/StreamLoader.java
index 623ff29..ce26268 100644
--- a/core/java/android/webkit/StreamLoader.java
+++ b/core/java/android/webkit/StreamLoader.java
@@ -16,6 +16,7 @@
package android.webkit;
+import android.content.Context;
import android.net.http.EventHandler;
import android.net.http.Headers;
import android.os.Handler;
@@ -52,7 +53,8 @@
private static final int MSG_DATA = 102; // Send data to loader
private static final int MSG_END = 103; // Send endData to loader
- protected LoadListener mHandler; // loader class
+ protected final Context mContext;
+ protected final LoadListener mHandler; // loader class
protected InputStream mDataStream; // stream to read data from
protected long mContentLength; // content length of data
private byte [] mData; // buffer to pass data to loader with.
@@ -66,6 +68,7 @@
*/
StreamLoader(LoadListener loadlistener) {
mHandler = loadlistener;
+ mContext = loadlistener.getContext();
}
/**
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 39b0a63..a6b74c4 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -3109,6 +3109,7 @@
zoomScale = mZoomScale;
// set mZoomScale to be 0 as we have done animation
mZoomScale = 0;
+ WebViewCore.resumeUpdatePicture(mWebViewCore);
// call invalidate() again to draw with the final filters
invalidate();
if (mNeedToAdjustWebTextView) {
@@ -3492,6 +3493,17 @@
mWebViewCore.sendMessage(EventHub.DUMP_RENDERTREE, toFile ? 1 : 0, 0);
}
+ /**
+ * Dump the V8 counters to standard output.
+ * Note that you need a build with V8 and WEBCORE_INSTRUMENTATION set to
+ * true. Otherwise, this will do nothing.
+ *
+ * @hide debug only
+ */
+ public void dumpV8Counters() {
+ mWebViewCore.sendMessage(EventHub.DUMP_V8COUNTERS);
+ }
+
// This is used to determine long press with the center key. Does not
// affect long press with the trackball/touch.
private boolean mGotCenterDown = false;
@@ -3952,8 +3964,9 @@
super.onSizeChanged(w, h, ow, oh);
// Center zooming to the center of the screen.
if (mZoomScale == 0) { // unless we're already zooming
- mZoomCenterX = getViewWidth() * .5f;
- mZoomCenterY = getViewHeight() * .5f;
+ // To anchor at top left corner.
+ mZoomCenterX = 0;
+ mZoomCenterY = getVisibleTitleHeight();
mAnchorX = viewToContentX((int) mZoomCenterX + mScrollX);
mAnchorY = viewToContentY((int) mZoomCenterY + mScrollY);
}
@@ -3996,7 +4009,6 @@
@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
-
sendOurVisibleRect();
}
@@ -4458,7 +4470,7 @@
deltaX = 0;
deltaY = 0;
- WebViewCore.reducePriority(mWebViewCore);
+ WebViewCore.reducePriority();
if (!mDragFromTextInput) {
nativeHideCursor();
}
@@ -4621,7 +4633,7 @@
|| computeVerticalScrollExtent() < computeVerticalScrollRange())) {
// we will not rewrite drag code here, but we
// will try fling if it applies.
- WebViewCore.reducePriority(mWebViewCore);
+ WebViewCore.reducePriority();
// fall through to TOUCH_DRAG_MODE
} else {
break;
@@ -4658,7 +4670,7 @@
break;
}
mLastVelocity = 0;
- WebViewCore.resumePriority(mWebViewCore);
+ WebViewCore.resumePriority();
break;
case TOUCH_DRAG_START_MODE:
case TOUCH_DONE_MODE:
@@ -4707,7 +4719,7 @@
mVelocityTracker = null;
}
if (mTouchMode == TOUCH_DRAG_MODE) {
- WebViewCore.resumePriority(mWebViewCore);
+ WebViewCore.resumePriority();
}
mPrivateHandler.removeMessages(SWITCH_TO_SHORTPRESS);
mPrivateHandler.removeMessages(SWITCH_TO_LONGPRESS);
@@ -5033,7 +5045,7 @@
vy = vy * 3 / 4;
}
if ((maxX == 0 && vy == 0) || (maxY == 0 && vx == 0)) {
- WebViewCore.resumePriority(mWebViewCore);
+ WebViewCore.resumePriority();
return;
}
float currentVelocity = mScroller.getCurrVelocity();
@@ -5090,6 +5102,7 @@
mInvInitialZoomScale = 1.0f / oldScale;
mInvFinalZoomScale = 1.0f / mActualScale;
mZoomScale = mActualScale;
+ WebViewCore.pauseUpdatePicture(mWebViewCore);
invalidate();
return true;
} else {
@@ -5904,7 +5917,7 @@
}
break;
case RESUME_WEBCORE_PRIORITY:
- WebViewCore.resumePriority(mWebViewCore);
+ WebViewCore.resumePriority();
break;
case LONG_PRESS_CENTER:
@@ -6068,7 +6081,7 @@
case SHOW_RECT_MSG_ID: {
WebViewCore.ShowRectData data = (WebViewCore.ShowRectData) msg.obj;
int x = mScrollX;
- int left = contentToViewDimension(data.mLeft);
+ int left = contentToViewX(data.mLeft);
int width = contentToViewDimension(data.mWidth);
int maxWidth = contentToViewDimension(data.mContentWidth);
int viewWidth = getViewWidth();
@@ -6079,21 +6092,29 @@
x += (int) (left + data.mXPercentInDoc * width
- mScrollX - data.mXPercentInView * viewWidth);
}
+ if (DebugFlags.WEB_VIEW) {
+ Log.v(LOGTAG, "showRectMsg=(left=" + left + ",width=" +
+ width + ",maxWidth=" + maxWidth +
+ ",viewWidth=" + viewWidth + ",x="
+ + x + ",xPercentInDoc=" + data.mXPercentInDoc +
+ ",xPercentInView=" + data.mXPercentInView+ ")");
+ }
// use the passing content width to cap x as the current
// mContentWidth may not be updated yet
x = Math.max(0,
(Math.min(maxWidth, x + viewWidth)) - viewWidth);
- int y = mScrollY;
- int top = contentToViewDimension(data.mTop);
+ int top = contentToViewY(data.mTop);
int height = contentToViewDimension(data.mHeight);
int maxHeight = contentToViewDimension(data.mContentHeight);
int viewHeight = getViewHeight();
- if (height < viewHeight) {
- // middle align
- y += top + height / 2 - mScrollY - viewHeight / 2;
- } else {
- y += (int) (top + data.mYPercentInDoc * height
- - mScrollY - data.mYPercentInView * viewHeight);
+ int y = (int) (top + data.mYPercentInDoc * height -
+ data.mYPercentInView * viewHeight);
+ if (DebugFlags.WEB_VIEW) {
+ Log.v(LOGTAG, "showRectMsg=(top=" + top + ",height=" +
+ height + ",maxHeight=" + maxHeight +
+ ",viewHeight=" + viewHeight + ",y="
+ + y + ",yPercentInDoc=" + data.mYPercentInDoc +
+ ",yPercentInView=" + data.mYPercentInView+ ")");
}
// use the passing content height to cap y as the current
// mContentHeight may not be updated yet
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 310721f..387942f 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -524,6 +524,8 @@
private native void nativeDumpNavTree();
+ private native void nativeDumpV8Counters();
+
private native void nativeSetJsFlags(String flags);
/**
@@ -874,8 +876,9 @@
static final int DUMP_DOMTREE = 170;
static final int DUMP_RENDERTREE = 171;
static final int DUMP_NAVTREE = 172;
+ static final int DUMP_V8COUNTERS = 173;
- static final int SET_JS_FLAGS = 173;
+ static final int SET_JS_FLAGS = 174;
// Geolocation
static final int GEOLOCATION_PERMISSIONS_PROVIDE = 180;
@@ -1296,6 +1299,10 @@
nativeDumpNavTree();
break;
+ case DUMP_V8COUNTERS:
+ nativeDumpV8Counters();
+ break;
+
case SET_JS_FLAGS:
nativeSetJsFlags((String)msg.obj);
break;
@@ -1676,6 +1683,9 @@
// Used to avoid posting more than one split picture message.
private boolean mSplitPictureIsScheduled;
+ // Used to suspend drawing.
+ private boolean mDrawIsPaused;
+
// mRestoreState is set in didFirstLayout(), and reset in the next
// webkitDraw after passing it to the UI thread.
private RestoreState mRestoreState = null;
@@ -1788,7 +1798,7 @@
return result;
}
- static void reducePriority(WebViewCore core) {
+ static void reducePriority() {
// remove the pending REDUCE_PRIORITY and RESUME_PRIORITY messages
sWebCoreHandler.removeMessages(WebCoreThread.REDUCE_PRIORITY);
sWebCoreHandler.removeMessages(WebCoreThread.RESUME_PRIORITY);
@@ -1796,7 +1806,7 @@
.obtainMessage(WebCoreThread.REDUCE_PRIORITY));
}
- static void resumePriority(WebViewCore core) {
+ static void resumePriority() {
// remove the pending REDUCE_PRIORITY and RESUME_PRIORITY messages
sWebCoreHandler.removeMessages(WebCoreThread.REDUCE_PRIORITY);
sWebCoreHandler.removeMessages(WebCoreThread.RESUME_PRIORITY);
@@ -1814,6 +1824,33 @@
.obtainMessage(WebCoreThread.BLOCK_CACHE_TICKER));
}
+ static void pauseUpdatePicture(WebViewCore core) {
+ // Note: there is one possible failure mode. If pauseUpdatePicture() is
+ // called from UI thread while WEBKIT_DRAW is just pulled out of the
+ // queue in WebCore thread to be executed. Then update won't be blocked.
+ if (core != null) {
+ synchronized (core) {
+ core.mDrawIsPaused = true;
+ if (core.mDrawIsScheduled) {
+ core.mEventHub.removeMessages(EventHub.WEBKIT_DRAW);
+ }
+ }
+ }
+
+ }
+
+ static void resumeUpdatePicture(WebViewCore core) {
+ if (core != null) {
+ synchronized (core) {
+ core.mDrawIsPaused = false;
+ if (core.mDrawIsScheduled) {
+ core.mDrawIsScheduled = false;
+ core.contentDraw();
+ }
+ }
+ }
+ }
+
//////////////////////////////////////////////////////////////////////////
private void restoreState(int index) {
@@ -1842,6 +1879,7 @@
synchronized (this) {
if (mDrawIsScheduled) return;
mDrawIsScheduled = true;
+ if (mDrawIsPaused) return;
mEventHub.sendMessage(Message.obtain(null, EventHub.WEBKIT_DRAW));
}
}
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 3a4b92d..1cc1c26 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -16,6 +16,8 @@
package android.widget;
+import com.android.internal.R;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
@@ -30,6 +32,7 @@
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.AttributeSet;
+import android.util.Log;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
import android.view.KeyEvent;
@@ -41,14 +44,12 @@
import android.view.ViewDebug;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
+import android.view.ContextMenu.ContextMenuInfo;
import android.view.inputmethod.BaseInputConnection;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputConnectionWrapper;
import android.view.inputmethod.InputMethodManager;
-import android.view.ContextMenu.ContextMenuInfo;
-
-import com.android.internal.R;
import java.util.ArrayList;
import java.util.List;
@@ -120,13 +121,24 @@
* Indicates the touch gesture is a scroll
*/
static final int TOUCH_MODE_SCROLL = 3;
-
+
/**
* Indicates the view is in the process of being flung
*/
static final int TOUCH_MODE_FLING = 4;
/**
+ * Indicates the touch gesture is an overscroll - a scroll beyond the beginning or end.
+ */
+ static final int TOUCH_MODE_OVERSCROLL = 5;
+
+ /**
+ * Indicates the view is being flung outside of normal content bounds
+ * and will spring back.
+ */
+ static final int TOUCH_MODE_OVERFLING = 6;
+
+ /**
* Regular layout - usually an unsolicited layout from the view system
*/
static final int LAYOUT_NORMAL = 0;
@@ -437,6 +449,10 @@
private int mMaximumVelocity;
final boolean[] mIsScrap = new boolean[1];
+
+ // True when the popup should be hidden because of a call to
+ // dispatchDisplayHint()
+ private boolean mPopupHidden;
/**
* Interface definition for a callback to be invoked when the list or grid
@@ -1915,6 +1931,14 @@
mLayoutMode = LAYOUT_NORMAL;
layoutChildren();
}
+ } else {
+ int touchMode = mTouchMode;
+ if (touchMode == TOUCH_MODE_OVERSCROLL || touchMode == TOUCH_MODE_OVERFLING) {
+ mScrollY = 0;
+ if (mFlingRunnable != null) {
+ mFlingRunnable.endFling();
+ }
+ }
}
}
@@ -1947,43 +1971,56 @@
switch (action) {
case MotionEvent.ACTION_DOWN: {
- int motionPosition = pointToPosition(x, y);
- if (!mDataChanged) {
- if ((mTouchMode != TOUCH_MODE_FLING) && (motionPosition >= 0)
- && (getAdapter().isEnabled(motionPosition))) {
- // User clicked on an actual view (and was not stopping a fling). It might be a
- // click or a scroll. Assume it is a click until proven otherwise
- mTouchMode = TOUCH_MODE_DOWN;
- // FIXME Debounce
- if (mPendingCheckForTap == null) {
- mPendingCheckForTap = new CheckForTap();
+ switch (mTouchMode) {
+ case TOUCH_MODE_OVERFLING: {
+ mFlingRunnable.endFling();
+ mTouchMode = TOUCH_MODE_OVERSCROLL;
+ mLastY = y;
+ mMotionCorrection = 0;
+ break;
+ }
+
+ default: {
+ int motionPosition = pointToPosition(x, y);
+ if (!mDataChanged) {
+ if ((mTouchMode != TOUCH_MODE_FLING) && (motionPosition >= 0)
+ && (getAdapter().isEnabled(motionPosition))) {
+ // User clicked on an actual view (and was not stopping a fling). It might be a
+ // click or a scroll. Assume it is a click until proven otherwise
+ mTouchMode = TOUCH_MODE_DOWN;
+ // FIXME Debounce
+ if (mPendingCheckForTap == null) {
+ mPendingCheckForTap = new CheckForTap();
+ }
+ postDelayed(mPendingCheckForTap, ViewConfiguration.getTapTimeout());
+ } else {
+ if (ev.getEdgeFlags() != 0 && motionPosition < 0) {
+ // If we couldn't find a view to click on, but the down event was touching
+ // the edge, we will bail out and try again. This allows the edge correcting
+ // code in ViewRoot to try to find a nearby view to select
+ return false;
+ }
+ // User clicked on whitespace, or stopped a fling. It is a scroll.
+ createScrollingCache();
+ mTouchMode = TOUCH_MODE_SCROLL;
+ mMotionCorrection = 0;
+ motionPosition = findMotionRow(y);
+ reportScrollStateChange(OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);
}
- postDelayed(mPendingCheckForTap, ViewConfiguration.getTapTimeout());
- } else {
- if (ev.getEdgeFlags() != 0 && motionPosition < 0) {
- // If we couldn't find a view to click on, but the down event was touching
- // the edge, we will bail out and try again. This allows the edge correcting
- // code in ViewRoot to try to find a nearby view to select
- return false;
- }
- // User clicked on whitespace, or stopped a fling. It is a scroll.
- createScrollingCache();
- mTouchMode = TOUCH_MODE_SCROLL;
- mMotionCorrection = 0;
- motionPosition = findMotionRow(y);
- reportScrollStateChange(OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);
}
- }
- if (motionPosition >= 0) {
- // Remember where the motion event started
- v = getChildAt(motionPosition - mFirstPosition);
- mMotionViewOriginalTop = v.getTop();
- mMotionX = x;
- mMotionY = y;
- mMotionPosition = motionPosition;
+ if (motionPosition >= 0) {
+ // Remember where the motion event started
+ v = getChildAt(motionPosition - mFirstPosition);
+ mMotionViewOriginalTop = v.getTop();
+ mMotionX = x;
+ mMotionY = y;
+ mMotionPosition = motionPosition;
+ }
+ mLastY = Integer.MIN_VALUE;
+ break;
}
- mLastY = Integer.MIN_VALUE;
+ }
break;
}
@@ -2008,17 +2045,61 @@
if (y != mLastY) {
deltaY -= mMotionCorrection;
int incrementalDeltaY = mLastY != Integer.MIN_VALUE ? y - mLastY : deltaY;
+
+ int motionViewPrevTop = 0;
+ View motionView = this.getChildAt(mMotionPosition - mFirstPosition);
+ if (motionView != null) {
+ motionViewPrevTop = motionView.getTop();
+ }
// No need to do all this work if we're not going to move anyway
if (incrementalDeltaY != 0) {
trackMotionScroll(deltaY, incrementalDeltaY);
}
// Check to see if we have bumped into the scroll limit
- View motionView = this.getChildAt(mMotionPosition - mFirstPosition);
+ motionView = this.getChildAt(mMotionPosition - mFirstPosition);
if (motionView != null) {
// Check if the top of the motion view is where it is
// supposed to be
- if (motionView.getTop() != mMotionViewNewTop) {
+ final int motionViewRealTop = motionView.getTop();
+ final int motionViewNewTop = mMotionViewNewTop;
+ if (motionViewRealTop != motionViewNewTop) {
+ // Apply overscroll
+
+ mScrollY -= incrementalDeltaY - (motionViewRealTop - motionViewPrevTop);
+ mTouchMode = TOUCH_MODE_OVERSCROLL;
+ invalidate();
+ }
+ }
+ mLastY = y;
+ }
+ break;
+
+ case TOUCH_MODE_OVERSCROLL:
+ if (y != mLastY) {
+ deltaY -= mMotionCorrection;
+ int incrementalDeltaY = mLastY != Integer.MIN_VALUE ? y - mLastY : deltaY;
+
+ final int oldScroll = mScrollY;
+ final int newScroll = oldScroll - incrementalDeltaY;
+
+ if ((oldScroll >= 0 && newScroll <= 0) ||
+ (oldScroll <= 0 && newScroll >= 0)) {
+ // Coming back to 'real' list scrolling
+ incrementalDeltaY = -newScroll;
+ mScrollY = 0;
+
+ // No need to do all this work if we're not going to move anyway
+ if (incrementalDeltaY != 0) {
+ trackMotionScroll(incrementalDeltaY, incrementalDeltaY);
+ }
+
+ // Check to see if we are back in
+ View motionView = this.getChildAt(mMotionPosition - mFirstPosition);
+ if (motionView != null) {
+ int topOffset = motionView.getTop() - mMotionViewNewTop;
+ mTouchMode = TOUCH_MODE_SCROLL;
+
// We did not scroll the full amount. Treat this essentially like the
// start of a new touch scroll
final int motionPosition = findMotionRow(y);
@@ -2029,6 +2110,9 @@
mMotionY = y;
mMotionPosition = motionPosition;
}
+ } else {
+ mScrollY -= incrementalDeltaY;
+ invalidate();
}
mLastY = y;
}
@@ -2120,6 +2204,7 @@
mFlingRunnable = new FlingRunnable();
}
reportScrollStateChange(OnScrollListener.SCROLL_STATE_FLING);
+
mFlingRunnable.start(-initialVelocity);
} else {
mTouchMode = TOUCH_MODE_REST;
@@ -2130,6 +2215,24 @@
mTouchMode = TOUCH_MODE_REST;
reportScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);
}
+ break;
+
+ case TOUCH_MODE_OVERSCROLL:
+ if (mFlingRunnable == null) {
+ mFlingRunnable = new FlingRunnable();
+ }
+ final VelocityTracker velocityTracker = mVelocityTracker;
+ velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
+ final int initialVelocity = (int) velocityTracker.getYVelocity();
+
+ reportScrollStateChange(OnScrollListener.SCROLL_STATE_FLING);
+ if (Math.abs(initialVelocity) > mMinimumVelocity) {
+ mFlingRunnable.startOverfling(-initialVelocity);
+ } else {
+ mFlingRunnable.startSpringback();
+ }
+
+ break;
}
setPressed(false);
@@ -2157,25 +2260,38 @@
}
case MotionEvent.ACTION_CANCEL: {
- mTouchMode = TOUCH_MODE_REST;
- setPressed(false);
- View motionView = this.getChildAt(mMotionPosition - mFirstPosition);
- if (motionView != null) {
- motionView.setPressed(false);
- }
- clearScrollingCache();
+ switch (mTouchMode) {
+ case TOUCH_MODE_OVERSCROLL:
+ if (mFlingRunnable == null) {
+ mFlingRunnable = new FlingRunnable();
+ }
+ mFlingRunnable.startSpringback();
+ break;
+
+ case TOUCH_MODE_OVERFLING:
+ // Do nothing - let it play out.
+ break;
+
+ default:
+ mTouchMode = TOUCH_MODE_REST;
+ setPressed(false);
+ View motionView = this.getChildAt(mMotionPosition - mFirstPosition);
+ if (motionView != null) {
+ motionView.setPressed(false);
+ }
+ clearScrollingCache();
- final Handler handler = getHandler();
- if (handler != null) {
- handler.removeCallbacks(mPendingCheckForLongPress);
- }
+ final Handler handler = getHandler();
+ if (handler != null) {
+ handler.removeCallbacks(mPendingCheckForLongPress);
+ }
- if (mVelocityTracker != null) {
- mVelocityTracker.recycle();
- mVelocityTracker = null;
+ if (mVelocityTracker != null) {
+ mVelocityTracker.recycle();
+ mVelocityTracker = null;
+ }
}
}
-
}
return true;
@@ -2205,8 +2321,13 @@
switch (action) {
case MotionEvent.ACTION_DOWN: {
+ int touchMode = mTouchMode;
+ if (touchMode == TOUCH_MODE_OVERFLING || touchMode == TOUCH_MODE_OVERSCROLL) {
+ return true;
+ }
+
int motionPosition = findMotionRow(y);
- if (mTouchMode != TOUCH_MODE_FLING && motionPosition >= 0) {
+ if (touchMode != TOUCH_MODE_FLING && motionPosition >= 0) {
// User clicked on an actual view (and was not stopping a fling).
// Remember where the motion event started
v = getChildAt(motionPosition - mFirstPosition);
@@ -2218,7 +2339,7 @@
clearScrollingCache();
}
mLastY = Integer.MIN_VALUE;
- if (mTouchMode == TOUCH_MODE_FLING) {
+ if (touchMode == TOUCH_MODE_FLING) {
return true;
}
break;
@@ -2293,18 +2414,18 @@
/**
* Tracks the decay of a fling scroll
*/
- private Scroller mScroller;
+ private OverScroller mScroller;
/**
* Y value reported by mScroller on the previous fling
*/
private int mLastFlingY;
- public FlingRunnable() {
- mScroller = new Scroller(getContext());
+ FlingRunnable() {
+ mScroller = new OverScroller(getContext());
}
- public void start(int initialVelocity) {
+ void start(int initialVelocity) {
int initialY = initialVelocity < 0 ? Integer.MAX_VALUE : 0;
mLastFlingY = initialY;
mScroller.fling(0, initialY, 0, initialVelocity,
@@ -2319,77 +2440,117 @@
}
}
}
-
+
+ void startSpringback() {
+ if (mScroller.springback(0, mScrollY, 0, 0, 0, 0)) {
+ mTouchMode = TOUCH_MODE_OVERFLING;
+ invalidate();
+ post(this);
+ }
+ }
+
+ void startOverfling(int initialVelocity) {
+ mScroller.fling(0, mScrollY, 0, initialVelocity, 0, 0, 0, 0, 0, getHeight());
+ mTouchMode = TOUCH_MODE_OVERFLING;
+ invalidate();
+ post(this);
+ }
+
private void endFling() {
mTouchMode = TOUCH_MODE_REST;
reportScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);
clearScrollingCache();
+ removeCallbacks(this);
}
public void run() {
- if (mTouchMode != TOUCH_MODE_FLING) {
+ switch (mTouchMode) {
+ default:
return;
- }
-
- if (mItemCount == 0 || getChildCount() == 0) {
- endFling();
- return;
- }
-
- final Scroller scroller = mScroller;
- boolean more = scroller.computeScrollOffset();
- final int y = scroller.getCurrY();
-
- // Flip sign to convert finger direction to list items direction
- // (e.g. finger moving down means list is moving towards the top)
- int delta = mLastFlingY - y;
-
- // Pretend that each frame of a fling scroll is a touch scroll
- if (delta > 0) {
- // List is moving towards the top. Use first view as mMotionPosition
- mMotionPosition = mFirstPosition;
- final View firstView = getChildAt(0);
- mMotionViewOriginalTop = firstView.getTop();
-
- // Don't fling more than 1 screen
- delta = Math.min(getHeight() - mPaddingBottom - mPaddingTop - 1, delta);
- } else {
- // List is moving towards the bottom. Use last view as mMotionPosition
- int offsetToLast = getChildCount() - 1;
- mMotionPosition = mFirstPosition + offsetToLast;
-
- final View lastView = getChildAt(offsetToLast);
- mMotionViewOriginalTop = lastView.getTop();
-
- // Don't fling more than 1 screen
- delta = Math.max(-(getHeight() - mPaddingBottom - mPaddingTop - 1), delta);
- }
-
- trackMotionScroll(delta, delta);
-
- // Check to see if we have bumped into the scroll limit
- View motionView = getChildAt(mMotionPosition - mFirstPosition);
- if (motionView != null) {
- // Check if the top of the motion view is where it is
- // supposed to be
- if (motionView.getTop() != mMotionViewNewTop) {
- more = false;
+
+ case TOUCH_MODE_FLING: {
+ if (mItemCount == 0 || getChildCount() == 0) {
+ endFling();
+ return;
}
- }
- if (more) {
- invalidate();
- mLastFlingY = y;
- post(this);
- } else {
- endFling();
- if (PROFILE_FLINGING) {
- if (mFlingProfilingStarted) {
- Debug.stopMethodTracing();
- mFlingProfilingStarted = false;
+ final OverScroller scroller = mScroller;
+ boolean more = scroller.computeScrollOffset();
+ final int y = scroller.getCurrY();
+
+ // Flip sign to convert finger direction to list items direction
+ // (e.g. finger moving down means list is moving towards the top)
+ int delta = mLastFlingY - y;
+
+ // Pretend that each frame of a fling scroll is a touch scroll
+ if (delta > 0) {
+ // List is moving towards the top. Use first view as mMotionPosition
+ mMotionPosition = mFirstPosition;
+ final View firstView = getChildAt(0);
+ mMotionViewOriginalTop = firstView.getTop();
+
+ // Don't fling more than 1 screen
+ delta = Math.min(getHeight() - mPaddingBottom - mPaddingTop - 1, delta);
+ } else {
+ // List is moving towards the bottom. Use last view as mMotionPosition
+ int offsetToLast = getChildCount() - 1;
+ mMotionPosition = mFirstPosition + offsetToLast;
+
+ final View lastView = getChildAt(offsetToLast);
+ mMotionViewOriginalTop = lastView.getTop();
+
+ // Don't fling more than 1 screen
+ delta = Math.max(-(getHeight() - mPaddingBottom - mPaddingTop - 1), delta);
+ }
+
+ // Do something different on overscroll - offsetChildrenTopAndBottom()
+ trackMotionScroll(delta, delta);
+
+ // Check to see if we have bumped into the scroll limit
+ View motionView = getChildAt(mMotionPosition - mFirstPosition);
+ if (motionView != null) {
+ // Check if the top of the motion view is where it is
+ // supposed to be
+ if (motionView.getTop() != mMotionViewNewTop) {
+ float vel = scroller.getCurrVelocity();
+ if (delta > 0) {
+ vel = -vel;
+ }
+ startOverfling(Math.round(vel));
+ break;
}
}
+
+ if (more) {
+ invalidate();
+ mLastFlingY = y;
+ post(this);
+ } else {
+ endFling();
+
+ if (PROFILE_FLINGING) {
+ if (mFlingProfilingStarted) {
+ Debug.stopMethodTracing();
+ mFlingProfilingStarted = false;
+ }
+ }
+ }
+ break;
}
+
+ case TOUCH_MODE_OVERFLING: {
+ final OverScroller scroller = mScroller;
+ if (scroller.computeScrollOffset()) {
+ mScrollY = scroller.getCurrY();
+ invalidate();
+ post(this);
+ } else {
+ endFling();
+ }
+ break;
+ }
+ }
+
}
}
@@ -2867,6 +3028,7 @@
}
break;
}
+ mPopupHidden = hint == INVISIBLE;
}
/**
@@ -2876,6 +3038,7 @@
if (mPopup != null) {
mPopup.dismiss();
}
+ mPopupHidden = false;
}
/**
@@ -3152,7 +3315,7 @@
public void onGlobalLayout() {
if (isShown()) {
// Show the popup if we are filtered
- if (mFiltered && mPopup != null && !mPopup.isShowing()) {
+ if (mFiltered && mPopup != null && !mPopup.isShowing() && !mPopupHidden) {
showPopup();
}
} else {
diff --git a/core/java/android/widget/DateTimeView.java b/core/java/android/widget/DateTimeView.java
index 9067e26..3dab9f2 100644
--- a/core/java/android/widget/DateTimeView.java
+++ b/core/java/android/widget/DateTimeView.java
@@ -203,7 +203,7 @@
private DateFormat getDateFormat() {
String format = Settings.System.getString(getContext().getContentResolver(),
Settings.System.DATE_FORMAT);
- if ("".equals(format)) {
+ if (format == null || "".equals(format)) {
return DateFormat.getDateInstance(DateFormat.SHORT);
} else {
return new SimpleDateFormat(format);
diff --git a/core/java/android/widget/OverScroller.java b/core/java/android/widget/OverScroller.java
index b22ae3c..44d415e 100644
--- a/core/java/android/widget/OverScroller.java
+++ b/core/java/android/widget/OverScroller.java
@@ -383,4 +383,15 @@
public int getFinalY() {
return mCurrScroller.getFinalY();
}
+
+ /**
+ * @hide
+ * Returns the current velocity.
+ *
+ * @return The original velocity less the deceleration. Result may be
+ * negative.
+ */
+ public float getCurrVelocity() {
+ return mCurrScroller.getCurrVelocity();
+ }
}
diff --git a/core/java/com/android/internal/backup/IBackupTransport.aidl b/core/java/com/android/internal/backup/IBackupTransport.aidl
index a830ebd..9da1066 100644
--- a/core/java/com/android/internal/backup/IBackupTransport.aidl
+++ b/core/java/com/android/internal/backup/IBackupTransport.aidl
@@ -102,7 +102,7 @@
int finishBackup();
/**
- * Get the set of backups currently available over this transport.
+ * Get the set of all backups currently available over this transport.
*
* @return Descriptions of the set of restore images available for this device,
* or null if an error occurred (the attempt should be rescheduled).
@@ -110,11 +110,22 @@
RestoreSet[] getAvailableRestoreSets();
/**
+ * Get the identifying token of the backup set currently being stored from
+ * this device. This is used in the case of applications wishing to restore
+ * their last-known-good data.
+ *
+ * @return A token that can be passed to {@link #startRestore}, or 0 if there
+ * is no backup set available corresponding to the current device state.
+ */
+ long getCurrentRestoreSet();
+
+ /**
* Start restoring application data from backup. After calling this function,
* alternate calls to {@link #nextRestorePackage} and {@link #nextRestoreData}
* to walk through the actual application data.
*
- * @param token A backup token as returned by {@link #getAvailableRestoreSets}.
+ * @param token A backup token as returned by {@link #getAvailableRestoreSets}
+ * or {@link #getCurrentRestoreSet}.
* @param packages List of applications to restore (if data is available).
* Application data will be restored in the order given.
* @return One of {@link BackupConstants#TRANSPORT_OK} (OK so far, call
diff --git a/core/java/com/android/internal/backup/LocalTransport.java b/core/java/com/android/internal/backup/LocalTransport.java
index 12bc5a8..23ec647 100644
--- a/core/java/com/android/internal/backup/LocalTransport.java
+++ b/core/java/com/android/internal/backup/LocalTransport.java
@@ -33,6 +33,9 @@
private static final String TRANSPORT_DIR_NAME
= "com.android.internal.backup.LocalTransport";
+ // The single hardcoded restore set always has the same (nonzero!) token
+ private static final long RESTORE_TOKEN = 1;
+
private Context mContext;
private PackageManager mPackageManager;
private File mDataDir = new File(Environment.getDownloadCacheDirectory(), "backup");
@@ -149,11 +152,16 @@
// Restore handling
public RestoreSet[] getAvailableRestoreSets() throws android.os.RemoteException {
// one hardcoded restore set
- RestoreSet set = new RestoreSet("Local disk image", "flash", 0);
+ RestoreSet set = new RestoreSet("Local disk image", "flash", RESTORE_TOKEN);
RestoreSet[] array = { set };
return array;
}
+ public long getCurrentRestoreSet() {
+ // The hardcoded restore set always has the same token
+ return RESTORE_TOKEN;
+ }
+
public int startRestore(long token, PackageInfo[] packages) {
if (DEBUG) Log.v(TAG, "start restore " + token);
mRestorePackages = packages;
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index 6347146..f074b80 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -80,9 +80,10 @@
* pin = digit-only password
* password = alphanumeric password
*/
- public static final int MODE_PATTERN = DevicePolicyManager.PASSWORD_MODE_SOMETHING;
- public static final int MODE_PIN = DevicePolicyManager.PASSWORD_MODE_NUMERIC;
- public static final int MODE_PASSWORD = DevicePolicyManager.PASSWORD_MODE_ALPHANUMERIC;
+ public static final int MODE_UNSPECIFIED = DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
+ public static final int MODE_PATTERN = DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
+ public static final int MODE_PIN = DevicePolicyManager.PASSWORD_QUALITY_NUMERIC;
+ public static final int MODE_PASSWORD = DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC;
/**
* The minimum number of dots the user must include in a wrong pattern
@@ -132,13 +133,13 @@
* @return
*/
public int getRequestedPasswordMode() {
- int policyMode = mDevicePolicyManager.getPasswordMode(null);
+ int policyMode = mDevicePolicyManager.getPasswordQuality(null);
switch (policyMode) {
- case DevicePolicyManager.PASSWORD_MODE_ALPHANUMERIC:
+ case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC:
return MODE_PASSWORD;
- case DevicePolicyManager.PASSWORD_MODE_NUMERIC:
+ case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
return MODE_PIN;
- case DevicePolicyManager.PASSWORD_MODE_UNSPECIFIED:
+ case DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED:
return MODE_PATTERN;
}
return MODE_PATTERN;
@@ -158,16 +159,16 @@
}
public void setActivePasswordState(int mode, int length) {
- int policyMode = DevicePolicyManager.PASSWORD_MODE_UNSPECIFIED;
+ int policyMode = DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
switch (mode) {
case MODE_PATTERN:
- policyMode = DevicePolicyManager.PASSWORD_MODE_UNSPECIFIED;
+ policyMode = DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
break;
case MODE_PIN:
- policyMode = DevicePolicyManager.PASSWORD_MODE_NUMERIC;
+ policyMode = DevicePolicyManager.PASSWORD_QUALITY_NUMERIC;
break;
case MODE_PASSWORD:
- policyMode = DevicePolicyManager.PASSWORD_MODE_ALPHANUMERIC;
+ policyMode = DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC;
break;
}
mDevicePolicyManager.setActivePasswordState(policyMode, length);
@@ -302,7 +303,7 @@
DevicePolicyManager dpm = (DevicePolicyManager)mContext.getSystemService(
Context.DEVICE_POLICY_SERVICE);
dpm.setActivePasswordState(
- DevicePolicyManager.PASSWORD_MODE_SOMETHING, pattern.size());
+ DevicePolicyManager.PASSWORD_QUALITY_SOMETHING, pattern.size());
}
} catch (FileNotFoundException fnfe) {
// Cant do much, unless we want to fail over to using the settings provider
@@ -314,7 +315,65 @@
}
/**
- * Save a lock password.
+ * Compare the given password and mode, ensuring that the password meets
+ * the mode and returning the minimum mode needed for the given password.
+ * @param password The password to be used.
+ * @param reqMode The desired password mode.
+ * @return Returns {@link #MODE_UNSPECIFIED} if the password is not
+ * good enough for the given mode. Otherwise, returns either the original
+ * reqMode or something better if that is needed for the given password.
+ */
+ static public int adjustPasswordMode(String password, int reqMode) {
+ boolean hasDigit = false;
+ boolean hasNonDigit = false;
+ final int len = password.length();
+ for (int i = 0; i < len; i++) {
+ if (Character.isDigit(password.charAt(i))) {
+ hasDigit = true;
+ } else {
+ hasNonDigit = true;
+ }
+ }
+
+ // First check if it is sufficient.
+ switch (reqMode) {
+ case MODE_PASSWORD: {
+ if (!hasDigit || !hasNonDigit) {
+ return MODE_UNSPECIFIED;
+ }
+ } break;
+
+ case MODE_PIN:
+ case MODE_PATTERN: {
+ // Whatever we have is acceptable; we may need to promote the
+ // mode later.
+ } break;
+
+ default:
+ // If it isn't a mode we specifically know, then fail fast.
+ Log.w(TAG, "adjustPasswordMode: unknown mode " + reqMode);
+ return MODE_UNSPECIFIED;
+ }
+
+ // Do we need to promote?
+ if (hasNonDigit) {
+ if (reqMode < MODE_PASSWORD) {
+ reqMode = MODE_PASSWORD;
+ }
+ }
+ if (hasDigit) {
+ if (reqMode < MODE_PIN) {
+ reqMode = MODE_PIN;
+ }
+ }
+
+ return reqMode;
+ }
+
+ /**
+ * Save a lock password. Does not ensure that the pattern is as good
+ * as the requested mode, but will adjust the mode to be as good as the
+ * pattern.
* @param password The password to save
*/
public void saveLockPassword(String password, int mode) {
@@ -331,9 +390,9 @@
}
raf.close();
if (password != null) {
- int textMode = TextUtils.isDigitsOnly(password) ? MODE_PIN : MODE_PASSWORD;
- if (textMode > mode) {
- mode = textMode;
+ int finalMode = adjustPasswordMode(password, mode);
+ if (mode < finalMode) {
+ mode = finalMode;
}
setLong(PASSWORD_TYPE_KEY, mode);
DevicePolicyManager dpm = (DevicePolicyManager)mContext.getSystemService(
diff --git a/core/java/com/android/internal/widget/SlidingTab.java b/core/java/com/android/internal/widget/SlidingTab.java
index eb6d1a6..fd38998 100644
--- a/core/java/com/android/internal/widget/SlidingTab.java
+++ b/core/java/com/android/internal/widget/SlidingTab.java
@@ -545,12 +545,22 @@
return true;
}
+ /**
+ * Reset the tabs to their original state and stop any existing animation.
+ * Animate them back into place if animate is true.
+ *
+ * @param animate
+ */
+ public void reset(boolean animate) {
+ mLeftSlider.reset(animate);
+ mRightSlider.reset(animate);
+ }
+
@Override
public void setVisibility(int visibility) {
// Clear animations so sliders don't continue to animate when we show the widget again.
if (visibility != getVisibility() && visibility == View.INVISIBLE) {
- mLeftSlider.reset(false);
- mRightSlider.reset(false);
+ reset(false);
}
super.setVisibility(visibility);
}
diff --git a/core/jni/CursorWindow.cpp b/core/jni/CursorWindow.cpp
index 7864189..7877921 100644
--- a/core/jni/CursorWindow.cpp
+++ b/core/jni/CursorWindow.cpp
@@ -18,7 +18,8 @@
#define LOG_TAG "CursorWindow"
#include <utils/Log.h>
-#include <binder/MemoryDealer.h>
+#include <binder/MemoryHeapBase.h>
+#include <binder/MemoryBase.h>
#include <assert.h>
#include <string.h>
@@ -37,7 +38,7 @@
{
}
-bool CursorWindow::setMemory(sp<IMemory> memory)
+bool CursorWindow::setMemory(const sp<IMemory>& memory)
{
mMemory = memory;
mData = (uint8_t *) memory->pointer();
@@ -47,7 +48,6 @@
mHeader = (window_header_t *) mData;
// Make the window read-only
- mHeap = NULL;
ssize_t size = memory->size();
mSize = size;
mMaxSize = size;
@@ -60,9 +60,10 @@
{
//TODO Use a non-memory dealer mmap region for localOnly
- mHeap = new MemoryDealer(new SharedHeap(mMaxSize, 0, "CursorWindow"));
- if (mHeap != NULL) {
- mMemory = mHeap->allocate(mMaxSize);
+ sp<MemoryHeapBase> heap;
+ heap = new MemoryHeapBase(mMaxSize, 0, "CursorWindow");
+ if (heap != NULL) {
+ mMemory = new MemoryBase(heap, 0, mMaxSize);
if (mMemory != NULL) {
mData = (uint8_t *) mMemory->pointer();
if (mData) {
@@ -75,10 +76,10 @@
return true;
}
}
- LOGE("memory dealer allocation failed");
+ LOGE("CursorWindow heap allocation failed");
return false;
} else {
- LOGE("failed to create the memory dealer");
+ LOGE("failed to create the CursorWindow heap");
return false;
}
}
diff --git a/core/jni/CursorWindow.h b/core/jni/CursorWindow.h
index e98b009..3fcb560 100644
--- a/core/jni/CursorWindow.h
+++ b/core/jni/CursorWindow.h
@@ -21,7 +21,7 @@
#include <stddef.h>
#include <stdint.h>
-#include <binder/MemoryDealer.h>
+#include <binder/IMemory.h>
#include <utils/RefBase.h>
#include <jni.h>
@@ -101,7 +101,7 @@
public:
CursorWindow(size_t maxSize);
CursorWindow(){}
- bool setMemory(sp<IMemory>);
+ bool setMemory(const sp<IMemory>&);
~CursorWindow();
bool initBuffer(bool localOnly);
@@ -189,7 +189,6 @@
size_t mSize;
size_t mMaxSize;
window_header_t * mHeader;
- sp<MemoryDealer> mHeap;
sp<IMemory> mMemory;
/**
diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp
index 1a5987c..03107a4 100644
--- a/core/jni/android_hardware_Camera.cpp
+++ b/core/jni/android_hardware_Camera.cpp
@@ -168,7 +168,7 @@
}
if(mCallbackBuffers.isEmpty()) {
- LOGW("Out of buffers, clearing callback!");
+ LOGV("Out of buffers, clearing callback!");
mCamera->setPreviewCallbackFlags(FRAME_CALLBACK_FLAG_NOOP);
mManualCameraCallbackSet = false;
diff --git a/core/jni/com_google_android_gles_jni_GLImpl.cpp b/core/jni/com_google_android_gles_jni_GLImpl.cpp
index 93e4d2b..bf613e1 100644
--- a/core/jni/com_google_android_gles_jni_GLImpl.cpp
+++ b/core/jni/com_google_android_gles_jni_GLImpl.cpp
@@ -24,6 +24,23 @@
#include <GLES/gl.h>
#include <GLES/glext.h>
+// Work around differences between the generated name and the actual name.
+
+#define glBlendEquation glBlendEquationOES
+#define glBlendEquationSeparate glBlendEquationSeparateOES
+#define glBlendFuncSeparate glBlendFuncSeparateOES
+#define glGetTexGenfv glGetTexGenfvOES
+#define glGetTexGeniv glGetTexGenivOES
+#define glGetTexGenxv glGetTexGenxvOES
+#define glTexGenf glTexGenfOES
+#define glTexGenfv glTexGenfvOES
+#define glTexGeni glTexGeniOES
+#define glTexGeniv glTexGenivOES
+#define glTexGenx glTexGenxOES
+#define glTexGenxv glTexGenxvOES
+
+
+
/* special calls implemented in Android's GLES wrapper used to more
* efficiently bound-check passed arrays */
extern "C" {
@@ -59,6 +76,11 @@
static jfieldID positionID;
static jfieldID limitID;
static jfieldID elementSizeShiftID;
+static jfieldID haveCheckedExtensionsID;
+static jfieldID have_OES_blend_equation_separateID;
+static jfieldID have_OES_blend_subtractID;
+static jfieldID have_OES_framebuffer_objectID;
+static jfieldID have_OES_texture_cube_mapID;
/* Cache method IDs each time the class is loaded. */
@@ -73,6 +95,11 @@
jclass g11impClassLocal = _env->FindClass("com/google/android/gles_jni/GLImpl");
G11ImplClass = (jclass) _env->NewGlobalRef(g11impClassLocal);
+ haveCheckedExtensionsID = _env->GetFieldID(G11ImplClass, "haveCheckedExtensions", "Z");
+ have_OES_blend_equation_separateID = _env->GetFieldID(G11ImplClass, "have_OES_blend_equation_separate", "Z");
+ have_OES_blend_subtractID = _env->GetFieldID(G11ImplClass, "have_OES_blend_subtract", "Z");
+ have_OES_framebuffer_objectID = _env->GetFieldID(G11ImplClass, "have_OES_framebuffer_object", "Z");
+ have_OES_texture_cube_mapID = _env->GetFieldID(G11ImplClass, "have_OES_texture_cube_map", "Z");
getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
"getBasePointer", "(Ljava/nio/Buffer;)J");
@@ -194,6 +221,64 @@
return numCompressedTextureFormats;
}
+// Check if the extension at the head of pExtensions is pExtension. Note that pExtensions is
+// terminated by either 0 or space, while pExtension is terminated by 0.
+
+static bool
+extensionEqual(const GLubyte* pExtensions, const GLubyte* pExtension) {
+ while (true) {
+ char a = *pExtensions++;
+ char b = *pExtension++;
+ bool aEnd = a == '\0' || a == ' ';
+ bool bEnd = b == '\0';
+ if ( aEnd || bEnd) {
+ return aEnd == bEnd;
+ }
+ if ( a != b ) {
+ return false;
+ }
+ }
+}
+
+static const GLubyte*
+nextExtension(const GLubyte* pExtensions) {
+ while (true) {
+ char a = *pExtensions++;
+ if ( a == '\0') {
+ return pExtensions-1;
+ } else if ( a == ' ') {
+ return pExtensions;
+ }
+ }
+}
+
+static bool
+checkForExtension(const GLubyte* pExtensions, const GLubyte* pExtension) {
+ for (;*pExtensions != '\0'; pExtensions = nextExtension(pExtensions)) {
+ if (extensionEqual(pExtensions, pExtension)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+static bool
+supportsExtension(JNIEnv *_env, jobject impl, jfieldID fieldId) {
+ if (!_env->GetBooleanField(impl, haveCheckedExtensionsID)) {
+ _env->SetBooleanField(impl, haveCheckedExtensionsID, true);
+ const GLubyte* sExtensions = glGetString(GL_EXTENSIONS);
+ _env->SetBooleanField(impl, have_OES_blend_equation_separateID,
+ checkForExtension(sExtensions, (const GLubyte*) "GL_OES_blend_equation_separate"));
+ _env->SetBooleanField(impl, have_OES_blend_subtractID,
+ checkForExtension(sExtensions, (const GLubyte*) "GL_OES_blend_subtract"));
+ _env->SetBooleanField(impl, have_OES_framebuffer_objectID,
+ checkForExtension(sExtensions, (const GLubyte*) "GL_OES_framebuffer_object"));
+ _env->SetBooleanField(impl, have_OES_texture_cube_mapID,
+ checkForExtension(sExtensions, (const GLubyte*) "GL_OES_texture_cube_map"));
+ }
+ return _env->GetBooleanField(impl, fieldId);
+}
+
// --------------------------------------------------------------------------
/* void glActiveTexture ( GLenum texture ) */
@@ -6137,315 +6222,1084 @@
static void
android_glBindFramebufferOES__II
(JNIEnv *_env, jobject _this, jint target, jint framebuffer) {
- _env->ThrowNew(UOEClass,
- "glBindFramebufferOES");
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glBindFramebufferOES");
+ return;
+ }
+ glBindFramebufferOES(
+ (GLint)target,
+ (GLint)framebuffer
+ );
}
/* void glBindRenderbufferOES ( GLint target, GLint renderbuffer ) */
static void
android_glBindRenderbufferOES__II
(JNIEnv *_env, jobject _this, jint target, jint renderbuffer) {
- _env->ThrowNew(UOEClass,
- "glBindRenderbufferOES");
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glBindRenderbufferOES");
+ return;
+ }
+ glBindRenderbufferOES(
+ (GLint)target,
+ (GLint)renderbuffer
+ );
}
/* void glBlendEquation ( GLint mode ) */
static void
android_glBlendEquation__I
(JNIEnv *_env, jobject _this, jint mode) {
- _env->ThrowNew(UOEClass,
- "glBlendEquation");
+ if (! supportsExtension(_env, _this, have_OES_blend_subtractID)) {
+ _env->ThrowNew(UOEClass,
+ "glBlendEquation");
+ return;
+ }
+ glBlendEquation(
+ (GLint)mode
+ );
}
/* void glBlendEquationSeparate ( GLint modeRGB, GLint modeAlpha ) */
static void
android_glBlendEquationSeparate__II
(JNIEnv *_env, jobject _this, jint modeRGB, jint modeAlpha) {
- _env->ThrowNew(UOEClass,
- "glBlendEquationSeparate");
+ if (! supportsExtension(_env, _this, have_OES_blend_equation_separateID)) {
+ _env->ThrowNew(UOEClass,
+ "glBlendEquationSeparate");
+ return;
+ }
+ glBlendEquationSeparate(
+ (GLint)modeRGB,
+ (GLint)modeAlpha
+ );
}
/* void glBlendFuncSeparate ( GLint srcRGB, GLint dstRGB, GLint srcAlpha, GLint dstAlpha ) */
static void
android_glBlendFuncSeparate__IIII
(JNIEnv *_env, jobject _this, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) {
- _env->ThrowNew(UOEClass,
- "glBlendFuncSeparate");
+ if (! supportsExtension(_env, _this, have_OES_blend_equation_separateID)) {
+ _env->ThrowNew(UOEClass,
+ "glBlendFuncSeparate");
+ return;
+ }
+ glBlendFuncSeparate(
+ (GLint)srcRGB,
+ (GLint)dstRGB,
+ (GLint)srcAlpha,
+ (GLint)dstAlpha
+ );
}
/* GLint glCheckFramebufferStatusOES ( GLint target ) */
static jint
android_glCheckFramebufferStatusOES__I
(JNIEnv *_env, jobject _this, jint target) {
- _env->ThrowNew(UOEClass,
- "glCheckFramebufferStatusOES");
- return 0;
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glCheckFramebufferStatusOES");
+ return 0;
+ }
+ GLint _returnValue = 0;
+ _returnValue = glCheckFramebufferStatusOES(
+ (GLint)target
+ );
+ return _returnValue;
}
-/* void glDeleteFramebuffersOES ( GLint n, GLint *framebuffers ) */
+/* void glDeleteFramebuffersOES ( GLint n, GLuint *framebuffers ) */
static void
android_glDeleteFramebuffersOES__I_3II
(JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
- _env->ThrowNew(UOEClass,
- "glDeleteFramebuffersOES");
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glDeleteFramebuffersOES");
+ return;
+ }
+ jint _exception = 0;
+ GLuint *framebuffers_base = (GLuint *) 0;
+ jint _remaining;
+ GLuint *framebuffers = (GLuint *) 0;
+
+ if (!framebuffers_ref) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "framebuffers == null");
+ goto exit;
+ }
+ if (offset < 0) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "offset < 0");
+ goto exit;
+ }
+ _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
+ if (_remaining < n) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "length - offset < n");
+ goto exit;
+ }
+ framebuffers_base = (GLuint *)
+ _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0);
+ framebuffers = framebuffers_base + offset;
+
+ glDeleteFramebuffersOES(
+ (GLint)n,
+ (GLuint *)framebuffers
+ );
+
+exit:
+ if (framebuffers_base) {
+ _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base,
+ _exception ? JNI_ABORT: 0);
+ }
}
-/* void glDeleteFramebuffersOES ( GLint n, GLint *framebuffers ) */
+/* void glDeleteFramebuffersOES ( GLint n, GLuint *framebuffers ) */
static void
android_glDeleteFramebuffersOES__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
- _env->ThrowNew(UOEClass,
- "glDeleteFramebuffersOES");
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glDeleteFramebuffersOES");
+ return;
+ }
+ jint _exception = 0;
+ jarray _array = (jarray) 0;
+ jint _remaining;
+ GLuint *framebuffers = (GLuint *) 0;
+
+ framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining);
+ if (_remaining < n) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "remaining() < n");
+ goto exit;
+ }
+ glDeleteFramebuffersOES(
+ (GLint)n,
+ (GLuint *)framebuffers
+ );
+
+exit:
+ if (_array) {
+ releasePointer(_env, _array, framebuffers, _exception ? JNI_FALSE : JNI_TRUE);
+ }
}
-/* void glDeleteRenderbuffersOES ( GLint n, GLint *renderbuffers ) */
+/* void glDeleteRenderbuffersOES ( GLint n, GLuint *renderbuffers ) */
static void
android_glDeleteRenderbuffersOES__I_3II
(JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
- _env->ThrowNew(UOEClass,
- "glDeleteRenderbuffersOES");
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glDeleteRenderbuffersOES");
+ return;
+ }
+ jint _exception = 0;
+ GLuint *renderbuffers_base = (GLuint *) 0;
+ jint _remaining;
+ GLuint *renderbuffers = (GLuint *) 0;
+
+ if (!renderbuffers_ref) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "renderbuffers == null");
+ goto exit;
+ }
+ if (offset < 0) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "offset < 0");
+ goto exit;
+ }
+ _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
+ if (_remaining < n) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "length - offset < n");
+ goto exit;
+ }
+ renderbuffers_base = (GLuint *)
+ _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0);
+ renderbuffers = renderbuffers_base + offset;
+
+ glDeleteRenderbuffersOES(
+ (GLint)n,
+ (GLuint *)renderbuffers
+ );
+
+exit:
+ if (renderbuffers_base) {
+ _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base,
+ _exception ? JNI_ABORT: 0);
+ }
}
-/* void glDeleteRenderbuffersOES ( GLint n, GLint *renderbuffers ) */
+/* void glDeleteRenderbuffersOES ( GLint n, GLuint *renderbuffers ) */
static void
android_glDeleteRenderbuffersOES__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
- _env->ThrowNew(UOEClass,
- "glDeleteRenderbuffersOES");
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glDeleteRenderbuffersOES");
+ return;
+ }
+ jint _exception = 0;
+ jarray _array = (jarray) 0;
+ jint _remaining;
+ GLuint *renderbuffers = (GLuint *) 0;
+
+ renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining);
+ if (_remaining < n) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "remaining() < n");
+ goto exit;
+ }
+ glDeleteRenderbuffersOES(
+ (GLint)n,
+ (GLuint *)renderbuffers
+ );
+
+exit:
+ if (_array) {
+ releasePointer(_env, _array, renderbuffers, _exception ? JNI_FALSE : JNI_TRUE);
+ }
}
/* void glFramebufferRenderbufferOES ( GLint target, GLint attachment, GLint renderbuffertarget, GLint renderbuffer ) */
static void
android_glFramebufferRenderbufferOES__IIII
(JNIEnv *_env, jobject _this, jint target, jint attachment, jint renderbuffertarget, jint renderbuffer) {
- _env->ThrowNew(UOEClass,
- "glFramebufferRenderbufferOES");
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glFramebufferRenderbufferOES");
+ return;
+ }
+ glFramebufferRenderbufferOES(
+ (GLint)target,
+ (GLint)attachment,
+ (GLint)renderbuffertarget,
+ (GLint)renderbuffer
+ );
}
/* void glFramebufferTexture2DOES ( GLint target, GLint attachment, GLint textarget, GLint texture, GLint level ) */
static void
android_glFramebufferTexture2DOES__IIIII
(JNIEnv *_env, jobject _this, jint target, jint attachment, jint textarget, jint texture, jint level) {
- _env->ThrowNew(UOEClass,
- "glFramebufferTexture2DOES");
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glFramebufferTexture2DOES");
+ return;
+ }
+ glFramebufferTexture2DOES(
+ (GLint)target,
+ (GLint)attachment,
+ (GLint)textarget,
+ (GLint)texture,
+ (GLint)level
+ );
}
/* void glGenerateMipmapOES ( GLint target ) */
static void
android_glGenerateMipmapOES__I
(JNIEnv *_env, jobject _this, jint target) {
- _env->ThrowNew(UOEClass,
- "glGenerateMipmapOES");
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glGenerateMipmapOES");
+ return;
+ }
+ glGenerateMipmapOES(
+ (GLint)target
+ );
}
-/* void glGenFramebuffersOES ( GLint n, GLint *framebuffers ) */
+/* void glGenFramebuffersOES ( GLint n, GLuint *framebuffers ) */
static void
android_glGenFramebuffersOES__I_3II
(JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
- _env->ThrowNew(UOEClass,
- "glGenFramebuffersOES");
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glGenFramebuffersOES");
+ return;
+ }
+ jint _exception = 0;
+ GLuint *framebuffers_base = (GLuint *) 0;
+ jint _remaining;
+ GLuint *framebuffers = (GLuint *) 0;
+
+ if (!framebuffers_ref) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "framebuffers == null");
+ goto exit;
+ }
+ if (offset < 0) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "offset < 0");
+ goto exit;
+ }
+ _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
+ if (_remaining < n) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "length - offset < n");
+ goto exit;
+ }
+ framebuffers_base = (GLuint *)
+ _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0);
+ framebuffers = framebuffers_base + offset;
+
+ glGenFramebuffersOES(
+ (GLint)n,
+ (GLuint *)framebuffers
+ );
+
+exit:
+ if (framebuffers_base) {
+ _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base,
+ _exception ? JNI_ABORT: 0);
+ }
}
-/* void glGenFramebuffersOES ( GLint n, GLint *framebuffers ) */
+/* void glGenFramebuffersOES ( GLint n, GLuint *framebuffers ) */
static void
android_glGenFramebuffersOES__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
- _env->ThrowNew(UOEClass,
- "glGenFramebuffersOES");
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glGenFramebuffersOES");
+ return;
+ }
+ jint _exception = 0;
+ jarray _array = (jarray) 0;
+ jint _remaining;
+ GLuint *framebuffers = (GLuint *) 0;
+
+ framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining);
+ if (_remaining < n) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "remaining() < n");
+ goto exit;
+ }
+ glGenFramebuffersOES(
+ (GLint)n,
+ (GLuint *)framebuffers
+ );
+
+exit:
+ if (_array) {
+ releasePointer(_env, _array, framebuffers, _exception ? JNI_FALSE : JNI_TRUE);
+ }
}
-/* void glGenRenderbuffersOES ( GLint n, GLint *renderbuffers ) */
+/* void glGenRenderbuffersOES ( GLint n, GLuint *renderbuffers ) */
static void
android_glGenRenderbuffersOES__I_3II
(JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
- _env->ThrowNew(UOEClass,
- "glGenRenderbuffersOES");
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glGenRenderbuffersOES");
+ return;
+ }
+ jint _exception = 0;
+ GLuint *renderbuffers_base = (GLuint *) 0;
+ jint _remaining;
+ GLuint *renderbuffers = (GLuint *) 0;
+
+ if (!renderbuffers_ref) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "renderbuffers == null");
+ goto exit;
+ }
+ if (offset < 0) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "offset < 0");
+ goto exit;
+ }
+ _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
+ if (_remaining < n) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "length - offset < n");
+ goto exit;
+ }
+ renderbuffers_base = (GLuint *)
+ _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0);
+ renderbuffers = renderbuffers_base + offset;
+
+ glGenRenderbuffersOES(
+ (GLint)n,
+ (GLuint *)renderbuffers
+ );
+
+exit:
+ if (renderbuffers_base) {
+ _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base,
+ _exception ? JNI_ABORT: 0);
+ }
}
-/* void glGenRenderbuffersOES ( GLint n, GLint *renderbuffers ) */
+/* void glGenRenderbuffersOES ( GLint n, GLuint *renderbuffers ) */
static void
android_glGenRenderbuffersOES__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
- _env->ThrowNew(UOEClass,
- "glGenRenderbuffersOES");
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glGenRenderbuffersOES");
+ return;
+ }
+ jint _exception = 0;
+ jarray _array = (jarray) 0;
+ jint _remaining;
+ GLuint *renderbuffers = (GLuint *) 0;
+
+ renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining);
+ if (_remaining < n) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "remaining() < n");
+ goto exit;
+ }
+ glGenRenderbuffersOES(
+ (GLint)n,
+ (GLuint *)renderbuffers
+ );
+
+exit:
+ if (_array) {
+ releasePointer(_env, _array, renderbuffers, _exception ? JNI_FALSE : JNI_TRUE);
+ }
}
/* void glGetFramebufferAttachmentParameterivOES ( GLint target, GLint attachment, GLint pname, GLint *params ) */
static void
android_glGetFramebufferAttachmentParameterivOES__III_3II
(JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) {
- _env->ThrowNew(UOEClass,
- "glGetFramebufferAttachmentParameterivOES");
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glGetFramebufferAttachmentParameterivOES");
+ return;
+ }
+ jint _exception = 0;
+ GLint *params_base = (GLint *) 0;
+ jint _remaining;
+ GLint *params = (GLint *) 0;
+
+ if (!params_ref) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "params == null");
+ goto exit;
+ }
+ if (offset < 0) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "offset < 0");
+ goto exit;
+ }
+ _remaining = _env->GetArrayLength(params_ref) - offset;
+ params_base = (GLint *)
+ _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ params = params_base + offset;
+
+ glGetFramebufferAttachmentParameterivOES(
+ (GLint)target,
+ (GLint)attachment,
+ (GLint)pname,
+ (GLint *)params
+ );
+
+exit:
+ if (params_base) {
+ _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _exception ? JNI_ABORT: 0);
+ }
}
/* void glGetFramebufferAttachmentParameterivOES ( GLint target, GLint attachment, GLint pname, GLint *params ) */
static void
android_glGetFramebufferAttachmentParameterivOES__IIILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) {
- _env->ThrowNew(UOEClass,
- "glGetFramebufferAttachmentParameterivOES");
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glGetFramebufferAttachmentParameterivOES");
+ return;
+ }
+ jint _exception = 0;
+ jarray _array = (jarray) 0;
+ jint _remaining;
+ GLint *params = (GLint *) 0;
+
+ params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
+ glGetFramebufferAttachmentParameterivOES(
+ (GLint)target,
+ (GLint)attachment,
+ (GLint)pname,
+ (GLint *)params
+ );
+ if (_array) {
+ releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ }
}
/* void glGetRenderbufferParameterivOES ( GLint target, GLint pname, GLint *params ) */
static void
android_glGetRenderbufferParameterivOES__II_3II
(JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
- _env->ThrowNew(UOEClass,
- "glGetRenderbufferParameterivOES");
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glGetRenderbufferParameterivOES");
+ return;
+ }
+ jint _exception = 0;
+ GLint *params_base = (GLint *) 0;
+ jint _remaining;
+ GLint *params = (GLint *) 0;
+
+ if (!params_ref) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "params == null");
+ goto exit;
+ }
+ if (offset < 0) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "offset < 0");
+ goto exit;
+ }
+ _remaining = _env->GetArrayLength(params_ref) - offset;
+ params_base = (GLint *)
+ _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ params = params_base + offset;
+
+ glGetRenderbufferParameterivOES(
+ (GLint)target,
+ (GLint)pname,
+ (GLint *)params
+ );
+
+exit:
+ if (params_base) {
+ _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _exception ? JNI_ABORT: 0);
+ }
}
/* void glGetRenderbufferParameterivOES ( GLint target, GLint pname, GLint *params ) */
static void
android_glGetRenderbufferParameterivOES__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
- _env->ThrowNew(UOEClass,
- "glGetRenderbufferParameterivOES");
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glGetRenderbufferParameterivOES");
+ return;
+ }
+ jint _exception = 0;
+ jarray _array = (jarray) 0;
+ jint _remaining;
+ GLint *params = (GLint *) 0;
+
+ params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
+ glGetRenderbufferParameterivOES(
+ (GLint)target,
+ (GLint)pname,
+ (GLint *)params
+ );
+ if (_array) {
+ releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ }
}
/* void glGetTexGenfv ( GLint coord, GLint pname, GLfloat *params ) */
static void
android_glGetTexGenfv__II_3FI
(JNIEnv *_env, jobject _this, jint coord, jint pname, jfloatArray params_ref, jint offset) {
- _env->ThrowNew(UOEClass,
- "glGetTexGenfv");
+ if (! supportsExtension(_env, _this, have_OES_texture_cube_mapID)) {
+ _env->ThrowNew(UOEClass,
+ "glGetTexGenfv");
+ return;
+ }
+ jint _exception = 0;
+ GLfloat *params_base = (GLfloat *) 0;
+ jint _remaining;
+ GLfloat *params = (GLfloat *) 0;
+
+ if (!params_ref) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "params == null");
+ goto exit;
+ }
+ if (offset < 0) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "offset < 0");
+ goto exit;
+ }
+ _remaining = _env->GetArrayLength(params_ref) - offset;
+ params_base = (GLfloat *)
+ _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ params = params_base + offset;
+
+ glGetTexGenfv(
+ (GLint)coord,
+ (GLint)pname,
+ (GLfloat *)params
+ );
+
+exit:
+ if (params_base) {
+ _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _exception ? JNI_ABORT: 0);
+ }
}
/* void glGetTexGenfv ( GLint coord, GLint pname, GLfloat *params ) */
static void
android_glGetTexGenfv__IILjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) {
- _env->ThrowNew(UOEClass,
- "glGetTexGenfv");
+ if (! supportsExtension(_env, _this, have_OES_texture_cube_mapID)) {
+ _env->ThrowNew(UOEClass,
+ "glGetTexGenfv");
+ return;
+ }
+ jint _exception = 0;
+ jarray _array = (jarray) 0;
+ jint _remaining;
+ GLfloat *params = (GLfloat *) 0;
+
+ params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
+ glGetTexGenfv(
+ (GLint)coord,
+ (GLint)pname,
+ (GLfloat *)params
+ );
+ if (_array) {
+ releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ }
}
/* void glGetTexGeniv ( GLint coord, GLint pname, GLint *params ) */
static void
android_glGetTexGeniv__II_3II
(JNIEnv *_env, jobject _this, jint coord, jint pname, jintArray params_ref, jint offset) {
- _env->ThrowNew(UOEClass,
- "glGetTexGeniv");
+ if (! supportsExtension(_env, _this, have_OES_texture_cube_mapID)) {
+ _env->ThrowNew(UOEClass,
+ "glGetTexGeniv");
+ return;
+ }
+ jint _exception = 0;
+ GLint *params_base = (GLint *) 0;
+ jint _remaining;
+ GLint *params = (GLint *) 0;
+
+ if (!params_ref) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "params == null");
+ goto exit;
+ }
+ if (offset < 0) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "offset < 0");
+ goto exit;
+ }
+ _remaining = _env->GetArrayLength(params_ref) - offset;
+ params_base = (GLint *)
+ _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ params = params_base + offset;
+
+ glGetTexGeniv(
+ (GLint)coord,
+ (GLint)pname,
+ (GLint *)params
+ );
+
+exit:
+ if (params_base) {
+ _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _exception ? JNI_ABORT: 0);
+ }
}
/* void glGetTexGeniv ( GLint coord, GLint pname, GLint *params ) */
static void
android_glGetTexGeniv__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) {
- _env->ThrowNew(UOEClass,
- "glGetTexGeniv");
+ if (! supportsExtension(_env, _this, have_OES_texture_cube_mapID)) {
+ _env->ThrowNew(UOEClass,
+ "glGetTexGeniv");
+ return;
+ }
+ jint _exception = 0;
+ jarray _array = (jarray) 0;
+ jint _remaining;
+ GLint *params = (GLint *) 0;
+
+ params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
+ glGetTexGeniv(
+ (GLint)coord,
+ (GLint)pname,
+ (GLint *)params
+ );
+ if (_array) {
+ releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ }
}
/* void glGetTexGenxv ( GLint coord, GLint pname, GLint *params ) */
static void
android_glGetTexGenxv__II_3II
(JNIEnv *_env, jobject _this, jint coord, jint pname, jintArray params_ref, jint offset) {
- _env->ThrowNew(UOEClass,
- "glGetTexGenxv");
+ if (! supportsExtension(_env, _this, have_OES_texture_cube_mapID)) {
+ _env->ThrowNew(UOEClass,
+ "glGetTexGenxv");
+ return;
+ }
+ jint _exception = 0;
+ GLint *params_base = (GLint *) 0;
+ jint _remaining;
+ GLint *params = (GLint *) 0;
+
+ if (!params_ref) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "params == null");
+ goto exit;
+ }
+ if (offset < 0) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "offset < 0");
+ goto exit;
+ }
+ _remaining = _env->GetArrayLength(params_ref) - offset;
+ params_base = (GLint *)
+ _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ params = params_base + offset;
+
+ glGetTexGenxv(
+ (GLint)coord,
+ (GLint)pname,
+ (GLint *)params
+ );
+
+exit:
+ if (params_base) {
+ _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _exception ? JNI_ABORT: 0);
+ }
}
/* void glGetTexGenxv ( GLint coord, GLint pname, GLint *params ) */
static void
android_glGetTexGenxv__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) {
- _env->ThrowNew(UOEClass,
- "glGetTexGenxv");
+ if (! supportsExtension(_env, _this, have_OES_texture_cube_mapID)) {
+ _env->ThrowNew(UOEClass,
+ "glGetTexGenxv");
+ return;
+ }
+ jint _exception = 0;
+ jarray _array = (jarray) 0;
+ jint _remaining;
+ GLint *params = (GLint *) 0;
+
+ params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
+ glGetTexGenxv(
+ (GLint)coord,
+ (GLint)pname,
+ (GLint *)params
+ );
+ if (_array) {
+ releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ }
}
/* GLboolean glIsFramebufferOES ( GLint framebuffer ) */
static jboolean
android_glIsFramebufferOES__I
(JNIEnv *_env, jobject _this, jint framebuffer) {
- _env->ThrowNew(UOEClass,
- "glIsFramebufferOES");
- return JNI_FALSE;
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glIsFramebufferOES");
+ return JNI_FALSE;
+ }
+ GLboolean _returnValue = JNI_FALSE;
+ _returnValue = glIsFramebufferOES(
+ (GLint)framebuffer
+ );
+ return _returnValue;
}
/* GLboolean glIsRenderbufferOES ( GLint renderbuffer ) */
static jboolean
android_glIsRenderbufferOES__I
(JNIEnv *_env, jobject _this, jint renderbuffer) {
- _env->ThrowNew(UOEClass,
- "glIsRenderbufferOES");
- return JNI_FALSE;
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glIsRenderbufferOES");
+ return JNI_FALSE;
+ }
+ GLboolean _returnValue = JNI_FALSE;
+ _returnValue = glIsRenderbufferOES(
+ (GLint)renderbuffer
+ );
+ return _returnValue;
}
/* void glRenderbufferStorageOES ( GLint target, GLint internalformat, GLint width, GLint height ) */
static void
android_glRenderbufferStorageOES__IIII
(JNIEnv *_env, jobject _this, jint target, jint internalformat, jint width, jint height) {
- _env->ThrowNew(UOEClass,
- "glRenderbufferStorageOES");
+ if (! supportsExtension(_env, _this, have_OES_framebuffer_objectID)) {
+ _env->ThrowNew(UOEClass,
+ "glRenderbufferStorageOES");
+ return;
+ }
+ glRenderbufferStorageOES(
+ (GLint)target,
+ (GLint)internalformat,
+ (GLint)width,
+ (GLint)height
+ );
}
/* void glTexGenf ( GLint coord, GLint pname, GLfloat param ) */
static void
android_glTexGenf__IIF
(JNIEnv *_env, jobject _this, jint coord, jint pname, jfloat param) {
- _env->ThrowNew(UOEClass,
- "glTexGenf");
+ if (! supportsExtension(_env, _this, have_OES_texture_cube_mapID)) {
+ _env->ThrowNew(UOEClass,
+ "glTexGenf");
+ return;
+ }
+ glTexGenf(
+ (GLint)coord,
+ (GLint)pname,
+ (GLfloat)param
+ );
}
/* void glTexGenfv ( GLint coord, GLint pname, GLfloat *params ) */
static void
android_glTexGenfv__II_3FI
(JNIEnv *_env, jobject _this, jint coord, jint pname, jfloatArray params_ref, jint offset) {
- _env->ThrowNew(UOEClass,
- "glTexGenfv");
+ if (! supportsExtension(_env, _this, have_OES_texture_cube_mapID)) {
+ _env->ThrowNew(UOEClass,
+ "glTexGenfv");
+ return;
+ }
+ jint _exception = 0;
+ GLfloat *params_base = (GLfloat *) 0;
+ jint _remaining;
+ GLfloat *params = (GLfloat *) 0;
+
+ if (!params_ref) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "params == null");
+ goto exit;
+ }
+ if (offset < 0) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "offset < 0");
+ goto exit;
+ }
+ _remaining = _env->GetArrayLength(params_ref) - offset;
+ params_base = (GLfloat *)
+ _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ params = params_base + offset;
+
+ glTexGenfv(
+ (GLint)coord,
+ (GLint)pname,
+ (GLfloat *)params
+ );
+
+exit:
+ if (params_base) {
+ _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _exception ? JNI_ABORT: 0);
+ }
}
/* void glTexGenfv ( GLint coord, GLint pname, GLfloat *params ) */
static void
android_glTexGenfv__IILjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) {
- _env->ThrowNew(UOEClass,
- "glTexGenfv");
+ if (! supportsExtension(_env, _this, have_OES_texture_cube_mapID)) {
+ _env->ThrowNew(UOEClass,
+ "glTexGenfv");
+ return;
+ }
+ jint _exception = 0;
+ jarray _array = (jarray) 0;
+ jint _remaining;
+ GLfloat *params = (GLfloat *) 0;
+
+ params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
+ glTexGenfv(
+ (GLint)coord,
+ (GLint)pname,
+ (GLfloat *)params
+ );
+ if (_array) {
+ releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ }
}
/* void glTexGeni ( GLint coord, GLint pname, GLint param ) */
static void
android_glTexGeni__III
(JNIEnv *_env, jobject _this, jint coord, jint pname, jint param) {
- _env->ThrowNew(UOEClass,
- "glTexGeni");
+ if (! supportsExtension(_env, _this, have_OES_texture_cube_mapID)) {
+ _env->ThrowNew(UOEClass,
+ "glTexGeni");
+ return;
+ }
+ glTexGeni(
+ (GLint)coord,
+ (GLint)pname,
+ (GLint)param
+ );
}
/* void glTexGeniv ( GLint coord, GLint pname, GLint *params ) */
static void
android_glTexGeniv__II_3II
(JNIEnv *_env, jobject _this, jint coord, jint pname, jintArray params_ref, jint offset) {
- _env->ThrowNew(UOEClass,
- "glTexGeniv");
+ if (! supportsExtension(_env, _this, have_OES_texture_cube_mapID)) {
+ _env->ThrowNew(UOEClass,
+ "glTexGeniv");
+ return;
+ }
+ jint _exception = 0;
+ GLint *params_base = (GLint *) 0;
+ jint _remaining;
+ GLint *params = (GLint *) 0;
+
+ if (!params_ref) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "params == null");
+ goto exit;
+ }
+ if (offset < 0) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "offset < 0");
+ goto exit;
+ }
+ _remaining = _env->GetArrayLength(params_ref) - offset;
+ params_base = (GLint *)
+ _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ params = params_base + offset;
+
+ glTexGeniv(
+ (GLint)coord,
+ (GLint)pname,
+ (GLint *)params
+ );
+
+exit:
+ if (params_base) {
+ _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _exception ? JNI_ABORT: 0);
+ }
}
/* void glTexGeniv ( GLint coord, GLint pname, GLint *params ) */
static void
android_glTexGeniv__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) {
- _env->ThrowNew(UOEClass,
- "glTexGeniv");
+ if (! supportsExtension(_env, _this, have_OES_texture_cube_mapID)) {
+ _env->ThrowNew(UOEClass,
+ "glTexGeniv");
+ return;
+ }
+ jint _exception = 0;
+ jarray _array = (jarray) 0;
+ jint _remaining;
+ GLint *params = (GLint *) 0;
+
+ params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
+ glTexGeniv(
+ (GLint)coord,
+ (GLint)pname,
+ (GLint *)params
+ );
+ if (_array) {
+ releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ }
}
/* void glTexGenx ( GLint coord, GLint pname, GLint param ) */
static void
android_glTexGenx__III
(JNIEnv *_env, jobject _this, jint coord, jint pname, jint param) {
- _env->ThrowNew(UOEClass,
- "glTexGenx");
+ if (! supportsExtension(_env, _this, have_OES_texture_cube_mapID)) {
+ _env->ThrowNew(UOEClass,
+ "glTexGenx");
+ return;
+ }
+ glTexGenx(
+ (GLint)coord,
+ (GLint)pname,
+ (GLint)param
+ );
}
/* void glTexGenxv ( GLint coord, GLint pname, GLint *params ) */
static void
android_glTexGenxv__II_3II
(JNIEnv *_env, jobject _this, jint coord, jint pname, jintArray params_ref, jint offset) {
- _env->ThrowNew(UOEClass,
- "glTexGenxv");
+ if (! supportsExtension(_env, _this, have_OES_texture_cube_mapID)) {
+ _env->ThrowNew(UOEClass,
+ "glTexGenxv");
+ return;
+ }
+ jint _exception = 0;
+ GLint *params_base = (GLint *) 0;
+ jint _remaining;
+ GLint *params = (GLint *) 0;
+
+ if (!params_ref) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "params == null");
+ goto exit;
+ }
+ if (offset < 0) {
+ _exception = 1;
+ _env->ThrowNew(IAEClass, "offset < 0");
+ goto exit;
+ }
+ _remaining = _env->GetArrayLength(params_ref) - offset;
+ params_base = (GLint *)
+ _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ params = params_base + offset;
+
+ glTexGenxv(
+ (GLint)coord,
+ (GLint)pname,
+ (GLint *)params
+ );
+
+exit:
+ if (params_base) {
+ _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _exception ? JNI_ABORT: 0);
+ }
}
/* void glTexGenxv ( GLint coord, GLint pname, GLint *params ) */
static void
android_glTexGenxv__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) {
- _env->ThrowNew(UOEClass,
- "glTexGenxv");
+ if (! supportsExtension(_env, _this, have_OES_texture_cube_mapID)) {
+ _env->ThrowNew(UOEClass,
+ "glTexGenxv");
+ return;
+ }
+ jint _exception = 0;
+ jarray _array = (jarray) 0;
+ jint _remaining;
+ GLint *params = (GLint *) 0;
+
+ params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
+ glTexGenxv(
+ (GLint)coord,
+ (GLint)pname,
+ (GLint *)params
+ );
+ if (_array) {
+ releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ }
}
static const char *classPathName = "com/google/android/gles_jni/GLImpl";
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 9a8af3f..2b8ddc4 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -231,4 +231,10 @@
<!-- Component name of the default wallpaper. This will be ImageWallpaper if not
specified -->
<string name="default_wallpaper_component">@null</string>
+
+ <!-- Component name of the service providing network location support. -->
+ <string name="config_networkLocationProvider">@null</string>
+
+ <!-- Component name of the service providing geocoder API support. -->
+ <string name="config_geocodeProvider">@null</string>
</resources>
diff --git a/core/tests/coretests/Android.mk b/core/tests/coretests/Android.mk
index 77c176f..1fb9852 100644
--- a/core/tests/coretests/Android.mk
+++ b/core/tests/coretests/Android.mk
@@ -5,10 +5,14 @@
LOCAL_MODULE_TAGS := tests
# Include all test java files.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
+LOCAL_SRC_FILES := \
+ $(call all-java-files-under, src) \
+ src/android/os/IAidlTest.aidl
LOCAL_JAVA_LIBRARIES := android.test.runner
LOCAL_PACKAGE_NAME := FrameworksCoreTests
+LOCAL_CERTIFICATE := platform
+
include $(BUILD_PACKAGE)
diff --git a/core/tests/coretests/AndroidManifest.xml b/core/tests/coretests/AndroidManifest.xml
index 02961f4..8d7e187 100644
--- a/core/tests/coretests/AndroidManifest.xml
+++ b/core/tests/coretests/AndroidManifest.xml
@@ -16,6 +16,46 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.frameworks.coretests">
+
+ <permission android:name="com.android.frameworks.coretests.permission.TEST_GRANTED"
+ android:protectionLevel="normal"
+ android:label="@string/permlab_testGranted"
+ android:description="@string/permdesc_testGranted">
+ <meta-data android:name="com.android.frameworks.coretests.string" android:value="foo" />
+ <meta-data android:name="com.android.frameworks.coretests.boolean" android:value="true" />
+ <meta-data android:name="com.android.frameworks.coretests.integer" android:value="100" />
+ <meta-data android:name="com.android.frameworks.coretests.color" android:value="#ff000000" />
+ <meta-data android:name="com.android.frameworks.coretests.float" android:value="100.1" />
+ <meta-data android:name="com.android.frameworks.coretests.reference" android:resource="@xml/metadata" />
+ </permission>
+ <permission android:name="com.android.frameworks.coretests.permission.TEST_DENIED"
+ android:protectionLevel="normal"
+ android:label="@string/permlab_testDenied"
+ android:description="@string/permdesc_testDenied" />
+
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
+ <uses-permission android:name="android.permission.BROADCAST_STICKY" />
+ <uses-permission android:name="android.permission.CLEAR_APP_CACHE" />
+ <uses-permission android:name="android.permission.CLEAR_APP_USER_DATA" />
+ <uses-permission android:name="android.permission.DELETE_CACHE_FILES" />
+ <uses-permission android:name="android.permission.GET_PACKAGE_SIZE" />
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.READ_CONTACTS" />
+ <uses-permission android:name="android.permission.READ_LOGS"/>
+ <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+ <uses-permission android:name="android.permission.READ_SMS"/>
+ <uses-permission android:name="android.permission.USE_CREDENTIALS" />
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
+ <uses-permission android:name="android.permission.WRITE_CONTACTS" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.WRITE_SETTINGS" />
+ <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
+ <uses-permission android:name="android.permission.WRITE_SMS"/>
+ <uses-permission android:name="android.permission.TEST_GRANTED" />
+ <uses-permission android:name="com.google.android.googleapps.permission.ACCESS_GOOGLE_PASSWORD" />
+ <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH" />
+ <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.ALL_SERVICES" />
+
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
@@ -28,12 +68,8 @@
<!-- location test permissions -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
- <uses-permission android:name="android.permission.WRITE_SETTINGS"/>
- <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
-
<uses-permission android:name="android.permission.HARDWARE_TEST" />
- <uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.ACCESSIBILITY_EVENT_VIEW_TYPES" />
<uses-permission android:name="android.permission.ACCESSIBILITY_EVENT_TRANSITION_TYPES" />
<uses-permission android:name="android.permission.ACCESSIBILITY_EVENT_NOTIFICATION_TYPES" />
@@ -975,6 +1011,187 @@
</intent-filter>
</activity>
+
+
+ <!-- Activity-level metadata -->
+ <meta-data android:name="com.android.frameworks.coretests.isApp" android:value="true" />
+ <meta-data android:name="com.android.frameworks.coretests.string" android:value="foo" />
+ <meta-data android:name="com.android.frameworks.coretests.boolean" android:value="true" />
+ <meta-data android:name="com.android.frameworks.coretests.integer" android:value="100" />
+ <meta-data android:name="com.android.frameworks.coretests.color" android:value="#ff000000" />
+ <meta-data android:name="com.android.frameworks.coretests.float" android:value="100.1" />
+ <meta-data android:name="com.android.frameworks.coretests.reference"
+ android:resource="@xml/metadata_app" />
+
+ <activity android:name="AndroidPerformanceTests" android:label="Android Performance Tests">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.UNIT_TEST" />
+ </intent-filter>
+ </activity>
+
+ <!-- Application components used for activity tests -->
+
+ <activity android:name="android.app.activity.TestedActivity"
+ android:process=":remoteActivity">
+ </activity>
+ <activity android:name="android.app.activity.LocalActivity" android:multiprocess="true">
+ <meta-data android:name="com.android.frameworks.coretests.string" android:value="foo" />
+ <meta-data android:name="com.android.frameworks.coretests.boolean" android:value="true" />
+ <meta-data android:name="com.android.frameworks.coretests.integer" android:value="100" />
+ <meta-data android:name="com.android.frameworks.coretests.color" android:value="#ff000000" />
+ <meta-data android:name="com.android.frameworks.coretests.float" android:value="100.1" />
+ <meta-data android:name="com.android.frameworks.coretests.reference" android:resource="@xml/metadata" />
+ </activity>
+ <activity android:name="android.app.activity.TestedScreen"
+ android:process=":remoteScreen">
+ </activity>
+ <activity android:name="android.app.activity.LocalScreen" android:multiprocess="true">
+ </activity>
+ <activity android:name="android.app.activity.ClearTop" android:multiprocess="true"
+ android:launchMode="singleTop">
+ </activity>
+ <activity android:name="android.app.activity.LocalDialog" android:multiprocess="true"
+ android:theme="@android:style/Theme.Dialog">
+ </activity>
+ <activity android:name="android.app.activity.SubActivityScreen">
+ </activity>
+ <activity android:name="android.app.activity.RemoteSubActivityScreen"
+ android:process=":remoteActivity">
+ </activity>
+ <activity android:name="android.app.activity.LaunchpadActivity" android:multiprocess="true">
+ </activity>
+ <activity android:name="android.app.activity.LaunchpadTabActivity" android:multiprocess="true">
+ </activity>
+
+ <receiver android:name="android.app.activity.AbortReceiver">
+ <intent-filter android:priority="1">
+ <action android:name="com.android.frameworks.coretests.activity.BROADCAST_ABORT" />
+ </intent-filter>
+ </receiver>
+ <receiver android:name="android.app.activity.LocalReceiver">
+ <intent-filter android:priority="-1">
+ <action android:name="com.android.frameworks.coretests.activity.BROADCAST_ABORT" />
+ <action android:name="com.android.frameworks.coretests.activity.BROADCAST_ALL" />
+ <action android:name="com.android.frameworks.coretests.activity.BROADCAST_REPEAT" />
+ <action android:name="com.android.frameworks.coretests.activity.BROADCAST_LOCAL" />
+ <action android:name="com.android.frameworks.coretests.activity.BROADCAST_FAIL_REGISTER" />
+ <action android:name="com.android.frameworks.coretests.activity.BROADCAST_FAIL_BIND" />
+ </intent-filter>
+ <meta-data android:name="com.android.frameworks.coretests.string" android:value="foo" />
+ <meta-data android:name="com.android.frameworks.coretests.boolean" android:value="true" />
+ <meta-data android:name="com.android.frameworks.coretests.integer" android:value="100" />
+ <meta-data android:name="com.android.frameworks.coretests.color" android:value="#ff000000" />
+ <meta-data android:name="com.android.frameworks.coretests.float" android:value="100.1" />
+ <meta-data android:name="com.android.frameworks.coretests.reference" android:resource="@xml/metadata" />
+ </receiver>
+ <receiver android:name="android.app.activity.ResultReceiver">
+ <intent-filter>
+ <action android:name="com.android.frameworks.coretests.activity.BROADCAST_RESULT" />
+ </intent-filter>
+ </receiver>
+ <receiver android:name="android.app.activity.LocalGrantedReceiver"
+ android:permission="com.android.frameworks.coretests.permission.TEST_GRANTED">
+ <intent-filter android:priority="-1">
+ <action android:name="com.android.frameworks.coretests.activity.BROADCAST_LOCAL_GRANTED" />
+ </intent-filter>
+ </receiver>
+ <receiver android:name="android.app.activity.LocalDeniedReceiver"
+ android:permission="com.android.frameworks.coretests.permission.TEST_DENIED">
+ <intent-filter android:priority="-1">
+ <action android:name="com.android.frameworks.coretests.activity.BROADCAST_LOCAL_DENIED" />
+ </intent-filter>
+ </receiver>
+ <receiver android:name="android.app.activity.RemoteReceiver"
+ android:process=":remoteReceiver">
+ <intent-filter android:priority="2">
+ <action android:name="com.android.frameworks.coretests.activity.BROADCAST_ABORT" />
+ <action android:name="com.android.frameworks.coretests.activity.BROADCAST_ALL" />
+ <action android:name="com.android.frameworks.coretests.activity.BROADCAST_REPEAT" />
+ <action android:name="com.android.frameworks.coretests.activity.BROADCAST_REMOTE" />
+ </intent-filter>
+ </receiver>
+ <receiver android:name="android.app.activity.RemoteGrantedReceiver"
+ android:permission="com.android.frameworks.coretests.permission.TEST_GRANTED">
+ <intent-filter android:priority="2">
+ <action android:name="com.android.frameworks.coretests.activity.BROADCAST_REMOTE_GRANTED" />
+ </intent-filter>
+ </receiver>
+ <receiver android:name="android.app.activity.RemoteDeniedReceiver"
+ android:permission="com.android.frameworks.coretests.permission.TEST_DENIED">
+ <intent-filter android:priority="2">
+ <action android:name="com.android.frameworks.coretests.activity.BROADCAST_REMOTE_DENIED" />
+ </intent-filter>
+ </receiver>
+ <service android:name="android.app.activity.LocalService">
+ <intent-filter>
+ <action android:name="com.android.frameworks.coretests.activity.SERVICE_LOCAL" />
+ </intent-filter>
+ <meta-data android:name="com.android.frameworks.coretests.string" android:value="foo" />
+ <meta-data android:name="com.android.frameworks.coretests.boolean" android:value="true" />
+ <meta-data android:name="com.android.frameworks.coretests.integer" android:value="100" />
+ <meta-data android:name="com.android.frameworks.coretests.color" android:value="#ff000000" />
+ <meta-data android:name="com.android.frameworks.coretests.float" android:value="100.1" />
+ <meta-data android:name="com.android.frameworks.coretests.reference" android:resource="@xml/metadata" />
+ </service>
+ <service android:name="android.app.activity.LocalDeniedService"
+ android:permission="com.android.frameworks.coretests.permission.TEST_DENIED">
+ <intent-filter>
+ <action android:name="com.android.frameworks.coretests.activity.SERVICE_LOCAL_DENIED" />
+ </intent-filter>
+ </service>
+ <service android:name="android.app.activity.LocalGrantedService"
+ android:permission="com.android.frameworks.coretests.permission.TEST_GRANTED">
+ <intent-filter>
+ <action android:name="com.android.frameworks.coretests.activity.SERVICE_LOCAL_GRANTED" />
+ </intent-filter>
+ </service>
+
+ <provider android:name="android.app.activity.LocalProvider"
+ android:authorities="com.android.frameworks.coretests.LocalProvider">
+ <meta-data android:name="com.android.frameworks.coretests.string" android:value="foo" />
+ <meta-data android:name="com.android.frameworks.coretests.boolean" android:value="true" />
+ <meta-data android:name="com.android.frameworks.coretests.integer" android:value="100" />
+ <meta-data android:name="com.android.frameworks.coretests.color" android:value="#ff000000" />
+ <meta-data android:name="com.android.frameworks.coretests.float" android:value="100.1" />
+ <meta-data android:name="com.android.frameworks.coretests.reference" android:resource="@xml/metadata" />
+ </provider>
+
+ <!-- Application components used for content tests -->
+ <provider android:name="android.content.MemoryFileProvider"
+ android:authorities="android.content.MemoryFileProvider"
+ android:process=":MemoryFileProvider">
+ </provider>
+
+ <!-- Application components used for os tests -->
+
+ <service android:name="android.os.MessengerService"
+ android:process=":messengerService">
+ </service>
+
+ <!-- Application components used for search manager tests -->
+
+ <activity android:name="android.app.activity.SearchableActivity"
+ android:label="Searchable Activity">
+ <intent-filter>
+ <action android:name="android.intent.action.SEARCH" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ <meta-data android:name="android.app.searchable"
+ android:resource="@xml/searchable" />
+ </activity>
+
+ <provider android:name="android.app.SuggestionProvider"
+ android:authorities="android.app.SuggestionProvider">
+ </provider>
+
+ <!-- Used to test IPC. -->
+ <service android:name="com.android.frameworks.coretests.binder.BinderTestService"
+ android:process="binder.BinderTestService" />
+ <service android:name="com.android.frameworks.coretests.binder.BinderPerformanceService"
+ android:process="binder.BinderPerformanceService" />
+ <service android:name="com.android.frameworks.coretests.binder.BinderVsMessagingService"
+ android:process="binder.BinderVsMessagingService" />
</application>
<instrumentation
diff --git a/tests/AndroidTests/assets/text.txt b/core/tests/coretests/assets/text.txt
similarity index 100%
rename from tests/AndroidTests/assets/text.txt
rename to core/tests/coretests/assets/text.txt
diff --git a/tests/AndroidTests/res/layout/layout_five.xml b/core/tests/coretests/res/layout/layout_five.xml
similarity index 100%
rename from tests/AndroidTests/res/layout/layout_five.xml
rename to core/tests/coretests/res/layout/layout_five.xml
diff --git a/tests/AndroidTests/res/layout/layout_four.xml b/core/tests/coretests/res/layout/layout_four.xml
similarity index 100%
rename from tests/AndroidTests/res/layout/layout_four.xml
rename to core/tests/coretests/res/layout/layout_four.xml
diff --git a/tests/AndroidTests/res/layout/layout_one.xml b/core/tests/coretests/res/layout/layout_one.xml
similarity index 82%
rename from tests/AndroidTests/res/layout/layout_one.xml
rename to core/tests/coretests/res/layout/layout_one.xml
index c326b2b..6966246 100644
--- a/tests/AndroidTests/res/layout/layout_one.xml
+++ b/core/tests/coretests/res/layout/layout_one.xml
@@ -17,4 +17,4 @@
** limitations under the License.
*/
-->
-<view xmlns:android="http://schemas.android.com/apk/res/android" class="com.android.unit_tests.InflateTest$ViewOne" android:id="@+id/viewOne" android:layout_width="match_parent" android:layout_height="match_parent"/>
+<view xmlns:android="http://schemas.android.com/apk/res/android" class="android.view.InflateTest$ViewOne" android:id="@+id/viewOne" android:layout_width="match_parent" android:layout_height="match_parent"/>
diff --git a/tests/AndroidTests/res/layout/layout_six.xml b/core/tests/coretests/res/layout/layout_six.xml
similarity index 100%
rename from tests/AndroidTests/res/layout/layout_six.xml
rename to core/tests/coretests/res/layout/layout_six.xml
diff --git a/tests/AndroidTests/res/layout/layout_tag.xml b/core/tests/coretests/res/layout/layout_tag.xml
similarity index 93%
rename from tests/AndroidTests/res/layout/layout_tag.xml
rename to core/tests/coretests/res/layout/layout_tag.xml
index 72874a6..7fb0489 100644
--- a/tests/AndroidTests/res/layout/layout_tag.xml
+++ b/core/tests/coretests/res/layout/layout_tag.xml
@@ -18,6 +18,6 @@
*/
-->
<view xmlns:android="http://schemas.android.com/apk/res/android"
- class="com.android.unit_tests.InflateTest$ViewOne"
+ class="android.view.InflateTest$ViewOne"
android:id="@+id/viewOne" android:tag="MyTag"
android:layout_width="match_parent" android:layout_height="match_parent"/>
diff --git a/core/tests/coretests/res/layout/layout_three.xml b/core/tests/coretests/res/layout/layout_three.xml
new file mode 100644
index 0000000..7242fc8
--- /dev/null
+++ b/core/tests/coretests/res/layout/layout_three.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/content" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
+ <view class="android.view.InflateTest$ViewOne" android:id="@+id/view1" android:layout_width="match_parent" android:layout_height="match_parent"/>
+ <view class="android.view.InflateTest$ViewOne" android:id="@+id/view2" android:layout_width="match_parent" android:layout_height="match_parent"/>
+ <view class="android.view.InflateTest$ViewOne" android:id="@+id/view3" android:layout_width="match_parent" android:layout_height="match_parent"/>
+ <view class="android.view.InflateTest$ViewOne" android:id="@+id/view4" android:layout_width="match_parent" android:layout_height="match_parent"/>
+ <view class="android.view.InflateTest$ViewOne" android:id="@+id/view5" android:layout_width="match_parent" android:layout_height="match_parent"/>
+ <view class="android.view.InflateTest$ViewOne" android:id="@+id/view6" android:layout_width="match_parent" android:layout_height="match_parent"/>
+</LinearLayout>
diff --git a/tests/AndroidTests/res/layout/layout_two.xml b/core/tests/coretests/res/layout/layout_two.xml
similarity index 84%
rename from tests/AndroidTests/res/layout/layout_two.xml
rename to core/tests/coretests/res/layout/layout_two.xml
index af14228..9fb7d3b 100644
--- a/tests/AndroidTests/res/layout/layout_two.xml
+++ b/core/tests/coretests/res/layout/layout_two.xml
@@ -18,6 +18,6 @@
*/
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/content" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
- <view class="com.android.unit_tests.InflateTest$ViewOne" android:id="@+id/viewOne" android:layout_width="match_parent" android:layout_height="match_parent"/>
+ <view class="android.view.InflateTest$ViewOne" android:id="@+id/viewOne" android:layout_width="match_parent" android:layout_height="match_parent"/>
</LinearLayout>
diff --git a/tests/AndroidTests/res/raw/medium.xml b/core/tests/coretests/res/raw/medium.xml
similarity index 100%
rename from tests/AndroidTests/res/raw/medium.xml
rename to core/tests/coretests/res/raw/medium.xml
diff --git a/tests/AndroidTests/res/raw/small.xml b/core/tests/coretests/res/raw/small.xml
similarity index 100%
rename from tests/AndroidTests/res/raw/small.xml
rename to core/tests/coretests/res/raw/small.xml
diff --git a/tests/AndroidTests/res/raw/text.txt b/core/tests/coretests/res/raw/text.txt
similarity index 100%
rename from tests/AndroidTests/res/raw/text.txt
rename to core/tests/coretests/res/raw/text.txt
diff --git a/tests/AndroidTests/res/raw/v21_backslash.vcf b/core/tests/coretests/res/raw/v21_backslash.vcf
similarity index 100%
rename from tests/AndroidTests/res/raw/v21_backslash.vcf
rename to core/tests/coretests/res/raw/v21_backslash.vcf
diff --git a/tests/AndroidTests/res/raw/v21_complicated.vcf b/core/tests/coretests/res/raw/v21_complicated.vcf
similarity index 100%
rename from tests/AndroidTests/res/raw/v21_complicated.vcf
rename to core/tests/coretests/res/raw/v21_complicated.vcf
diff --git a/tests/AndroidTests/res/raw/v21_invalid_comment_line.vcf b/core/tests/coretests/res/raw/v21_invalid_comment_line.vcf
similarity index 100%
rename from tests/AndroidTests/res/raw/v21_invalid_comment_line.vcf
rename to core/tests/coretests/res/raw/v21_invalid_comment_line.vcf
diff --git a/tests/AndroidTests/res/raw/v21_japanese_1.vcf b/core/tests/coretests/res/raw/v21_japanese_1.vcf
similarity index 100%
rename from tests/AndroidTests/res/raw/v21_japanese_1.vcf
rename to core/tests/coretests/res/raw/v21_japanese_1.vcf
diff --git a/tests/AndroidTests/res/raw/v21_japanese_2.vcf b/core/tests/coretests/res/raw/v21_japanese_2.vcf
similarity index 100%
rename from tests/AndroidTests/res/raw/v21_japanese_2.vcf
rename to core/tests/coretests/res/raw/v21_japanese_2.vcf
diff --git a/tests/AndroidTests/res/raw/v21_multiple_entry.vcf b/core/tests/coretests/res/raw/v21_multiple_entry.vcf
similarity index 100%
rename from tests/AndroidTests/res/raw/v21_multiple_entry.vcf
rename to core/tests/coretests/res/raw/v21_multiple_entry.vcf
diff --git a/tests/AndroidTests/res/raw/v21_org_before_title.vcf b/core/tests/coretests/res/raw/v21_org_before_title.vcf
similarity index 100%
rename from tests/AndroidTests/res/raw/v21_org_before_title.vcf
rename to core/tests/coretests/res/raw/v21_org_before_title.vcf
diff --git a/tests/AndroidTests/res/raw/v21_pref_handling.vcf b/core/tests/coretests/res/raw/v21_pref_handling.vcf
similarity index 100%
rename from tests/AndroidTests/res/raw/v21_pref_handling.vcf
rename to core/tests/coretests/res/raw/v21_pref_handling.vcf
diff --git a/tests/AndroidTests/res/raw/v21_simple_1.vcf b/core/tests/coretests/res/raw/v21_simple_1.vcf
similarity index 100%
rename from tests/AndroidTests/res/raw/v21_simple_1.vcf
rename to core/tests/coretests/res/raw/v21_simple_1.vcf
diff --git a/tests/AndroidTests/res/raw/v21_simple_2.vcf b/core/tests/coretests/res/raw/v21_simple_2.vcf
similarity index 100%
rename from tests/AndroidTests/res/raw/v21_simple_2.vcf
rename to core/tests/coretests/res/raw/v21_simple_2.vcf
diff --git a/tests/AndroidTests/res/raw/v21_simple_3.vcf b/core/tests/coretests/res/raw/v21_simple_3.vcf
similarity index 100%
rename from tests/AndroidTests/res/raw/v21_simple_3.vcf
rename to core/tests/coretests/res/raw/v21_simple_3.vcf
diff --git a/tests/AndroidTests/res/raw/v21_title_before_org.vcf b/core/tests/coretests/res/raw/v21_title_before_org.vcf
similarity index 100%
rename from tests/AndroidTests/res/raw/v21_title_before_org.vcf
rename to core/tests/coretests/res/raw/v21_title_before_org.vcf
diff --git a/tests/AndroidTests/res/raw/v21_winmo_65.vcf b/core/tests/coretests/res/raw/v21_winmo_65.vcf
similarity index 100%
rename from tests/AndroidTests/res/raw/v21_winmo_65.vcf
rename to core/tests/coretests/res/raw/v21_winmo_65.vcf
diff --git a/tests/AndroidTests/res/raw/v30_comma_separated.vcf b/core/tests/coretests/res/raw/v30_comma_separated.vcf
similarity index 100%
rename from tests/AndroidTests/res/raw/v30_comma_separated.vcf
rename to core/tests/coretests/res/raw/v30_comma_separated.vcf
diff --git a/tests/AndroidTests/res/raw/v30_simple.vcf b/core/tests/coretests/res/raw/v30_simple.vcf
similarity index 100%
rename from tests/AndroidTests/res/raw/v30_simple.vcf
rename to core/tests/coretests/res/raw/v30_simple.vcf
diff --git a/core/tests/coretests/res/values/strings.xml b/core/tests/coretests/res/values/strings.xml
index 05b57e0..807386a 100644
--- a/core/tests/coretests/res/values/strings.xml
+++ b/core/tests/coretests/res/values/strings.xml
@@ -100,4 +100,21 @@
<string name="include_button">I was included!</string>
<string name="view">View</string>
+
+ <string name="layout_five_text_text">S</string>
+ <string name="layout_four_text_text">S</string>
+ <string name="layout_six_text_text">S</string>
+
+ <string name="menu_test">test</string>
+ <string name="metadata_text">text</string>
+
+ <string name="permlab_testGranted">Test Granted</string>
+ <string name="permdesc_testGranted">Used for running unit tests, for
+ testing operations where we have the permission.</string>
+ <string name="permlab_testDenied">Test Denied</string>
+ <string name="permdesc_testDenied">Used for running unit tests, for
+ testing operations where we do not have the permission.</string>
+
+ <string name="searchable_label">SearchManager Test</string>
+ <string name="searchable_hint">A search hint</string>
</resources>
diff --git a/tests/AndroidTests/res/xml/metadata.xml b/core/tests/coretests/res/xml/metadata.xml
similarity index 100%
rename from tests/AndroidTests/res/xml/metadata.xml
rename to core/tests/coretests/res/xml/metadata.xml
diff --git a/tests/AndroidTests/res/xml/metadata_app.xml b/core/tests/coretests/res/xml/metadata_app.xml
similarity index 100%
rename from tests/AndroidTests/res/xml/metadata_app.xml
rename to core/tests/coretests/res/xml/metadata_app.xml
diff --git a/tests/AndroidTests/res/xml/searchable.xml b/core/tests/coretests/res/xml/searchable.xml
similarity index 100%
rename from tests/AndroidTests/res/xml/searchable.xml
rename to core/tests/coretests/res/xml/searchable.xml
diff --git a/tests/AndroidTests/src/com/android/unit_tests/accounts/AccountManagerServiceTest.java b/core/tests/coretests/src/android/accounts/AccountManagerServiceTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/accounts/AccountManagerServiceTest.java
rename to core/tests/coretests/src/android/accounts/AccountManagerServiceTest.java
index 1e4f161..394b9f2 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/accounts/AccountManagerServiceTest.java
+++ b/core/tests/coretests/src/android/accounts/AccountManagerServiceTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.accounts;
+package android.accounts;
import android.test.AndroidTestCase;
import android.test.RenamingDelegatingContext;
@@ -175,4 +175,4 @@
assertNull(ams.readAuthTokenFromDatabase(a12, "att2"));
}
-}
\ No newline at end of file
+}
diff --git a/tests/AndroidTests/src/com/android/unit_tests/SearchManagerTest.java b/core/tests/coretests/src/android/app/SearchManagerTest.java
similarity index 95%
rename from tests/AndroidTests/src/com/android/unit_tests/SearchManagerTest.java
rename to core/tests/coretests/src/android/app/SearchManagerTest.java
index 6f6f55d..21ed4c5 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/SearchManagerTest.java
+++ b/core/tests/coretests/src/android/app/SearchManagerTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.app;
-import com.android.unit_tests.activity.LocalActivity;
+import android.app.activity.LocalActivity;
import android.app.Activity;
import android.app.ISearchManager;
@@ -39,8 +39,8 @@
public class SearchManagerTest extends ActivityInstrumentationTestCase2<LocalActivity> {
private ComponentName SEARCHABLE_ACTIVITY =
- new ComponentName("com.android.unit_tests",
- "com.android.unit_tests.SearchableActivity");
+ new ComponentName("com.android.frameworks.coretests",
+ "android.app.activity.SearchableActivity");
/*
* Bug list of test ideas.
@@ -76,7 +76,7 @@
Context mContext;
public SearchManagerTest() {
- super("com.android.unit_tests", LocalActivity.class);
+ super("com.android.frameworks.coretests", LocalActivity.class);
}
/**
diff --git a/tests/AndroidTests/src/com/android/unit_tests/SearchablesTest.java b/core/tests/coretests/src/android/app/SearchablesTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/SearchablesTest.java
rename to core/tests/coretests/src/android/app/SearchablesTest.java
index 972559d..9b4520e 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/SearchablesTest.java
+++ b/core/tests/coretests/src/android/app/SearchablesTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.app;
import android.app.SearchManager;
import android.app.SearchableInfo;
@@ -108,8 +108,8 @@
// confirm that we return null for non-searchy activities
ComponentName nonActivity = new ComponentName(
- "com.android.unit_tests",
- "com.android.unit_tests.NO_SEARCH_ACTIVITY");
+ "com.android.frameworks.coretests",
+ "com.android.frameworks.coretests.activity.NO_SEARCH_ACTIVITY");
SearchableInfo si = searchables.getSearchableInfo(nonActivity);
assertNull(si);
}
diff --git a/tests/AndroidTests/src/com/android/unit_tests/SuggestionProvider.java b/core/tests/coretests/src/android/app/SuggestionProvider.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/SuggestionProvider.java
rename to core/tests/coretests/src/android/app/SuggestionProvider.java
index bc61e27..9fb7dcf 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/SuggestionProvider.java
+++ b/core/tests/coretests/src/android/app/SuggestionProvider.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.app;
import android.app.SearchManager;
import android.content.ContentProvider;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/AbortReceiver.java b/core/tests/coretests/src/android/app/activity/AbortReceiver.java
similarity index 96%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/AbortReceiver.java
rename to core/tests/coretests/src/android/app/activity/AbortReceiver.java
index d9d6101..fef1775 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/AbortReceiver.java
+++ b/core/tests/coretests/src/android/app/activity/AbortReceiver.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.content.Context;
import android.content.Intent;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/ActivityManagerTest.java b/core/tests/coretests/src/android/app/activity/ActivityManagerTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/ActivityManagerTest.java
rename to core/tests/coretests/src/android/app/activity/ActivityManagerTest.java
index ab91761..61d73bc 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/ActivityManagerTest.java
+++ b/core/tests/coretests/src/android/app/activity/ActivityManagerTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.app.ActivityManager;
import android.content.Context;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/ActivityTests.java b/core/tests/coretests/src/android/app/activity/ActivityTests.java
similarity index 96%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/ActivityTests.java
rename to core/tests/coretests/src/android/app/activity/ActivityTests.java
index cffc60a..c57fe98 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/ActivityTests.java
+++ b/core/tests/coretests/src/android/app/activity/ActivityTests.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import junit.framework.TestSuite;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/ActivityTestsBase.java b/core/tests/coretests/src/android/app/activity/ActivityTestsBase.java
similarity index 96%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/ActivityTestsBase.java
rename to core/tests/coretests/src/android/app/activity/ActivityTestsBase.java
index f960969..232abe2 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/ActivityTestsBase.java
+++ b/core/tests/coretests/src/android/app/activity/ActivityTestsBase.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.app.Activity;
import android.content.Context;
@@ -25,9 +25,9 @@
public class ActivityTestsBase extends AndroidTestCase
implements PerformanceTestCase, LaunchpadActivity.CallingTest {
public static final String PERMISSION_GRANTED =
- "com.android.unit_tests.permission.TEST_GRANTED";
+ "com.android.frameworks.coretests.permission.TEST_GRANTED";
public static final String PERMISSION_DENIED =
- "com.android.unit_tests.permission.TEST_DENIED";
+ "com.android.frameworks.coretests.permission.TEST_DENIED";
protected Intent mIntent;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/BroadcastTest.java b/core/tests/coretests/src/android/app/activity/BroadcastTest.java
similarity index 93%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/BroadcastTest.java
rename to core/tests/coretests/src/android/app/activity/BroadcastTest.java
index 7f6db3c..4b1f9fd 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/BroadcastTest.java
+++ b/core/tests/coretests/src/android/app/activity/BroadcastTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.app.Activity;
import android.app.ActivityManagerNative;
@@ -36,35 +36,35 @@
public static final int BROADCAST_TIMEOUT = 5 * 1000;
public static final String BROADCAST_REGISTERED =
- "com.android.unit_tests.activity.BROADCAST_REGISTERED";
+ "com.android.frameworks.coretests.activity.BROADCAST_REGISTERED";
public static final String BROADCAST_LOCAL =
- "com.android.unit_tests.activity.BROADCAST_LOCAL";
+ "com.android.frameworks.coretests.activity.BROADCAST_LOCAL";
public static final String BROADCAST_LOCAL_GRANTED =
- "com.android.unit_tests.activity.BROADCAST_LOCAL_GRANTED";
+ "com.android.frameworks.coretests.activity.BROADCAST_LOCAL_GRANTED";
public static final String BROADCAST_LOCAL_DENIED =
- "com.android.unit_tests.activity.BROADCAST_LOCAL_DENIED";
+ "com.android.frameworks.coretests.activity.BROADCAST_LOCAL_DENIED";
public static final String BROADCAST_REMOTE =
- "com.android.unit_tests.activity.BROADCAST_REMOTE";
+ "com.android.frameworks.coretests.activity.BROADCAST_REMOTE";
public static final String BROADCAST_REMOTE_GRANTED =
- "com.android.unit_tests.activity.BROADCAST_REMOTE_GRANTED";
+ "com.android.frameworks.coretests.activity.BROADCAST_REMOTE_GRANTED";
public static final String BROADCAST_REMOTE_DENIED =
- "com.android.unit_tests.activity.BROADCAST_REMOTE_DENIED";
+ "com.android.frameworks.coretests.activity.BROADCAST_REMOTE_DENIED";
public static final String BROADCAST_ALL =
- "com.android.unit_tests.activity.BROADCAST_ALL";
+ "com.android.frameworks.coretests.activity.BROADCAST_ALL";
public static final String BROADCAST_MULTI =
- "com.android.unit_tests.activity.BROADCAST_MULTI";
+ "com.android.frameworks.coretests.activity.BROADCAST_MULTI";
public static final String BROADCAST_ABORT =
- "com.android.unit_tests.activity.BROADCAST_ABORT";
+ "com.android.frameworks.coretests.activity.BROADCAST_ABORT";
public static final String BROADCAST_STICKY1 =
- "com.android.unit_tests.activity.BROADCAST_STICKY1";
+ "com.android.frameworks.coretests.activity.BROADCAST_STICKY1";
public static final String BROADCAST_STICKY2 =
- "com.android.unit_tests.activity.BROADCAST_STICKY2";
+ "com.android.frameworks.coretests.activity.BROADCAST_STICKY2";
public static final String BROADCAST_FAIL_REGISTER =
- "com.android.unit_tests.activity.BROADCAST_FAIL_REGISTER";
+ "com.android.frameworks.coretests.activity.BROADCAST_FAIL_REGISTER";
public static final String BROADCAST_FAIL_BIND =
- "com.android.unit_tests.activity.BROADCAST_FAIL_BIND";
+ "com.android.frameworks.coretests.activity.BROADCAST_FAIL_BIND";
public static final String RECEIVER_REG = "receiver-reg";
public static final String RECEIVER_LOCAL = "receiver-local";
@@ -276,7 +276,7 @@
map.putString("foo", "you");
map.putString("remove", "me");
getContext().sendOrderedBroadcast(
- new Intent("com.android.unit_tests.activity.BROADCAST_RESULT"),
+ new Intent("com.android.frameworks.coretests.activity.BROADCAST_RESULT"),
null, broadcastReceiver, null, 1, "foo", map);
while (!broadcastReceiver.mHaveResult) {
try {
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/ClearTop.java b/core/tests/coretests/src/android/app/activity/ClearTop.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/ClearTop.java
rename to core/tests/coretests/src/android/app/activity/ClearTop.java
index dd5274a..a5ee2ce 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/ClearTop.java
+++ b/core/tests/coretests/src/android/app/activity/ClearTop.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.app.Activity;
import android.content.Intent;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/IntentSenderTest.java b/core/tests/coretests/src/android/app/activity/IntentSenderTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/IntentSenderTest.java
rename to core/tests/coretests/src/android/app/activity/IntentSenderTest.java
index a30c1cb..3c30915 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/IntentSenderTest.java
+++ b/core/tests/coretests/src/android/app/activity/IntentSenderTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.app.Activity;
import android.app.PendingIntent;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/LaunchTest.java b/core/tests/coretests/src/android/app/activity/LaunchTest.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/LaunchTest.java
rename to core/tests/coretests/src/android/app/activity/LaunchTest.java
index 12b1b5d..5893fd0 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/LaunchTest.java
+++ b/core/tests/coretests/src/android/app/activity/LaunchTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.content.ComponentName;
import android.test.suitebuilder.annotation.LargeTest;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/LaunchpadActivity.java b/core/tests/coretests/src/android/app/activity/LaunchpadActivity.java
similarity index 93%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/LaunchpadActivity.java
rename to core/tests/coretests/src/android/app/activity/LaunchpadActivity.java
index 06e7a84..7662456 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/LaunchpadActivity.java
+++ b/core/tests/coretests/src/android/app/activity/LaunchpadActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.app.Activity;
import android.content.BroadcastReceiver;
@@ -71,49 +71,49 @@
}
// Also used as the Binder interface descriptor string in these tests
- public static final String LAUNCH = "com.android.unit_tests.activity.LAUNCH";
+ public static final String LAUNCH = "com.android.frameworks.coretests.activity.LAUNCH";
public static final String FORWARD_RESULT =
- "com.android.unit_tests.activity.FORWARD_RESULT";
+ "com.android.frameworks.coretests.activity.FORWARD_RESULT";
public static final String RETURNED_RESULT =
- "com.android.unit_tests.activity.RETURNED_RESULT";
+ "com.android.frameworks.coretests.activity.RETURNED_RESULT";
public static final String BAD_PARCELABLE =
- "com.android.unit_tests.activity.BAD_PARCELABLE";
+ "comcom.android.frameworks.coretests.activity.BAD_PARCELABLE";
public static final int LAUNCHED_RESULT = 1;
public static final int FORWARDED_RESULT = 2;
public static final String LIFECYCLE_BASIC =
- "com.android.unit_tests.activity.LIFECYCLE_BASIC";
+ "com.android.frameworks.coretests.activity.LIFECYCLE_BASIC";
public static final String LIFECYCLE_SCREEN =
- "com.android.unit_tests.activity.LIFECYCLE_SCREEN";
+ "com.android.frameworks.coretests.activity.LIFECYCLE_SCREEN";
public static final String LIFECYCLE_DIALOG =
- "com.android.unit_tests.activity.LIFECYCLE_DIALOG";
+ "com.android.frameworks.coretests.activity.LIFECYCLE_DIALOG";
public static final String LIFECYCLE_FINISH_CREATE =
- "com.android.unit_tests.activity.LIFECYCLE_FINISH_CREATE";
+ "com.android.frameworks.coretests.activity.LIFECYCLE_FINISH_CREATE";
public static final String LIFECYCLE_FINISH_START =
- "com.android.unit_tests.activity.LIFECYCLE_FINISH_START";
+ "com.android.frameworks.coretests.activity.LIFECYCLE_FINISH_START";
public static final String BROADCAST_REGISTERED =
- "com.android.unit_tests.activity.BROADCAST_REGISTERED";
+ "com.android.frameworks.coretests.activity.BROADCAST_REGISTERED";
public static final String BROADCAST_LOCAL =
- "com.android.unit_tests.activity.BROADCAST_LOCAL";
+ "com.android.frameworks.coretests.activity.BROADCAST_LOCAL";
public static final String BROADCAST_REMOTE =
- "com.android.unit_tests.activity.BROADCAST_REMOTE";
+ "com.android.frameworks.coretests.activity.BROADCAST_REMOTE";
public static final String BROADCAST_ALL =
- "com.android.unit_tests.activity.BROADCAST_ALL";
+ "com.android.frameworks.coretests.activity.BROADCAST_ALL";
public static final String BROADCAST_REPEAT =
- "com.android.unit_tests.activity.BROADCAST_REPEAT";
+ "com.android.frameworks.coretests.activity.BROADCAST_REPEAT";
public static final String BROADCAST_MULTI =
- "com.android.unit_tests.activity.BROADCAST_MULTI";
+ "com.android.frameworks.coretests.activity.BROADCAST_MULTI";
public static final String BROADCAST_ABORT =
- "com.android.unit_tests.activity.BROADCAST_ABORT";
+ "com.android.frameworks.coretests.activity.BROADCAST_ABORT";
public static final String BROADCAST_STICKY1 =
- "com.android.unit_tests.activity.BROADCAST_STICKY1";
+ "com.android.frameworks.coretests.activity.BROADCAST_STICKY1";
public static final String BROADCAST_STICKY2 =
- "com.android.unit_tests.activity.BROADCAST_STICKY2";
+ "com.android.frameworks.coretests.activity.BROADCAST_STICKY2";
public static final String RECEIVER_REG = "receiver-reg";
public static final String RECEIVER_LOCAL = "receiver-local";
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/LaunchpadTabActivity.java b/core/tests/coretests/src/android/app/activity/LaunchpadTabActivity.java
similarity index 96%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/LaunchpadTabActivity.java
rename to core/tests/coretests/src/android/app/activity/LaunchpadTabActivity.java
index 1e0e4a6..79b860f 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/LaunchpadTabActivity.java
+++ b/core/tests/coretests/src/android/app/activity/LaunchpadTabActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.app.TabActivity;
import android.content.ComponentName;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/LifecycleTest.java b/core/tests/coretests/src/android/app/activity/LifecycleTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/LifecycleTest.java
rename to core/tests/coretests/src/android/app/activity/LifecycleTest.java
index 069b697..768a9a4 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/LifecycleTest.java
+++ b/core/tests/coretests/src/android/app/activity/LifecycleTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.content.ComponentName;
import android.content.Intent;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/LocalActivity.java b/core/tests/coretests/src/android/app/activity/LocalActivity.java
similarity index 95%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/LocalActivity.java
rename to core/tests/coretests/src/android/app/activity/LocalActivity.java
index 3c107be..01f1fb6 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/LocalActivity.java
+++ b/core/tests/coretests/src/android/app/activity/LocalActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import java.util.Map;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/LocalDeniedReceiver.java b/core/tests/coretests/src/android/app/activity/LocalDeniedReceiver.java
similarity index 96%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/LocalDeniedReceiver.java
rename to core/tests/coretests/src/android/app/activity/LocalDeniedReceiver.java
index ac235c0..2120a1d 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/LocalDeniedReceiver.java
+++ b/core/tests/coretests/src/android/app/activity/LocalDeniedReceiver.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.content.BroadcastReceiver;
import android.content.Context;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/LocalDeniedService.java b/core/tests/coretests/src/android/app/activity/LocalDeniedService.java
similarity index 93%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/LocalDeniedService.java
rename to core/tests/coretests/src/android/app/activity/LocalDeniedService.java
index 0473ea9..3bdac22 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/LocalDeniedService.java
+++ b/core/tests/coretests/src/android/app/activity/LocalDeniedService.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
public class LocalDeniedService extends LocalService
{
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/LocalDialog.java b/core/tests/coretests/src/android/app/activity/LocalDialog.java
similarity index 95%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/LocalDialog.java
rename to core/tests/coretests/src/android/app/activity/LocalDialog.java
index 3694375..c92fa43 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/LocalDialog.java
+++ b/core/tests/coretests/src/android/app/activity/LocalDialog.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import java.util.Map;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/LocalGrantedReceiver.java b/core/tests/coretests/src/android/app/activity/LocalGrantedReceiver.java
similarity index 96%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/LocalGrantedReceiver.java
rename to core/tests/coretests/src/android/app/activity/LocalGrantedReceiver.java
index 48f5658..c9e6ab4 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/LocalGrantedReceiver.java
+++ b/core/tests/coretests/src/android/app/activity/LocalGrantedReceiver.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.content.BroadcastReceiver;
import android.content.Context;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/LocalGrantedService.java b/core/tests/coretests/src/android/app/activity/LocalGrantedService.java
similarity index 93%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/LocalGrantedService.java
rename to core/tests/coretests/src/android/app/activity/LocalGrantedService.java
index 0dbcd00..7ab0fb4 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/LocalGrantedService.java
+++ b/core/tests/coretests/src/android/app/activity/LocalGrantedService.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
public class LocalGrantedService extends LocalService
{
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/LocalProvider.java b/core/tests/coretests/src/android/app/activity/LocalProvider.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/LocalProvider.java
rename to core/tests/coretests/src/android/app/activity/LocalProvider.java
index a3375bd..085e622 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/LocalProvider.java
+++ b/core/tests/coretests/src/android/app/activity/LocalProvider.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.content.UriMatcher;
import android.content.*;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/LocalReceiver.java b/core/tests/coretests/src/android/app/activity/LocalReceiver.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/LocalReceiver.java
rename to core/tests/coretests/src/android/app/activity/LocalReceiver.java
index 019c5c0..bfd543f 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/LocalReceiver.java
+++ b/core/tests/coretests/src/android/app/activity/LocalReceiver.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/LocalScreen.java b/core/tests/coretests/src/android/app/activity/LocalScreen.java
similarity index 95%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/LocalScreen.java
rename to core/tests/coretests/src/android/app/activity/LocalScreen.java
index ad65fcc..f7c8c33 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/LocalScreen.java
+++ b/core/tests/coretests/src/android/app/activity/LocalScreen.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import java.util.Map;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/LocalService.java b/core/tests/coretests/src/android/app/activity/LocalService.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/LocalService.java
rename to core/tests/coretests/src/android/app/activity/LocalService.java
index d79205d..c31ca4b 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/LocalService.java
+++ b/core/tests/coretests/src/android/app/activity/LocalService.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.app.Service;
import android.content.Intent;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/MetaDataTest.java b/core/tests/coretests/src/android/app/activity/MetaDataTest.java
similarity index 86%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/MetaDataTest.java
rename to core/tests/coretests/src/android/app/activity/MetaDataTest.java
index 4660e29..214bc91 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/MetaDataTest.java
+++ b/core/tests/coretests/src/android/app/activity/MetaDataTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.content.ComponentName;
import android.content.pm.ActivityInfo;
@@ -29,7 +29,7 @@
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
-import com.android.unit_tests.R;
+import com.android.frameworks.coretests.R;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -47,18 +47,18 @@
Bundle md = ci.metaData;
assertNotNull("No meta data found", md);
- assertEquals("foo", md.getString("com.android.unit_tests.string"));
- assertTrue(md.getBoolean("com.android.unit_tests.boolean"));
- assertEquals(100, md.getInt("com.android.unit_tests.integer"));
- assertEquals(0xff000000, md.getInt("com.android.unit_tests.color"));
+ assertEquals("foo", md.getString("com.android.frameworks.coretests.string"));
+ assertTrue(md.getBoolean("com.android.frameworks.coretests.boolean"));
+ assertEquals(100, md.getInt("com.android.frameworks.coretests.integer"));
+ assertEquals(0xff000000, md.getInt("com.android.frameworks.coretests.color"));
assertEquals((double) 1001,
- Math.floor(md.getFloat("com.android.unit_tests.float") * 10 + .5));
+ Math.floor(md.getFloat("com.android.frameworks.coretests.float") * 10 + .5));
- assertEquals(R.xml.metadata, md.getInt("com.android.unit_tests.reference"));
+ assertEquals(R.xml.metadata, md.getInt("com.android.frameworks.coretests.reference"));
XmlResourceParser xml = ci.loadXmlMetaData(mContext.getPackageManager(),
- "com.android.unit_tests.reference");
+ "com.android.frameworks.coretests.reference");
assertNotNull(xml);
int type;
@@ -138,12 +138,12 @@
public void testProviderWithData() throws Exception {
ComponentName cn = new ComponentName(mContext, LocalProvider.class);
ProviderInfo pi = mContext.getPackageManager().resolveContentProvider(
- "com.android.unit_tests.LocalProvider",
+ "com.android.frameworks.coretests.LocalProvider",
PackageManager.GET_META_DATA);
checkMetaData(cn, pi);
pi = mContext.getPackageManager().resolveContentProvider(
- "com.android.unit_tests.LocalProvider", 0);
+ "com.android.frameworks.coretests.LocalProvider", 0);
assertNull("Meta data returned when not requested", pi.metaData);
}
@@ -151,7 +151,7 @@
@SmallTest
public void testPermissionWithData() throws Exception {
ComponentName cn = new ComponentName("foo",
- "com.android.unit_tests.permission.TEST_GRANTED");
+ "com.android.frameworks.coretests.permission.TEST_GRANTED");
PermissionInfo pi = mContext.getPackageManager().getPermissionInfo(
cn.getClassName(), PackageManager.GET_META_DATA);
checkMetaData(cn, pi);
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/RemoteDeniedReceiver.java b/core/tests/coretests/src/android/app/activity/RemoteDeniedReceiver.java
similarity index 96%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/RemoteDeniedReceiver.java
rename to core/tests/coretests/src/android/app/activity/RemoteDeniedReceiver.java
index 7656580..7c89346 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/RemoteDeniedReceiver.java
+++ b/core/tests/coretests/src/android/app/activity/RemoteDeniedReceiver.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.content.BroadcastReceiver;
import android.content.Context;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/RemoteGrantedReceiver.java b/core/tests/coretests/src/android/app/activity/RemoteGrantedReceiver.java
similarity index 96%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/RemoteGrantedReceiver.java
rename to core/tests/coretests/src/android/app/activity/RemoteGrantedReceiver.java
index 034aa1d..0eca8f7 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/RemoteGrantedReceiver.java
+++ b/core/tests/coretests/src/android/app/activity/RemoteGrantedReceiver.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.content.BroadcastReceiver;
import android.content.Context;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/RemoteReceiver.java b/core/tests/coretests/src/android/app/activity/RemoteReceiver.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/RemoteReceiver.java
rename to core/tests/coretests/src/android/app/activity/RemoteReceiver.java
index 818bffe..9608fc4 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/RemoteReceiver.java
+++ b/core/tests/coretests/src/android/app/activity/RemoteReceiver.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.content.Context;
import android.content.Intent;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/RemoteSubActivityScreen.java b/core/tests/coretests/src/android/app/activity/RemoteSubActivityScreen.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/RemoteSubActivityScreen.java
rename to core/tests/coretests/src/android/app/activity/RemoteSubActivityScreen.java
index e750ed6..e969d10 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/RemoteSubActivityScreen.java
+++ b/core/tests/coretests/src/android/app/activity/RemoteSubActivityScreen.java
@@ -15,7 +15,7 @@
** limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.content.Intent;
import android.os.Bundle;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/ResultReceiver.java b/core/tests/coretests/src/android/app/activity/ResultReceiver.java
similarity index 96%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/ResultReceiver.java
rename to core/tests/coretests/src/android/app/activity/ResultReceiver.java
index 4b5d468..f7daf2c 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/ResultReceiver.java
+++ b/core/tests/coretests/src/android/app/activity/ResultReceiver.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.content.Context;
import android.content.Intent;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/SearchableActivity.java b/core/tests/coretests/src/android/app/activity/SearchableActivity.java
similarity index 95%
rename from tests/AndroidTests/src/com/android/unit_tests/SearchableActivity.java
rename to core/tests/coretests/src/android/app/activity/SearchableActivity.java
index 53f40e9..e238572 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/SearchableActivity.java
+++ b/core/tests/coretests/src/android/app/activity/SearchableActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.app.activity;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/ServiceTest.java b/core/tests/coretests/src/android/app/activity/ServiceTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/ServiceTest.java
rename to core/tests/coretests/src/android/app/activity/ServiceTest.java
index 95f6e36..d3ae415 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/ServiceTest.java
+++ b/core/tests/coretests/src/android/app/activity/ServiceTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.content.ComponentName;
import android.content.Context;
@@ -38,11 +38,11 @@
public class ServiceTest extends ActivityTestsBase {
public static final String SERVICE_LOCAL =
- "com.android.unit_tests.activity.SERVICE_LOCAL";
+ "com.android.frameworks.coretests.activity.SERVICE_LOCAL";
public static final String SERVICE_LOCAL_GRANTED =
- "com.android.unit_tests.activity.SERVICE_LOCAL_GRANTED";
+ "com.android.frameworks.coretests.activity.SERVICE_LOCAL_GRANTED";
public static final String SERVICE_LOCAL_DENIED =
- "com.android.unit_tests.activity.SERVICE_LOCAL_DENIED";
+ "com.android.frameworks.coretests.activity.SERVICE_LOCAL_DENIED";
public static final String REPORT_OBJ_NAME = "report";
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/SetTimeZonePermissionsTest.java b/core/tests/coretests/src/android/app/activity/SetTimeZonePermissionsTest.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/SetTimeZonePermissionsTest.java
rename to core/tests/coretests/src/android/app/activity/SetTimeZonePermissionsTest.java
index 1fa7579..41b9547 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/SetTimeZonePermissionsTest.java
+++ b/core/tests/coretests/src/android/app/activity/SetTimeZonePermissionsTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.app.AlarmManager;
import android.content.Context;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/SubActivityScreen.java b/core/tests/coretests/src/android/app/activity/SubActivityScreen.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/SubActivityScreen.java
rename to core/tests/coretests/src/android/app/activity/SubActivityScreen.java
index 914b909..919c591 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/SubActivityScreen.java
+++ b/core/tests/coretests/src/android/app/activity/SubActivityScreen.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.app.Activity;
import android.app.PendingIntent;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/SubActivityTest.java b/core/tests/coretests/src/android/app/activity/SubActivityTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/SubActivityTest.java
rename to core/tests/coretests/src/android/app/activity/SubActivityTest.java
index ee02c98..35dde8a 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/SubActivityTest.java
+++ b/core/tests/coretests/src/android/app/activity/SubActivityTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.test.suitebuilder.annotation.Suppress;
import android.content.ComponentName;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/TestedActivity.java b/core/tests/coretests/src/android/app/activity/TestedActivity.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/TestedActivity.java
rename to core/tests/coretests/src/android/app/activity/TestedActivity.java
index ec407a9..3a1c15f 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/TestedActivity.java
+++ b/core/tests/coretests/src/android/app/activity/TestedActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.app.Activity;
import android.os.Handler;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/activity/TestedScreen.java b/core/tests/coretests/src/android/app/activity/TestedScreen.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/activity/TestedScreen.java
rename to core/tests/coretests/src/android/app/activity/TestedScreen.java
index 4085aa9..1682d1a 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/activity/TestedScreen.java
+++ b/core/tests/coretests/src/android/app/activity/TestedScreen.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.activity;
+package android.app.activity;
import android.app.Activity;
import android.content.Intent;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/content/AssetTest.java b/core/tests/coretests/src/android/content/AssetTest.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/content/AssetTest.java
rename to core/tests/coretests/src/android/content/AssetTest.java
index f38d062..b66574c 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/content/AssetTest.java
+++ b/core/tests/coretests/src/android/content/AssetTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.content;
+package android.content;
import android.content.res.AssetManager;
import android.test.AndroidTestCase;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/ContentQueryMapTest.java b/core/tests/coretests/src/android/content/ContentQueryMapTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/ContentQueryMapTest.java
rename to core/tests/coretests/src/android/content/ContentQueryMapTest.java
index 241a1bf..d1b8c24 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/ContentQueryMapTest.java
+++ b/core/tests/coretests/src/android/content/ContentQueryMapTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.content;
import android.content.ContentQueryMap;
import android.content.ContentResolver;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/content/ContentTests.java b/core/tests/coretests/src/android/content/ContentTests.java
similarity index 95%
rename from tests/AndroidTests/src/com/android/unit_tests/content/ContentTests.java
rename to core/tests/coretests/src/android/content/ContentTests.java
index 636660f..a1299e3 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/content/ContentTests.java
+++ b/core/tests/coretests/src/android/content/ContentTests.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.content;
+package android.content;
import junit.framework.TestSuite;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/content/MemoryFileProvider.java b/core/tests/coretests/src/android/content/MemoryFileProvider.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/content/MemoryFileProvider.java
rename to core/tests/coretests/src/android/content/MemoryFileProvider.java
index b31ce18..c4bc767 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/content/MemoryFileProvider.java
+++ b/core/tests/coretests/src/android/content/MemoryFileProvider.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.content;
+package android.content;
import android.content.ContentProvider;
import android.content.ContentValues;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/content/MemoryFileProviderTest.java b/core/tests/coretests/src/android/content/MemoryFileProviderTest.java
similarity index 89%
rename from tests/AndroidTests/src/com/android/unit_tests/content/MemoryFileProviderTest.java
rename to core/tests/coretests/src/android/content/MemoryFileProviderTest.java
index f88a9da..6708af6e 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/content/MemoryFileProviderTest.java
+++ b/core/tests/coretests/src/android/content/MemoryFileProviderTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.content;
+package android.content;
import android.content.ContentResolver;
import android.net.Uri;
@@ -34,7 +34,7 @@
@MediumTest
public void testRead() throws Exception {
ContentResolver resolver = getContext().getContentResolver();
- Uri uri = Uri.parse("content://com.android.unit_tests.content.MemoryFileProvider/data/1/blob");
+ Uri uri = Uri.parse("content://android.content.MemoryFileProvider/data/1/blob");
byte[] buf = new byte[MemoryFileProvider.TEST_BLOB.length];
InputStream in = resolver.openInputStream(uri);
assertNotNull(in);
@@ -52,7 +52,7 @@
// open enough file descriptors that we will crash something if we leak FDs
// or address space
for (int i = 0; i < 1025; i++) {
- Uri uri = Uri.parse("content://com.android.unit_tests.content.MemoryFileProvider/huge");
+ Uri uri = Uri.parse("content://android.content.MemoryFileProvider/huge");
InputStream in = resolver.openInputStream(uri);
assertNotNull("Failed to open stream number " + i, in);
assertEquals(1000000, in.skip(1000000));
@@ -68,7 +68,7 @@
@MediumTest
public void testFile() throws Exception {
ContentResolver resolver = getContext().getContentResolver();
- Uri uri = Uri.parse("content://com.android.unit_tests.content.MemoryFileProvider/file");
+ Uri uri = Uri.parse("content://android.content.MemoryFileProvider/file");
byte[] buf = new byte[MemoryFileProvider.TEST_BLOB.length];
InputStream in = resolver.openInputStream(uri);
assertNotNull(in);
diff --git a/tests/AndroidTests/src/com/android/unit_tests/CursorWindowTest.java b/core/tests/coretests/src/android/database/CursorWindowTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/CursorWindowTest.java
rename to core/tests/coretests/src/android/database/CursorWindowTest.java
index 0247355..07e75cb 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/CursorWindowTest.java
+++ b/core/tests/coretests/src/android/database/CursorWindowTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.database;
import android.database.AbstractCursor;
import android.test.suitebuilder.annotation.SmallTest;
diff --git a/core/tests/coretests/src/android/database/DatabaseCursorTest.java b/core/tests/coretests/src/android/database/DatabaseCursorTest.java
new file mode 100644
index 0000000..fad4349
--- /dev/null
+++ b/core/tests/coretests/src/android/database/DatabaseCursorTest.java
@@ -0,0 +1,630 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.database;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.CursorIndexOutOfBoundsException;
+import android.database.DataSetObserver;
+import android.database.DatabaseUtils;
+import android.database.sqlite.SQLiteCursor;
+import android.database.sqlite.SQLiteCursorDriver;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteQuery;
+import android.database.sqlite.SQLiteStatement;
+import android.os.Looper;
+import android.test.AndroidTestCase;
+import android.test.PerformanceTestCase;
+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 java.io.File;
+import java.util.Arrays;
+import java.util.Random;
+
+import junit.framework.TestCase;
+
+public class DatabaseCursorTest extends AndroidTestCase implements PerformanceTestCase {
+
+ private static final String sString1 = "this is a test";
+ private static final String sString2 = "and yet another test";
+ private static final String sString3 = "this string is a little longer, but still a test";
+
+ private static final int CURRENT_DATABASE_VERSION = 42;
+ private SQLiteDatabase mDatabase;
+ private File mDatabaseFile;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ File dbDir = getContext().getDir("tests", Context.MODE_PRIVATE);
+ mDatabaseFile = new File(dbDir, "database_test.db");
+
+ if (mDatabaseFile.exists()) {
+ mDatabaseFile.delete();
+ }
+ mDatabase = SQLiteDatabase.openOrCreateDatabase(mDatabaseFile.getPath(), null);
+ assertNotNull(mDatabase);
+ mDatabase.setVersion(CURRENT_DATABASE_VERSION);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ mDatabase.close();
+ mDatabaseFile.delete();
+ super.tearDown();
+ }
+
+ public boolean isPerformanceOnly() {
+ return false;
+ }
+
+ // These test can only be run once.
+ public int startPerformance(Intermediates intermediates) {
+ return 1;
+ }
+
+ private void populateDefaultTable() {
+ mDatabase.execSQL("CREATE TABLE test (_id INTEGER PRIMARY KEY, data TEXT);");
+
+ mDatabase.execSQL("INSERT INTO test (data) VALUES ('" + sString1 + "');");
+ mDatabase.execSQL("INSERT INTO test (data) VALUES ('" + sString2 + "');");
+ mDatabase.execSQL("INSERT INTO test (data) VALUES ('" + sString3 + "');");
+ }
+
+ @MediumTest
+ public void testCursorUpdate() {
+ mDatabase.execSQL(
+ "CREATE TABLE test (_id INTEGER PRIMARY KEY, d INTEGER, s INTEGER);");
+ for(int i = 0; i < 20; i++) {
+ mDatabase.execSQL("INSERT INTO test (d, s) VALUES (" + i +
+ "," + i%2 + ");");
+ }
+
+ Cursor c = mDatabase.query("test", null, "s = 0", null, null, null, null);
+ int dCol = c.getColumnIndexOrThrow("d");
+ int sCol = c.getColumnIndexOrThrow("s");
+
+ int count = 0;
+ while (c.moveToNext()) {
+ assertTrue(c.updateInt(dCol, 3));
+ count++;
+ }
+ assertEquals(10, count);
+
+ assertTrue(c.commitUpdates());
+
+ assertTrue(c.requery());
+
+ count = 0;
+ while (c.moveToNext()) {
+ assertEquals(3, c.getInt(dCol));
+ count++;
+ }
+
+ assertEquals(10, count);
+ assertTrue(c.moveToFirst());
+ assertTrue(c.deleteRow());
+ assertEquals(9, c.getCount());
+ c.close();
+ }
+
+ @MediumTest
+ public void testBlob() throws Exception {
+ // create table
+ mDatabase.execSQL(
+ "CREATE TABLE test (_id INTEGER PRIMARY KEY, s TEXT, d REAL, l INTEGER, b BLOB);");
+ // insert blob
+ Object[] args = new Object[4];
+
+ byte[] blob = new byte[1000];
+ byte value = 99;
+ Arrays.fill(blob, value);
+ args[3] = blob;
+
+ String s = new String("text");
+ args[0] = s;
+ Double d = 99.9;
+ args[1] = d;
+ Long l = (long)1000;
+ args[2] = l;
+
+ String sql = "INSERT INTO test (s, d, l, b) VALUES (?,?,?,?)";
+ mDatabase.execSQL(sql, args);
+ // use cursor to access blob
+ Cursor c = mDatabase.query("test", null, null, null, null, null, null);
+ c.moveToNext();
+ ContentValues cv = new ContentValues();
+ DatabaseUtils.cursorRowToContentValues(c, cv);
+
+ int bCol = c.getColumnIndexOrThrow("b");
+ int sCol = c.getColumnIndexOrThrow("s");
+ int dCol = c.getColumnIndexOrThrow("d");
+ int lCol = c.getColumnIndexOrThrow("l");
+ byte[] cBlob = c.getBlob(bCol);
+ assertTrue(Arrays.equals(blob, cBlob));
+ assertEquals(s, c.getString(sCol));
+ assertEquals((double)d, c.getDouble(dCol));
+ assertEquals((long)l, c.getLong(lCol));
+
+ // new byte[]
+ byte[] newblob = new byte[1000];
+ value = 98;
+ Arrays.fill(blob, value);
+
+ c.updateBlob(bCol, newblob);
+ cBlob = c.getBlob(bCol);
+ assertTrue(Arrays.equals(newblob, cBlob));
+
+ // commit
+ assertTrue(c.commitUpdates());
+ assertTrue(c.requery());
+ c.moveToNext();
+ cBlob = c.getBlob(bCol);
+ assertTrue(Arrays.equals(newblob, cBlob));
+ c.close();
+ }
+
+ @MediumTest
+ public void testRealColumns() throws Exception {
+ mDatabase.execSQL("CREATE TABLE test (_id INTEGER PRIMARY KEY, data REAL);");
+ ContentValues values = new ContentValues();
+ values.put("data", 42.11);
+ long id = mDatabase.insert("test", "data", values);
+ assertTrue(id > 0);
+ Cursor c = mDatabase.rawQuery("SELECT data FROM test", null);
+ assertNotNull(c);
+ assertTrue(c.moveToFirst());
+ assertEquals(42.11, c.getDouble(0));
+ c.close();
+ }
+
+ @MediumTest
+ public void testCursor1() throws Exception {
+ populateDefaultTable();
+
+ Cursor c = mDatabase.query("test", null, null, null, null, null, null);
+
+ int dataColumn = c.getColumnIndexOrThrow("data");
+
+ // The cursor should ignore text before the last period when looking for a column. (This
+ // is a temporary hack in all implementations of getColumnIndex.)
+ int dataColumn2 = c.getColumnIndexOrThrow("junk.data");
+ assertEquals(dataColumn, dataColumn2);
+
+ assertSame(3, c.getCount());
+
+ assertTrue(c.isBeforeFirst());
+
+ try {
+ c.getInt(0);
+ fail("CursorIndexOutOfBoundsException expected");
+ } catch (CursorIndexOutOfBoundsException ex) {
+ // expected
+ }
+
+ c.moveToNext();
+ assertEquals(1, c.getInt(0));
+
+ String s = c.getString(dataColumn);
+ assertEquals(sString1, s);
+
+ c.moveToNext();
+ s = c.getString(dataColumn);
+ assertEquals(sString2, s);
+
+ c.moveToNext();
+ s = c.getString(dataColumn);
+ assertEquals(sString3, s);
+
+ c.moveToPosition(-1);
+ c.moveToNext();
+ s = c.getString(dataColumn);
+ assertEquals(sString1, s);
+
+ c.moveToPosition(2);
+ s = c.getString(dataColumn);
+ assertEquals(sString3, s);
+
+ int i;
+
+ for (c.moveToFirst(), i = 0; !c.isAfterLast(); c.moveToNext(), i++) {
+ c.getInt(0);
+ }
+
+ assertEquals(3, i);
+
+ try {
+ c.getInt(0);
+ fail("CursorIndexOutOfBoundsException expected");
+ } catch (CursorIndexOutOfBoundsException ex) {
+ // expected
+ }
+ c.close();
+ }
+
+ @MediumTest
+ public void testCursor2() throws Exception {
+ populateDefaultTable();
+
+ Cursor c = mDatabase.query("test", null, "_id > 1000", null, null, null, null);
+ assertEquals(0, c.getCount());
+ assertTrue(c.isBeforeFirst());
+
+ try {
+ c.getInt(0);
+ fail("CursorIndexOutOfBoundsException expected");
+ } catch (CursorIndexOutOfBoundsException ex) {
+ // expected
+ }
+
+ int i;
+ for (c.moveToFirst(), i = 0; !c.isAfterLast(); c.moveToNext(), i++) {
+ c.getInt(0);
+ }
+ assertEquals(0, i);
+ try {
+ c.getInt(0);
+ fail("CursorIndexOutOfBoundsException expected");
+ } catch (CursorIndexOutOfBoundsException ex) {
+ // expected
+ }
+ c.close();
+ }
+
+ @MediumTest
+ public void testLargeField() throws Exception {
+ mDatabase.execSQL("CREATE TABLE test (_id INTEGER PRIMARY KEY, data TEXT);");
+
+ StringBuilder sql = new StringBuilder(2100);
+ sql.append("INSERT INTO test (data) VALUES ('");
+ Random random = new Random(System.currentTimeMillis());
+ StringBuilder randomString = new StringBuilder(1979);
+ for (int i = 0; i < 1979; i++) {
+ randomString.append((random.nextInt() & 0xf) % 10);
+ }
+ sql.append(randomString);
+ sql.append("');");
+ mDatabase.execSQL(sql.toString());
+
+ Cursor c = mDatabase.query("test", null, null, null, null, null, null);
+ assertNotNull(c);
+ assertEquals(1, c.getCount());
+
+ assertTrue(c.moveToFirst());
+ assertEquals(0, c.getPosition());
+ String largeString = c.getString(c.getColumnIndexOrThrow("data"));
+ assertNotNull(largeString);
+ assertEquals(randomString.toString(), largeString);
+ c.close();
+ }
+
+ class TestObserver extends DataSetObserver {
+ int total;
+ SQLiteCursor c;
+ boolean quit = false;
+ public TestObserver(int total_, SQLiteCursor cursor) {
+ c = cursor;
+ total = total_;
+ }
+
+ @Override
+ public void onChanged() {
+ int count = c.getCount();
+ if (total == count) {
+ int i = 0;
+ while (c.moveToNext()) {
+ assertEquals(i, c.getInt(1));
+ i++;
+ }
+ assertEquals(count, i);
+ quit = true;
+ Looper.myLooper().quit();
+ }
+ }
+
+ @Override
+ public void onInvalidated() {
+ }
+ }
+
+ //@Large
+ @Suppress
+ public void testLoadingThreadDelayRegisterData() throws Exception {
+ mDatabase.execSQL("CREATE TABLE test (_id INTEGER PRIMARY KEY, data INT);");
+
+ final int count = 505;
+ String sql = "INSERT INTO test (data) VALUES (?);";
+ SQLiteStatement s = mDatabase.compileStatement(sql);
+ for (int i = 0; i < count; i++) {
+ s.bindLong(1, i);
+ s.execute();
+ }
+
+ int maxRead = 500;
+ int initialRead = 5;
+ SQLiteCursor c = (SQLiteCursor)mDatabase.rawQuery("select * from test;",
+ null, initialRead, maxRead);
+
+ TestObserver observer = new TestObserver(count, c);
+ c.getCount();
+ c.registerDataSetObserver(observer);
+ if (!observer.quit) {
+ Looper.loop();
+ }
+ c.close();
+ }
+
+ @LargeTest
+ public void testLoadingThread() throws Exception {
+ mDatabase.execSQL("CREATE TABLE test (_id INTEGER PRIMARY KEY, data INT);");
+
+ final int count = 50000;
+ String sql = "INSERT INTO test (data) VALUES (?);";
+ SQLiteStatement s = mDatabase.compileStatement(sql);
+ for (int i = 0; i < count; i++) {
+ s.bindLong(1, i);
+ s.execute();
+ }
+
+ int maxRead = 1000;
+ int initialRead = 5;
+ SQLiteCursor c = (SQLiteCursor)mDatabase.rawQuery("select * from test;",
+ null, initialRead, maxRead);
+
+ TestObserver observer = new TestObserver(count, c);
+ c.registerDataSetObserver(observer);
+ c.getCount();
+
+ Looper.loop();
+ c.close();
+ }
+
+ @LargeTest
+ public void testLoadingThreadClose() throws Exception {
+ mDatabase.execSQL("CREATE TABLE test (_id INTEGER PRIMARY KEY, data INT);");
+
+ final int count = 1000;
+ String sql = "INSERT INTO test (data) VALUES (?);";
+ SQLiteStatement s = mDatabase.compileStatement(sql);
+ for (int i = 0; i < count; i++) {
+ s.bindLong(1, i);
+ s.execute();
+ }
+
+ int maxRead = 11;
+ int initialRead = 5;
+ SQLiteCursor c = (SQLiteCursor)mDatabase.rawQuery("select * from test;",
+ null, initialRead, maxRead);
+
+ TestObserver observer = new TestObserver(count, c);
+ c.registerDataSetObserver(observer);
+ c.getCount();
+ c.close();
+ }
+
+ @LargeTest
+ public void testLoadingThreadDeactivate() throws Exception {
+ mDatabase.execSQL("CREATE TABLE test (_id INTEGER PRIMARY KEY, data INT);");
+
+ final int count = 1000;
+ String sql = "INSERT INTO test (data) VALUES (?);";
+ SQLiteStatement s = mDatabase.compileStatement(sql);
+ for (int i = 0; i < count; i++) {
+ s.bindLong(1, i);
+ s.execute();
+ }
+
+ int maxRead = 11;
+ int initialRead = 5;
+ SQLiteCursor c = (SQLiteCursor)mDatabase.rawQuery("select * from test;",
+ null, initialRead, maxRead);
+
+ TestObserver observer = new TestObserver(count, c);
+ c.registerDataSetObserver(observer);
+ c.getCount();
+ c.deactivate();
+ c.close();
+ }
+
+ @LargeTest
+ public void testManyRowsLong() throws Exception {
+ mDatabase.execSQL("CREATE TABLE test (_id INTEGER PRIMARY KEY, data INT);");
+
+ final int count = 36799;
+ for (int i = 0; i < count; i++) {
+ mDatabase.execSQL("INSERT INTO test (data) VALUES (" + i + ");");
+ }
+
+ Cursor c = mDatabase.query("test", new String[]{"data"}, null, null, null, null, null);
+ assertNotNull(c);
+
+ int i = 0;
+ while (c.moveToNext()) {
+ assertEquals(i, c.getInt(0));
+ i++;
+ }
+ assertEquals(count, i);
+ assertEquals(count, c.getCount());
+
+ Log.d("testManyRows", "count " + Integer.toString(i));
+ c.close();
+ }
+
+ @LargeTest
+ public void testManyRowsTxt() throws Exception {
+ mDatabase.execSQL("CREATE TABLE test (_id INTEGER PRIMARY KEY, data TEXT);");
+ StringBuilder sql = new StringBuilder(2100);
+ sql.append("INSERT INTO test (data) VALUES ('");
+ Random random = new Random(System.currentTimeMillis());
+ StringBuilder randomString = new StringBuilder(1979);
+ for (int i = 0; i < 1979; i++) {
+ randomString.append((random.nextInt() & 0xf) % 10);
+ }
+ sql.append(randomString);
+ sql.append("');");
+
+ // if cursor window size changed, adjust this value too
+ final int count = 600; // more than two fillWindow needed
+ for (int i = 0; i < count; i++) {
+ mDatabase.execSQL(sql.toString());
+ }
+
+ Cursor c = mDatabase.query("test", new String[]{"data"}, null, null, null, null, null);
+ assertNotNull(c);
+
+ int i = 0;
+ while (c.moveToNext()) {
+ assertEquals(randomString.toString(), c.getString(0));
+ i++;
+ }
+ assertEquals(count, i);
+ assertEquals(count, c.getCount());
+ c.close();
+ }
+
+ @LargeTest
+ public void testManyRowsTxtLong() throws Exception {
+ mDatabase.execSQL("CREATE TABLE test (_id INTEGER PRIMARY KEY, txt TEXT, data INT);");
+
+ Random random = new Random(System.currentTimeMillis());
+ StringBuilder randomString = new StringBuilder(1979);
+ for (int i = 0; i < 1979; i++) {
+ randomString.append((random.nextInt() & 0xf) % 10);
+ }
+
+ // if cursor window size changed, adjust this value too
+ final int count = 600;
+ for (int i = 0; i < count; i++) {
+ StringBuilder sql = new StringBuilder(2100);
+ sql.append("INSERT INTO test (txt, data) VALUES ('");
+ sql.append(randomString);
+ sql.append("','");
+ sql.append(i);
+ sql.append("');");
+ mDatabase.execSQL(sql.toString());
+ }
+
+ Cursor c = mDatabase.query("test", new String[]{"txt", "data"}, null, null, null, null, null);
+ assertNotNull(c);
+
+ int i = 0;
+ while (c.moveToNext()) {
+ assertEquals(randomString.toString(), c.getString(0));
+ assertEquals(i, c.getInt(1));
+ i++;
+ }
+ assertEquals(count, i);
+ assertEquals(count, c.getCount());
+ c.close();
+ }
+
+ @MediumTest
+ public void testRequery() throws Exception {
+ populateDefaultTable();
+
+ Cursor c = mDatabase.rawQuery("SELECT * FROM test", null);
+ assertNotNull(c);
+ assertEquals(3, c.getCount());
+ c.deactivate();
+ c.requery();
+ assertEquals(3, c.getCount());
+ c.close();
+ }
+
+ @MediumTest
+ public void testRequeryWithSelection() throws Exception {
+ populateDefaultTable();
+
+ Cursor c = mDatabase.rawQuery("SELECT data FROM test WHERE data = '" + sString1 + "'",
+ null);
+ assertNotNull(c);
+ assertEquals(1, c.getCount());
+ assertTrue(c.moveToFirst());
+ assertEquals(sString1, c.getString(0));
+ c.deactivate();
+ c.requery();
+ assertEquals(1, c.getCount());
+ assertTrue(c.moveToFirst());
+ assertEquals(sString1, c.getString(0));
+ c.close();
+ }
+
+ @MediumTest
+ public void testRequeryWithSelectionArgs() throws Exception {
+ populateDefaultTable();
+
+ Cursor c = mDatabase.rawQuery("SELECT data FROM test WHERE data = ?",
+ new String[]{sString1});
+ assertNotNull(c);
+ assertEquals(1, c.getCount());
+ assertTrue(c.moveToFirst());
+ assertEquals(sString1, c.getString(0));
+ c.deactivate();
+ c.requery();
+ assertEquals(1, c.getCount());
+ assertTrue(c.moveToFirst());
+ assertEquals(sString1, c.getString(0));
+ c.close();
+ }
+
+ @MediumTest
+ public void testRequeryWithAlteredSelectionArgs() throws Exception {
+ /**
+ * Test the ability of a subclass of SQLiteCursor to change its query arguments.
+ */
+ populateDefaultTable();
+
+ SQLiteDatabase.CursorFactory factory = new SQLiteDatabase.CursorFactory() {
+ public Cursor newCursor(
+ SQLiteDatabase db, SQLiteCursorDriver masterQuery, String editTable,
+ SQLiteQuery query) {
+ return new SQLiteCursor(db, masterQuery, editTable, query) {
+ @Override
+ public boolean requery() {
+ setSelectionArguments(new String[]{"2"});
+ return super.requery();
+ }
+ };
+ }
+ };
+ Cursor c = mDatabase.rawQueryWithFactory(
+ factory, "SELECT data FROM test WHERE _id <= ?", new String[]{"1"},
+ null);
+ assertNotNull(c);
+ assertEquals(1, c.getCount());
+ assertTrue(c.moveToFirst());
+ assertEquals(sString1, c.getString(0));
+
+ // Our hacked requery() changes the query arguments in the cursor.
+ c.requery();
+
+ assertEquals(2, c.getCount());
+ assertTrue(c.moveToFirst());
+ assertEquals(sString1, c.getString(0));
+ assertTrue(c.moveToNext());
+ assertEquals(sString2, c.getString(0));
+
+ // Test that setting query args on a deactivated cursor also works.
+ c.deactivate();
+ c.requery();
+ }
+}
diff --git a/tests/AndroidTests/src/com/android/unit_tests/DatabaseGeneralTest.java b/core/tests/coretests/src/android/database/DatabaseGeneralTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/DatabaseGeneralTest.java
rename to core/tests/coretests/src/android/database/DatabaseGeneralTest.java
index d7dd601..ca650e0 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/DatabaseGeneralTest.java
+++ b/core/tests/coretests/src/android/database/DatabaseGeneralTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.database;
import android.content.ContentValues;
import android.content.Context;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/DatabaseLocaleTest.java b/core/tests/coretests/src/android/database/DatabaseLocaleTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/DatabaseLocaleTest.java
rename to core/tests/coretests/src/android/database/DatabaseLocaleTest.java
index f07ca7c..b3282941 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/DatabaseLocaleTest.java
+++ b/core/tests/coretests/src/android/database/DatabaseLocaleTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.database;
import android.database.sqlite.SQLiteDatabase;
import android.database.Cursor;
@@ -126,4 +126,4 @@
if (cursor != null) cursor.close();
}
}
-}
\ No newline at end of file
+}
diff --git a/tests/AndroidTests/src/com/android/unit_tests/DatabaseLockTest.java b/core/tests/coretests/src/android/database/DatabaseLockTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/DatabaseLockTest.java
rename to core/tests/coretests/src/android/database/DatabaseLockTest.java
index 326f873..f7a9f8a 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/DatabaseLockTest.java
+++ b/core/tests/coretests/src/android/database/DatabaseLockTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.database;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/DatabasePerformanceTests.java b/core/tests/coretests/src/android/database/DatabasePerformanceTests.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/DatabasePerformanceTests.java
rename to core/tests/coretests/src/android/database/DatabasePerformanceTests.java
index 68ce5e1..b8ebcc4 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/DatabasePerformanceTests.java
+++ b/core/tests/coretests/src/android/database/DatabasePerformanceTests.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.database;
import junit.framework.Assert;
diff --git a/core/tests/coretests/src/android/database/DatabaseStatementTest.java b/core/tests/coretests/src/android/database/DatabaseStatementTest.java
new file mode 100644
index 0000000..71dc3ae
--- /dev/null
+++ b/core/tests/coretests/src/android/database/DatabaseStatementTest.java
@@ -0,0 +1,324 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.database;
+
+import android.content.Context;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteConstraintException;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteDoneException;
+import android.database.sqlite.SQLiteStatement;
+import android.test.AndroidTestCase;
+import android.test.PerformanceTestCase;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.SmallTest;
+import junit.framework.TestCase;
+
+import java.io.File;
+
+public class DatabaseStatementTest extends AndroidTestCase implements PerformanceTestCase {
+
+ private static final String sString1 = "this is a test";
+ private static final String sString2 = "and yet another test";
+ private static final String sString3 = "this string is a little longer, but still a test";
+
+ private static final int CURRENT_DATABASE_VERSION = 42;
+ private SQLiteDatabase mDatabase;
+ private File mDatabaseFile;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ File dbDir = getContext().getDir("tests", Context.MODE_PRIVATE);
+ mDatabaseFile = new File(dbDir, "database_test.db");
+
+ if (mDatabaseFile.exists()) {
+ mDatabaseFile.delete();
+ }
+ mDatabase = SQLiteDatabase.openOrCreateDatabase(mDatabaseFile.getPath(), null);
+ assertNotNull(mDatabase);
+ mDatabase.setVersion(CURRENT_DATABASE_VERSION);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ mDatabase.close();
+ mDatabaseFile.delete();
+ super.tearDown();
+ }
+
+ public boolean isPerformanceOnly() {
+ return false;
+ }
+
+ // These test can only be run once.
+ public int startPerformance(Intermediates intermediates) {
+ return 1;
+ }
+
+ private void populateDefaultTable() {
+ mDatabase.execSQL("CREATE TABLE test (_id INTEGER PRIMARY KEY, data TEXT);");
+
+ mDatabase.execSQL("INSERT INTO test (data) VALUES ('" + sString1 + "');");
+ mDatabase.execSQL("INSERT INTO test (data) VALUES ('" + sString2 + "');");
+ mDatabase.execSQL("INSERT INTO test (data) VALUES ('" + sString3 + "');");
+ }
+
+ @MediumTest
+ public void testExecuteStatement() throws Exception {
+ populateDefaultTable();
+ SQLiteStatement statement = mDatabase.compileStatement("DELETE FROM test");
+ statement.execute();
+
+ Cursor c = mDatabase.query("test", null, null, null, null, null, null);
+ assertEquals(0, c.getCount());
+ c.deactivate();
+ statement.close();
+ }
+
+ @MediumTest
+ public void testSimpleQuery() throws Exception {
+ mDatabase.execSQL("CREATE TABLE test (num INTEGER NOT NULL, str TEXT NOT NULL);");
+ mDatabase.execSQL("INSERT INTO test VALUES (1234, 'hello');");
+ SQLiteStatement statement1 =
+ mDatabase.compileStatement("SELECT num FROM test WHERE str = ?");
+ SQLiteStatement statement2 =
+ mDatabase.compileStatement("SELECT str FROM test WHERE num = ?");
+
+ try {
+ statement1.bindString(1, "hello");
+ long value = statement1.simpleQueryForLong();
+ assertEquals(1234, value);
+
+ statement1.bindString(1, "world");
+ statement1.simpleQueryForLong();
+ fail("shouldn't get here");
+ } catch (SQLiteDoneException e) {
+ // expected
+ }
+
+ try {
+ statement2.bindLong(1, 1234);
+ String value = statement1.simpleQueryForString();
+ assertEquals("hello", value);
+
+ statement2.bindLong(1, 5678);
+ statement1.simpleQueryForString();
+ fail("shouldn't get here");
+ } catch (SQLiteDoneException e) {
+ // expected
+ }
+
+ statement1.close();
+ statement2.close();
+ }
+
+ @MediumTest
+ public void testStatementLongBinding() throws Exception {
+ mDatabase.execSQL("CREATE TABLE test (num INTEGER);");
+ SQLiteStatement statement = mDatabase.compileStatement("INSERT INTO test (num) VALUES (?)");
+
+ for (int i = 0; i < 10; i++) {
+ statement.bindLong(1, i);
+ statement.execute();
+ }
+ statement.close();
+
+ Cursor c = mDatabase.query("test", null, null, null, null, null, null);
+ int numCol = c.getColumnIndexOrThrow("num");
+ c.moveToFirst();
+ for (long i = 0; i < 10; i++) {
+ long num = c.getLong(numCol);
+ assertEquals(i, num);
+ c.moveToNext();
+ }
+ c.close();
+ }
+
+ @MediumTest
+ public void testStatementStringBinding() throws Exception {
+ mDatabase.execSQL("CREATE TABLE test (num TEXT);");
+ SQLiteStatement statement = mDatabase.compileStatement("INSERT INTO test (num) VALUES (?)");
+
+ for (long i = 0; i < 10; i++) {
+ statement.bindString(1, Long.toHexString(i));
+ statement.execute();
+ }
+ statement.close();
+
+ Cursor c = mDatabase.query("test", null, null, null, null, null, null);
+ int numCol = c.getColumnIndexOrThrow("num");
+ c.moveToFirst();
+ for (long i = 0; i < 10; i++) {
+ String num = c.getString(numCol);
+ assertEquals(Long.toHexString(i), num);
+ c.moveToNext();
+ }
+ c.close();
+ }
+
+ @MediumTest
+ public void testStatementClearBindings() throws Exception {
+ mDatabase.execSQL("CREATE TABLE test (num INTEGER);");
+ SQLiteStatement statement = mDatabase.compileStatement("INSERT INTO test (num) VALUES (?)");
+
+ for (long i = 0; i < 10; i++) {
+ statement.bindLong(1, i);
+ statement.clearBindings();
+ statement.execute();
+ }
+ statement.close();
+
+ Cursor c = mDatabase.query("test", null, null, null, null, null, "ROWID");
+ int numCol = c.getColumnIndexOrThrow("num");
+ assertTrue(c.moveToFirst());
+ for (long i = 0; i < 10; i++) {
+ assertTrue(c.isNull(numCol));
+ c.moveToNext();
+ }
+ c.close();
+ }
+
+ @MediumTest
+ public void testSimpleStringBinding() throws Exception {
+ mDatabase.execSQL("CREATE TABLE test (num TEXT, value TEXT);");
+ String statement = "INSERT INTO test (num, value) VALUES (?,?)";
+
+ String[] args = new String[2];
+ for (int i = 0; i < 2; i++) {
+ args[i] = Integer.toHexString(i);
+ }
+
+ mDatabase.execSQL(statement, args);
+
+ Cursor c = mDatabase.query("test", null, null, null, null, null, null);
+ int numCol = c.getColumnIndexOrThrow("num");
+ int valCol = c.getColumnIndexOrThrow("value");
+ c.moveToFirst();
+ String num = c.getString(numCol);
+ assertEquals(Integer.toHexString(0), num);
+
+ String val = c.getString(valCol);
+ assertEquals(Integer.toHexString(1), val);
+ c.close();
+ }
+
+ @MediumTest
+ public void testStatementMultipleBindings() throws Exception {
+ mDatabase.execSQL("CREATE TABLE test (num INTEGER, str TEXT);");
+ SQLiteStatement statement =
+ mDatabase.compileStatement("INSERT INTO test (num, str) VALUES (?, ?)");
+
+ for (long i = 0; i < 10; i++) {
+ statement.bindLong(1, i);
+ statement.bindString(2, Long.toHexString(i));
+ statement.execute();
+ }
+ statement.close();
+
+ Cursor c = mDatabase.query("test", null, null, null, null, null, "ROWID");
+ int numCol = c.getColumnIndexOrThrow("num");
+ int strCol = c.getColumnIndexOrThrow("str");
+ assertTrue(c.moveToFirst());
+ for (long i = 0; i < 10; i++) {
+ long num = c.getLong(numCol);
+ String str = c.getString(strCol);
+ assertEquals(i, num);
+ assertEquals(Long.toHexString(i), str);
+ c.moveToNext();
+ }
+ c.close();
+ }
+
+ private static class StatementTestThread extends Thread {
+ private SQLiteDatabase mDatabase;
+ private SQLiteStatement mStatement;
+
+ public StatementTestThread(SQLiteDatabase db, SQLiteStatement statement) {
+ super();
+ mDatabase = db;
+ mStatement = statement;
+ }
+
+ @Override
+ public void run() {
+ mDatabase.beginTransaction();
+ for (long i = 0; i < 10; i++) {
+ mStatement.bindLong(1, i);
+ mStatement.bindString(2, Long.toHexString(i));
+ mStatement.execute();
+ }
+ mDatabase.setTransactionSuccessful();
+ mDatabase.endTransaction();
+
+ Cursor c = mDatabase.query("test", null, null, null, null, null, "ROWID");
+ int numCol = c.getColumnIndexOrThrow("num");
+ int strCol = c.getColumnIndexOrThrow("str");
+ assertTrue(c.moveToFirst());
+ for (long i = 0; i < 10; i++) {
+ long num = c.getLong(numCol);
+ String str = c.getString(strCol);
+ assertEquals(i, num);
+ assertEquals(Long.toHexString(i), str);
+ c.moveToNext();
+ }
+ c.close();
+ }
+ }
+
+ @MediumTest
+ public void testStatementMultiThreaded() throws Exception {
+ mDatabase.execSQL("CREATE TABLE test (num INTEGER, str TEXT);");
+ SQLiteStatement statement =
+ mDatabase.compileStatement("INSERT INTO test (num, str) VALUES (?, ?)");
+
+ StatementTestThread thread = new StatementTestThread(mDatabase, statement);
+ thread.start();
+ try {
+ thread.join();
+ } finally {
+ statement.close();
+ }
+ }
+
+ @MediumTest
+ public void testStatementConstraint() throws Exception {
+ mDatabase.execSQL("CREATE TABLE test (num INTEGER NOT NULL);");
+ SQLiteStatement statement = mDatabase.compileStatement("INSERT INTO test (num) VALUES (?)");
+
+ // Try to insert NULL, which violates the constraint
+ try {
+ statement.clearBindings();
+ statement.execute();
+ fail("expected exception not thrown");
+ } catch (SQLiteConstraintException e) {
+ // expected
+ }
+
+ // Make sure the statement can still be used
+ statement.bindLong(1, 1);
+ statement.execute();
+ statement.close();
+
+ Cursor c = mDatabase.query("test", null, null, null, null, null, null);
+ int numCol = c.getColumnIndexOrThrow("num");
+ c.moveToFirst();
+ long num = c.getLong(numCol);
+ assertEquals(1, num);
+ c.close();
+ }
+}
diff --git a/tests/AndroidTests/src/com/android/unit_tests/DatabaseStressTest.java b/core/tests/coretests/src/android/database/DatabaseStressTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/DatabaseStressTest.java
rename to core/tests/coretests/src/android/database/DatabaseStressTest.java
index b110125..30e46e7 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/DatabaseStressTest.java
+++ b/core/tests/coretests/src/android/database/DatabaseStressTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.database;
import android.content.Context;
import android.database.sqlite.*;
diff --git a/core/tests/coretests/src/android/database/sqlite/SQLiteDebugTest.java b/core/tests/coretests/src/android/database/sqlite/SQLiteDebugTest.java
new file mode 100644
index 0000000..ea807bd
--- /dev/null
+++ b/core/tests/coretests/src/android/database/sqlite/SQLiteDebugTest.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.database.sqlite;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for the SQLiteDebug
+ */
+public class SQLiteDebugTest extends TestCase {
+ private static final String TEST_DB = "test.db";
+
+ public void testCaptureSql() {
+ String rslt = SQLiteDebug.captureSql(TEST_DB, "select * from t1 where a=? and b=1",
+ new Object[] {"blah"});
+ String expectedVal = "select * from t1 where a='blah' and b=1";
+ assertTrue(rslt.equals("captured_sql|" + TEST_DB + "|" + expectedVal));
+
+ rslt = SQLiteDebug.captureSql(TEST_DB, "select * from t1 where a=?",
+ new Object[] {"blah"});
+ expectedVal = "select * from t1 where a='blah'";
+ assertTrue(rslt.equals("captured_sql|" + TEST_DB + "|" + expectedVal));
+
+ rslt = SQLiteDebug.captureSql(TEST_DB, "select * from t1 where a=1",
+ new Object[] {"blah"});
+ assertTrue(rslt.startsWith("too many bindArgs provided."));
+
+ rslt = SQLiteDebug.captureSql(TEST_DB, "update t1 set a=? where b=?",
+ new Object[] {"blah", "foo"});
+ expectedVal = "update t1 set a='blah' where b='foo'";
+ assertTrue(rslt.equals("captured_sql|" + TEST_DB + "|" + expectedVal));
+ }
+}
diff --git a/tests/AndroidTests/src/com/android/unit_tests/LocalSocketTest.java b/core/tests/coretests/src/android/net/LocalSocketTest.java
similarity index 95%
rename from tests/AndroidTests/src/com/android/unit_tests/LocalSocketTest.java
rename to core/tests/coretests/src/android/net/LocalSocketTest.java
index 0b8ec74..1349844 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/LocalSocketTest.java
+++ b/core/tests/coretests/src/android/net/LocalSocketTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.net;
import android.net.Credentials;
import android.net.LocalServerSocket;
@@ -35,11 +35,11 @@
LocalSocket ls;
LocalSocket ls1;
- ss = new LocalServerSocket("com.android.unit_tests.LocalSocketTest");
+ ss = new LocalServerSocket("android.net.LocalSocketTest");
ls = new LocalSocket();
- ls.connect(new LocalSocketAddress("com.android.unit_tests.LocalSocketTest"));
+ ls.connect(new LocalSocketAddress("android.net.LocalSocketTest"));
ls1 = ss.accept();
diff --git a/tests/AndroidTests/src/com/android/unit_tests/SSLTest.java b/core/tests/coretests/src/android/net/SSLTest.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/SSLTest.java
rename to core/tests/coretests/src/android/net/SSLTest.java
index 9481180..810ed0d 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/SSLTest.java
+++ b/core/tests/coretests/src/android/net/SSLTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.net;
import android.net.SSLCertificateSocketFactory;
import android.test.suitebuilder.annotation.Suppress;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/UriMatcherTest.java b/core/tests/coretests/src/android/net/UriMatcherTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/UriMatcherTest.java
rename to core/tests/coretests/src/android/net/UriMatcherTest.java
index ce3ea75..2872144 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/UriMatcherTest.java
+++ b/core/tests/coretests/src/android/net/UriMatcherTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.net;
import android.content.UriMatcher;
import android.net.Uri;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/UriTest.java b/core/tests/coretests/src/android/net/UriTest.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/UriTest.java
rename to core/tests/coretests/src/android/net/UriTest.java
index 42066d9..ad71fcb 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/UriTest.java
+++ b/core/tests/coretests/src/android/net/UriTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.net;
import android.net.Uri;
import android.content.ContentUris;
@@ -52,15 +52,20 @@
private void parcelAndUnparcel(Uri u) {
Parcel p = Parcel.obtain();
- Uri.writeToParcel(p, u);
- p.setDataPosition(0);
- assertEquals(u, Uri.CREATOR.createFromParcel(p));
+ try {
+ Uri.writeToParcel(p, u);
+ p.setDataPosition(0);
+ assertEquals(u, Uri.CREATOR.createFromParcel(p));
- p.setDataPosition(0);
- u = u.buildUpon().build();
- Uri.writeToParcel(p, u);
- p.setDataPosition(0);
- assertEquals(u, Uri.CREATOR.createFromParcel(p));
+ p.setDataPosition(0);
+ u = u.buildUpon().build();
+ Uri.writeToParcel(p, u);
+ p.setDataPosition(0);
+ assertEquals(u, Uri.CREATOR.createFromParcel(p));
+ }
+ finally {
+ p.recycle();
+ }
}
@SmallTest
diff --git a/tests/AndroidTests/src/com/android/unit_tests/os/AidlTest.aidl b/core/tests/coretests/src/android/os/AidlTest.aidl
similarity index 94%
rename from tests/AndroidTests/src/com/android/unit_tests/os/AidlTest.aidl
rename to core/tests/coretests/src/android/os/AidlTest.aidl
index 62c75a5..6004f4b 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/os/AidlTest.aidl
+++ b/core/tests/coretests/src/android/os/AidlTest.aidl
@@ -15,6 +15,6 @@
** limitations under the License.
*/
-package com.android.unit_tests.os;
+package android.os;
parcelable AidlTest.TestParcelable;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/os/AidlTest.java b/core/tests/coretests/src/android/os/AidlTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/os/AidlTest.java
rename to core/tests/coretests/src/android/os/AidlTest.java
index 52e666d..bf11d56 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/os/AidlTest.java
+++ b/core/tests/coretests/src/android/os/AidlTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.os;
+package android.os;
import android.os.IInterface;
import android.os.Parcel;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/os/BroadcasterTest.java b/core/tests/coretests/src/android/os/BroadcasterTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/os/BroadcasterTest.java
rename to core/tests/coretests/src/android/os/BroadcasterTest.java
index 0df1653..551ea8d 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/os/BroadcasterTest.java
+++ b/core/tests/coretests/src/android/os/BroadcasterTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.os;
+package android.os;
import android.os.Broadcaster;
import android.os.Handler;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/BuildTest.java b/core/tests/coretests/src/android/os/BuildTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/BuildTest.java
rename to core/tests/coretests/src/android/os/BuildTest.java
index 88fa3cc..3758627 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/BuildTest.java
+++ b/core/tests/coretests/src/android/os/BuildTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.os;
import android.os.Build;
import android.test.suitebuilder.annotation.SmallTest;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/os/FileObserverTest.java b/core/tests/coretests/src/android/os/FileObserverTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/os/FileObserverTest.java
rename to core/tests/coretests/src/android/os/FileObserverTest.java
index a9be5bd..ca4e0d6 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/os/FileObserverTest.java
+++ b/core/tests/coretests/src/android/os/FileObserverTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.os;
+package android.os;
import com.google.android.collect.Lists;
import com.google.android.collect.Maps;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/os/FileUtilsTest.java b/core/tests/coretests/src/android/os/FileUtilsTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/os/FileUtilsTest.java
rename to core/tests/coretests/src/android/os/FileUtilsTest.java
index f2c9293..f12cbe1 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/os/FileUtilsTest.java
+++ b/core/tests/coretests/src/android/os/FileUtilsTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.os;
+package android.os;
import android.content.Context;
import android.os.FileUtils;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/os/HandlerTester.java b/core/tests/coretests/src/android/os/HandlerTester.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/os/HandlerTester.java
rename to core/tests/coretests/src/android/os/HandlerTester.java
index 303245f..a216a0b 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/os/HandlerTester.java
+++ b/core/tests/coretests/src/android/os/HandlerTester.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.os;
+package android.os;
import android.os.Handler;
import android.os.Looper;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/os/HandlerThreadTest.java b/core/tests/coretests/src/android/os/HandlerThreadTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/os/HandlerThreadTest.java
rename to core/tests/coretests/src/android/os/HandlerThreadTest.java
index f2025c6..9772aa4 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/os/HandlerThreadTest.java
+++ b/core/tests/coretests/src/android/os/HandlerThreadTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.os;
+package android.os;
import junit.framework.TestCase;
import android.os.Handler;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/os/HierarchicalStateMachineTest.java b/core/tests/coretests/src/android/os/HierarchicalStateMachineTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/os/HierarchicalStateMachineTest.java
rename to core/tests/coretests/src/android/os/HierarchicalStateMachineTest.java
index c5ca5a7..6e50c7e 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/os/HierarchicalStateMachineTest.java
+++ b/core/tests/coretests/src/android/os/HierarchicalStateMachineTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.os;
+package android.os;
import junit.framework.TestCase;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/os/IAidlTest.aidl b/core/tests/coretests/src/android/os/IAidlTest.aidl
similarity index 95%
rename from tests/AndroidTests/src/com/android/unit_tests/os/IAidlTest.aidl
rename to core/tests/coretests/src/android/os/IAidlTest.aidl
index 94c39ff..a09022e 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/os/IAidlTest.aidl
+++ b/core/tests/coretests/src/android/os/IAidlTest.aidl
@@ -15,9 +15,9 @@
** limitations under the License.
*/
-package com.android.unit_tests.os;
+package android.os;
-import com.android.unit_tests.os.AidlTest;
+import android.os.AidlTest;
interface IAidlTest {
int intMethod(int a);
diff --git a/tests/AndroidTests/src/com/android/unit_tests/os/IdleHandlerTest.java b/core/tests/coretests/src/android/os/IdleHandlerTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/os/IdleHandlerTest.java
rename to core/tests/coretests/src/android/os/IdleHandlerTest.java
index fc3b007..6c0a862 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/os/IdleHandlerTest.java
+++ b/core/tests/coretests/src/android/os/IdleHandlerTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.os;
+package android.os;
import android.os.Handler;
import android.os.Looper;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/os/MemoryFileTest.java b/core/tests/coretests/src/android/os/MemoryFileTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/os/MemoryFileTest.java
rename to core/tests/coretests/src/android/os/MemoryFileTest.java
index 18b3d63..411bdaa 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/os/MemoryFileTest.java
+++ b/core/tests/coretests/src/android/os/MemoryFileTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.os;
+package android.os;
import android.os.MemoryFile;
import android.test.AndroidTestCase;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/os/MessageQueueTest.java b/core/tests/coretests/src/android/os/MessageQueueTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/os/MessageQueueTest.java
rename to core/tests/coretests/src/android/os/MessageQueueTest.java
index 155a247..b7c2d1f 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/os/MessageQueueTest.java
+++ b/core/tests/coretests/src/android/os/MessageQueueTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.os;
+package android.os;
import android.os.Handler;
import android.os.Message;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/os/MessengerService.java b/core/tests/coretests/src/android/os/MessengerService.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/os/MessengerService.java
rename to core/tests/coretests/src/android/os/MessengerService.java
index 9228a43f..f15e134 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/os/MessengerService.java
+++ b/core/tests/coretests/src/android/os/MessengerService.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.os;
+package android.os;
import android.app.Service;
import android.content.Intent;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/os/MessengerTest.java b/core/tests/coretests/src/android/os/MessengerTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/os/MessengerTest.java
rename to core/tests/coretests/src/android/os/MessengerTest.java
index 2a3e204d..473ffe2 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/os/MessengerTest.java
+++ b/core/tests/coretests/src/android/os/MessengerTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.os;
+package android.os;
import android.content.ComponentName;
import android.content.Context;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/os/OsTests.java b/core/tests/coretests/src/android/os/OsTests.java
similarity index 89%
rename from tests/AndroidTests/src/com/android/unit_tests/os/OsTests.java
rename to core/tests/coretests/src/android/os/OsTests.java
index bf02509..582bf1a 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/os/OsTests.java
+++ b/core/tests/coretests/src/android/os/OsTests.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.os;
+package android.os;
import com.google.android.collect.Lists;
import junit.framework.TestSuite;
@@ -30,10 +30,8 @@
suite.addTestSuite(BroadcasterTest.class);
suite.addTestSuite(FileObserverTest.class);
suite.addTestSuite(IdleHandlerTest.class);
- suite.addTestSuite(MemoryFileTest.class);
suite.addTestSuite(MessageQueueTest.class);
suite.addTestSuite(MessengerTest.class);
- suite.addTestSuite(PowerManagerTest.class);
suite.addTestSuite(SystemPropertiesTest.class);
return suite;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/os/PerformanceCollectorTest.java b/core/tests/coretests/src/android/os/PerformanceCollectorTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/os/PerformanceCollectorTest.java
rename to core/tests/coretests/src/android/os/PerformanceCollectorTest.java
index 25b6e0e..a382239 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/os/PerformanceCollectorTest.java
+++ b/core/tests/coretests/src/android/os/PerformanceCollectorTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.os;
+package android.os;
import android.os.Bundle;
import android.os.Parcelable;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/os/PowerManagerTest.java b/core/tests/coretests/src/android/os/PowerManagerTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/os/PowerManagerTest.java
rename to core/tests/coretests/src/android/os/PowerManagerTest.java
index 2f1a7389..e089b3e 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/os/PowerManagerTest.java
+++ b/core/tests/coretests/src/android/os/PowerManagerTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.os;
+package android.os;
import android.content.Context;
import android.os.PowerManager;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/os/SystemPropertiesTest.java b/core/tests/coretests/src/android/os/SystemPropertiesTest.java
similarity index 93%
rename from tests/AndroidTests/src/com/android/unit_tests/os/SystemPropertiesTest.java
rename to core/tests/coretests/src/android/os/SystemPropertiesTest.java
index df08bb9..25868ce 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/os/SystemPropertiesTest.java
+++ b/core/tests/coretests/src/android/os/SystemPropertiesTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.os;
+package android.os;
import static junit.framework.Assert.assertEquals;
import junit.framework.TestCase;
@@ -23,7 +23,7 @@
import android.test.suitebuilder.annotation.SmallTest;
public class SystemPropertiesTest extends TestCase {
- private static final String KEY = "com.android.unit_tests";
+ private static final String KEY = "com.android.frameworks.coretests";
@SmallTest
public void testProperties() throws Exception {
if (false) {
diff --git a/tests/AndroidTests/src/com/android/unit_tests/os/TestHandlerThread.java b/core/tests/coretests/src/android/os/TestHandlerThread.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/os/TestHandlerThread.java
rename to core/tests/coretests/src/android/os/TestHandlerThread.java
index dba8dde..7e84af3 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/os/TestHandlerThread.java
+++ b/core/tests/coretests/src/android/os/TestHandlerThread.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.os;
+package android.os;
import android.os.Handler;
import android.os.Looper;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/TraceTest.java b/core/tests/coretests/src/android/os/TraceTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/TraceTest.java
rename to core/tests/coretests/src/android/os/TraceTest.java
index 6705080..7a788ee 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/TraceTest.java
+++ b/core/tests/coretests/src/android/os/TraceTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.os;
import android.os.Debug;
import android.test.AndroidTestCase;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/ContentValuesBuilder.java b/core/tests/coretests/src/android/pim/vcard/ContentValuesBuilder.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/vcard/ContentValuesBuilder.java
rename to core/tests/coretests/src/android/pim/vcard/ContentValuesBuilder.java
index e99e4cb..b3c0773 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/ContentValuesBuilder.java
+++ b/core/tests/coretests/src/android/pim/vcard/ContentValuesBuilder.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.vcard;
+package android.pim.vcard;
import android.content.ContentValues;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/ContentValuesVerifier.java b/core/tests/coretests/src/android/pim/vcard/ContentValuesVerifier.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/vcard/ContentValuesVerifier.java
rename to core/tests/coretests/src/android/pim/vcard/ContentValuesVerifier.java
index 3fa6ae6..b9e9875 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/ContentValuesVerifier.java
+++ b/core/tests/coretests/src/android/pim/vcard/ContentValuesVerifier.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.unit_tests.vcard;
+package android.pim.vcard;
import android.pim.vcard.VCardConfig;
import android.pim.vcard.VCardEntry;
@@ -98,4 +98,4 @@
elem.verifyResolver();
}
}
-}
\ No newline at end of file
+}
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/ContentValuesVerifierElem.java b/core/tests/coretests/src/android/pim/vcard/ContentValuesVerifierElem.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/vcard/ContentValuesVerifierElem.java
rename to core/tests/coretests/src/android/pim/vcard/ContentValuesVerifierElem.java
index f511217..2edbb36 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/ContentValuesVerifierElem.java
+++ b/core/tests/coretests/src/android/pim/vcard/ContentValuesVerifierElem.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.unit_tests.vcard;
+package android.pim.vcard;
import android.content.ContentValues;
import android.pim.vcard.VCardConfig;
@@ -92,4 +92,4 @@
public void onParsingEnd() {
mHandler.onEnd();
}
-}
\ No newline at end of file
+}
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/ExportTestResolver.java b/core/tests/coretests/src/android/pim/vcard/ExportTestResolver.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/vcard/ExportTestResolver.java
rename to core/tests/coretests/src/android/pim/vcard/ExportTestResolver.java
index a76dfd8..1b3cdcc 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/ExportTestResolver.java
+++ b/core/tests/coretests/src/android/pim/vcard/ExportTestResolver.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.android.unit_tests.vcard;
+package android.pim.vcard;
import android.content.ContentResolver;
import android.content.ContentValues;
@@ -210,4 +210,4 @@
}
};
}
-}
\ No newline at end of file
+}
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/ImportTestResolver.java b/core/tests/coretests/src/android/pim/vcard/ImportTestResolver.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/vcard/ImportTestResolver.java
rename to core/tests/coretests/src/android/pim/vcard/ImportTestResolver.java
index a1e9d75..019b9e3 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/ImportTestResolver.java
+++ b/core/tests/coretests/src/android/pim/vcard/ImportTestResolver.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.unit_tests.vcard;
+package android.pim.vcard;
import android.content.ContentProviderOperation;
import android.content.ContentProviderResult;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/LineVerifier.java b/core/tests/coretests/src/android/pim/vcard/LineVerifier.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/vcard/LineVerifier.java
rename to core/tests/coretests/src/android/pim/vcard/LineVerifier.java
index 27b95a6..cef15fd7 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/LineVerifier.java
+++ b/core/tests/coretests/src/android/pim/vcard/LineVerifier.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.unit_tests.vcard;
+package android.pim.vcard;
import android.content.Context;
import android.pim.vcard.VCardComposer;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/LineVerifierElem.java b/core/tests/coretests/src/android/pim/vcard/LineVerifierElem.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/vcard/LineVerifierElem.java
rename to core/tests/coretests/src/android/pim/vcard/LineVerifierElem.java
index fc478afcf..b23b29b 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/LineVerifierElem.java
+++ b/core/tests/coretests/src/android/pim/vcard/LineVerifierElem.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.android.unit_tests.vcard;
+package android.pim.vcard;
import android.pim.vcard.VCardConfig;
import android.text.TextUtils;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/PropertyNode.java b/core/tests/coretests/src/android/pim/vcard/PropertyNode.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/vcard/PropertyNode.java
rename to core/tests/coretests/src/android/pim/vcard/PropertyNode.java
index 14a789a..2c1f6d2 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/PropertyNode.java
+++ b/core/tests/coretests/src/android/pim/vcard/PropertyNode.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.unit_tests.vcard;
+package android.pim.vcard;
import android.content.ContentValues;
import android.pim.vcard.VCardEntry;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/PropertyNodesVerifier.java b/core/tests/coretests/src/android/pim/vcard/PropertyNodesVerifier.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/vcard/PropertyNodesVerifier.java
rename to core/tests/coretests/src/android/pim/vcard/PropertyNodesVerifier.java
index 0afad49..cfdd074 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/PropertyNodesVerifier.java
+++ b/core/tests/coretests/src/android/pim/vcard/PropertyNodesVerifier.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.unit_tests.vcard;
+package android.pim.vcard;
import android.content.ContentValues;
import android.pim.vcard.VCardConfig;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardExporterTests.java b/core/tests/coretests/src/android/pim/vcard/VCardExporterTests.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/vcard/VCardExporterTests.java
rename to core/tests/coretests/src/android/pim/vcard/VCardExporterTests.java
index e744a92..004a197 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardExporterTests.java
+++ b/core/tests/coretests/src/android/pim/vcard/VCardExporterTests.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.vcard;
+package android.pim.vcard;
import android.content.ContentValues;
import android.pim.vcard.VCardConfig;
@@ -31,7 +31,7 @@
import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
import android.provider.ContactsContract.CommonDataKinds.Website;
-import com.android.unit_tests.vcard.PropertyNodesVerifierElem.TypeSet;
+import android.pim.vcard.PropertyNodesVerifierElem.TypeSet;
import java.util.Arrays;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardImporterTests.java b/core/tests/coretests/src/android/pim/vcard/VCardImporterTests.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/vcard/VCardImporterTests.java
rename to core/tests/coretests/src/android/pim/vcard/VCardImporterTests.java
index 45d3e3c..21f2254 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardImporterTests.java
+++ b/core/tests/coretests/src/android/pim/vcard/VCardImporterTests.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.unit_tests.vcard;
+package android.pim.vcard;
import android.content.ContentValues;
import android.pim.vcard.VCardConfig;
@@ -28,8 +28,8 @@
import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
import android.provider.ContactsContract.CommonDataKinds.Website;
-import com.android.unit_tests.R;
-import com.android.unit_tests.vcard.PropertyNodesVerifierElem.TypeSet;
+import com.android.frameworks.coretests.R;
+import android.pim.vcard.PropertyNodesVerifierElem.TypeSet;
import java.util.Arrays;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardJapanizationTests.java b/core/tests/coretests/src/android/pim/vcard/VCardJapanizationTests.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/vcard/VCardJapanizationTests.java
rename to core/tests/coretests/src/android/pim/vcard/VCardJapanizationTests.java
index eea98c6..5b60342 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardJapanizationTests.java
+++ b/core/tests/coretests/src/android/pim/vcard/VCardJapanizationTests.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.vcard;
+package android.pim.vcard;
import android.content.ContentValues;
import android.pim.vcard.VCardConfig;
@@ -24,7 +24,7 @@
import android.provider.ContactsContract.CommonDataKinds.StructuredName;
import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
-import com.android.unit_tests.vcard.PropertyNodesVerifierElem.TypeSet;
+import android.pim.vcard.PropertyNodesVerifierElem.TypeSet;
import java.util.Arrays;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardTestsBase.java b/core/tests/coretests/src/android/pim/vcard/VCardTestsBase.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/vcard/VCardTestsBase.java
rename to core/tests/coretests/src/android/pim/vcard/VCardTestsBase.java
index 2382b42..0857e0c 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardTestsBase.java
+++ b/core/tests/coretests/src/android/pim/vcard/VCardTestsBase.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.vcard;
+package android.pim.vcard;
import android.content.ContentProvider;
import android.content.ContentProviderOperation;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardUtilsTests.java b/core/tests/coretests/src/android/pim/vcard/VCardUtilsTests.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/vcard/VCardUtilsTests.java
rename to core/tests/coretests/src/android/pim/vcard/VCardUtilsTests.java
index 9f173af..59299f9 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardUtilsTests.java
+++ b/core/tests/coretests/src/android/pim/vcard/VCardUtilsTests.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.vcard;
+package android.pim.vcard;
import android.pim.vcard.VCardUtils;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardVerifier.java b/core/tests/coretests/src/android/pim/vcard/VCardVerifier.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/vcard/VCardVerifier.java
rename to core/tests/coretests/src/android/pim/vcard/VCardVerifier.java
index 4b97750..bfc3158 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardVerifier.java
+++ b/core/tests/coretests/src/android/pim/vcard/VCardVerifier.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.android.unit_tests.vcard;
+package android.pim.vcard;
import android.content.ContentProvider;
import android.content.ContentResolver;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/VNode.java b/core/tests/coretests/src/android/pim/vcard/VNode.java
similarity index 95%
rename from tests/AndroidTests/src/com/android/unit_tests/vcard/VNode.java
rename to core/tests/coretests/src/android/pim/vcard/VNode.java
index 7587320..79f10dc 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/VNode.java
+++ b/core/tests/coretests/src/android/pim/vcard/VNode.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.unit_tests.vcard;
+package android.pim.vcard;
import java.util.ArrayList;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/VNodeBuilder.java b/core/tests/coretests/src/android/pim/vcard/VNodeBuilder.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/vcard/VNodeBuilder.java
rename to core/tests/coretests/src/android/pim/vcard/VNodeBuilder.java
index 971fe0d..0e6c325 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/VNodeBuilder.java
+++ b/core/tests/coretests/src/android/pim/vcard/VNodeBuilder.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.unit_tests.vcard;
+package android.pim.vcard;
import android.content.ContentValues;
import android.pim.vcard.VCardInterpreter;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/SettingsProviderTest.java b/core/tests/coretests/src/android/provider/SettingsProviderTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/SettingsProviderTest.java
rename to core/tests/coretests/src/android/provider/SettingsProviderTest.java
index 7d828ec..f82d79a 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/SettingsProviderTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsProviderTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.provider;
import android.content.ContentResolver;
import android.content.ContentUris;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/SmsProviderTest.java b/core/tests/coretests/src/android/provider/SmsProviderTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/SmsProviderTest.java
rename to core/tests/coretests/src/android/provider/SmsProviderTest.java
index 0e2f0c5..c8ed728 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/SmsProviderTest.java
+++ b/core/tests/coretests/src/android/provider/SmsProviderTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.provider;
import android.content.ContentResolver;
import android.content.ContentValues;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/SpannedTest.java b/core/tests/coretests/src/android/text/SpannedTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/SpannedTest.java
rename to core/tests/coretests/src/android/text/SpannedTest.java
index 9e3f483..1c22cf9 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/SpannedTest.java
+++ b/core/tests/coretests/src/android/text/SpannedTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.text;
import android.graphics.Typeface;
import android.os.Parcel;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/TextLayoutTest.java b/core/tests/coretests/src/android/text/TextLayoutTest.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/TextLayoutTest.java
rename to core/tests/coretests/src/android/text/TextLayoutTest.java
index 8cfcd5e..6cf3000 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/TextLayoutTest.java
+++ b/core/tests/coretests/src/android/text/TextLayoutTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.text;
import android.test.suitebuilder.annotation.SmallTest;
import android.text.DynamicLayout;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/TextUtilsTest.java b/core/tests/coretests/src/android/text/TextUtilsTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/TextUtilsTest.java
rename to core/tests/coretests/src/android/text/TextUtilsTest.java
index b194896..5b427be 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/TextUtilsTest.java
+++ b/core/tests/coretests/src/android/text/TextUtilsTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.text;
import android.graphics.Paint;
import android.test.suitebuilder.annotation.LargeTest;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/TimeTest.java b/core/tests/coretests/src/android/text/format/TimeTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/TimeTest.java
rename to core/tests/coretests/src/android/text/format/TimeTest.java
index 724ef6a..489f58b 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/TimeTest.java
+++ b/core/tests/coretests/src/android/text/format/TimeTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.text.format;
import android.test.suitebuilder.annotation.SmallTest;
import android.test.suitebuilder.annotation.Suppress;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/LogTest.java b/core/tests/coretests/src/android/util/LogTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/LogTest.java
rename to core/tests/coretests/src/android/util/LogTest.java
index 786c4b9..41947d7 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/LogTest.java
+++ b/core/tests/coretests/src/android/util/LogTest.java
@@ -1,4 +1,4 @@
-package com.android.unit_tests;
+package android.util;
import junit.framework.Assert;
import junit.framework.TestCase;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/TimeUtilsTest.java b/core/tests/coretests/src/android/util/TimeUtilsTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/TimeUtilsTest.java
rename to core/tests/coretests/src/android/util/TimeUtilsTest.java
index 6ba64fd..65a6078 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/TimeUtilsTest.java
+++ b/core/tests/coretests/src/android/util/TimeUtilsTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.util;
import junit.framework.TestCase;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/CreateViewTest.java b/core/tests/coretests/src/android/view/CreateViewTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/CreateViewTest.java
rename to core/tests/coretests/src/android/view/CreateViewTest.java
index 0c57ac4..16656f6 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/CreateViewTest.java
+++ b/core/tests/coretests/src/android/view/CreateViewTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.view;
import android.content.Context;
import android.test.AndroidTestCase;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/InflateTest.java b/core/tests/coretests/src/android/view/InflateTest.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/InflateTest.java
rename to core/tests/coretests/src/android/view/InflateTest.java
index d7c9d60..cb4f8e2 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/InflateTest.java
+++ b/core/tests/coretests/src/android/view/InflateTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.view;
import android.content.Context;
import android.content.res.Resources;
@@ -24,6 +24,7 @@
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
+import com.android.frameworks.coretests.R;
import java.util.Map;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/MenuTest.java b/core/tests/coretests/src/android/view/MenuTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/MenuTest.java
rename to core/tests/coretests/src/android/view/MenuTest.java
index c436726..e8a8438 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/MenuTest.java
+++ b/core/tests/coretests/src/android/view/MenuTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.view;
import com.android.internal.view.menu.MenuBuilder;
@@ -29,6 +29,8 @@
import android.view.MenuItem;
import android.view.SubMenu;
+import com.android.frameworks.coretests.R;
+
public class MenuTest extends AndroidTestCase {
private MenuBuilder mMenu;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/WebkitTest.java b/core/tests/coretests/src/android/webkit/WebkitTest.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/WebkitTest.java
rename to core/tests/coretests/src/android/webkit/WebkitTest.java
index 4a0519e..17b4088 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/WebkitTest.java
+++ b/core/tests/coretests/src/android/webkit/WebkitTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.webkit;
import android.test.AndroidTestCase;
import android.text.format.DateFormat;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/LabelView.java b/core/tests/coretests/src/android/widget/LabelView.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/LabelView.java
rename to core/tests/coretests/src/android/widget/LabelView.java
index ac29776..4661c01 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/LabelView.java
+++ b/core/tests/coretests/src/android/widget/LabelView.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.widget;
import android.content.Context;
import android.graphics.Canvas;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/TextViewPerformanceTest.java b/core/tests/coretests/src/android/widget/TextViewPerformanceTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/TextViewPerformanceTest.java
rename to core/tests/coretests/src/android/widget/TextViewPerformanceTest.java
index 6fa8f4f..c25df7c 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/TextViewPerformanceTest.java
+++ b/core/tests/coretests/src/android/widget/TextViewPerformanceTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.widget;
import android.content.Context;
import android.graphics.Bitmap;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/TextViewTest.java b/core/tests/coretests/src/android/widget/TextViewTest.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/TextViewTest.java
rename to core/tests/coretests/src/android/widget/TextViewTest.java
index 8e49118..d8d145c 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/TextViewTest.java
+++ b/core/tests/coretests/src/android/widget/TextViewTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.widget;
import com.google.android.collect.Lists;
import com.google.android.collect.Maps;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/BitwiseStreamsTest.java b/core/tests/coretests/src/com/android/internal/util/BitwiseStreamsTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/BitwiseStreamsTest.java
rename to core/tests/coretests/src/com/android/internal/util/BitwiseStreamsTest.java
index c5562b3..a304b68 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/BitwiseStreamsTest.java
+++ b/core/tests/coretests/src/com/android/internal/util/BitwiseStreamsTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package com.android.internal.util;
import com.android.internal.util.BitwiseInputStream;
import com.android.internal.util.BitwiseOutputStream;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/CharSequencesTest.java b/core/tests/coretests/src/com/android/internal/util/CharSequencesTest.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/CharSequencesTest.java
rename to core/tests/coretests/src/com/android/internal/util/CharSequencesTest.java
index 092f309..55d186c 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/CharSequencesTest.java
+++ b/core/tests/coretests/src/com/android/internal/util/CharSequencesTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package com.android.internal.util;
import com.android.internal.util.CharSequences;
import static com.android.internal.util.CharSequences.forAsciiBytes;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/ParentalControlTest.java b/core/tests/coretests/src/com/google/android/net/ParentalControlTest.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/ParentalControlTest.java
rename to core/tests/coretests/src/com/google/android/net/ParentalControlTest.java
index d4d2a82..d8ffeab 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/ParentalControlTest.java
+++ b/core/tests/coretests/src/com/google/android/net/ParentalControlTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package com.google.android.net;
import com.google.android.net.ParentalControl;
import com.google.android.net.ParentalControlState;
diff --git a/docs/html/guide/developing/debug-tasks.jd b/docs/html/guide/developing/debug-tasks.jd
index a980efc..500ef58 100644
--- a/docs/html/guide/developing/debug-tasks.jd
+++ b/docs/html/guide/developing/debug-tasks.jd
@@ -58,8 +58,8 @@
<pre class="no-pretty-print">
I/MyActivity( 1557): MyClass.getView() — get item number 1
</pre>
- <p>Logcat is also the place to look when debugging a web page in the Android browser. All
-browser bugs will be output to logcat with the {@code WebCore} tag.
+ <p>Logcat is also the place to look when debugging a web page in the Android Browser app. See
+<a href="#DebuggingWebPages">Debugging Web Pages</a> below.</p>
</dl>
<p>For more information about all the development tools provided with the Android SDK, see the <a
@@ -148,10 +148,10 @@
<h2 id="DebuggingWebPages">Debugging Web Pages</h2>
-<p>If you're developing a web application for Android devices, you can debug your JavaScript on
-Android using the Console APIs, which will output messages to logcat. If you're familiar
+<p>If you're developing a web application for Android devices, you can debug your JavaScript in the
+Android Browser using the Console APIs, which will output messages to logcat. If you're familiar
debugging web pages with Firefox's FireBug or WebKit's Web Inspector, then you're probably familiar
-with the Console APIs. The Android Browser (and {@link android.webkit.WebChromeClient}) supports
+with the Console APIs. The Android Browser (and the {@link android.webkit.WebChromeClient}) supports
most of the same APIs.</p>
<p>When you call a function from the Console APIs (in the DOM's {@code window.console} object),
@@ -162,19 +162,28 @@
</pre>
<p>Then the logcat output from the Android Browser will look like this:</p>
<pre class="no-pretty-print">
-W/browser ( 202): Console: Hello World :0
+W/browser ( 202): Console: Hello World http://www.example.com/hello.html :82
</pre>
-<p class="note"><strong>Note:</strong> All Console messages from the Android
-Browser are tagged with the name "browser" on Android platforms running API Level 7 or higher and
-tagged with the name "WebCore" for platforms running API Level 6 or lower.</p>
+<p>All Console messages from the Android Browser are tagged with the name "browser" on Android
+platforms running API Level 7 or higher. On platforms running API Level 6 or lower, Browser
+messages are tagged with the name "WebCore". The Android Browser also formats console messages
+with the log message
+preceded by "Console:" and then followed by the address and line number where the
+message occurred. (The format for the address and line number will appear different from the example
+above on platforms running API Level 6 or lower.)</p>
-<p>Not all of the Console APIs available in Firefox or other WebKit browsers are implemented
-on Android. Mostly, you need to depend on basic text logging provided by
-functions like {@code console.log(String)}, {@code console.info(String)}, {@code
-console.warn(String)}, and {@code console.error(String)}. Although other Console functions may not
-be implemented, they will not raise run-time errors, but will simply not behave as you might
-expect.</p>
+<p>The Android Browser (and {@link android.webkit.WebChromeClient}) does not implement all of the
+Console APIs provided by Firefox or other WebKit-based browsers. Primarily, you need to depend
+on the basic text logging functions:</p>
+<ul>
+ <li>{@code console.log(String)}</li>
+ <li>{@code console.info(String)}</li>
+ <li>{@code console.warn(String)}</li>
+ <li>{@code console.error(String)}</li>
+</ul>
+<p>Although the Android Browser may not fully implement other Console functions, they will not raise
+run-time errors, but may not behave the same as they do on other desktop browsers.</p>
<p>If you've implemented a custom {@link android.webkit.WebView} in your application, then in order
to receive messages that are sent through the Console APIs, you must provide a {@link
@@ -185,7 +194,7 @@
<pre>
myWebView.setWebChromeClient(new WebChromeClient() {
public void onConsoleMessage(String message, int lineNumber, String sourceID) {
- Log.d("MyApplication", message);
+ Log.d("MyApplication", message + " -- From line " + lineNumber + " of " + sourceID);
}
});
</pre>
@@ -195,13 +204,14 @@
<p>When the "Hello World" log is executed through your {@link android.webkit.WebView}, it will
now look like this:</p>
<pre class="no-pretty-print">
-D/MyApplication ( 430): Hello World
+D/MyApplication ( 430): Hello World -- From line 82 of http://www.example.com/hello.html
</pre>
<p class="note"><strong>Note:</strong> The {@link
android.webkit.WebChromeClient#onConsoleMessage(String,int,String) onConsoleMessage()} callback
-method was added with API Level 7. If you are targetting platforms running API Level 6 or lower,
-then your Console messages will automatically be sent to logcat with the "WebCore" logging tag.</p>
+method was added with API Level 7. If you are using a custom {@link
+android.webkit.WebView} on a platform running API Level 6 or lower, then your Console messages will
+automatically be sent to logcat with the "WebCore" logging tag.</p>
diff --git a/graphics/tests/graphicstests/Android.mk b/graphics/tests/graphicstests/Android.mk
new file mode 100644
index 0000000..1845395
--- /dev/null
+++ b/graphics/tests/graphicstests/Android.mk
@@ -0,0 +1,14 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+# We only want this apk build for tests.
+LOCAL_MODULE_TAGS := tests
+
+# Include all test java files.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_JAVA_LIBRARIES := android.test.runner
+LOCAL_PACKAGE_NAME := FrameworksGraphicsTests
+
+include $(BUILD_PACKAGE)
+
diff --git a/graphics/tests/graphicstests/AndroidManifest.xml b/graphics/tests/graphicstests/AndroidManifest.xml
new file mode 100644
index 0000000..5fb5959
--- /dev/null
+++ b/graphics/tests/graphicstests/AndroidManifest.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.frameworks.graphicstests">
+ <uses-permission android:name="android.permission.RECEIVE_SMS"/>
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.READ_CONTACTS" />
+ <uses-permission android:name="android.permission.WRITE_CONTACTS" />
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
+ <uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
+ <uses-permission android:name="android.permission.WRITE_APN_SETTINGS" />
+ <uses-permission android:name="android.permission.BROADCAST_STICKY" />
+
+
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation
+ android:name="android.test.InstrumentationTestRunner"
+ android:targetPackage="com.android.frameworks.graphicstests"
+ android:label="Frameworks Graphics Tests" />
+</manifest>
diff --git a/tests/AndroidTests/res/drawable/test128x96.png b/graphics/tests/graphicstests/res/drawable/test128x96.png
similarity index 100%
rename from tests/AndroidTests/res/drawable/test128x96.png
rename to graphics/tests/graphicstests/res/drawable/test128x96.png
Binary files differ
diff --git a/tests/AndroidTests/res/drawable/test16x12.png b/graphics/tests/graphicstests/res/drawable/test16x12.png
similarity index 100%
rename from tests/AndroidTests/res/drawable/test16x12.png
rename to graphics/tests/graphicstests/res/drawable/test16x12.png
Binary files differ
diff --git a/tests/AndroidTests/res/drawable/test256x192.png b/graphics/tests/graphicstests/res/drawable/test256x192.png
similarity index 100%
rename from tests/AndroidTests/res/drawable/test256x192.png
rename to graphics/tests/graphicstests/res/drawable/test256x192.png
Binary files differ
diff --git a/tests/AndroidTests/res/drawable/test320x240.png b/graphics/tests/graphicstests/res/drawable/test320x240.png
similarity index 100%
rename from tests/AndroidTests/res/drawable/test320x240.png
rename to graphics/tests/graphicstests/res/drawable/test320x240.png
Binary files differ
diff --git a/tests/AndroidTests/res/drawable/test32x24.png b/graphics/tests/graphicstests/res/drawable/test32x24.png
similarity index 100%
rename from tests/AndroidTests/res/drawable/test32x24.png
rename to graphics/tests/graphicstests/res/drawable/test32x24.png
Binary files differ
diff --git a/tests/AndroidTests/res/drawable/test64x48.png b/graphics/tests/graphicstests/res/drawable/test64x48.png
similarity index 100%
rename from tests/AndroidTests/res/drawable/test64x48.png
rename to graphics/tests/graphicstests/res/drawable/test64x48.png
Binary files differ
diff --git a/tests/AndroidTests/src/com/android/unit_tests/graphics/BitmapTest.java b/graphics/tests/graphicstests/src/android/graphics/BitmapTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/graphics/BitmapTest.java
rename to graphics/tests/graphicstests/src/android/graphics/BitmapTest.java
index e8001e34..6734bb7 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/graphics/BitmapTest.java
+++ b/graphics/tests/graphicstests/src/android/graphics/BitmapTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.graphics;
+package android.graphics;
import android.graphics.Bitmap;
import android.graphics.Color;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/GraphicsPerformanceTests.java b/graphics/tests/graphicstests/src/android/graphics/GraphicsPerformanceTests.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/GraphicsPerformanceTests.java
rename to graphics/tests/graphicstests/src/android/graphics/GraphicsPerformanceTests.java
index a6c5869..f60ac7b 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/GraphicsPerformanceTests.java
+++ b/graphics/tests/graphicstests/src/android/graphics/GraphicsPerformanceTests.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.graphics;
import junit.framework.Assert;
import android.content.Context;
@@ -28,6 +28,8 @@
import android.test.suitebuilder.annotation.Suppress;
import android.util.Log;
+import com.android.frameworks.graphicstests.R;
+
/**
* Graphics Performance Tests
*
diff --git a/tests/AndroidTests/src/com/android/unit_tests/graphics/GraphicsTests.java b/graphics/tests/graphicstests/src/android/graphics/GraphicsTests.java
similarity index 95%
rename from tests/AndroidTests/src/com/android/unit_tests/graphics/GraphicsTests.java
rename to graphics/tests/graphicstests/src/android/graphics/GraphicsTests.java
index a8b6b9a..8d01ea7 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/graphics/GraphicsTests.java
+++ b/graphics/tests/graphicstests/src/android/graphics/GraphicsTests.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.graphics;
+package android.graphics;
import junit.framework.TestSuite;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/ThreadBitmapTest.java b/graphics/tests/graphicstests/src/android/graphics/ThreadBitmapTest.java
similarity index 96%
rename from tests/AndroidTests/src/com/android/unit_tests/ThreadBitmapTest.java
rename to graphics/tests/graphicstests/src/android/graphics/ThreadBitmapTest.java
index 220bc99e..84bdc56 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/ThreadBitmapTest.java
+++ b/graphics/tests/graphicstests/src/android/graphics/ThreadBitmapTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.graphics;
import junit.framework.TestCase;
import android.graphics.Bitmap;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/graphics/TypefaceTest.java b/graphics/tests/graphicstests/src/android/graphics/TypefaceTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/graphics/TypefaceTest.java
rename to graphics/tests/graphicstests/src/android/graphics/TypefaceTest.java
index 5c40e6f..334fddf 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/graphics/TypefaceTest.java
+++ b/graphics/tests/graphicstests/src/android/graphics/TypefaceTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests.graphics;
+package android.graphics;
import android.graphics.Paint;
import android.graphics.Typeface;
diff --git a/include/binder/MemoryDealer.h b/include/binder/MemoryDealer.h
index 03ac70a..170f20d 100644
--- a/include/binder/MemoryDealer.h
+++ b/include/binder/MemoryDealer.h
@@ -22,232 +22,35 @@
#include <sys/types.h>
#include <binder/IMemory.h>
-#include <utils/threads.h>
#include <binder/MemoryHeapBase.h>
namespace android {
// ----------------------------------------------------------------------------
-class String8;
-/*
- * interface for implementing a "heap". A heap basically provides
- * the IMemoryHeap interface for cross-process sharing and the
- * ability to map/unmap pages within the heap.
- */
-class HeapInterface : public virtual BnMemoryHeap
-{
-public:
- // all values must be page-aligned
- virtual sp<IMemory> mapMemory(size_t offset, size_t size) = 0;
-
- HeapInterface();
-protected:
- virtual ~HeapInterface();
-};
-
-// ----------------------------------------------------------------------------
-
-/*
- * interface for implementing an allocator. An allocator provides
- * methods for allocating and freeing memory blocks and dumping
- * its state.
- */
-class AllocatorInterface : public RefBase
-{
-public:
- enum {
- PAGE_ALIGNED = 0x00000001
- };
-
- virtual size_t allocate(size_t size, uint32_t flags = 0) = 0;
- virtual status_t deallocate(size_t offset) = 0;
- virtual size_t size() const = 0;
- virtual void dump(const char* what, uint32_t flags = 0) const = 0;
- virtual void dump(String8& res,
- const char* what, uint32_t flags = 0) const = 0;
-
- AllocatorInterface();
-protected:
- virtual ~AllocatorInterface();
-};
-
-// ----------------------------------------------------------------------------
-
-/*
- * concrete implementation of HeapInterface on top of mmap()
- */
-class SharedHeap : public HeapInterface, public MemoryHeapBase
-{
-public:
- SharedHeap();
- SharedHeap(size_t size, uint32_t flags = 0, char const * name = NULL);
- virtual ~SharedHeap();
- virtual sp<IMemory> mapMemory(size_t offset, size_t size);
-};
-
-// ----------------------------------------------------------------------------
-
-/*
- * A simple templatized doubly linked-list implementation
- */
-
-template <typename NODE>
-class LinkedList
-{
- NODE* mFirst;
- NODE* mLast;
-
-public:
- LinkedList() : mFirst(0), mLast(0) { }
- bool isEmpty() const { return mFirst == 0; }
- NODE const* head() const { return mFirst; }
- NODE* head() { return mFirst; }
- NODE const* tail() const { return mLast; }
- NODE* tail() { return mLast; }
-
- void insertAfter(NODE* node, NODE* newNode) {
- newNode->prev = node;
- newNode->next = node->next;
- if (node->next == 0) mLast = newNode;
- else node->next->prev = newNode;
- node->next = newNode;
- }
-
- void insertBefore(NODE* node, NODE* newNode) {
- newNode->prev = node->prev;
- newNode->next = node;
- if (node->prev == 0) mFirst = newNode;
- else node->prev->next = newNode;
- node->prev = newNode;
- }
-
- void insertHead(NODE* newNode) {
- if (mFirst == 0) {
- mFirst = mLast = newNode;
- newNode->prev = newNode->next = 0;
- } else {
- newNode->prev = 0;
- newNode->next = mFirst;
- mFirst->prev = newNode;
- mFirst = newNode;
- }
- }
-
- void insertTail(NODE* newNode) {
- if (mLast == 0) {
- insertHead(newNode);
- } else {
- newNode->prev = mLast;
- newNode->next = 0;
- mLast->next = newNode;
- mLast = newNode;
- }
- }
-
- NODE* remove(NODE* node) {
- if (node->prev == 0) mFirst = node->next;
- else node->prev->next = node->next;
- if (node->next == 0) mLast = node->prev;
- else node->next->prev = node->prev;
- return node;
- }
-};
-
-
-/*
- * concrete implementation of AllocatorInterface using a simple
- * best-fit allocation scheme
- */
-class SimpleBestFitAllocator : public AllocatorInterface
-{
-public:
-
- SimpleBestFitAllocator(size_t size);
- virtual ~SimpleBestFitAllocator();
-
- virtual size_t allocate(size_t size, uint32_t flags = 0);
- virtual status_t deallocate(size_t offset);
- virtual size_t size() const;
- virtual void dump(const char* what, uint32_t flags = 0) const;
- virtual void dump(String8& res,
- const char* what, uint32_t flags = 0) const;
-
-private:
-
- struct chunk_t {
- chunk_t(size_t start, size_t size)
- : start(start), size(size), free(1), prev(0), next(0) {
- }
- size_t start;
- size_t size : 28;
- int free : 4;
- mutable chunk_t* prev;
- mutable chunk_t* next;
- };
-
- ssize_t alloc(size_t size, uint32_t flags);
- chunk_t* dealloc(size_t start);
- void dump_l(const char* what, uint32_t flags = 0) const;
- void dump_l(String8& res, const char* what, uint32_t flags = 0) const;
-
- static const int kMemoryAlign;
- mutable Mutex mLock;
- LinkedList<chunk_t> mList;
- size_t mHeapSize;
-};
+class SimpleBestFitAllocator;
// ----------------------------------------------------------------------------
class MemoryDealer : public RefBase
{
public:
+ MemoryDealer(size_t size, const char* name = 0);
- enum {
- READ_ONLY = MemoryHeapBase::READ_ONLY,
- PAGE_ALIGNED = AllocatorInterface::PAGE_ALIGNED
- };
-
- // creates a memory dealer with the SharedHeap and SimpleBestFitAllocator
- MemoryDealer(size_t size, uint32_t flags = 0, const char* name = 0);
-
- // provide a custom heap but use the SimpleBestFitAllocator
- MemoryDealer(const sp<HeapInterface>& heap);
-
- // provide both custom heap and allocotar
- MemoryDealer(
- const sp<HeapInterface>& heap,
- const sp<AllocatorInterface>& allocator);
-
- virtual sp<IMemory> allocate(size_t size, uint32_t flags = 0);
+ virtual sp<IMemory> allocate(size_t size);
virtual void deallocate(size_t offset);
- virtual void dump(const char* what, uint32_t flags = 0) const;
-
+ virtual void dump(const char* what) const;
sp<IMemoryHeap> getMemoryHeap() const { return heap(); }
- sp<AllocatorInterface> getAllocator() const { return allocator(); }
protected:
virtual ~MemoryDealer();
-private:
- const sp<HeapInterface>& heap() const;
- const sp<AllocatorInterface>& allocator() const;
+private:
+ const sp<IMemoryHeap>& heap() const;
+ SimpleBestFitAllocator* allocator() const;
- class Allocation : public BnMemory {
- public:
- Allocation(const sp<MemoryDealer>& dealer,
- ssize_t offset, size_t size, const sp<IMemory>& memory);
- virtual ~Allocation();
- virtual sp<IMemoryHeap> getMemory(ssize_t* offset, size_t* size) const;
- private:
- sp<MemoryDealer> mDealer;
- ssize_t mOffset;
- size_t mSize;
- sp<IMemory> mMemory;
- };
-
- sp<HeapInterface> mHeap;
- sp<AllocatorInterface> mAllocator;
+ sp<IMemoryHeap> mHeap;
+ SimpleBestFitAllocator* mAllocator;
};
diff --git a/include/binder/MemoryHeapPmem.h b/include/binder/MemoryHeapPmem.h
index dbf26ff..aac164f 100644
--- a/include/binder/MemoryHeapPmem.h
+++ b/include/binder/MemoryHeapPmem.h
@@ -20,10 +20,10 @@
#include <stdlib.h>
#include <stdint.h>
-#include <binder/MemoryDealer.h>
#include <binder/MemoryHeapBase.h>
#include <binder/IMemory.h>
#include <utils/SortedVector.h>
+#include <utils/threads.h>
namespace android {
@@ -31,7 +31,7 @@
// ---------------------------------------------------------------------------
-class MemoryHeapPmem : public HeapInterface, public MemoryHeapBase
+class MemoryHeapPmem : public MemoryHeapBase
{
public:
class MemoryPmem : public BnMemory {
diff --git a/include/media/MediaProfiles.h b/include/media/MediaProfiles.h
new file mode 100644
index 0000000..be928ec
--- /dev/null
+++ b/include/media/MediaProfiles.h
@@ -0,0 +1,303 @@
+/*
+ **
+ ** Copyright 2010, The Android Open Source Project.
+ **
+ ** Licensed under the Apache License, Version 2.0 (the "License");
+ ** you may not use this file except in compliance with the License.
+ ** You may obtain a copy of the License at
+ **
+ ** http://www.apache.org/licenses/LICENSE-2.0
+ **
+ ** Unless required by applicable law or agreed to in writing, software
+ ** distributed under the License is distributed on an "AS IS" BASIS,
+ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ** See the License for the specific language governing permissions and
+ ** limitations under the License.
+ */
+
+#ifndef ANDROID_MEDIAPROFILES_H
+#define ANDROID_MEDIAPROFILES_H
+
+#include <utils/threads.h>
+#include <media/mediarecorder.h>
+
+namespace android {
+
+enum camcorder_quality {
+ CAMCORDER_QUALITY_HIGH = 0,
+ CAMCORDER_QUALITY_LOW = 1
+};
+
+enum video_decoder {
+ VIDEO_DECODER_WMV,
+};
+
+enum audio_decoder {
+ AUDIO_DECODER_WMA,
+};
+
+
+class MediaProfiles
+{
+public:
+
+ /**
+ * Returns the singleton instance for subsequence queries.
+ * or NULL if error.
+ */
+ static MediaProfiles* getInstance();
+
+ /**
+ * Returns the value for the given param name at the given quality level,
+ * or -1 if error.
+ *
+ * Supported param name are:
+ * file.format - output file format. see mediarecorder.h for details
+ * codec.vid - video encoder. see mediarecorder.h for details.
+ * codec.aud - audio encoder. see mediarecorder.h for details.
+ * vid.width - video frame width
+ * vid.height - video frame height
+ * vid.fps - video frame rate
+ * vid.bps - video bit rate
+ * aud.bps - audio bit rate
+ * aud.hz - audio sample rate
+ * aud.ch - number of audio channels
+ */
+ int getCamcorderProfileParamByName(const char *name, camcorder_quality quality) const;
+
+ /**
+ * Returns the output file formats supported.
+ */
+ Vector<output_format> getOutputFileFormats() const;
+
+ /**
+ * Returns the video encoders supported.
+ */
+ Vector<video_encoder> getVideoEncoders() const;
+
+ /**
+ * Returns the value for the given param name for the given video encoder
+ * returned from getVideoEncoderByIndex or -1 if error.
+ *
+ * Supported param name are:
+ * enc.vid.width.min - min video frame width
+ * enc.vid.width.max - max video frame width
+ * enc.vid.height.min - min video frame height
+ * enc.vid.height.max - max video frame height
+ * enc.vid.bps.min - min bit rate in bits per second
+ * enc.vid.bps.max - max bit rate in bits per second
+ * enc.vid.fps.min - min frame rate in frames per second
+ * enc.vid.fps.max - max frame rate in frames per second
+ */
+ int getVideoEncoderParamByName(const char *name, video_encoder codec) const;
+
+ /**
+ * Returns the audio encoders supported.
+ */
+ Vector<audio_encoder> getAudioEncoders() const;
+
+ /**
+ * Returns the value for the given param name for the given audio encoder
+ * returned from getAudioEncoderByIndex or -1 if error.
+ *
+ * Supported param name are:
+ * enc.aud.ch.min - min number of channels
+ * enc.aud.ch.max - max number of channels
+ * enc.aud.bps.min - min bit rate in bits per second
+ * enc.aud.bps.max - max bit rate in bits per second
+ * enc.aud.hz.min - min sample rate in samples per second
+ * enc.aud.hz.max - max sample rate in samples per second
+ */
+ int getAudioEncoderParamByName(const char *name, audio_encoder codec) const;
+
+ /**
+ * Returns the video decoders supported.
+ */
+ Vector<video_decoder> getVideoDecoders() const;
+
+ /**
+ * Returns the audio decoders supported.
+ */
+ Vector<audio_decoder> getAudioDecoders() const;
+
+private:
+ MediaProfiles& operator=(const MediaProfiles&); // Don't call me
+ MediaProfiles(const MediaProfiles&); // Don't call me
+ MediaProfiles() {} // Dummy default constructor
+ ~MediaProfiles(); // Don't delete me
+
+ struct VideoCodec {
+ VideoCodec(video_encoder codec, int bitRate, int frameWidth, int frameHeight, int frameRate)
+ : mCodec(codec),
+ mBitRate(bitRate),
+ mFrameWidth(frameWidth),
+ mFrameHeight(frameHeight),
+ mFrameRate(frameRate) {}
+
+ ~VideoCodec() {}
+
+ video_encoder mCodec;
+ int mBitRate;
+ int mFrameWidth;
+ int mFrameHeight;
+ int mFrameRate;
+ };
+
+ struct AudioCodec {
+ AudioCodec(audio_encoder codec, int bitRate, int sampleRate, int channels)
+ : mCodec(codec),
+ mBitRate(bitRate),
+ mSampleRate(sampleRate),
+ mChannels(channels) {}
+
+ ~AudioCodec() {}
+
+ audio_encoder mCodec;
+ int mBitRate;
+ int mSampleRate;
+ int mChannels;
+ };
+
+ struct CamcorderProfile {
+ CamcorderProfile()
+ : mFileFormat(OUTPUT_FORMAT_THREE_GPP),
+ mQuality(CAMCORDER_QUALITY_HIGH),
+ mDuration(0),
+ mVideoCodec(0),
+ mAudioCodec(0) {}
+
+ ~CamcorderProfile() {
+ delete mVideoCodec;
+ delete mAudioCodec;
+ }
+
+ output_format mFileFormat;
+ camcorder_quality mQuality;
+ int mDuration;
+ VideoCodec *mVideoCodec;
+ AudioCodec *mAudioCodec;
+ };
+
+ struct VideoEncoderCap {
+ // Ugly constructor
+ VideoEncoderCap(video_encoder codec,
+ int minBitRate, int maxBitRate,
+ int minFrameWidth, int maxFrameWidth,
+ int minFrameHeight, int maxFrameHeight,
+ int minFrameRate, int maxFrameRate)
+ : mCodec(codec),
+ mMinBitRate(minBitRate), mMaxBitRate(maxBitRate),
+ mMinFrameWidth(minFrameWidth), mMaxFrameWidth(maxFrameWidth),
+ mMinFrameHeight(minFrameHeight), mMaxFrameHeight(maxFrameHeight),
+ mMinFrameRate(minFrameRate), mMaxFrameRate(maxFrameRate) {}
+
+ ~VideoEncoderCap() {}
+
+ video_encoder mCodec;
+ int mMinBitRate, mMaxBitRate;
+ int mMinFrameWidth, mMaxFrameWidth;
+ int mMinFrameHeight, mMaxFrameHeight;
+ int mMinFrameRate, mMaxFrameRate;
+ };
+
+ struct AudioEncoderCap {
+ // Ugly constructor
+ AudioEncoderCap(audio_encoder codec,
+ int minBitRate, int maxBitRate,
+ int minSampleRate, int maxSampleRate,
+ int minChannels, int maxChannels)
+ : mCodec(codec),
+ mMinBitRate(minBitRate), mMaxBitRate(maxBitRate),
+ mMinSampleRate(minSampleRate), mMaxSampleRate(maxSampleRate),
+ mMinChannels(minChannels), mMaxChannels(maxChannels) {}
+
+ ~AudioEncoderCap() {}
+
+ audio_encoder mCodec;
+ int mMinBitRate, mMaxBitRate;
+ int mMinSampleRate, mMaxSampleRate;
+ int mMinChannels, mMaxChannels;
+ };
+
+ struct VideoDecoderCap {
+ VideoDecoderCap(video_decoder codec): mCodec(codec) {}
+ ~VideoDecoderCap() {}
+
+ video_decoder mCodec;
+ };
+
+ struct AudioDecoderCap {
+ AudioDecoderCap(audio_decoder codec): mCodec(codec) {}
+ ~AudioDecoderCap() {}
+
+ audio_decoder mCodec;
+ };
+
+ struct NameToTagMap {
+ const char* name;
+ int tag;
+ };
+
+ // Debug
+ static void logVideoCodec(const VideoCodec& codec);
+ static void logAudioCodec(const AudioCodec& codec);
+ static void logVideoEncoderCap(const VideoEncoderCap& cap);
+ static void logAudioEncoderCap(const AudioEncoderCap& cap);
+ static void logVideoDecoderCap(const VideoDecoderCap& cap);
+ static void logAudioDecoderCap(const AudioDecoderCap& cap);
+
+ // If the xml configuration file does exist, use the settings
+ // from the xml
+ static MediaProfiles* createInstanceFromXmlFile(const char *xml);
+ static output_format createEncoderOutputFileFormat(const char **atts);
+ static VideoCodec* createVideoCodec(const char **atts, MediaProfiles *profiles);
+ static AudioCodec* createAudioCodec(const char **atts, MediaProfiles *profiles);
+ static AudioDecoderCap* createAudioDecoderCap(const char **atts);
+ static VideoDecoderCap* createVideoDecoderCap(const char **atts);
+ static VideoEncoderCap* createVideoEncoderCap(const char **atts);
+ static AudioEncoderCap* createAudioEncoderCap(const char **atts);
+ static CamcorderProfile* createCamcorderProfile(const char **atts);
+
+ // Customized element tag handler for parsing the xml configuration file.
+ static void startElementHandler(void *userData, const char *name, const char **atts);
+
+ // If the xml configuration file does not exist, use hard-coded values
+ static MediaProfiles* createDefaultInstance();
+ static CamcorderProfile *createDefaultCamcorderLowProfile();
+ static CamcorderProfile *createDefaultCamcorderHighProfile();
+ static void createDefaultCamcorderProfiles(MediaProfiles *profiles);
+ static void createDefaultVideoEncoders(MediaProfiles *profiles);
+ static void createDefaultAudioEncoders(MediaProfiles *profiles);
+ static void createDefaultVideoDecoders(MediaProfiles *profiles);
+ static void createDefaultAudioDecoders(MediaProfiles *profiles);
+ static void createDefaultEncoderOutputFileFormats(MediaProfiles *profiles);
+ static VideoEncoderCap* createDefaultH263VideoEncoderCap();
+ static VideoEncoderCap* createDefaultM4vVideoEncoderCap();
+ static AudioEncoderCap* createDefaultAmrNBEncoderCap();
+
+ static int findTagForName(const NameToTagMap *map, size_t nMappings, const char *name);
+
+ // Mappings from name (for instance, codec name) to enum value
+ static const NameToTagMap sVideoEncoderNameMap[];
+ static const NameToTagMap sAudioEncoderNameMap[];
+ static const NameToTagMap sFileFormatMap[];
+ static const NameToTagMap sVideoDecoderNameMap[];
+ static const NameToTagMap sAudioDecoderNameMap[];
+ static const NameToTagMap sCamcorderQualityNameMap[];
+
+ static bool sIsInitialized;
+ static MediaProfiles *sInstance;
+ static Mutex sLock;
+
+ Vector<CamcorderProfile*> mCamcorderProfiles;
+ Vector<AudioEncoderCap*> mAudioEncoders;
+ Vector<VideoEncoderCap*> mVideoEncoders;
+ Vector<AudioDecoderCap*> mAudioDecoders;
+ Vector<VideoDecoderCap*> mVideoDecoders;
+ Vector<output_format> mEncoderOutputFileFormats;
+};
+
+}; // namespace android
+
+#endif // ANDROID_MEDIAPROFILES_H
+
diff --git a/include/media/stagefright/AudioPlayer.h b/include/media/stagefright/AudioPlayer.h
index 71344e6..26fcc95 100644
--- a/include/media/stagefright/AudioPlayer.h
+++ b/include/media/stagefright/AudioPlayer.h
@@ -47,7 +47,7 @@
// Return time in us.
virtual int64_t getRealTimeUs();
- void start();
+ status_t start();
void pause();
void resume();
diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h
index 82dd2b5..f8bc7ab 100644
--- a/include/media/stagefright/OMXCodec.h
+++ b/include/media/stagefright/OMXCodec.h
@@ -95,6 +95,7 @@
kRequiresAllocateBufferOnOutputPorts = 32,
kRequiresFlushBeforeShutdown = 64,
kDefersOutputBufferAllocation = 128,
+ kDecoderLiesAboutNumberOfChannels = 256,
};
struct BufferInfo {
diff --git a/include/ui/CameraParameters.h b/include/ui/CameraParameters.h
index cae0676..2c29bfb 100644
--- a/include/ui/CameraParameters.h
+++ b/include/ui/CameraParameters.h
@@ -34,8 +34,10 @@
void set(const char *key, const char *value);
void set(const char *key, int value);
+ void setFloat(const char *key, float value);
const char *get(const char *key) const;
int getInt(const char *key) const;
+ float getFloat(const char *key) const;
/* preview-size=176x144 */
void setPreviewSize(int width, int height);
@@ -176,6 +178,16 @@
// Supported focus modes.
// Example value: "auto,macro,fixed". Read only.
static const char KEY_SUPPORTED_FOCUS_MODES[];
+ // Focal length in millimeter.
+ // Example value: "4.31". Read only.
+ static const char KEY_FOCAL_LENGTH[];
+ // Horizontal angle of view in degrees.
+ // Example value: "54.8". Read only.
+ static const char KEY_HORIZONTAL_VIEW_ANGLE[];
+ // Vertical angle of view in degrees.
+ // Example value: "42.5". Read only.
+ static const char KEY_VERTICAL_VIEW_ANGLE[];
+
// Values for white balance settings.
static const char WHITE_BALANCE_AUTO[];
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp
index cad420a..9d52882 100644
--- a/libs/audioflinger/AudioFlinger.cpp
+++ b/libs/audioflinger/AudioFlinger.cpp
@@ -2929,7 +2929,7 @@
AudioFlinger::Client::Client(const sp<AudioFlinger>& audioFlinger, pid_t pid)
: RefBase(),
mAudioFlinger(audioFlinger),
- mMemoryDealer(new MemoryDealer(1024*1024)),
+ mMemoryDealer(new MemoryDealer(1024*1024, "AudioFlinger::Client")),
mPid(pid)
{
// 1 MB of address space is good for 32 tracks, 8 buffers each, 4 KB/buffer
diff --git a/libs/binder/MemoryDealer.cpp b/libs/binder/MemoryDealer.cpp
index d5ffe7f..18669f7 100644
--- a/libs/binder/MemoryDealer.cpp
+++ b/libs/binder/MemoryDealer.cpp
@@ -17,12 +17,13 @@
#define LOG_TAG "MemoryDealer"
#include <binder/MemoryDealer.h>
+#include <binder/IPCThreadState.h>
+#include <binder/MemoryBase.h>
#include <utils/Log.h>
-#include <binder/IPCThreadState.h>
#include <utils/SortedVector.h>
#include <utils/String8.h>
-#include <binder/MemoryBase.h>
+#include <utils/threads.h>
#include <stdint.h>
#include <stdio.h>
@@ -40,90 +41,203 @@
namespace android {
// ----------------------------------------------------------------------------
-HeapInterface::HeapInterface() { }
-HeapInterface::~HeapInterface() { }
+/*
+ * A simple templatized doubly linked-list implementation
+ */
-// ----------------------------------------------------------------------------
+template <typename NODE>
+class LinkedList
+{
+ NODE* mFirst;
+ NODE* mLast;
-AllocatorInterface::AllocatorInterface() { }
-AllocatorInterface::~AllocatorInterface() { }
-
-// ----------------------------------------------------------------------------
-
-class SimpleMemory : public MemoryBase {
public:
- SimpleMemory(const sp<IMemoryHeap>& heap, ssize_t offset, size_t size);
- virtual ~SimpleMemory();
+ LinkedList() : mFirst(0), mLast(0) { }
+ bool isEmpty() const { return mFirst == 0; }
+ NODE const* head() const { return mFirst; }
+ NODE* head() { return mFirst; }
+ NODE const* tail() const { return mLast; }
+ NODE* tail() { return mLast; }
+
+ void insertAfter(NODE* node, NODE* newNode) {
+ newNode->prev = node;
+ newNode->next = node->next;
+ if (node->next == 0) mLast = newNode;
+ else node->next->prev = newNode;
+ node->next = newNode;
+ }
+
+ void insertBefore(NODE* node, NODE* newNode) {
+ newNode->prev = node->prev;
+ newNode->next = node;
+ if (node->prev == 0) mFirst = newNode;
+ else node->prev->next = newNode;
+ node->prev = newNode;
+ }
+
+ void insertHead(NODE* newNode) {
+ if (mFirst == 0) {
+ mFirst = mLast = newNode;
+ newNode->prev = newNode->next = 0;
+ } else {
+ newNode->prev = 0;
+ newNode->next = mFirst;
+ mFirst->prev = newNode;
+ mFirst = newNode;
+ }
+ }
+
+ void insertTail(NODE* newNode) {
+ if (mLast == 0) {
+ insertHead(newNode);
+ } else {
+ newNode->prev = mLast;
+ newNode->next = 0;
+ mLast->next = newNode;
+ mLast = newNode;
+ }
+ }
+
+ NODE* remove(NODE* node) {
+ if (node->prev == 0) mFirst = node->next;
+ else node->prev->next = node->next;
+ if (node->next == 0) mLast = node->prev;
+ else node->next->prev = node->prev;
+ return node;
+ }
};
+// ----------------------------------------------------------------------------
+
+class Allocation : public MemoryBase {
+public:
+ Allocation(const sp<MemoryDealer>& dealer,
+ const sp<IMemoryHeap>& heap, ssize_t offset, size_t size);
+ virtual ~Allocation();
+private:
+ sp<MemoryDealer> mDealer;
+};
// ----------------------------------------------------------------------------
-MemoryDealer::Allocation::Allocation(
- const sp<MemoryDealer>& dealer, ssize_t offset, size_t size,
- const sp<IMemory>& memory)
- : mDealer(dealer), mOffset(offset), mSize(size), mMemory(memory)
+class SimpleBestFitAllocator
{
+ enum {
+ PAGE_ALIGNED = 0x00000001
+ };
+public:
+ SimpleBestFitAllocator(size_t size);
+ ~SimpleBestFitAllocator();
+
+ size_t allocate(size_t size, uint32_t flags = 0);
+ status_t deallocate(size_t offset);
+ size_t size() const;
+ void dump(const char* what) const;
+ void dump(String8& res, const char* what) const;
+
+private:
+
+ struct chunk_t {
+ chunk_t(size_t start, size_t size)
+ : start(start), size(size), free(1), prev(0), next(0) {
+ }
+ size_t start;
+ size_t size : 28;
+ int free : 4;
+ mutable chunk_t* prev;
+ mutable chunk_t* next;
+ };
+
+ ssize_t alloc(size_t size, uint32_t flags);
+ chunk_t* dealloc(size_t start);
+ void dump_l(const char* what) const;
+ void dump_l(String8& res, const char* what) const;
+
+ static const int kMemoryAlign;
+ mutable Mutex mLock;
+ LinkedList<chunk_t> mList;
+ size_t mHeapSize;
+};
+
+// ----------------------------------------------------------------------------
+
+Allocation::Allocation(
+ const sp<MemoryDealer>& dealer,
+ const sp<IMemoryHeap>& heap, ssize_t offset, size_t size)
+ : MemoryBase(heap, offset, size), mDealer(dealer)
+{
+#ifndef NDEBUG
+ void* const start_ptr = (void*)(intptr_t(heap->base()) + offset);
+ memset(start_ptr, 0xda, size);
+#endif
}
-MemoryDealer::Allocation::~Allocation()
+Allocation::~Allocation()
{
- if (mSize) {
+ size_t freedOffset = getOffset();
+ size_t freedSize = getSize();
+ if (freedSize) {
/* NOTE: it's VERY important to not free allocations of size 0 because
* they're special as they don't have any record in the allocator
* and could alias some real allocation (their offset is zero). */
- mDealer->deallocate(mOffset);
- }
-}
+ mDealer->deallocate(freedOffset);
-sp<IMemoryHeap> MemoryDealer::Allocation::getMemory(
- ssize_t* offset, size_t* size) const
-{
- return mMemory->getMemory(offset, size);
+ // keep the size to unmap in excess
+ size_t pagesize = getpagesize();
+ size_t start = freedOffset;
+ size_t end = start + freedSize;
+ start &= ~(pagesize-1);
+ end = (end + pagesize-1) & ~(pagesize-1);
+
+ // give back to the kernel the pages we don't need
+ size_t free_start = freedOffset;
+ size_t free_end = free_start + freedSize;
+ if (start < free_start)
+ start = free_start;
+ if (end > free_end)
+ end = free_end;
+ start = (start + pagesize-1) & ~(pagesize-1);
+ end &= ~(pagesize-1);
+
+ if (start < end) {
+ void* const start_ptr = (void*)(intptr_t(getHeap()->base()) + start);
+ size_t size = end-start;
+
+#ifndef NDEBUG
+ memset(start_ptr, 0xdf, size);
+#endif
+
+ // MADV_REMOVE is not defined on Dapper based Goobuntu
+#ifdef MADV_REMOVE
+ if (size) {
+ int err = madvise(start_ptr, size, MADV_REMOVE);
+ LOGW_IF(err, "madvise(%p, %u, MADV_REMOVE) returned %s",
+ start_ptr, size, err<0 ? strerror(errno) : "Ok");
+ }
+#endif
+ }
+ }
}
// ----------------------------------------------------------------------------
-MemoryDealer::MemoryDealer(size_t size, uint32_t flags, const char* name)
- : mHeap(new SharedHeap(size, flags, name)),
+MemoryDealer::MemoryDealer(size_t size, const char* name)
+ : mHeap(new MemoryHeapBase(size, 0, name)),
mAllocator(new SimpleBestFitAllocator(size))
{
}
-MemoryDealer::MemoryDealer(const sp<HeapInterface>& heap)
- : mHeap(heap),
- mAllocator(new SimpleBestFitAllocator(heap->virtualSize()))
-{
-}
-
-MemoryDealer::MemoryDealer( const sp<HeapInterface>& heap,
- const sp<AllocatorInterface>& allocator)
- : mHeap(heap), mAllocator(allocator)
-{
-}
-
MemoryDealer::~MemoryDealer()
{
+ delete mAllocator;
}
-sp<IMemory> MemoryDealer::allocate(size_t size, uint32_t flags)
+sp<IMemory> MemoryDealer::allocate(size_t size)
{
sp<IMemory> memory;
- const ssize_t offset = allocator()->allocate(size, flags);
+ const ssize_t offset = allocator()->allocate(size);
if (offset >= 0) {
- sp<IMemory> new_memory = heap()->mapMemory(offset, size);
- if (new_memory != 0) {
- memory = new Allocation(this, offset, size, new_memory);
- } else {
- LOGE("couldn't map [%8lx, %u]", offset, size);
- if (size) {
- /* NOTE: it's VERY important to not free allocations of size 0
- * because they're special as they don't have any record in the
- * allocator and could alias some real allocation
- * (their offset is zero). */
- allocator()->deallocate(offset);
- }
- }
+ memory = new Allocation(this, heap(), offset, size);
}
return memory;
}
@@ -133,16 +247,16 @@
allocator()->deallocate(offset);
}
-void MemoryDealer::dump(const char* what, uint32_t flags) const
+void MemoryDealer::dump(const char* what) const
{
- allocator()->dump(what, flags);
+ allocator()->dump(what);
}
-const sp<HeapInterface>& MemoryDealer::heap() const {
+const sp<IMemoryHeap>& MemoryDealer::heap() const {
return mHeap;
}
-const sp<AllocatorInterface>& MemoryDealer::allocator() const {
+SimpleBestFitAllocator* MemoryDealer::allocator() const {
return mAllocator;
}
@@ -287,28 +401,28 @@
return 0;
}
-void SimpleBestFitAllocator::dump(const char* what, uint32_t flags) const
+void SimpleBestFitAllocator::dump(const char* what) const
{
Mutex::Autolock _l(mLock);
- dump_l(what, flags);
+ dump_l(what);
}
-void SimpleBestFitAllocator::dump_l(const char* what, uint32_t flags) const
+void SimpleBestFitAllocator::dump_l(const char* what) const
{
String8 result;
- dump_l(result, what, flags);
+ dump_l(result, what);
LOGD("%s", result.string());
}
void SimpleBestFitAllocator::dump(String8& result,
- const char* what, uint32_t flags) const
+ const char* what) const
{
Mutex::Autolock _l(mLock);
- dump_l(result, what, flags);
+ dump_l(result, what);
}
void SimpleBestFitAllocator::dump_l(String8& result,
- const char* what, uint32_t flags) const
+ const char* what) const
{
size_t size = 0;
int32_t i = 0;
@@ -341,81 +455,10 @@
i++;
cur = cur->next;
}
- snprintf(buffer, SIZE, " size allocated: %u (%u KB)\n", int(size), int(size/1024));
+ snprintf(buffer, SIZE,
+ " size allocated: %u (%u KB)\n", int(size), int(size/1024));
result.append(buffer);
}
-
-// ----------------------------------------------------------------------------
-SharedHeap::SharedHeap()
- : HeapInterface(), MemoryHeapBase()
-{
-}
-
-SharedHeap::SharedHeap(size_t size, uint32_t flags, char const * name)
- : MemoryHeapBase(size, flags, name)
-{
-}
-
-SharedHeap::~SharedHeap()
-{
-}
-
-sp<IMemory> SharedHeap::mapMemory(size_t offset, size_t size)
-{
- return new SimpleMemory(this, offset, size);
-}
-
-
-SimpleMemory::SimpleMemory(const sp<IMemoryHeap>& heap,
- ssize_t offset, size_t size)
- : MemoryBase(heap, offset, size)
-{
-#ifndef NDEBUG
- void* const start_ptr = (void*)(intptr_t(heap->base()) + offset);
- memset(start_ptr, 0xda, size);
-#endif
-}
-
-SimpleMemory::~SimpleMemory()
-{
- size_t freedOffset = getOffset();
- size_t freedSize = getSize();
-
- // keep the size to unmap in excess
- size_t pagesize = getpagesize();
- size_t start = freedOffset;
- size_t end = start + freedSize;
- start &= ~(pagesize-1);
- end = (end + pagesize-1) & ~(pagesize-1);
-
- // give back to the kernel the pages we don't need
- size_t free_start = freedOffset;
- size_t free_end = free_start + freedSize;
- if (start < free_start)
- start = free_start;
- if (end > free_end)
- end = free_end;
- start = (start + pagesize-1) & ~(pagesize-1);
- end &= ~(pagesize-1);
-
- if (start < end) {
- void* const start_ptr = (void*)(intptr_t(getHeap()->base()) + start);
- size_t size = end-start;
-
-#ifndef NDEBUG
- memset(start_ptr, 0xdf, size);
-#endif
-
- // MADV_REMOVE is not defined on Dapper based Goobuntu
-#ifdef MADV_REMOVE
- if (size) {
- int err = madvise(start_ptr, size, MADV_REMOVE);
- LOGW_IF(err, "madvise(%p, %u, MADV_REMOVE) returned %s",
- start_ptr, size, err<0 ? strerror(errno) : "Ok");
- }
-#endif
- }
-}
}; // namespace android
diff --git a/libs/binder/MemoryHeapPmem.cpp b/libs/binder/MemoryHeapPmem.cpp
index c660947..16e92f9 100644
--- a/libs/binder/MemoryHeapPmem.cpp
+++ b/libs/binder/MemoryHeapPmem.cpp
@@ -127,7 +127,7 @@
MemoryHeapPmem::MemoryHeapPmem(const sp<MemoryHeapBase>& pmemHeap,
uint32_t flags)
- : HeapInterface(), MemoryHeapBase()
+ : MemoryHeapBase()
{
char const * const device = pmemHeap->getDevice();
#if HAVE_ANDROID_OS
diff --git a/libs/ui/CameraParameters.cpp b/libs/ui/CameraParameters.cpp
index a94f6b9..c4958a0 100644
--- a/libs/ui/CameraParameters.cpp
+++ b/libs/ui/CameraParameters.cpp
@@ -56,6 +56,9 @@
const char CameraParameters::KEY_SUPPORTED_FLASH_MODES[] = "flash-mode-values";
const char CameraParameters::KEY_FOCUS_MODE[] = "focus-mode";
const char CameraParameters::KEY_SUPPORTED_FOCUS_MODES[] = "focus-mode-values";
+const char CameraParameters::KEY_FOCAL_LENGTH[] = "focal-length";
+const char CameraParameters::KEY_HORIZONTAL_VIEW_ANGLE[] = "horizontal-view-angle";
+const char CameraParameters::KEY_VERTICAL_VIEW_ANGLE[] = "vertical-view-angle";
// Values for white balance settings.
const char CameraParameters::WHITE_BALANCE_AUTO[] = "auto";
@@ -206,6 +209,13 @@
set(key, str);
}
+void CameraParameters::setFloat(const char *key, float value)
+{
+ char str[16]; // 14 should be enough. We overestimate to be safe.
+ snprintf(str, sizeof(str), "%g", value);
+ set(key, str);
+}
+
const char *CameraParameters::get(const char *key) const
{
String8 v = mMap.valueFor(String8(key));
@@ -222,6 +232,13 @@
return strtol(v, 0, 0);
}
+float CameraParameters::getFloat(const char *key) const
+{
+ const char *v = get(key);
+ if (v == 0) return -1;
+ return strtof(v, 0);
+}
+
static int parse_size(const char *str, int &width, int &height)
{
// Find the width.
diff --git a/location/java/android/location/ILocationProvider.aidl b/location/java/android/location/ILocationProvider.aidl
index 7da16e4..9fe6ab4 100644
--- a/location/java/android/location/ILocationProvider.aidl
+++ b/location/java/android/location/ILocationProvider.aidl
@@ -37,7 +37,6 @@
int getAccuracy();
void enable();
void disable();
- boolean isEnabled();
int getStatus(out Bundle extras);
long getStatusUpdateTime();
void enableLocationTracking(boolean enable);
diff --git a/location/java/android/location/LocationProviderImpl.java b/location/java/android/location/LocationProviderImpl.java
index 9a3624e..7148a02 100644
--- a/location/java/android/location/LocationProviderImpl.java
+++ b/location/java/android/location/LocationProviderImpl.java
@@ -75,10 +75,6 @@
LocationProviderImpl.this.disable();
}
- public boolean isEnabled() {
- return LocationProviderImpl.this.isEnabled();
- }
-
public int getStatus(Bundle extras) {
return LocationProviderImpl.this.getStatus(extras);
}
@@ -138,11 +134,6 @@
public abstract void disable();
/**
- * Returns true if the provider is currently enabled
- */
- public abstract boolean isEnabled();
-
- /**
* Returns a information on the status of this provider.
* {@link #OUT_OF_SERVICE} is returned if the provider is
* out of service, and this is not expected to change in the near
diff --git a/location/java/com/android/internal/location/GpsLocationProvider.java b/location/java/com/android/internal/location/GpsLocationProvider.java
index 9d67882..8b5f702 100755
--- a/location/java/com/android/internal/location/GpsLocationProvider.java
+++ b/location/java/com/android/internal/location/GpsLocationProvider.java
@@ -56,6 +56,7 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
+import java.util.Date;
import java.util.Properties;
import java.util.Map.Entry;
@@ -239,10 +240,14 @@
// how often to request NTP time, in milliseconds
// current setting 4 hours
- private static final long NTP_INTERVAL = 4*60*60*1000;
+ private static final long NTP_INTERVAL = 4*60*60*1000;
// how long to wait if we have a network error in NTP or XTRA downloading
// current setting - 5 minutes
- private static final long RETRY_INTERVAL = 5*60*1000;
+ private static final long RETRY_INTERVAL = 5*60*1000;
+
+ // to avoid injecting bad NTP time, we reject any time fixes that differ from system time
+ // by more than 5 minutes.
+ private static final long MAX_NTP_SYSTEM_TIME_OFFSET = 5*60*1000;
private final IGpsStatusProvider mGpsStatusProvider = new IGpsStatusProvider.Stub() {
public void addGpsStatusListener(IGpsStatusListener listener) throws RemoteException {
@@ -571,10 +576,6 @@
}
}
- public boolean isEnabled() {
- return mEnabled;
- }
-
public int getStatus(Bundle extras) {
if (extras != null) {
extras.putInt("satellites", mSvCount);
@@ -884,6 +885,7 @@
switch (status) {
case GPS_STATUS_SESSION_BEGIN:
mNavigating = true;
+ mEngineOn = true;
break;
case GPS_STATUS_SESSION_END:
mNavigating = false;
@@ -893,6 +895,7 @@
break;
case GPS_STATUS_ENGINE_OFF:
mEngineOn = false;
+ mNavigating = false;
break;
}
@@ -1250,13 +1253,26 @@
long time = client.getNtpTime();
long timeReference = client.getNtpTimeReference();
int certainty = (int)(client.getRoundTripTime()/2);
+ long now = System.currentTimeMillis();
+ long systemTimeOffset = time - now;
- if (DEBUG) Log.d(TAG, "calling native_inject_time: " +
- time + " reference: " + timeReference
- + " certainty: " + certainty);
-
- native_inject_time(time, timeReference, certainty);
- mNextNtpTime = System.currentTimeMillis() + NTP_INTERVAL;
+ Log.d(TAG, "NTP server returned: "
+ + time + " (" + new Date(time)
+ + ") reference: " + timeReference
+ + " certainty: " + certainty
+ + " system time offset: " + systemTimeOffset);
+
+ // sanity check NTP time and do not use if it is too far from system time
+ if (systemTimeOffset < 0) {
+ systemTimeOffset = -systemTimeOffset;
+ }
+ if (systemTimeOffset < MAX_NTP_SYSTEM_TIME_OFFSET) {
+ native_inject_time(time, timeReference, certainty);
+ } else {
+ Log.e(TAG, "NTP time differs from system time by " + systemTimeOffset
+ + "ms. Ignoring.");
+ }
+ mNextNtpTime = now + NTP_INTERVAL;
} else {
if (DEBUG) Log.d(TAG, "requestTime failed");
mNextNtpTime = System.currentTimeMillis() + RETRY_INTERVAL;
diff --git a/location/java/com/android/internal/location/LocationProviderProxy.java b/location/java/com/android/internal/location/LocationProviderProxy.java
index 89337b3..2e0be89 100644
--- a/location/java/com/android/internal/location/LocationProviderProxy.java
+++ b/location/java/com/android/internal/location/LocationProviderProxy.java
@@ -40,6 +40,7 @@
private final String mName;
private final ILocationProvider mProvider;
private boolean mLocationTracking = false;
+ private boolean mEnabled = false;
private long mMinTime = 0;
private boolean mDead;
@@ -152,6 +153,7 @@
public void enable() {
try {
mProvider.enable();
+ mEnabled = true;
} catch (RemoteException e) {
Log.e(TAG, "enable failed", e);
}
@@ -160,18 +162,14 @@
public void disable() {
try {
mProvider.disable();
+ mEnabled = false;
} catch (RemoteException e) {
Log.e(TAG, "disable failed", e);
}
}
public boolean isEnabled() {
- try {
- return mProvider.isEnabled();
- } catch (RemoteException e) {
- Log.e(TAG, "isEnabled failed", e);
- return false;
- }
+ return mEnabled;
}
public int getStatus(Bundle extras) {
diff --git a/location/java/com/android/internal/location/MockProvider.java b/location/java/com/android/internal/location/MockProvider.java
index 2614f82..7d9e86c 100644
--- a/location/java/com/android/internal/location/MockProvider.java
+++ b/location/java/com/android/internal/location/MockProvider.java
@@ -95,10 +95,6 @@
return mStatusUpdateTime;
}
- public boolean isEnabled() {
- return mEnabled;
- }
-
public int getAccuracy() {
return mAccuracy;
}
diff --git a/tests/AndroidTests/src/com/android/unit_tests/GeocoderTest.java b/location/tests/locationtests/src/android/location/GeocoderTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/GeocoderTest.java
rename to location/tests/locationtests/src/android/location/GeocoderTest.java
index e28a7dc..8a13a24 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/GeocoderTest.java
+++ b/location/tests/locationtests/src/android/location/GeocoderTest.java
@@ -1,4 +1,4 @@
-package com.android.unit_tests;
+package android.location;
/*
* Copyright (C) 2007 The Android Open Source Project
diff --git a/tests/AndroidTests/src/com/android/unit_tests/LocationManagerTest.java b/location/tests/locationtests/src/android/location/LocationManagerTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/LocationManagerTest.java
rename to location/tests/locationtests/src/android/location/LocationManagerTest.java
index 47c7522..0b8e61d 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/LocationManagerTest.java
+++ b/location/tests/locationtests/src/android/location/LocationManagerTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.location;
import android.content.Context;
import android.location.Criteria;
diff --git a/media/java/android/media/EncoderCapabilities.java b/media/java/android/media/EncoderCapabilities.java
new file mode 100644
index 0000000..71cb1b3
--- /dev/null
+++ b/media/java/android/media/EncoderCapabilities.java
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.media;
+
+import java.util.List;
+import java.util.ArrayList;
+import android.util.Log;
+
+/**
+ * The EncoderCapabilities class is used to retrieve the
+ * capabilities for different video and audio
+ * encoders supported on a specific Android platform.
+ * {@hide}
+ */
+public class EncoderCapabilities
+{
+ private static final String TAG = "EncoderCapabilities";
+
+ /**
+ * The VideoEncoderCap class represents a video encoder's
+ * supported parameter range in:
+ *
+ * <ul>
+ * <li>Resolution: the frame size (width/height) in pixels;
+ * <li>Bit rate: the compressed output bit rate in bits per second;
+ * <li>Frame rate: the output number of frames per second.
+ * </ul>
+ *
+ */
+ static public class VideoEncoderCap {
+ // These are not modifiable externally, thus are public accessible
+ public final int mCodec; // @see android.media.MediaRecorder.VideoEncoder
+ public final int mMinBitRate, mMaxBitRate; // min and max bit rate (bps)
+ public final int mMinFrameRate, mMaxFrameRate; // min and max frame rate (fps)
+ public final int mMinFrameWidth, mMaxFrameWidth; // min and max frame width (pixel)
+ public final int mMinFrameHeight, mMaxFrameHeight; // minn and max frame height (pixel)
+
+ // Private constructor called by JNI
+ private VideoEncoderCap(int codec,
+ int minBitRate, int maxBitRate,
+ int minFrameRate, int maxFrameRate,
+ int minFrameWidth, int maxFrameWidth,
+ int minFrameHeight, int maxFrameHeight) {
+ mCodec = codec;
+ mMinBitRate = minBitRate;
+ mMaxBitRate = maxBitRate;
+ mMinFrameRate = minFrameRate;
+ mMaxFrameRate = maxFrameRate;
+ mMinFrameWidth = minFrameWidth;
+ mMaxFrameWidth = maxFrameWidth;
+ mMinFrameHeight = minFrameHeight;
+ mMaxFrameHeight = maxFrameHeight;
+ }
+ };
+
+ /**
+ * The AudioEncoderCap class represents an audio encoder's
+ * parameter range in:
+ *
+ * <ul>
+ * <li>Bit rate: the compressed output bit rate in bits per second;
+ * <li>Sample rate: the sampling rate used for recording the audio in samples per second;
+ * <li>Number of channels: the number of channels the audio is recorded.
+ * </ul>
+ *
+ */
+ static public class AudioEncoderCap {
+ // These are not modifiable externally, thus are public accessible
+ public final int mCodec; // @see android.media.MediaRecorder.AudioEncoder
+ public final int mMinChannels, mMaxChannels; // min and max number of channels
+ public final int mMinSampleRate, mMaxSampleRate; // min and max sample rate (hz)
+ public final int mMinBitRate, mMaxBitRate; // min and max bit rate (bps)
+
+ // Private constructor called by JNI
+ private AudioEncoderCap(int codec,
+ int minBitRate, int maxBitRate,
+ int minSampleRate, int maxSampleRate,
+ int minChannels, int maxChannels) {
+ mCodec = codec;
+ mMinBitRate = minBitRate;
+ mMaxBitRate = maxBitRate;
+ mMinSampleRate = minSampleRate;
+ mMaxSampleRate = maxSampleRate;
+ mMinChannels = minChannels;
+ mMaxChannels = maxChannels;
+ }
+ };
+
+ static {
+ System.loadLibrary("media_jni");
+ native_init();
+ }
+
+ /**
+ * Returns the array of supported output file formats.
+ * @see android.media.MediaRecorder.OutputFormat
+ */
+ public static int[] getOutputFileFormats() {
+ int nFormats = native_get_num_file_formats();
+ if (nFormats == 0) return null;
+
+ int[] formats = new int[nFormats];
+ for (int i = 0; i < nFormats; ++i) {
+ formats[i] = native_get_file_format(i);
+ }
+ return formats;
+ }
+
+ /**
+ * Returns the capabilities of the supported video encoders.
+ * @see android.media.EncoderCapabilities.VideoEncoderCap
+ */
+ public static List<VideoEncoderCap> getVideoEncoders() {
+ int nEncoders = native_get_num_video_encoders();
+ if (nEncoders == 0) return null;
+
+ List<VideoEncoderCap> encoderList = new ArrayList<VideoEncoderCap>();
+ for (int i = 0; i < nEncoders; ++i) {
+ encoderList.add(native_get_video_encoder_cap(i));
+ }
+ return encoderList;
+ }
+
+ /**
+ * Returns the capabilities of the supported audio encoders.
+ * @see android.media.EncoderCapabilities.AudioEncoderCap
+ */
+ public static List<AudioEncoderCap> getAudioEncoders() {
+ int nEncoders = native_get_num_audio_encoders();
+ if (nEncoders == 0) return null;
+
+ List<AudioEncoderCap> encoderList = new ArrayList<AudioEncoderCap>();
+ for (int i = 0; i < nEncoders; ++i) {
+ encoderList.add(native_get_audio_encoder_cap(i));
+ }
+ return encoderList;
+ }
+
+
+ private EncoderCapabilities() {} // Don't call me
+
+ // Implemented by JNI
+ private static native final void native_init();
+ private static native final int native_get_num_file_formats();
+ private static native final int native_get_file_format(int index);
+ private static native final int native_get_num_video_encoders();
+ private static native final VideoEncoderCap native_get_video_encoder_cap(int index);
+ private static native final int native_get_num_audio_encoders();
+ private static native final AudioEncoderCap native_get_audio_encoder_cap(int index);
+}
diff --git a/media/java/android/media/MiniThumbFile.java b/media/java/android/media/MiniThumbFile.java
index f6e6317..df141c1 100644
--- a/media/java/android/media/MiniThumbFile.java
+++ b/media/java/android/media/MiniThumbFile.java
@@ -17,7 +17,6 @@
package android.media;
import android.graphics.Bitmap;
-import android.media.ThumbnailUtil;
import android.net.Uri;
import android.os.Environment;
import android.util.Log;
diff --git a/media/java/android/media/ThumbnailUtil.java b/media/java/android/media/ThumbnailUtils.java
similarity index 82%
rename from media/java/android/media/ThumbnailUtil.java
rename to media/java/android/media/ThumbnailUtils.java
index 0cf4e76..225d4b6 100644
--- a/media/java/android/media/ThumbnailUtil.java
+++ b/media/java/android/media/ThumbnailUtils.java
@@ -16,13 +16,6 @@
package android.media;
-import android.net.Uri;
-import android.os.ParcelFileDescriptor;
-import android.provider.BaseColumns;
-import android.provider.MediaStore.Images;
-import android.provider.MediaStore.Images.Thumbnails;
-import android.util.Log;
-
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
@@ -34,47 +27,171 @@
import android.graphics.Rect;
import android.media.MediaMetadataRetriever;
import android.media.MediaFile.MediaFileType;
+import android.net.Uri;
+import android.os.ParcelFileDescriptor;
+import android.provider.BaseColumns;
+import android.provider.MediaStore.Images;
+import android.provider.MediaStore.Images.Thumbnails;
+import android.util.Log;
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.OutputStream;
/**
- * Thumbnail generation routines for media provider. This class should only be used internaly.
- * {@hide} THIS IS NOT FOR PUBLIC API.
+ * Thumbnail generation routines for media provider.
*/
-public class ThumbnailUtil {
- private static final String TAG = "ThumbnailUtil";
- //Whether we should recycle the input (unless the output is the input).
- public static final boolean RECYCLE_INPUT = true;
- public static final boolean NO_RECYCLE_INPUT = false;
- public static final boolean ROTATE_AS_NEEDED = true;
- public static final boolean NO_ROTATE = false;
- public static final boolean USE_NATIVE = true;
- public static final boolean NO_NATIVE = false;
+public class ThumbnailUtils {
+ private static final String TAG = "ThumbnailUtils";
- public static final int THUMBNAIL_TARGET_SIZE = 320;
- public static final int MINI_THUMB_TARGET_SIZE = 96;
- public static final int THUMBNAIL_MAX_NUM_PIXELS = 512 * 384;
- public static final int MINI_THUMB_MAX_NUM_PIXELS = 128 * 128;
- public static final int UNCONSTRAINED = -1;
+ /* Maximum pixels size for created bitmap. */
+ private static final int THUMBNAIL_MAX_NUM_PIXELS = 512 * 384;
+ private static final int MINI_THUMB_MAX_NUM_PIXELS = 128 * 128;
+ private static final int UNCONSTRAINED = -1;
- // Returns Options that set the native alloc flag for Bitmap decode.
- public static BitmapFactory.Options createNativeAllocOptions() {
- BitmapFactory.Options options = new BitmapFactory.Options();
- options.inNativeAlloc = true;
- return options;
- }
+ /* Whether we should rotate the resulting bitmap. */
+ private static final boolean ROTATE_AS_NEEDED = true;
+ private static final boolean NO_ROTATE = false;
+
+ /* Whether we should create bitmap in native memory. */
+ private static final boolean USE_NATIVE = true;
+ private static final boolean NO_NATIVE = false;
+
/**
- * Make a bitmap from a given Uri.
- *
- * @param uri
+ * Constant used to indicate we should recycle the input in
+ * {@link #extractMiniThumb(Bitmap, int, int, boolean)} unless the output is the input.
*/
- public static Bitmap makeBitmap(int minSideLength, int maxNumOfPixels,
- Uri uri, ContentResolver cr) {
- return makeBitmap(minSideLength, maxNumOfPixels, uri, cr,
- NO_NATIVE);
+ public static final boolean RECYCLE_INPUT = true;
+
+ /**
+ * Constant used to indicate we should not recycle the input in
+ * {@link #extractMiniThumb(Bitmap, int, int, boolean)}.
+ */
+ public static final boolean NO_RECYCLE_INPUT = false;
+
+ /**
+ * Constant used to indicate the dimension of normal thumbnail in
+ * {@link #extractMiniThumb(Bitmap, int, int, boolean)}.
+ */
+ public static final int THUMBNAIL_TARGET_SIZE = 320;
+
+ /**
+ * Constant used to indicate the dimension of mini thumbnail in
+ * {@link #extractMiniThumb(Bitmap, int, int, boolean)}.
+ */
+ public static final int MINI_THUMB_TARGET_SIZE = 96;
+
+ /**
+ * This method first examines if the thumbnail embedded in EXIF is bigger than our target
+ * size. If not, then it'll create a thumbnail from original image. Due to efficiency
+ * consideration, we want to let MediaThumbRequest avoid calling this method twice for
+ * both kinds, so it only requests for MICRO_KIND and set saveImage to true.
+ *
+ * This method always returns a "square thumbnail" for MICRO_KIND thumbnail.
+ *
+ * @param cr ContentResolver
+ * @param filePath file path needed by EXIF interface
+ * @param uri URI of original image
+ * @param origId image id
+ * @param kind either MINI_KIND or MICRO_KIND
+ * @param saveMini Whether to save MINI_KIND thumbnail obtained in this method.
+ * @return Bitmap
+ */
+ public static Bitmap createImageThumbnail(ContentResolver cr, String filePath, Uri uri,
+ long origId, int kind, boolean saveMini) {
+ boolean wantMini = (kind == Images.Thumbnails.MINI_KIND || saveMini);
+ int targetSize = wantMini ?
+ THUMBNAIL_TARGET_SIZE : MINI_THUMB_TARGET_SIZE;
+ int maxPixels = wantMini ?
+ THUMBNAIL_MAX_NUM_PIXELS : MINI_THUMB_MAX_NUM_PIXELS;
+ SizedThumbnailBitmap sizedThumbnailBitmap = new SizedThumbnailBitmap();
+ Bitmap bitmap = null;
+ MediaFileType fileType = MediaFile.getFileType(filePath);
+ if (fileType != null && fileType.fileType == MediaFile.FILE_TYPE_JPEG) {
+ createThumbnailFromEXIF(filePath, targetSize, maxPixels, sizedThumbnailBitmap);
+ bitmap = sizedThumbnailBitmap.mBitmap;
+ }
+
+ if (bitmap == null) {
+ bitmap = makeBitmap(targetSize, maxPixels, uri, cr);
+ }
+
+ if (bitmap == null) {
+ return null;
+ }
+
+ if (saveMini) {
+ if (sizedThumbnailBitmap.mThumbnailData != null) {
+ storeThumbnail(cr, origId,
+ sizedThumbnailBitmap.mThumbnailData,
+ sizedThumbnailBitmap.mThumbnailWidth,
+ sizedThumbnailBitmap.mThumbnailHeight);
+ } else {
+ storeThumbnail(cr, origId, bitmap);
+ }
+ }
+
+ if (kind == Images.Thumbnails.MICRO_KIND) {
+ // now we make it a "square thumbnail" for MICRO_KIND thumbnail
+ bitmap = extractMiniThumb(bitmap,
+ MINI_THUMB_TARGET_SIZE,
+ MINI_THUMB_TARGET_SIZE, RECYCLE_INPUT);
+ }
+ return bitmap;
+ }
+
+ /**
+ * Create a video thumbnail for a video. May return null if the video is
+ * corrupt.
+ *
+ * @param filePath
+ */
+ public static Bitmap createVideoThumbnail(String filePath) {
+ Bitmap bitmap = null;
+ MediaMetadataRetriever retriever = new MediaMetadataRetriever();
+ try {
+ retriever.setMode(MediaMetadataRetriever.MODE_CAPTURE_FRAME_ONLY);
+ retriever.setDataSource(filePath);
+ bitmap = retriever.captureFrame();
+ } catch (IllegalArgumentException ex) {
+ // Assume this is a corrupt video file
+ } catch (RuntimeException ex) {
+ // Assume this is a corrupt video file.
+ } finally {
+ try {
+ retriever.release();
+ } catch (RuntimeException ex) {
+ // Ignore failures while cleaning up.
+ }
+ }
+ return bitmap;
+ }
+
+ /**
+ * Creates a centered bitmap of the desired size.
+ *
+ * @param source original bitmap source
+ * @param width targeted width
+ * @param height targeted height
+ * @param recycle whether we want to recycle the input
+ */
+ public static Bitmap extractMiniThumb(
+ Bitmap source, int width, int height, boolean recycle) {
+ if (source == null) {
+ return null;
+ }
+
+ float scale;
+ if (source.getWidth() < source.getHeight()) {
+ scale = width / (float) source.getWidth();
+ } else {
+ scale = height / (float) source.getHeight();
+ }
+ Matrix matrix = new Matrix();
+ matrix.setScale(scale, scale);
+ Bitmap miniThumbnail = transform(matrix, source, width, height, true, recycle);
+ return miniThumbnail;
}
/*
@@ -96,7 +213,7 @@
* For example, BitmapFactory downsamples an image by 2 even though the
* request is 3. So we round up the sample size to avoid OOM.
*/
- public static int computeSampleSize(BitmapFactory.Options options,
+ private static int computeSampleSize(BitmapFactory.Options options,
int minSideLength, int maxNumOfPixels) {
int initialSize = computeInitialSampleSize(options, minSideLength,
maxNumOfPixels);
@@ -140,7 +257,30 @@
}
}
- public static Bitmap makeBitmap(int minSideLength, int maxNumOfPixels,
+ /**
+ * Returns Options that set the native alloc flag for Bitmap decode.
+ */
+ private static BitmapFactory.Options createNativeAllocOptions() {
+ BitmapFactory.Options options = new BitmapFactory.Options();
+ options.inNativeAlloc = true;
+ return options;
+ }
+
+ /**
+ * Make a bitmap from a given Uri, minimal side length, and maximum number of pixels.
+ */
+ private static Bitmap makeBitmap(int minSideLength, int maxNumOfPixels,
+ Uri uri, ContentResolver cr) {
+ return makeBitmap(minSideLength, maxNumOfPixels, uri, cr,
+ NO_NATIVE);
+ }
+
+ /**
+ * Make a bitmap from a given Uri, minimal side length, and maximum number of pixels.
+ * The image data will be read from specified ContentResolver and clients are allowed to specify
+ * whether they want the Bitmap be created in native memory.
+ */
+ private static Bitmap makeBitmap(int minSideLength, int maxNumOfPixels,
Uri uri, ContentResolver cr, boolean useNative) {
ParcelFileDescriptor input = null;
try {
@@ -159,9 +299,52 @@
}
}
- // Rotates the bitmap by the specified degree.
- // If a new bitmap is created, the original bitmap is recycled.
- public static Bitmap rotate(Bitmap b, int degrees) {
+ /**
+ * Make a bitmap from a given Uri, minimal side length, and maximum number of pixels.
+ * The image data will be read from specified pfd if it's not null, otherwise
+ * a new input stream will be created using specified ContentResolver.
+ *
+ * Clients are allowed to pass their own BitmapFactory.Options used for bitmap decoding. A
+ * new BitmapFactory.Options will be created if options is null.
+ */
+ private static Bitmap makeBitmap(int minSideLength, int maxNumOfPixels,
+ Uri uri, ContentResolver cr, ParcelFileDescriptor pfd,
+ BitmapFactory.Options options) {
+ Bitmap b = null;
+ try {
+ if (pfd == null) pfd = makeInputStream(uri, cr);
+ if (pfd == null) return null;
+ if (options == null) options = new BitmapFactory.Options();
+
+ FileDescriptor fd = pfd.getFileDescriptor();
+ options.inSampleSize = 1;
+ options.inJustDecodeBounds = true;
+ BitmapFactory.decodeFileDescriptor(fd, null, options);
+ if (options.mCancel || options.outWidth == -1
+ || options.outHeight == -1) {
+ return null;
+ }
+ options.inSampleSize = computeSampleSize(
+ options, minSideLength, maxNumOfPixels);
+ options.inJustDecodeBounds = false;
+
+ options.inDither = false;
+ options.inPreferredConfig = Bitmap.Config.ARGB_8888;
+ b = BitmapFactory.decodeFileDescriptor(fd, null, options);
+ } catch (OutOfMemoryError ex) {
+ Log.e(TAG, "Got oom exception ", ex);
+ return null;
+ } finally {
+ closeSilently(pfd);
+ }
+ return b;
+ }
+
+ /**
+ * Rotates the bitmap by the specified degree.
+ * If a new bitmap is created, the original bitmap is recycled.
+ */
+ private static Bitmap rotate(Bitmap b, int degrees) {
if (degrees != 0 && b != null) {
Matrix m = new Matrix();
m.setRotate(degrees,
@@ -198,149 +381,10 @@
}
}
- public static Bitmap makeBitmap(int minSideLength, int maxNumOfPixels,
- Uri uri, ContentResolver cr, ParcelFileDescriptor pfd,
- BitmapFactory.Options options) {
- Bitmap b = null;
- try {
- if (pfd == null) pfd = makeInputStream(uri, cr);
- if (pfd == null) return null;
- if (options == null) options = new BitmapFactory.Options();
-
- FileDescriptor fd = pfd.getFileDescriptor();
- options.inSampleSize = 1;
- options.inJustDecodeBounds = true;
- BitmapFactory.decodeFileDescriptor(fd, null, options);
- if (options.mCancel || options.outWidth == -1
- || options.outHeight == -1) {
- return null;
- }
- options.inSampleSize = computeSampleSize(
- options, minSideLength, maxNumOfPixels);
- options.inJustDecodeBounds = false;
-
- options.inDither = false;
- options.inPreferredConfig = Bitmap.Config.ARGB_8888;
- b = BitmapFactory.decodeFileDescriptor(fd, null, options);
- } catch (OutOfMemoryError ex) {
- Log.e(TAG, "Got oom exception ", ex);
- return null;
- } finally {
- closeSilently(pfd);
- }
- return b;
- }
-
/**
- * Creates a centered bitmap of the desired size.
- * @param source
- * @param recycle whether we want to recycle the input
+ * Transform source Bitmap to targeted width and height.
*/
- public static Bitmap extractMiniThumb(
- Bitmap source, int width, int height, boolean recycle) {
- if (source == null) {
- return null;
- }
-
- float scale;
- if (source.getWidth() < source.getHeight()) {
- scale = width / (float) source.getWidth();
- } else {
- scale = height / (float) source.getHeight();
- }
- Matrix matrix = new Matrix();
- matrix.setScale(scale, scale);
- Bitmap miniThumbnail = transform(matrix, source, width, height, true, recycle);
- return miniThumbnail;
- }
-
- /**
- * Create a video thumbnail for a video. May return null if the video is
- * corrupt.
- *
- * @param filePath
- */
- public static Bitmap createVideoThumbnail(String filePath) {
- Bitmap bitmap = null;
- MediaMetadataRetriever retriever = new MediaMetadataRetriever();
- try {
- retriever.setMode(MediaMetadataRetriever.MODE_CAPTURE_FRAME_ONLY);
- retriever.setDataSource(filePath);
- bitmap = retriever.captureFrame();
- } catch (IllegalArgumentException ex) {
- // Assume this is a corrupt video file
- } catch (RuntimeException ex) {
- // Assume this is a corrupt video file.
- } finally {
- try {
- retriever.release();
- } catch (RuntimeException ex) {
- // Ignore failures while cleaning up.
- }
- }
- return bitmap;
- }
-
- /**
- * This method first examines if the thumbnail embedded in EXIF is bigger than our target
- * size. If not, then it'll create a thumbnail from original image. Due to efficiency
- * consideration, we want to let MediaThumbRequest avoid calling this method twice for
- * both kinds, so it only requests for MICRO_KIND and set saveImage to true.
- *
- * This method always returns a "square thumbnail" for MICRO_KIND thumbnail.
- *
- * @param cr ContentResolver
- * @param filePath file path needed by EXIF interface
- * @param uri URI of original image
- * @param origId image id
- * @param kind either MINI_KIND or MICRO_KIND
- * @param saveMini Whether to save MINI_KIND thumbnail obtained in this method.
- * @return Bitmap
- */
- public static Bitmap createImageThumbnail(ContentResolver cr, String filePath, Uri uri,
- long origId, int kind, boolean saveMini) {
- boolean wantMini = (kind == Images.Thumbnails.MINI_KIND || saveMini);
- int targetSize = wantMini ?
- ThumbnailUtil.THUMBNAIL_TARGET_SIZE : ThumbnailUtil.MINI_THUMB_TARGET_SIZE;
- int maxPixels = wantMini ?
- ThumbnailUtil.THUMBNAIL_MAX_NUM_PIXELS : ThumbnailUtil.MINI_THUMB_MAX_NUM_PIXELS;
- SizedThumbnailBitmap sizedThumbnailBitmap = new SizedThumbnailBitmap();
- Bitmap bitmap = null;
- MediaFileType fileType = MediaFile.getFileType(filePath);
- if (fileType != null && fileType.fileType == MediaFile.FILE_TYPE_JPEG) {
- createThumbnailFromEXIF(filePath, targetSize, maxPixels, sizedThumbnailBitmap);
- bitmap = sizedThumbnailBitmap.mBitmap;
- }
-
- if (bitmap == null) {
- bitmap = ThumbnailUtil.makeBitmap(targetSize, maxPixels, uri, cr);
- }
-
- if (bitmap == null) {
- return null;
- }
-
- if (saveMini) {
- if (sizedThumbnailBitmap.mThumbnailData != null) {
- ThumbnailUtil.storeThumbnail(cr, origId,
- sizedThumbnailBitmap.mThumbnailData,
- sizedThumbnailBitmap.mThumbnailWidth,
- sizedThumbnailBitmap.mThumbnailHeight);
- } else {
- ThumbnailUtil.storeThumbnail(cr, origId, bitmap);
- }
- }
-
- if (kind == Images.Thumbnails.MICRO_KIND) {
- // now we make it a "square thumbnail" for MICRO_KIND thumbnail
- bitmap = ThumbnailUtil.extractMiniThumb(bitmap,
- ThumbnailUtil.MINI_THUMB_TARGET_SIZE,
- ThumbnailUtil.MINI_THUMB_TARGET_SIZE, ThumbnailUtil.RECYCLE_INPUT);
- }
- return bitmap;
- }
-
- public static Bitmap transform(Matrix scaler,
+ private static Bitmap transform(Matrix scaler,
Bitmap source,
int targetWidth,
int targetHeight,
@@ -441,10 +485,6 @@
/**
* Look up thumbnail uri by given imageId, it will be automatically created if it's not created
* yet. Most of the time imageId is identical to thumbId, but it's not always true.
- * @param req
- * @param width
- * @param height
- * @return Uri Thumbnail uri
*/
private static Uri getImageThumbnailUri(ContentResolver cr, long origId, int width, int height) {
Uri thumbUri = Images.Thumbnails.EXTERNAL_CONTENT_URI;
@@ -513,10 +553,14 @@
}
}
- // SizedThumbnailBitmap contains the bitmap, which is downsampled either from
- // the thumbnail in exif or the full image.
- // mThumbnailData, mThumbnailWidth and mThumbnailHeight are set together only if mThumbnail is not null.
- // The width/height of the sized bitmap may be different from mThumbnailWidth/mThumbnailHeight.
+ /**
+ * SizedThumbnailBitmap contains the bitmap, which is downsampled either from
+ * the thumbnail in exif or the full image.
+ * mThumbnailData, mThumbnailWidth and mThumbnailHeight are set together only if mThumbnail
+ * is not null.
+ *
+ * The width/height of the sized bitmap may be different from mThumbnailWidth/mThumbnailHeight.
+ */
private static class SizedThumbnailBitmap {
public byte[] mThumbnailData;
public Bitmap mBitmap;
@@ -524,9 +568,11 @@
public int mThumbnailHeight;
}
- // Creates a bitmap by either downsampling from the thumbnail in EXIF or the full image.
- // The functions returns a SizedThumbnailBitmap,
- // which contains a downsampled bitmap and the thumbnail data in EXIF if exists.
+ /**
+ * Creates a bitmap by either downsampling from the thumbnail in EXIF or the full image.
+ * The functions returns a SizedThumbnailBitmap,
+ * which contains a downsampled bitmap and the thumbnail data in EXIF if exists.
+ */
private static void createThumbnailFromEXIF(String filePath, int targetSize,
int maxPixels, SizedThumbnailBitmap sizedThumbBitmap) {
if (filePath == null) return;
diff --git a/media/jni/Android.mk b/media/jni/Android.mk
index 1d82e32..d83f493 100644
--- a/media/jni/Android.mk
+++ b/media/jni/Android.mk
@@ -10,7 +10,8 @@
android_media_MediaRecorder.cpp \
android_media_MediaScanner.cpp \
android_media_MediaMetadataRetriever.cpp \
- android_media_ResampleInputStream.cpp
+ android_media_ResampleInputStream.cpp \
+ android_media_MediaProfiles.cpp
LOCAL_SHARED_LIBRARIES := \
libandroid_runtime \
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index 27f5668..76d1674 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -739,6 +739,7 @@
extern int register_android_media_MediaRecorder(JNIEnv *env);
extern int register_android_media_MediaScanner(JNIEnv *env);
extern int register_android_media_ResampleInputStream(JNIEnv *env);
+extern int register_android_media_MediaProfiles(JNIEnv *env);
#ifndef NO_OPENCORE
extern int register_android_media_AmrInputStream(JNIEnv *env);
@@ -787,6 +788,11 @@
goto bail;
}
+ if (register_android_media_MediaProfiles(env) < 0) {
+ LOGE("ERROR: MediaProfiles native registration failed");
+ goto bail;
+ }
+
/* success -- return valid version number */
result = JNI_VERSION_1_4;
diff --git a/media/jni/android_media_MediaProfiles.cpp b/media/jni/android_media_MediaProfiles.cpp
new file mode 100644
index 0000000..cd3ad88
--- /dev/null
+++ b/media/jni/android_media_MediaProfiles.cpp
@@ -0,0 +1,187 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "MediaProfilesJNI"
+#include <utils/Log.h>
+
+#include <stdio.h>
+#include <utils/threads.h>
+
+#include "jni.h"
+#include "JNIHelp.h"
+#include "android_runtime/AndroidRuntime.h"
+#include <media/MediaProfiles.h>
+
+using namespace android;
+
+static Mutex sLock;
+MediaProfiles *sProfiles = NULL;
+
+// This function is called from a static block in MediaProfiles.java class,
+// which won't run until the first time an instance of this class is used.
+static void
+android_media_MediaProfiles_native_init(JNIEnv *env)
+{
+ LOGV("native_init");
+ Mutex::Autolock lock(sLock);
+
+ if (sProfiles == NULL) {
+ sProfiles = MediaProfiles::getInstance();
+ }
+}
+
+static int
+android_media_MediaProfiles_native_get_num_file_formats(JNIEnv *env, jobject thiz)
+{
+ LOGV("native_get_num_file_formats");
+ return sProfiles->getOutputFileFormats().size();
+}
+
+static int
+android_media_MediaProfiles_native_get_file_format(JNIEnv *env, jobject thiz, jint index)
+{
+ LOGV("native_get_file_format: %d", index);
+ Vector<output_format> formats = sProfiles->getOutputFileFormats();
+ int nSize = formats.size();
+ if (index < 0 || index >= nSize) {
+ jniThrowException(env, "java/lang/IllegalArgumentException", "out of array boundary");
+ return -1;
+ }
+ int format = static_cast<int>(formats[index]);
+ return format;
+}
+
+static int
+android_media_MediaProfiles_native_get_num_video_encoders(JNIEnv *env, jobject thiz)
+{
+ LOGV("native_get_num_video_encoders");
+ return sProfiles->getVideoEncoders().size();
+}
+
+static jobject
+android_media_MediaProfiles_native_get_video_encoder_cap(JNIEnv *env, jobject thiz, jint index)
+{
+ LOGV("native_get_video_encoder_cap: %d", index);
+ Vector<video_encoder> encoders = sProfiles->getVideoEncoders();
+ int nSize = encoders.size();
+ if (index < 0 || index >= nSize) {
+ jniThrowException(env, "java/lang/IllegalArgumentException", "out of array boundary");
+ return NULL;
+ }
+
+ video_encoder encoder = encoders[index];
+ int minBitRate = sProfiles->getVideoEncoderParamByName("enc.vid.bps.min", encoder);
+ int maxBitRate = sProfiles->getVideoEncoderParamByName("enc.vid.bps.max", encoder);
+ int minFrameRate = sProfiles->getVideoEncoderParamByName("enc.vid.fps.min", encoder);
+ int maxFrameRate = sProfiles->getVideoEncoderParamByName("enc.vid.fps.max", encoder);
+ int minFrameWidth = sProfiles->getVideoEncoderParamByName("enc.vid.width.min", encoder);
+ int maxFrameWidth = sProfiles->getVideoEncoderParamByName("enc.vid.width.max", encoder);
+ int minFrameHeight = sProfiles->getVideoEncoderParamByName("enc.vid.height.min", encoder);
+ int maxFrameHeight = sProfiles->getVideoEncoderParamByName("enc.vid.height.max", encoder);
+
+ // Check on the values retrieved
+ if ((minBitRate == -1 || maxBitRate == -1) ||
+ (minFrameRate == -1 || maxFrameRate == -1) ||
+ (minFrameWidth == -1 || maxFrameWidth == -1) ||
+ (minFrameHeight == -1 || maxFrameHeight == -1)) {
+
+ jniThrowException(env, "java/lang/RuntimeException", "Error retrieving video encoder capability params");
+ return NULL;
+ }
+
+ // Construct an instance of the VideoEncoderCap and set its member variables
+ jclass videoEncoderCapClazz = env->FindClass("android/media/EncoderCapabilities$VideoEncoderCap");
+ jmethodID videoEncoderCapConstructorMethodID = env->GetMethodID(videoEncoderCapClazz, "<init>", "(IIIIIIIII)V");
+ jobject cap = env->NewObject(videoEncoderCapClazz,
+ videoEncoderCapConstructorMethodID,
+ static_cast<int>(encoder),
+ minBitRate, maxBitRate,
+ minFrameRate, maxFrameRate,
+ minFrameWidth, maxFrameWidth,
+ minFrameHeight, maxFrameHeight);
+ return cap;
+}
+
+static int
+android_media_MediaProfiles_native_get_num_audio_encoders(JNIEnv *env, jobject thiz)
+{
+ LOGV("native_get_num_audio_encoders");
+ return sProfiles->getAudioEncoders().size();
+}
+
+static jobject
+android_media_MediaProfiles_native_get_audio_encoder_cap(JNIEnv *env, jobject thiz, jint index)
+{
+ LOGV("native_get_audio_encoder_cap: %d", index);
+ Vector<audio_encoder> encoders = sProfiles->getAudioEncoders();
+ int nSize = encoders.size();
+ if (index < 0 || index >= nSize) {
+ jniThrowException(env, "java/lang/IllegalArgumentException", "out of array boundary");
+ return NULL;
+ }
+
+ audio_encoder encoder = encoders[index];
+ int minBitRate = sProfiles->getAudioEncoderParamByName("enc.aud.bps.min", encoder);
+ int maxBitRate = sProfiles->getAudioEncoderParamByName("enc.aud.bps.max", encoder);
+ int minSampleRate = sProfiles->getAudioEncoderParamByName("enc.aud.hz.min", encoder);
+ int maxSampleRate = sProfiles->getAudioEncoderParamByName("enc.aud.hz.max", encoder);
+ int minChannels = sProfiles->getAudioEncoderParamByName("enc.aud.ch.min", encoder);
+ int maxChannels = sProfiles->getAudioEncoderParamByName("enc.aud.ch.max", encoder);
+
+ // Check on the values retrieved
+ if ((minBitRate == -1 || maxBitRate == -1) ||
+ (minSampleRate == -1 || maxSampleRate == -1) ||
+ (minChannels == -1 || maxChannels == -1)) {
+
+ jniThrowException(env, "java/lang/RuntimeException", "Error retrieving video encoder capability params");
+ return NULL;
+ }
+
+ jclass audioEncoderCapClazz = env->FindClass("android/media/EncoderCapabilities$AudioEncoderCap");
+ jmethodID audioEncoderCapConstructorMethodID = env->GetMethodID(audioEncoderCapClazz, "<init>", "(IIIIIII)V");
+ jobject cap = env->NewObject(audioEncoderCapClazz,
+ audioEncoderCapConstructorMethodID,
+ static_cast<int>(encoder),
+ minBitRate, maxBitRate,
+ minSampleRate, maxSampleRate,
+ minChannels, maxChannels);
+ return cap;
+}
+
+static JNINativeMethod gMethods[] = {
+ {"native_init", "()V", (void *)android_media_MediaProfiles_native_init},
+ {"native_get_num_file_formats", "()I", (void *)android_media_MediaProfiles_native_get_num_file_formats},
+ {"native_get_file_format", "(I)I", (void *)android_media_MediaProfiles_native_get_file_format},
+ {"native_get_num_video_encoders", "()I", (void *)android_media_MediaProfiles_native_get_num_video_encoders},
+ {"native_get_num_audio_encoders", "()I", (void *)android_media_MediaProfiles_native_get_num_audio_encoders},
+
+ {"native_get_video_encoder_cap", "(I)Landroid/media/EncoderCapabilities$VideoEncoderCap;",
+ (void *)android_media_MediaProfiles_native_get_video_encoder_cap},
+
+ {"native_get_audio_encoder_cap", "(I)Landroid/media/EncoderCapabilities$AudioEncoderCap;",
+ (void *)android_media_MediaProfiles_native_get_audio_encoder_cap},
+};
+
+static const char* const kClassPathName = "android/media/MediaProfiles";
+
+// This function only registers the native methods, and is called from
+// JNI_OnLoad in android_media_MediaPlayer.cpp
+int register_android_media_MediaProfiles(JNIEnv *env)
+{
+ return AndroidRuntime::registerNativeMethods(env,
+ "android/media/EncoderCapabilities", gMethods, NELEM(gMethods));
+}
diff --git a/media/libmedia/Android.mk b/media/libmedia/Android.mk
index 4ae4ec9b..c59d323 100644
--- a/media/libmedia/Android.mk
+++ b/media/libmedia/Android.mk
@@ -25,10 +25,11 @@
MediaScanner.cpp \
MediaScannerClient.cpp \
autodetect.cpp \
- IMediaDeathNotifier.cpp
+ IMediaDeathNotifier.cpp \
+ MediaProfiles.cpp
LOCAL_SHARED_LIBRARIES := \
- libui libcutils libutils libbinder libsonivox libicuuc
+ libui libcutils libutils libbinder libsonivox libicuuc libexpat
LOCAL_MODULE:= libmedia
@@ -43,10 +44,11 @@
LOCAL_C_INCLUDES := \
$(JNI_H_INCLUDE) \
$(call include-path-for, graphics corecg) \
- $(TOP)/external/opencore/extern_libs_v2/khronos/openmax/include \
- external/speex/include \
- external/speex/libspeex \
- external/icu4c/common
+ $(TOP)/external/opencore/extern_libs_v2/khronos/openmax/include \
+ external/speex/include \
+ external/speex/libspeex \
+ external/icu4c/common \
+ external/expat/lib
LOCAL_STATIC_LIBRARIES := libspeex
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index f4165ff..7bbd0b2 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -32,7 +32,6 @@
#include <binder/IServiceManager.h>
#include <utils/Log.h>
-#include <binder/MemoryDealer.h>
#include <binder/Parcel.h>
#include <binder/IPCThreadState.h>
#include <utils/Timers.h>
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index ad0f42e..74852dc 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -32,7 +32,6 @@
#include <media/AudioTrack.h>
#include <utils/Log.h>
-#include <binder/MemoryDealer.h>
#include <binder/Parcel.h>
#include <binder/IPCThreadState.h>
#include <utils/Timers.h>
diff --git a/media/libmedia/MediaProfiles.cpp b/media/libmedia/MediaProfiles.cpp
new file mode 100644
index 0000000..0efade1
--- /dev/null
+++ b/media/libmedia/MediaProfiles.cpp
@@ -0,0 +1,675 @@
+/*
+**
+** Copyright 2010, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "MediaProfiles"
+
+#include <stdlib.h>
+#include <utils/Log.h>
+#include <utils/Vector.h>
+#include <cutils/properties.h>
+#include <expat.h>
+#include <media/MediaProfiles.h>
+#include <media/stagefright/MediaDebug.h>
+
+namespace android {
+
+Mutex MediaProfiles::sLock;
+bool MediaProfiles::sIsInitialized = false;
+MediaProfiles *MediaProfiles::sInstance = NULL;
+
+const MediaProfiles::NameToTagMap MediaProfiles::sVideoEncoderNameMap[] = {
+ {"h263", VIDEO_ENCODER_H263},
+ {"h264", VIDEO_ENCODER_H264},
+ {"m4v", VIDEO_ENCODER_MPEG_4_SP}
+};
+
+const MediaProfiles::NameToTagMap MediaProfiles::sAudioEncoderNameMap[] = {
+ {"amrnb", AUDIO_ENCODER_AMR_NB},
+ {"amrwb", AUDIO_ENCODER_AMR_WB},
+ {"aac", AUDIO_ENCODER_AAC},
+};
+
+const MediaProfiles::NameToTagMap MediaProfiles::sFileFormatMap[] = {
+ {"3gp", OUTPUT_FORMAT_THREE_GPP},
+ {"mp4", OUTPUT_FORMAT_MPEG_4}
+};
+
+const MediaProfiles::NameToTagMap MediaProfiles::sVideoDecoderNameMap[] = {
+ {"wmv", VIDEO_DECODER_WMV}
+};
+
+const MediaProfiles::NameToTagMap MediaProfiles::sAudioDecoderNameMap[] = {
+ {"wma", AUDIO_DECODER_WMA}
+};
+
+const MediaProfiles::NameToTagMap MediaProfiles::sCamcorderQualityNameMap[] = {
+ {"high", CAMCORDER_QUALITY_HIGH},
+ {"low", CAMCORDER_QUALITY_LOW}
+};
+
+/*static*/ void
+MediaProfiles::logVideoCodec(const MediaProfiles::VideoCodec& codec)
+{
+ LOGV("video codec:");
+ LOGV("codec = %d", codec.mCodec);
+ LOGV("bit rate: %d", codec.mBitRate);
+ LOGV("frame width: %d", codec.mFrameWidth);
+ LOGV("frame height: %d", codec.mFrameHeight);
+ LOGV("frame rate: %d", codec.mFrameRate);
+}
+
+/*static*/ void
+MediaProfiles::logAudioCodec(const MediaProfiles::AudioCodec& codec)
+{
+ LOGV("audio codec:");
+ LOGV("codec = %d", codec.mCodec);
+ LOGV("bit rate: %d", codec.mBitRate);
+ LOGV("sample rate: %d", codec.mSampleRate);
+ LOGV("number of channels: %d", codec.mChannels);
+}
+
+/*static*/ void
+MediaProfiles::logVideoEncoderCap(const MediaProfiles::VideoEncoderCap& cap)
+{
+ LOGV("video encoder cap:");
+ LOGV("codec = %d", cap.mCodec);
+ LOGV("bit rate: min = %d and max = %d", cap.mMinBitRate, cap.mMaxBitRate);
+ LOGV("frame width: min = %d and max = %d", cap.mMinFrameWidth, cap.mMaxFrameWidth);
+ LOGV("frame height: min = %d and max = %d", cap.mMinFrameHeight, cap.mMaxFrameHeight);
+ LOGV("frame rate: min = %d and max = %d", cap.mMinFrameRate, cap.mMaxFrameRate);
+}
+
+/*static*/ void
+MediaProfiles::logAudioEncoderCap(const MediaProfiles::AudioEncoderCap& cap)
+{
+ LOGV("audio encoder cap:");
+ LOGV("codec = %d", cap.mCodec);
+ LOGV("bit rate: min = %d and max = %d", cap.mMinBitRate, cap.mMaxBitRate);
+ LOGV("sample rate: min = %d and max = %d", cap.mMinSampleRate, cap.mMaxSampleRate);
+ LOGV("number of channels: min = %d and max = %d", cap.mMinChannels, cap.mMaxChannels);
+}
+
+/*static*/ void
+MediaProfiles::logVideoDecoderCap(const MediaProfiles::VideoDecoderCap& cap)
+{
+ LOGV("video decoder cap:");
+ LOGV("codec = %d", cap.mCodec);
+}
+
+/*static*/ void
+MediaProfiles::logAudioDecoderCap(const MediaProfiles::AudioDecoderCap& cap)
+{
+ LOGV("audio codec cap:");
+ LOGV("codec = %d", cap.mCodec);
+}
+
+/*static*/ int
+MediaProfiles::findTagForName(const MediaProfiles::NameToTagMap *map, size_t nMappings, const char *name)
+{
+ int tag = -1;
+ for (size_t i = 0; i < nMappings; ++i) {
+ if (!strcmp(map[i].name, name)) {
+ tag = map[i].tag;
+ break;
+ }
+ }
+ return tag;
+}
+
+/*static*/ MediaProfiles::VideoCodec*
+MediaProfiles::createVideoCodec(const char **atts, MediaProfiles *profiles)
+{
+ CHECK(!strcmp("codec", atts[0]) &&
+ !strcmp("bitRate", atts[2]) &&
+ !strcmp("width", atts[4]) &&
+ !strcmp("height", atts[6]) &&
+ !strcmp("frameRate", atts[8]));
+
+ const size_t nMappings = sizeof(sVideoEncoderNameMap)/sizeof(sVideoEncoderNameMap[0]);
+ const int codec = findTagForName(sVideoEncoderNameMap, nMappings, atts[1]);
+ CHECK(codec != -1);
+
+ MediaProfiles::VideoCodec *videoCodec =
+ new MediaProfiles::VideoCodec(static_cast<video_encoder>(codec),
+ atoi(atts[3]), atoi(atts[5]), atoi(atts[7]), atoi(atts[9]));
+ logVideoCodec(*videoCodec);
+
+ size_t nCamcorderProfiles;
+ CHECK((nCamcorderProfiles = profiles->mCamcorderProfiles.size()) >= 1);
+ profiles->mCamcorderProfiles[nCamcorderProfiles - 1]->mVideoCodec = videoCodec;
+ return videoCodec;
+}
+
+/*static*/ MediaProfiles::AudioCodec*
+MediaProfiles::createAudioCodec(const char **atts, MediaProfiles *profiles)
+{
+ CHECK(!strcmp("codec", atts[0]) &&
+ !strcmp("bitRate", atts[2]) &&
+ !strcmp("sampleRate", atts[4]) &&
+ !strcmp("channels", atts[6]));
+ const size_t nMappings = sizeof(sAudioEncoderNameMap)/sizeof(sAudioEncoderNameMap[0]);
+ const int codec = findTagForName(sAudioEncoderNameMap, nMappings, atts[1]);
+ CHECK(codec != -1);
+
+ MediaProfiles::AudioCodec *audioCodec =
+ new MediaProfiles::AudioCodec(static_cast<audio_encoder>(codec),
+ atoi(atts[3]), atoi(atts[5]), atoi(atts[7]));
+ logAudioCodec(*audioCodec);
+
+ size_t nCamcorderProfiles;
+ CHECK((nCamcorderProfiles = profiles->mCamcorderProfiles.size()) >= 1);
+ profiles->mCamcorderProfiles[nCamcorderProfiles - 1]->mAudioCodec = audioCodec;
+ return audioCodec;
+}
+/*static*/ MediaProfiles::AudioDecoderCap*
+MediaProfiles::createAudioDecoderCap(const char **atts)
+{
+ CHECK(!strcmp("name", atts[0]) &&
+ !strcmp("enabled", atts[2]));
+
+ const size_t nMappings = sizeof(sAudioDecoderNameMap)/sizeof(sAudioDecoderNameMap[0]);
+ const int codec = findTagForName(sAudioDecoderNameMap, nMappings, atts[1]);
+ CHECK(codec != -1);
+
+ MediaProfiles::AudioDecoderCap *cap =
+ new MediaProfiles::AudioDecoderCap(static_cast<audio_decoder>(codec));
+ logAudioDecoderCap(*cap);
+ return cap;
+}
+
+/*static*/ MediaProfiles::VideoDecoderCap*
+MediaProfiles::createVideoDecoderCap(const char **atts)
+{
+ CHECK(!strcmp("name", atts[0]) &&
+ !strcmp("enabled", atts[2]));
+
+ const size_t nMappings = sizeof(sVideoDecoderNameMap)/sizeof(sVideoDecoderNameMap[0]);
+ const int codec = findTagForName(sVideoDecoderNameMap, nMappings, atts[1]);
+ CHECK(codec != -1);
+
+ MediaProfiles::VideoDecoderCap *cap =
+ new MediaProfiles::VideoDecoderCap(static_cast<video_decoder>(codec));
+ logVideoDecoderCap(*cap);
+ return cap;
+}
+
+/*static*/ MediaProfiles::VideoEncoderCap*
+MediaProfiles::createVideoEncoderCap(const char **atts)
+{
+ CHECK(!strcmp("name", atts[0]) &&
+ !strcmp("enabled", atts[2]) &&
+ !strcmp("minBitRate", atts[4]) &&
+ !strcmp("maxBitRate", atts[6]) &&
+ !strcmp("minFrameWidth", atts[8]) &&
+ !strcmp("maxFrameWidth", atts[10]) &&
+ !strcmp("minFrameHeight", atts[12]) &&
+ !strcmp("maxFrameHeight", atts[14]) &&
+ !strcmp("minFrameRate", atts[16]) &&
+ !strcmp("maxFrameRate", atts[18]));
+
+ const size_t nMappings = sizeof(sVideoEncoderNameMap)/sizeof(sVideoEncoderNameMap[0]);
+ const int codec = findTagForName(sVideoEncoderNameMap, nMappings, atts[1]);
+ CHECK(codec != -1);
+
+ MediaProfiles::VideoEncoderCap *cap =
+ new MediaProfiles::VideoEncoderCap(static_cast<video_encoder>(codec),
+ atoi(atts[5]), atoi(atts[7]), atoi(atts[9]), atoi(atts[11]), atoi(atts[13]),
+ atoi(atts[15]), atoi(atts[17]), atoi(atts[19]));
+ logVideoEncoderCap(*cap);
+ return cap;
+}
+
+/*static*/ MediaProfiles::AudioEncoderCap*
+MediaProfiles::createAudioEncoderCap(const char **atts)
+{
+ CHECK(!strcmp("name", atts[0]) &&
+ !strcmp("enabled", atts[2]) &&
+ !strcmp("minBitRate", atts[4]) &&
+ !strcmp("maxBitRate", atts[6]) &&
+ !strcmp("minSampleRate", atts[8]) &&
+ !strcmp("maxSampleRate", atts[10]) &&
+ !strcmp("minChannels", atts[12]) &&
+ !strcmp("maxChannels", atts[14]));
+
+ const size_t nMappings = sizeof(sAudioEncoderNameMap)/sizeof(sAudioEncoderNameMap[0]);
+ const int codec = findTagForName(sAudioEncoderNameMap, nMappings, atts[1]);
+ CHECK(codec != -1);
+
+ MediaProfiles::AudioEncoderCap *cap =
+ new MediaProfiles::AudioEncoderCap(static_cast<audio_encoder>(codec), atoi(atts[5]), atoi(atts[7]),
+ atoi(atts[9]), atoi(atts[11]), atoi(atts[13]),
+ atoi(atts[15]));
+ logAudioEncoderCap(*cap);
+ return cap;
+}
+
+/*static*/ output_format
+MediaProfiles::createEncoderOutputFileFormat(const char **atts)
+{
+ CHECK(!strcmp("name", atts[0]));
+
+ const size_t nMappings =sizeof(sFileFormatMap)/sizeof(sFileFormatMap[0]);
+ const int format = findTagForName(sFileFormatMap, nMappings, atts[1]);
+ CHECK(format != -1);
+
+ return static_cast<output_format>(format);
+}
+
+/*static*/ MediaProfiles::CamcorderProfile*
+MediaProfiles::createCamcorderProfile(const char **atts)
+{
+ CHECK(!strcmp("quality", atts[0]) &&
+ !strcmp("fileFormat", atts[2]) &&
+ !strcmp("duration", atts[4]));
+
+ const size_t nProfileMappings = sizeof(sCamcorderQualityNameMap)/sizeof(sCamcorderQualityNameMap[0]);
+ const int quality = findTagForName(sCamcorderQualityNameMap, nProfileMappings, atts[1]);
+ CHECK(quality != -1);
+
+ const size_t nFormatMappings = sizeof(sFileFormatMap)/sizeof(sFileFormatMap[0]);
+ const int fileFormat = findTagForName(sFileFormatMap, nFormatMappings, atts[3]);
+ CHECK(fileFormat != -1);
+
+ MediaProfiles::CamcorderProfile *profile = new MediaProfiles::CamcorderProfile;
+ profile->mFileFormat = static_cast<output_format>(fileFormat);
+ profile->mQuality = static_cast<camcorder_quality>(quality);
+ profile->mDuration = atoi(atts[5]);
+ return profile;
+}
+
+/*static*/ void
+MediaProfiles::startElementHandler(void *userData, const char *name, const char **atts)
+{
+ MediaProfiles *profiles = (MediaProfiles *) userData;
+ if (strcmp("Video", name) == 0) {
+ createVideoCodec(atts, profiles);
+ } else if (strcmp("Audio", name) == 0) {
+ createAudioCodec(atts, profiles);
+ } else if (strcmp("VideoEncoderCap", name) == 0 &&
+ strcmp("true", atts[3]) == 0) {
+ profiles->mVideoEncoders.add(createVideoEncoderCap(atts));
+ } else if (strcmp("AudioEncoderCap", name) == 0 &&
+ strcmp("true", atts[3]) == 0) {
+ profiles->mAudioEncoders.add(createAudioEncoderCap(atts));
+ } else if (strcmp("VideoDecoderCap", name) == 0 &&
+ strcmp("true", atts[3]) == 0) {
+ profiles->mVideoDecoders.add(createVideoDecoderCap(atts));
+ } else if (strcmp("AudioDecoderCap", name) == 0 &&
+ strcmp("true", atts[3]) == 0) {
+ profiles->mAudioDecoders.add(createAudioDecoderCap(atts));
+ } else if (strcmp("EncoderOutputFileFormat", name) == 0) {
+ profiles->mEncoderOutputFileFormats.add(createEncoderOutputFileFormat(atts));
+ } else if (strcmp("EncoderProfile", name) == 0) {
+ profiles->mCamcorderProfiles.add(createCamcorderProfile(atts));
+ }
+}
+
+/*static*/ MediaProfiles*
+MediaProfiles::getInstance()
+{
+ LOGV("getInstance");
+ Mutex::Autolock lock(sLock);
+ if (!sIsInitialized) {
+ char value[PROPERTY_VALUE_MAX];
+ if (property_get("media.settings.xml", value, NULL) <= 0) {
+ const char *defaultXmlFile = "/etc/media_profiles.xml";
+ FILE *fp = fopen(defaultXmlFile, "r");
+ if (fp == NULL) {
+ LOGW("could not find media config xml file");
+ sInstance = createDefaultInstance();
+ } else {
+ fclose(fp); // close the file first.
+ sInstance = createInstanceFromXmlFile(defaultXmlFile);
+ }
+ } else {
+ sInstance = createInstanceFromXmlFile(value);
+ }
+ }
+
+ return sInstance;
+}
+
+/*static*/ MediaProfiles::VideoEncoderCap*
+MediaProfiles::createDefaultH263VideoEncoderCap()
+{
+ return new MediaProfiles::VideoEncoderCap(
+ VIDEO_ENCODER_H263, 192000, 420000, 176, 352, 144, 288, 1, 20);
+}
+
+/*static*/ MediaProfiles::VideoEncoderCap*
+MediaProfiles::createDefaultM4vVideoEncoderCap()
+{
+ return new MediaProfiles::VideoEncoderCap(
+ VIDEO_ENCODER_MPEG_4_SP, 192000, 420000, 176, 352, 144, 288, 1, 20);
+}
+
+
+/*static*/ void
+MediaProfiles::createDefaultVideoEncoders(MediaProfiles *profiles)
+{
+ profiles->mVideoEncoders.add(createDefaultH263VideoEncoderCap());
+ profiles->mVideoEncoders.add(createDefaultM4vVideoEncoderCap());
+}
+
+/*static*/ MediaProfiles::CamcorderProfile*
+MediaProfiles::createDefaultCamcorderHighProfile()
+{
+ MediaProfiles::VideoCodec *videoCodec =
+ new MediaProfiles::VideoCodec(VIDEO_ENCODER_H263, 360000, 352, 288, 20);
+
+ AudioCodec *audioCodec = new AudioCodec(AUDIO_ENCODER_AMR_NB, 12200, 8000, 1);
+ CamcorderProfile *profile = new CamcorderProfile;
+ profile->mFileFormat = OUTPUT_FORMAT_THREE_GPP;
+ profile->mQuality = CAMCORDER_QUALITY_HIGH;
+ profile->mDuration = 60;
+ profile->mVideoCodec = videoCodec;
+ profile->mAudioCodec = audioCodec;
+ return profile;
+}
+
+/*static*/ MediaProfiles::CamcorderProfile*
+MediaProfiles::createDefaultCamcorderLowProfile()
+{
+ MediaProfiles::VideoCodec *videoCodec =
+ new MediaProfiles::VideoCodec(VIDEO_ENCODER_H263, 192000, 176, 144, 20);
+
+ MediaProfiles::AudioCodec *audioCodec =
+ new MediaProfiles::AudioCodec(AUDIO_ENCODER_AMR_NB, 12200, 8000, 1);
+
+ MediaProfiles::CamcorderProfile *profile = new MediaProfiles::CamcorderProfile;
+ profile->mFileFormat = OUTPUT_FORMAT_THREE_GPP;
+ profile->mQuality = CAMCORDER_QUALITY_LOW;
+ profile->mDuration = 30;
+ profile->mVideoCodec = videoCodec;
+ profile->mAudioCodec = audioCodec;
+ return profile;
+}
+
+/*static*/ void
+MediaProfiles::createDefaultCamcorderProfiles(MediaProfiles *profiles)
+{
+ profiles->mCamcorderProfiles.add(createDefaultCamcorderHighProfile());
+ profiles->mCamcorderProfiles.add(createDefaultCamcorderLowProfile());
+}
+
+/*static*/ void
+MediaProfiles::createDefaultAudioEncoders(MediaProfiles *profiles)
+{
+ profiles->mAudioEncoders.add(createDefaultAmrNBEncoderCap());
+}
+
+/*static*/ void
+MediaProfiles::createDefaultVideoDecoders(MediaProfiles *profiles)
+{
+ MediaProfiles::VideoDecoderCap *cap =
+ new MediaProfiles::VideoDecoderCap(VIDEO_DECODER_WMV);
+
+ profiles->mVideoDecoders.add(cap);
+}
+
+/*static*/ void
+MediaProfiles::createDefaultAudioDecoders(MediaProfiles *profiles)
+{
+ MediaProfiles::AudioDecoderCap *cap =
+ new MediaProfiles::AudioDecoderCap(AUDIO_DECODER_WMA);
+
+ profiles->mAudioDecoders.add(cap);
+}
+
+/*static*/ void
+MediaProfiles::createDefaultEncoderOutputFileFormats(MediaProfiles *profiles)
+{
+ profiles->mEncoderOutputFileFormats.add(OUTPUT_FORMAT_THREE_GPP);
+ profiles->mEncoderOutputFileFormats.add(OUTPUT_FORMAT_MPEG_4);
+}
+
+/*static*/ MediaProfiles::AudioEncoderCap*
+MediaProfiles::createDefaultAmrNBEncoderCap()
+{
+ return new MediaProfiles::AudioEncoderCap(
+ AUDIO_ENCODER_AMR_NB, 5525, 12200, 8000, 8000, 1, 1);
+}
+
+/*static*/ MediaProfiles*
+MediaProfiles::createDefaultInstance()
+{
+ MediaProfiles *profiles = new MediaProfiles;
+ createDefaultCamcorderProfiles(profiles);
+ createDefaultVideoEncoders(profiles);
+ createDefaultAudioEncoders(profiles);
+ createDefaultVideoDecoders(profiles);
+ createDefaultAudioDecoders(profiles);
+ createDefaultEncoderOutputFileFormats(profiles);
+ sIsInitialized = true;
+ return profiles;
+}
+
+/*static*/ MediaProfiles*
+MediaProfiles::createInstanceFromXmlFile(const char *xml)
+{
+ FILE *fp = NULL;
+ CHECK((fp = fopen(xml, "r")));
+
+ XML_Parser parser = ::XML_ParserCreate(NULL);
+ CHECK(parser != NULL);
+
+ MediaProfiles *profiles = new MediaProfiles();
+ ::XML_SetUserData(parser, profiles);
+ ::XML_SetElementHandler(parser, startElementHandler, NULL);
+
+ /*
+ FIXME:
+ expat is not compiled with -DXML_DTD. We don't have DTD parsing support.
+
+ if (!::XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS)) {
+ LOGE("failed to enable DTD support in the xml file");
+ return UNKNOWN_ERROR;
+ }
+
+ */
+
+ const int BUFF_SIZE = 512;
+ for (;;) {
+ void *buff = ::XML_GetBuffer(parser, BUFF_SIZE);
+ if (buff == NULL) {
+ LOGE("failed to in call to XML_GetBuffer()");
+ delete profiles;
+ profiles = NULL;
+ goto exit;
+ }
+
+ int bytes_read = ::fread(buff, 1, BUFF_SIZE, fp);
+ if (bytes_read < 0) {
+ LOGE("failed in call to read");
+ delete profiles;
+ profiles = NULL;
+ goto exit;
+ }
+
+ CHECK(::XML_ParseBuffer(parser, bytes_read, bytes_read == 0));
+
+ if (bytes_read == 0) break; // done parsing the xml file
+ }
+
+exit:
+ ::XML_ParserFree(parser);
+ ::fclose(fp);
+ if (profiles) {
+ sIsInitialized = true;
+ }
+ return profiles;
+}
+
+Vector<output_format> MediaProfiles::getOutputFileFormats() const
+{
+ return mEncoderOutputFileFormats; // copy out
+}
+
+Vector<video_encoder> MediaProfiles::getVideoEncoders() const
+{
+ Vector<video_encoder> encoders;
+ for (size_t i = 0; i < mVideoEncoders.size(); ++i) {
+ encoders.add(mVideoEncoders[i]->mCodec);
+ }
+ return encoders; // copy out
+}
+
+int MediaProfiles::getVideoEncoderParamByName(const char *name, video_encoder codec) const
+{
+ LOGV("getVideoEncoderParamByName: %s for codec %d", name, codec);
+ int index = -1;
+ for (size_t i = 0, n = mVideoEncoders.size(); i < n; ++i) {
+ if (mVideoEncoders[i]->mCodec == codec) {
+ index = i;
+ break;
+ }
+ }
+ if (index == -1) {
+ LOGE("The given video encoder %d is not found", codec);
+ return -1;
+ }
+
+ if (!strcmp("enc.vid.width.min", name)) return mVideoEncoders[index]->mMinFrameWidth;
+ if (!strcmp("enc.vid.width.max", name)) return mVideoEncoders[index]->mMaxFrameWidth;
+ if (!strcmp("enc.vid.height.min", name)) return mVideoEncoders[index]->mMinFrameHeight;
+ if (!strcmp("enc.vid.height.max", name)) return mVideoEncoders[index]->mMaxFrameHeight;
+ if (!strcmp("enc.vid.bps.min", name)) return mVideoEncoders[index]->mMinBitRate;
+ if (!strcmp("enc.vid.bps.max", name)) return mVideoEncoders[index]->mMaxBitRate;
+ if (!strcmp("enc.vid.fps.min", name)) return mVideoEncoders[index]->mMinFrameRate;
+ if (!strcmp("enc.vid.fps.max", name)) return mVideoEncoders[index]->mMaxFrameRate;
+
+ LOGE("The given video encoder param name %s is not found", name);
+ return -1;
+}
+
+Vector<audio_encoder> MediaProfiles::getAudioEncoders() const
+{
+ Vector<audio_encoder> encoders;
+ for (size_t i = 0; i < mAudioEncoders.size(); ++i) {
+ encoders.add(mAudioEncoders[i]->mCodec);
+ }
+ return encoders; // copy out
+}
+
+int MediaProfiles::getAudioEncoderParamByName(const char *name, audio_encoder codec) const
+{
+ LOGV("getAudioEncoderParamByName: %s for codec %d", name, codec);
+ int index = -1;
+ for (size_t i = 0, n = mAudioEncoders.size(); i < n; ++i) {
+ if (mAudioEncoders[i]->mCodec == codec) {
+ index = i;
+ break;
+ }
+ }
+ if (index == -1) {
+ LOGE("The given audio encoder %d is not found", codec);
+ return -1;
+ }
+
+ if (!strcmp("enc.aud.ch.min", name)) return mAudioEncoders[index]->mMinChannels;
+ if (!strcmp("enc.aud.ch.max", name)) return mAudioEncoders[index]->mMaxChannels;
+ if (!strcmp("enc.aud.bps.min", name)) return mAudioEncoders[index]->mMinBitRate;
+ if (!strcmp("enc.aud.bps.max", name)) return mAudioEncoders[index]->mMaxBitRate;
+ if (!strcmp("enc.aud.hz.min", name)) return mAudioEncoders[index]->mMinSampleRate;
+ if (!strcmp("enc.aud.hz.max", name)) return mAudioEncoders[index]->mMaxSampleRate;
+
+ LOGE("The given audio encoder param name %s is not found", name);
+ return -1;
+}
+
+Vector<video_decoder> MediaProfiles::getVideoDecoders() const
+{
+ Vector<video_decoder> decoders;
+ for (size_t i = 0; i < mVideoDecoders.size(); ++i) {
+ decoders.add(mVideoDecoders[i]->mCodec);
+ }
+ return decoders; // copy out
+}
+
+Vector<audio_decoder> MediaProfiles::getAudioDecoders() const
+{
+ Vector<audio_decoder> decoders;
+ for (size_t i = 0; i < mAudioDecoders.size(); ++i) {
+ decoders.add(mAudioDecoders[i]->mCodec);
+ }
+ return decoders; // copy out
+}
+
+int MediaProfiles::getCamcorderProfileParamByName(const char *name, camcorder_quality quality) const
+{
+ LOGV("getCamcorderProfileParamByName: %s for quality %d", name, quality);
+
+ int index = -1;
+ for (size_t i = 0, n = mCamcorderProfiles.size(); i < n; ++i) {
+ if (mCamcorderProfiles[i]->mQuality == quality) {
+ index = i;
+ break;
+ }
+ }
+ if (index == -1) {
+ LOGE("The given camcorder profile quality %d is not found", quality);
+ return -1;
+ }
+
+ if (!strcmp("file.format", name)) return mCamcorderProfiles[index]->mFileFormat;
+ if (!strcmp("vid.codec", name)) return mCamcorderProfiles[index]->mVideoCodec->mCodec;
+ if (!strcmp("vid.width", name)) return mCamcorderProfiles[index]->mVideoCodec->mFrameWidth;
+ if (!strcmp("vid.height", name)) return mCamcorderProfiles[index]->mVideoCodec->mFrameHeight;
+ if (!strcmp("vid.bps", name)) return mCamcorderProfiles[index]->mVideoCodec->mBitRate;
+ if (!strcmp("vid.fps", name)) return mCamcorderProfiles[index]->mVideoCodec->mFrameRate;
+ if (!strcmp("aud.codec", name)) return mCamcorderProfiles[index]->mAudioCodec->mCodec;
+ if (!strcmp("aud.bps", name)) return mCamcorderProfiles[index]->mAudioCodec->mBitRate;
+ if (!strcmp("aud.ch", name)) return mCamcorderProfiles[index]->mAudioCodec->mChannels;
+ if (!strcmp("aud.hz", name)) return mCamcorderProfiles[index]->mAudioCodec->mSampleRate;
+
+ LOGE("The given camcorder profile param name %s is not found", name);
+ return -1;
+}
+
+MediaProfiles::~MediaProfiles()
+{
+ CHECK("destructor should never be called" == 0);
+#if 0
+ for (size_t i = 0; i < mAudioEncoders.size(); ++i) {
+ delete mAudioEncoders[i];
+ }
+ mAudioEncoders.clear();
+
+ for (size_t i = 0; i < mVideoEncoders.size(); ++i) {
+ delete mVideoEncoders[i];
+ }
+ mVideoEncoders.clear();
+
+ for (size_t i = 0; i < mVideoDecoders.size(); ++i) {
+ delete mVideoDecoders[i];
+ }
+ mVideoDecoders.clear();
+
+ for (size_t i = 0; i < mAudioDecoders.size(); ++i) {
+ delete mAudioDecoders[i];
+ }
+ mAudioDecoders.clear();
+
+ for (size_t i = 0; i < mCamcorderProfiles.size(); ++i) {
+ delete mCamcorderProfiles[i];
+ }
+ mCamcorderProfiles.clear();
+#endif
+}
+} // namespace android
diff --git a/media/libmediaplayerservice/MetadataRetrieverClient.cpp b/media/libmediaplayerservice/MetadataRetrieverClient.cpp
index 66de2ee..550b84df 100644
--- a/media/libmediaplayerservice/MetadataRetrieverClient.cpp
+++ b/media/libmediaplayerservice/MetadataRetrieverClient.cpp
@@ -28,7 +28,8 @@
#include <string.h>
#include <cutils/atomic.h>
#include <cutils/properties.h>
-#include <binder/MemoryDealer.h>
+#include <binder/MemoryBase.h>
+#include <binder/MemoryHeapBase.h>
#include <android_runtime/ActivityManager.h>
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
@@ -62,8 +63,6 @@
{
LOGV("MetadataRetrieverClient constructor pid(%d)", pid);
mPid = pid;
- mThumbnailDealer = NULL;
- mAlbumArtDealer = NULL;
mThumbnail = NULL;
mAlbumArt = NULL;
mRetriever = NULL;
@@ -94,8 +93,6 @@
LOGV("disconnect from pid %d", mPid);
Mutex::Autolock lock(mLock);
mRetriever.clear();
- mThumbnailDealer.clear();
- mAlbumArtDealer.clear();
mThumbnail.clear();
mAlbumArt.clear();
mMode = METADATA_MODE_FRAME_CAPTURE_AND_METADATA_RETRIEVAL;
@@ -242,7 +239,6 @@
LOGV("captureFrame");
Mutex::Autolock lock(mLock);
mThumbnail.clear();
- mThumbnailDealer.clear();
if (mRetriever == NULL) {
LOGE("retriever is not initialized");
return NULL;
@@ -253,16 +249,15 @@
return NULL;
}
size_t size = sizeof(VideoFrame) + frame->mSize;
- mThumbnailDealer = new MemoryDealer(size);
- if (mThumbnailDealer == NULL) {
+ sp<MemoryHeapBase> heap = new MemoryHeapBase(size, 0, "MetadataRetrieverClient");
+ if (heap == NULL) {
LOGE("failed to create MemoryDealer");
delete frame;
return NULL;
}
- mThumbnail = mThumbnailDealer->allocate(size);
+ mThumbnail = new MemoryBase(heap, 0, size);
if (mThumbnail == NULL) {
LOGE("not enough memory for VideoFrame size=%u", size);
- mThumbnailDealer.clear();
delete frame;
return NULL;
}
@@ -283,7 +278,6 @@
LOGV("extractAlbumArt");
Mutex::Autolock lock(mLock);
mAlbumArt.clear();
- mAlbumArtDealer.clear();
if (mRetriever == NULL) {
LOGE("retriever is not initialized");
return NULL;
@@ -294,16 +288,15 @@
return NULL;
}
size_t size = sizeof(MediaAlbumArt) + albumArt->mSize;
- mAlbumArtDealer = new MemoryDealer(size);
- if (mAlbumArtDealer == NULL) {
+ sp<MemoryHeapBase> heap = new MemoryHeapBase(size, 0, "MetadataRetrieverClient");
+ if (heap == NULL) {
LOGE("failed to create MemoryDealer object");
delete albumArt;
return NULL;
}
- mAlbumArt = mAlbumArtDealer->allocate(size);
+ mAlbumArt = new MemoryBase(heap, 0, size);
if (mAlbumArt == NULL) {
LOGE("not enough memory for MediaAlbumArt size=%u", size);
- mAlbumArtDealer.clear();
delete albumArt;
return NULL;
}
diff --git a/media/libmediaplayerservice/MetadataRetrieverClient.h b/media/libmediaplayerservice/MetadataRetrieverClient.h
index 8cb8ad1..4aab94f 100644
--- a/media/libmediaplayerservice/MetadataRetrieverClient.h
+++ b/media/libmediaplayerservice/MetadataRetrieverClient.h
@@ -63,8 +63,6 @@
int mMode;
// Keep the shared memory copy of album art and capture frame (for thumbnail)
- sp<MemoryDealer> mAlbumArtDealer;
- sp<MemoryDealer> mThumbnailDealer;
sp<IMemory> mAlbumArt;
sp<IMemory> mThumbnail;
};
diff --git a/media/libstagefright/AudioPlayer.cpp b/media/libstagefright/AudioPlayer.cpp
index 14842c0..efe7ebb 100644
--- a/media/libstagefright/AudioPlayer.cpp
+++ b/media/libstagefright/AudioPlayer.cpp
@@ -58,12 +58,15 @@
mSource = source;
}
-void AudioPlayer::start() {
+status_t AudioPlayer::start() {
CHECK(!mStarted);
CHECK(mSource != NULL);
status_t err = mSource->start();
- CHECK_EQ(err, OK);
+
+ if (err != OK) {
+ return err;
+ }
sp<MetaData> format = mSource->getFormat();
const char *mime;
@@ -83,7 +86,11 @@
mSampleRate, numChannels, AudioSystem::PCM_16_BIT,
DEFAULT_AUDIOSINK_BUFFERCOUNT,
&AudioPlayer::AudioSinkCallback, this);
- CHECK_EQ(err, OK);
+ if (err != OK) {
+ mSource->stop();
+
+ return err;
+ }
mLatencyUs = (int64_t)mAudioSink->latency() * 1000;
mFrameSize = mAudioSink->frameSize();
@@ -97,7 +104,14 @@
: AudioSystem::CHANNEL_OUT_MONO,
8192, 0, &AudioCallback, this, 0);
- CHECK_EQ(mAudioTrack->initCheck(), OK);
+ if (mAudioTrack->initCheck() != OK) {
+ delete mAudioTrack;
+ mAudioTrack = NULL;
+
+ mSource->stop();
+
+ return mAudioTrack->initCheck();
+ }
mLatencyUs = (int64_t)mAudioTrack->latency() * 1000;
mFrameSize = mAudioTrack->frameSize();
@@ -106,6 +120,8 @@
}
mStarted = true;
+
+ return OK;
}
void AudioPlayer::pause() {
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index d6db59f..4e7738e 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -249,7 +249,16 @@
if (mVideoSource != NULL) {
mVideoSource->stop();
+
+ // The following hack is necessary to ensure that the OMX
+ // component is completely released by the time we may try
+ // to instantiate it again.
+ wp<MediaSource> tmp = mVideoSource;
mVideoSource.clear();
+ while (tmp.promote() != NULL) {
+ usleep(1000);
+ }
+ IPCThreadState::self()->flushCommands();
}
mAudioSource.clear();
@@ -369,7 +378,16 @@
&AwesomePlayer::AudioNotify, this);
mAudioPlayer->setSource(mAudioSource);
- mAudioPlayer->start();
+ status_t err = mAudioPlayer->start();
+
+ if (err != OK) {
+ delete mAudioPlayer;
+ mAudioPlayer = NULL;
+
+ mFlags &= ~(PLAYING | FIRST_FRAME);
+
+ return err;
+ }
delete mTimeSource;
mTimeSource = mAudioPlayer;
diff --git a/media/libstagefright/HTTPDataSource.cpp b/media/libstagefright/HTTPDataSource.cpp
index 5564886..e1ddfef 100644
--- a/media/libstagefright/HTTPDataSource.cpp
+++ b/media/libstagefright/HTTPDataSource.cpp
@@ -274,6 +274,9 @@
ssize_t contentLength = 0;
if (mFirstRequest || offset != mBufferOffset + mBufferLength) {
if (!mFirstRequest) {
+ LOGV("new range offset=%ld (old=%ld)",
+ offset, mBufferOffset + mBufferLength);
+
mHttp->disconnect();
}
mFirstRequest = false;
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index ed12b6d..6274a6c 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -28,6 +28,7 @@
#include <string.h>
#include <media/stagefright/DataSource.h>
+#include "include/ESDS.h"
#include <media/stagefright/MediaBuffer.h>
#include <media/stagefright/MediaBufferGroup.h>
#include <media/stagefright/MediaDebug.h>
@@ -84,6 +85,112 @@
MPEG4Source &operator=(const MPEG4Source &);
};
+// This custom data source wraps an existing one and satisfies requests
+// falling entirely within a cached range from the cache while forwarding
+// all remaining requests to the wrapped datasource.
+// This is used to cache the full sampletable metadata for a single track,
+// possibly wrapping multiple times to cover all tracks, i.e.
+// Each MPEG4DataSource caches the sampletable metadata for a single track.
+
+struct MPEG4DataSource : public DataSource {
+ MPEG4DataSource(const sp<DataSource> &source);
+
+ virtual status_t initCheck() const;
+ virtual ssize_t readAt(off_t offset, void *data, size_t size);
+ virtual status_t getSize(off_t *size);
+ virtual uint32_t flags();
+
+ status_t setCachedRange(off_t offset, size_t size);
+
+protected:
+ virtual ~MPEG4DataSource();
+
+private:
+ Mutex mLock;
+
+ sp<DataSource> mSource;
+ off_t mCachedOffset;
+ size_t mCachedSize;
+ uint8_t *mCache;
+
+ void clearCache();
+
+ MPEG4DataSource(const MPEG4DataSource &);
+ MPEG4DataSource &operator=(const MPEG4DataSource &);
+};
+
+MPEG4DataSource::MPEG4DataSource(const sp<DataSource> &source)
+ : mSource(source),
+ mCachedOffset(0),
+ mCachedSize(0),
+ mCache(NULL) {
+}
+
+MPEG4DataSource::~MPEG4DataSource() {
+ clearCache();
+}
+
+void MPEG4DataSource::clearCache() {
+ if (mCache) {
+ free(mCache);
+ mCache = NULL;
+ }
+
+ mCachedOffset = 0;
+ mCachedSize = 0;
+}
+
+status_t MPEG4DataSource::initCheck() const {
+ return mSource->initCheck();
+}
+
+ssize_t MPEG4DataSource::readAt(off_t offset, void *data, size_t size) {
+ Mutex::Autolock autoLock(mLock);
+
+ if (offset >= mCachedOffset
+ && offset + size <= mCachedOffset + mCachedSize) {
+ memcpy(data, &mCache[offset - mCachedOffset], size);
+ return size;
+ }
+
+ return mSource->readAt(offset, data, size);
+}
+
+status_t MPEG4DataSource::getSize(off_t *size) {
+ return mSource->getSize(size);
+}
+
+uint32_t MPEG4DataSource::flags() {
+ return mSource->flags();
+}
+
+status_t MPEG4DataSource::setCachedRange(off_t offset, size_t size) {
+ Mutex::Autolock autoLock(mLock);
+
+ clearCache();
+
+ mCache = (uint8_t *)malloc(size);
+
+ if (mCache == NULL) {
+ return -ENOMEM;
+ }
+
+ mCachedOffset = offset;
+ mCachedSize = size;
+
+ ssize_t err = mSource->readAt(mCachedOffset, mCache, mCachedSize);
+
+ if (err < (ssize_t)size) {
+ clearCache();
+
+ return ERROR_IO;
+ }
+
+ return OK;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
static void hexdump(const void *_data, size_t size) {
const uint8_t *data = (const uint8_t *)_data;
size_t offset = 0;
@@ -374,6 +481,19 @@
case FOURCC('u', 'd', 't', 'a'):
case FOURCC('i', 'l', 's', 't'):
{
+ if (chunk_type == FOURCC('s', 't', 'b', 'l')) {
+ LOGV("sampleTable chunk is %d bytes long.", (size_t)chunk_size);
+
+ if (mDataSource->flags() & DataSource::kWantsPrefetching) {
+ sp<MPEG4DataSource> cachedSource =
+ new MPEG4DataSource(mDataSource);
+
+ if (cachedSource->setCachedRange(*offset, chunk_size) == OK) {
+ mDataSource = cachedSource;
+ }
+ }
+ }
+
off_t stop_offset = *offset + chunk_size;
*offset = data_offset;
while (*offset < stop_offset) {
@@ -779,6 +899,21 @@
mLastTrack->meta->setData(
kKeyESDS, kTypeESDS, &buffer[4], chunk_data_size - 4);
+ if (mPath.size() >= 2
+ && mPath[mPath.size() - 2] == FOURCC('m', 'p', '4', 'a')) {
+ // Information from the ESDS must be relied on for proper
+ // setup of sample rate and channel count for MPEG4 Audio.
+ // The generic header appears to only contain generic
+ // information...
+
+ status_t err = updateAudioTrackInfoFromESDS_MPEG4Audio(
+ &buffer[4], chunk_data_size - 4);
+
+ if (err != OK) {
+ return err;
+ }
+ }
+
*offset += chunk_size;
break;
}
@@ -1002,6 +1137,86 @@
track->meta, mDataSource, track->timescale, track->sampleTable);
}
+status_t MPEG4Extractor::updateAudioTrackInfoFromESDS_MPEG4Audio(
+ const void *esds_data, size_t esds_size) {
+ ESDS esds(esds_data, esds_size);
+ const uint8_t *csd;
+ size_t csd_size;
+ if (esds.getCodecSpecificInfo(
+ (const void **)&csd, &csd_size) != OK) {
+ return ERROR_MALFORMED;
+ }
+
+#if 0
+ printf("ESD of size %d\n", csd_size);
+ hexdump(csd, csd_size);
+#endif
+
+ if (csd_size < 2) {
+ return ERROR_MALFORMED;
+ }
+
+ uint32_t objectType = csd[0] >> 3;
+
+ if (objectType == 31) {
+ return ERROR_UNSUPPORTED;
+ }
+
+ uint32_t freqIndex = (csd[0] & 7) << 1 | (csd[1] >> 7);
+ int32_t sampleRate = 0;
+ int32_t numChannels = 0;
+ if (freqIndex == 15) {
+ if (csd_size < 5) {
+ return ERROR_MALFORMED;
+ }
+
+ sampleRate = (csd[1] & 0x7f) << 17
+ | csd[2] << 9
+ | csd[3] << 1
+ | (csd[4] >> 7);
+
+ numChannels = (csd[4] >> 3) & 15;
+ } else {
+ static uint32_t kSamplingRate[] = {
+ 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050,
+ 16000, 12000, 11025, 8000, 7350
+ };
+
+ if (freqIndex == 13 || freqIndex == 14) {
+ return ERROR_MALFORMED;
+ }
+
+ sampleRate = kSamplingRate[freqIndex];
+ numChannels = (csd[1] >> 3) & 15;
+ }
+
+ if (numChannels == 0) {
+ return ERROR_UNSUPPORTED;
+ }
+
+ int32_t prevSampleRate;
+ CHECK(mLastTrack->meta->findInt32(kKeySampleRate, &prevSampleRate));
+
+ if (prevSampleRate != sampleRate) {
+ LOGW("mpeg4 audio sample rate different from previous setting. "
+ "was: %d, now: %d", prevSampleRate, sampleRate);
+ }
+
+ mLastTrack->meta->setInt32(kKeySampleRate, sampleRate);
+
+ int32_t prevChannelCount;
+ CHECK(mLastTrack->meta->findInt32(kKeyChannelCount, &prevChannelCount));
+
+ if (prevChannelCount != numChannels) {
+ LOGW("mpeg4 audio channel count different from previous setting. "
+ "was: %d, now: %d", prevChannelCount, numChannels);
+ }
+
+ mLastTrack->meta->setInt32(kKeyChannelCount, numChannels);
+
+ return OK;
+}
+
////////////////////////////////////////////////////////////////////////////////
MPEG4Source::MPEG4Source(
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 986dcb2..90bbdfe 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -290,6 +290,7 @@
}
if (!strcmp(componentName, "OMX.TI.MP3.decode")) {
quirks |= kNeedsFlushBeforeDisable;
+ quirks |= kDecoderLiesAboutNumberOfChannels;
}
if (!strcmp(componentName, "OMX.TI.AAC.decode")) {
quirks |= kNeedsFlushBeforeDisable;
@@ -1183,7 +1184,7 @@
}
size_t totalSize = def.nBufferCountActual * def.nBufferSize;
- mDealer[portIndex] = new MemoryDealer(totalSize);
+ mDealer[portIndex] = new MemoryDealer(totalSize, "OMXCodec");
for (OMX_U32 i = 0; i < def.nBufferCountActual; ++i) {
sp<IMemory> mem = mDealer[portIndex]->allocate(def.nBufferSize);
@@ -2817,7 +2818,9 @@
if ((OMX_U32)numChannels != params.nChannels) {
LOGW("Codec outputs a different number of channels than "
- "the input stream contains.");
+ "the input stream contains (contains %d channels, "
+ "codec outputs %ld channels).",
+ numChannels, params.nChannels);
}
mOutputFormat->setCString(
@@ -2825,8 +2828,12 @@
// Use the codec-advertised number of channels, as some
// codecs appear to output stereo even if the input data is
- // mono.
- mOutputFormat->setInt32(kKeyChannelCount, params.nChannels);
+ // mono. If we know the codec lies about this information,
+ // use the actual number of channels instead.
+ mOutputFormat->setInt32(
+ kKeyChannelCount,
+ (mQuirks & kDecoderLiesAboutNumberOfChannels)
+ ? numChannels : params.nChannels);
// The codec-reported sampleRate is not reliable...
mOutputFormat->setInt32(kKeySampleRate, sampleRate);
diff --git a/media/libstagefright/WAVExtractor.cpp b/media/libstagefright/WAVExtractor.cpp
index da8fe79..7365dfa 100644
--- a/media/libstagefright/WAVExtractor.cpp
+++ b/media/libstagefright/WAVExtractor.cpp
@@ -178,7 +178,8 @@
mBitsPerSample = U16_LE_AT(&formatSpec[14]);
- if (mBitsPerSample != 8 && mBitsPerSample != 16) {
+ if (mBitsPerSample != 8 && mBitsPerSample != 16
+ && mBitsPerSample != 24) {
return ERROR_UNSUPPORTED;
}
@@ -329,6 +330,24 @@
buffer->release();
buffer = tmp;
+ } else if (mBitsPerSample == 24) {
+ // Convert 24-bit signed samples to 16-bit signed.
+
+ const uint8_t *src =
+ (const uint8_t *)buffer->data() + buffer->range_offset();
+ int16_t *dst = (int16_t *)src;
+
+ size_t numSamples = buffer->range_length() / 3;
+ for (size_t i = 0; i < numSamples; ++i) {
+ int32_t x = (int32_t)(src[0] | src[1] << 8 | src[2] << 16);
+ x = (x << 8) >> 8; // sign extension
+
+ x = x >> 8;
+ *dst++ = (int16_t)x;
+ src += 3;
+ }
+
+ buffer->set_range(buffer->range_offset(), 2 * numSamples);
}
size_t bytesPerSample = mBitsPerSample >> 3;
diff --git a/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp b/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp
index d874224..aa2a3d1 100644
--- a/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp
+++ b/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp
@@ -80,6 +80,8 @@
stop();
}
+ PVAVCCleanUpDecoder(mHandle);
+
delete mHandle;
mHandle = NULL;
}
@@ -320,8 +322,10 @@
crop_top = crop_left = 0;
}
- mFormat->setInt32(kKeyWidth, crop_right - crop_left + 1);
- mFormat->setInt32(kKeyHeight, crop_bottom - crop_top + 1);
+ int32_t aligned_width = (crop_right - crop_left + 1 + 15) & ~15;
+ int32_t aligned_height = (crop_bottom - crop_top + 1 + 15) & ~15;
+ mFormat->setInt32(kKeyWidth, aligned_width);
+ mFormat->setInt32(kKeyHeight, aligned_height);
mInputBuffer->release();
mInputBuffer = NULL;
diff --git a/media/libstagefright/colorconversion/SoftwareRenderer.cpp b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
index ef6ede0..ed91eea 100644
--- a/media/libstagefright/colorconversion/SoftwareRenderer.cpp
+++ b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
@@ -20,6 +20,7 @@
#include "../include/SoftwareRenderer.h"
#include <binder/MemoryHeapBase.h>
+#include <binder/MemoryHeapPmem.h>
#include <media/stagefright/MediaDebug.h>
#include <ui/ISurface.h>
@@ -38,8 +39,16 @@
mDecodedWidth(decodedWidth),
mDecodedHeight(decodedHeight),
mFrameSize(mDecodedWidth * mDecodedHeight * 2), // RGB565
- mMemoryHeap(new MemoryHeapBase(2 * mFrameSize)),
mIndex(0) {
+ // TODO: How do I allocate physical memory on Droid?
+ mMemoryHeap = new MemoryHeapBase("/dev/pmem_adsp", 2 * mFrameSize);
+ if (mMemoryHeap->heapID() < 0) {
+ LOGI("Creating physical memory heap failed, reverting to regular heap.");
+ mMemoryHeap = new MemoryHeapBase(2 * mFrameSize);
+ } else {
+ mMemoryHeap = new MemoryHeapPmem(mMemoryHeap);
+ }
+
CHECK(mISurface.get() != NULL);
CHECK(mDecodedWidth > 0);
CHECK(mDecodedHeight > 0);
diff --git a/media/libstagefright/include/MPEG4Extractor.h b/media/libstagefright/include/MPEG4Extractor.h
index 1a13446..3a63e88 100644
--- a/media/libstagefright/include/MPEG4Extractor.h
+++ b/media/libstagefright/include/MPEG4Extractor.h
@@ -65,6 +65,9 @@
status_t parseChunk(off_t *offset, int depth);
status_t parseMetaData(off_t offset, size_t size);
+ status_t updateAudioTrackInfoFromESDS_MPEG4Audio(
+ const void *esds_data, size_t esds_size);
+
MPEG4Extractor(const MPEG4Extractor &);
MPEG4Extractor &operator=(const MPEG4Extractor &);
};
diff --git a/media/libstagefright/omx/tests/OMXHarness.cpp b/media/libstagefright/omx/tests/OMXHarness.cpp
index 6c36163..51fcaf5 100644
--- a/media/libstagefright/omx/tests/OMXHarness.cpp
+++ b/media/libstagefright/omx/tests/OMXHarness.cpp
@@ -286,7 +286,7 @@
return OK;
}
- sp<MemoryDealer> dealer = new MemoryDealer(8 * 1024 * 1024);
+ sp<MemoryDealer> dealer = new MemoryDealer(8 * 1024 * 1024, "OMXHarness");
IOMX::node_id node;
status_t err =
diff --git a/opengl/java/com/google/android/gles_jni/GLImpl.java b/opengl/java/com/google/android/gles_jni/GLImpl.java
index 01a9c91..30b9325 100644
--- a/opengl/java/com/google/android/gles_jni/GLImpl.java
+++ b/opengl/java/com/google/android/gles_jni/GLImpl.java
@@ -48,6 +48,12 @@
Buffer _pointSizePointerOES = null;
Buffer _matrixIndexPointerOES = null;
Buffer _weightPointerOES = null;
+
+ private boolean haveCheckedExtensions;
+ private boolean have_OES_blend_equation_separate;
+ private boolean have_OES_blend_subtract;
+ private boolean have_OES_framebuffer_object;
+ private boolean have_OES_texture_cube_map;
public GLImpl() {
}
@@ -1935,7 +1941,7 @@
int target
);
- // C function void glDeleteFramebuffersOES ( GLint n, GLint *framebuffers )
+ // C function void glDeleteFramebuffersOES ( GLint n, GLuint *framebuffers )
public native void glDeleteFramebuffersOES(
int n,
@@ -1943,14 +1949,14 @@
int offset
);
- // C function void glDeleteFramebuffersOES ( GLint n, GLint *framebuffers )
+ // C function void glDeleteFramebuffersOES ( GLint n, GLuint *framebuffers )
public native void glDeleteFramebuffersOES(
int n,
java.nio.IntBuffer framebuffers
);
- // C function void glDeleteRenderbuffersOES ( GLint n, GLint *renderbuffers )
+ // C function void glDeleteRenderbuffersOES ( GLint n, GLuint *renderbuffers )
public native void glDeleteRenderbuffersOES(
int n,
@@ -1958,7 +1964,7 @@
int offset
);
- // C function void glDeleteRenderbuffersOES ( GLint n, GLint *renderbuffers )
+ // C function void glDeleteRenderbuffersOES ( GLint n, GLuint *renderbuffers )
public native void glDeleteRenderbuffersOES(
int n,
@@ -1990,7 +1996,7 @@
int target
);
- // C function void glGenFramebuffersOES ( GLint n, GLint *framebuffers )
+ // C function void glGenFramebuffersOES ( GLint n, GLuint *framebuffers )
public native void glGenFramebuffersOES(
int n,
@@ -1998,14 +2004,14 @@
int offset
);
- // C function void glGenFramebuffersOES ( GLint n, GLint *framebuffers )
+ // C function void glGenFramebuffersOES ( GLint n, GLuint *framebuffers )
public native void glGenFramebuffersOES(
int n,
java.nio.IntBuffer framebuffers
);
- // C function void glGenRenderbuffersOES ( GLint n, GLint *renderbuffers )
+ // C function void glGenRenderbuffersOES ( GLint n, GLuint *renderbuffers )
public native void glGenRenderbuffersOES(
int n,
@@ -2013,7 +2019,7 @@
int offset
);
- // C function void glGenRenderbuffersOES ( GLint n, GLint *renderbuffers )
+ // C function void glGenRenderbuffersOES ( GLint n, GLuint *renderbuffers )
public native void glGenRenderbuffersOES(
int n,
diff --git a/opengl/libagl/texture.cpp b/opengl/libagl/texture.cpp
index 2875c13..fae89b9 100644
--- a/opengl/libagl/texture.cpp
+++ b/opengl/libagl/texture.cpp
@@ -1389,9 +1389,20 @@
// (x,y) is the lower-left corner of colorBuffer
y = cbSurface.height - (y + height);
+ /* The GLES spec says:
+ * If any of the pixels within the specified rectangle are outside
+ * the framebuffer associated with the current rendering context,
+ * then the values obtained for those pixels are undefined.
+ */
+ if (x+width > GLint(cbSurface.width))
+ width = cbSurface.width - x;
+
+ if (y+height > GLint(cbSurface.height))
+ height = cbSurface.height - y;
+
int err = copyPixels(c,
txSurface, 0, 0,
- cbSurface, x, y, cbSurface.width, cbSurface.height);
+ cbSurface, x, y, width, height);
if (err) {
ogles_error(c, err);
}
@@ -1439,6 +1450,17 @@
const GGLSurface& cbSurface = c->rasterizer.state.buffers.color.s;
y = cbSurface.height - (y + height);
+ /* The GLES spec says:
+ * If any of the pixels within the specified rectangle are outside
+ * the framebuffer associated with the current rendering context,
+ * then the values obtained for those pixels are undefined.
+ */
+ if (x+width > GLint(cbSurface.width))
+ width = cbSurface.width - x;
+
+ if (y+height > GLint(cbSurface.height))
+ height = cbSurface.height - y;
+
int err = copyPixels(c,
surface, xoffset, yoffset,
cbSurface, x, y, width, height);
diff --git a/opengl/tools/glgen/specs/jsr239/glspec-1.1extpack b/opengl/tools/glgen/specs/jsr239/glspec-1.1extpack
index ca9e6d2..d6012d9 100644
--- a/opengl/tools/glgen/specs/jsr239/glspec-1.1extpack
+++ b/opengl/tools/glgen/specs/jsr239/glspec-1.1extpack
@@ -7,14 +7,14 @@
GLint glCheckFramebufferStatusOES ( GLint target )
void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data )
void glCopyTexImage2D ( GLint target, GLint level, GLint internalformat, GLint x, GLint y, GLint width, GLint height, GLint border )
-void glDeleteFramebuffersOES ( GLint n, GLint *framebuffers )
-void glDeleteRenderbuffersOES ( GLint n, GLint *renderbuffers )
+void glDeleteFramebuffersOES ( GLint n, GLuint *framebuffers )
+void glDeleteRenderbuffersOES ( GLint n, GLuint *renderbuffers )
void glEnable ( GLint cap )
void glFramebufferRenderbufferOES ( GLint target, GLint attachment, GLint renderbuffertarget, GLint renderbuffer )
void glFramebufferTexture2DOES ( GLint target, GLint attachment, GLint textarget, GLint texture, GLint level )
void glGenerateMipmapOES ( GLint target )
-void glGenFramebuffersOES ( GLint n, GLint *framebuffers )
-void glGenRenderbuffersOES ( GLint n, GLint *renderbuffers )
+void glGenFramebuffersOES ( GLint n, GLuint *framebuffers )
+void glGenRenderbuffersOES ( GLint n, GLuint *renderbuffers )
void glGetFramebufferAttachmentParameterivOES ( GLint target, GLint attachment, GLint pname, GLint *params )
void glGetIntegerv ( GLint pname, GLint *params )
void glGetRenderbufferParameterivOES ( GLint target, GLint pname, GLint *params )
diff --git a/opengl/tools/glgen/specs/jsr239/glspec-checks b/opengl/tools/glgen/specs/jsr239/glspec-checks
index c28e403..9f8a793 100644
--- a/opengl/tools/glgen/specs/jsr239/glspec-checks
+++ b/opengl/tools/glgen/specs/jsr239/glspec-checks
@@ -29,28 +29,28 @@
glDrawTexivOES check coords 5
glDrawTexsvOES check coords 5
glDrawTexxvOES check coords 5
-glBindFramebufferOES unsupported
-glBindRenderbufferOES unsupported
-glBlendEquation unsupported
-glBlendEquationSeparate unsupported
-glBlendFuncSeparate unsupported
-glCheckFramebufferStatusOES unsupported return 0
-glDeleteFramebuffersOES unsupported
-glDeleteRenderbuffersOES unsupported
-glFramebufferRenderbufferOES unsupported
-glFramebufferStorageOES unsupported
-glFramebufferTexture2DOES unsupported
-glGenFramebuffersOES unsupported
-glGenRenderbuffersOES unsupported
-glGenerateMipmapOES unsupported
+glBindFramebufferOES requires OES_framebuffer_object
+glBindRenderbufferOES requires OES_framebuffer_object
+glBlendEquation requires OES_blend_subtract
+glBlendEquationSeparate requires OES_blend_equation_separate
+glBlendFuncSeparate requires OES_blend_equation_separate
+glCheckFramebufferStatusOES requires OES_framebuffer_object return 0
+glDeleteFramebuffersOES requires OES_framebuffer_object check framebuffers n
+glDeleteRenderbuffersOES requires OES_framebuffer_object check renderbuffers n
+glFramebufferRenderbufferOES requires OES_framebuffer_object
+glFramebufferStorageOES requires OES_framebuffer_object
+glFramebufferTexture2DOES requires OES_framebuffer_object
+glGenFramebuffersOES requires OES_framebuffer_object check framebuffers n
+glGenRenderbuffersOES requires OES_framebuffer_object check renderbuffers n
+glGenerateMipmapOES requires OES_framebuffer_object
+glGetFramebufferAttachmentParameterivOES requires OES_framebuffer_object
+glGetRenderbufferParameterivOES requires OES_framebuffer_object
+glIsFramebufferOES requires OES_framebuffer_object return JNI_FALSE
+glIsRenderbufferOES requires OES_framebuffer_object return JNI_FALSE
+glRenderbufferStorageOES requires OES_framebuffer_object
+glGetTexGen requires OES_texture_cube_map
+glTexGen requires OES_texture_cube_map
+glTexGenf requires OES_texture_cube_map
+glTexGeni requires OES_texture_cube_map
+glTexGenx requires OES_texture_cube_map
glGetBufferParameter unsupported
-glGetFramebufferAttachmentParameterivOES unsupported
-glGetRenderbufferParameterivOES unsupported
-glGetTexGen unsupported
-glIsFramebufferOES unsupported return JNI_FALSE
-glIsRenderbufferOES unsupported return JNI_FALSE
-glRenderbufferStorageOES unsupported return false
-glTexGen unsupported
-glTexGenf unsupported
-glTexGeni unsupported
-glTexGenx unsupported
diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java
index e79170a..2db4e8d 100644
--- a/opengl/tools/glgen/src/JniCodeEmitter.java
+++ b/opengl/tools/glgen/src/JniCodeEmitter.java
@@ -211,6 +211,8 @@
index += 5;
} else if (checks[index].equals("unsupported")) {
index += 1;
+ } else if (checks[index].equals("requires")) {
+ index += 2;
} else if (checks[index].equals("nullAllowed")) {
return true;
} else {
@@ -243,6 +245,8 @@
index += 5;
} else if (checks[index].equals("unsupported")) {
index += 1;
+ } else if (checks[index].equals("requires")) {
+ index += 2;
} else if (checks[index].equals("nullAllowed")) {
index += 1;
} else {
@@ -263,6 +267,8 @@
while (index < checks.length) {
if (checks[index].equals("unsupported")) {
return true;
+ } else if (checks[index].equals("requires")) {
+ index += 2;
} else if (checks[index].equals("return")) {
index += 2;
} else if (checks[index].startsWith("check")) {
@@ -280,7 +286,34 @@
}
return false;
}
-
+
+ String isRequiresFunc(CFunc cfunc) {
+ String[] checks = mChecker.getChecks(cfunc.getName());
+ int index = 1;
+ if (checks != null) {
+ while (index < checks.length) {
+ if (checks[index].equals("unsupported")) {
+ index += 1;
+ } else if (checks[index].equals("requires")) {
+ return checks[index+1];
+ } else if (checks[index].equals("return")) {
+ index += 2;
+ } else if (checks[index].startsWith("check")) {
+ index += 3;
+ } else if (checks[index].equals("ifcheck")) {
+ index += 5;
+ } else if (checks[index].equals("nullAllowed")) {
+ index += 1;
+ } else {
+ System.out.println("Error: unknown keyword \"" +
+ checks[index] + "\"");
+ System.exit(0);
+ }
+ }
+ }
+ return null;
+ }
+
void emitNativeBoundsChecks(CFunc cfunc, String cname, PrintStream out,
boolean isBuffer, boolean emitExceptionCheck, String offset, String remaining, String iii) {
@@ -365,6 +398,9 @@
} else if (checks[index].equals("unsupported")) {
// ignore
index += 1;
+ } else if (checks[index].equals("requires")) {
+ // ignore
+ index += 2;
} else if (checks[index].equals("nullAllowed")) {
// ignore
index += 1;
@@ -776,7 +812,23 @@
out.println();
return;
}
-
+
+ String requiresExtension = isRequiresFunc(cfunc);
+ if (requiresExtension != null) {
+ out.println(indent +
+ "if (! supportsExtension(_env, _this, have_" + requiresExtension + "ID)) {");
+ out.println(indent + indent +
+ "_env->ThrowNew(UOEClass,");
+ out.println(indent + indent +
+ " \"" + cfunc.getName() + "\");");
+ if (isVoid) {
+ out.println(indent + indent + " return;");
+ } else {
+ String retval = getErrorReturnValue(cfunc);
+ out.println(indent + indent + " return " + retval + ";");
+ }
+ out.println(indent + "}");
+ }
if (mUseContextPointer) {
out.println(indent +
"android::gl::ogles_context_t *ctx = getContext(_env, _this);");
diff --git a/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
index b3d1c6c..c2464b0 100644
--- a/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
+++ b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
@@ -23,6 +23,23 @@
#include <GLES/gl.h>
#include <GLES/glext.h>
+// Work around differences between the generated name and the actual name.
+
+#define glBlendEquation glBlendEquationOES
+#define glBlendEquationSeparate glBlendEquationSeparateOES
+#define glBlendFuncSeparate glBlendFuncSeparateOES
+#define glGetTexGenfv glGetTexGenfvOES
+#define glGetTexGeniv glGetTexGenivOES
+#define glGetTexGenxv glGetTexGenxvOES
+#define glTexGenf glTexGenfOES
+#define glTexGenfv glTexGenfvOES
+#define glTexGeni glTexGeniOES
+#define glTexGeniv glTexGenivOES
+#define glTexGenx glTexGenxOES
+#define glTexGenxv glTexGenxvOES
+
+
+
/* special calls implemented in Android's GLES wrapper used to more
* efficiently bound-check passed arrays */
extern "C" {
@@ -58,6 +75,11 @@
static jfieldID positionID;
static jfieldID limitID;
static jfieldID elementSizeShiftID;
+static jfieldID haveCheckedExtensionsID;
+static jfieldID have_OES_blend_equation_separateID;
+static jfieldID have_OES_blend_subtractID;
+static jfieldID have_OES_framebuffer_objectID;
+static jfieldID have_OES_texture_cube_mapID;
/* Cache method IDs each time the class is loaded. */
@@ -72,6 +94,11 @@
jclass g11impClassLocal = _env->FindClass("com/google/android/gles_jni/GLImpl");
G11ImplClass = (jclass) _env->NewGlobalRef(g11impClassLocal);
+ haveCheckedExtensionsID = _env->GetFieldID(G11ImplClass, "haveCheckedExtensions", "Z");
+ have_OES_blend_equation_separateID = _env->GetFieldID(G11ImplClass, "have_OES_blend_equation_separate", "Z");
+ have_OES_blend_subtractID = _env->GetFieldID(G11ImplClass, "have_OES_blend_subtract", "Z");
+ have_OES_framebuffer_objectID = _env->GetFieldID(G11ImplClass, "have_OES_framebuffer_object", "Z");
+ have_OES_texture_cube_mapID = _env->GetFieldID(G11ImplClass, "have_OES_texture_cube_map", "Z");
getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
"getBasePointer", "(Ljava/nio/Buffer;)J");
@@ -193,5 +220,63 @@
return numCompressedTextureFormats;
}
+// Check if the extension at the head of pExtensions is pExtension. Note that pExtensions is
+// terminated by either 0 or space, while pExtension is terminated by 0.
+
+static bool
+extensionEqual(const GLubyte* pExtensions, const GLubyte* pExtension) {
+ while (true) {
+ char a = *pExtensions++;
+ char b = *pExtension++;
+ bool aEnd = a == '\0' || a == ' ';
+ bool bEnd = b == '\0';
+ if ( aEnd || bEnd) {
+ return aEnd == bEnd;
+ }
+ if ( a != b ) {
+ return false;
+ }
+ }
+}
+
+static const GLubyte*
+nextExtension(const GLubyte* pExtensions) {
+ while (true) {
+ char a = *pExtensions++;
+ if ( a == '\0') {
+ return pExtensions-1;
+ } else if ( a == ' ') {
+ return pExtensions;
+ }
+ }
+}
+
+static bool
+checkForExtension(const GLubyte* pExtensions, const GLubyte* pExtension) {
+ for (;*pExtensions != '\0'; pExtensions = nextExtension(pExtensions)) {
+ if (extensionEqual(pExtensions, pExtension)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+static bool
+supportsExtension(JNIEnv *_env, jobject impl, jfieldID fieldId) {
+ if (!_env->GetBooleanField(impl, haveCheckedExtensionsID)) {
+ _env->SetBooleanField(impl, haveCheckedExtensionsID, true);
+ const GLubyte* sExtensions = glGetString(GL_EXTENSIONS);
+ _env->SetBooleanField(impl, have_OES_blend_equation_separateID,
+ checkForExtension(sExtensions, (const GLubyte*) "GL_OES_blend_equation_separate"));
+ _env->SetBooleanField(impl, have_OES_blend_subtractID,
+ checkForExtension(sExtensions, (const GLubyte*) "GL_OES_blend_subtract"));
+ _env->SetBooleanField(impl, have_OES_framebuffer_objectID,
+ checkForExtension(sExtensions, (const GLubyte*) "GL_OES_framebuffer_object"));
+ _env->SetBooleanField(impl, have_OES_texture_cube_mapID,
+ checkForExtension(sExtensions, (const GLubyte*) "GL_OES_texture_cube_map"));
+ }
+ return _env->GetBooleanField(impl, fieldId);
+}
+
// --------------------------------------------------------------------------
diff --git a/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl b/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl
index 76fea3f..3727106 100644
--- a/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl
+++ b/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl
@@ -47,6 +47,12 @@
Buffer _pointSizePointerOES = null;
Buffer _matrixIndexPointerOES = null;
Buffer _weightPointerOES = null;
+
+ private boolean haveCheckedExtensions;
+ private boolean have_OES_blend_equation_separate;
+ private boolean have_OES_blend_subtract;
+ private boolean have_OES_framebuffer_object;
+ private boolean have_OES_texture_cube_map;
public GLImpl() {
}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index 979955c..015b487 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -71,7 +71,7 @@
// database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
// is properly propagated through your change. Not doing so will result in a loss of user
// settings.
- private static final int DATABASE_VERSION = 47;
+ private static final int DATABASE_VERSION = 48;
private Context mContext;
@@ -595,8 +595,23 @@
upgradeVersion = 47;
}
+
+ if (upgradeVersion == 47) {
+ /*
+ * The password mode constants have changed again; reset back to no
+ * password.
+ */
+ db.beginTransaction();
+ try {
+ db.execSQL("DELETE FROM system WHERE name='lockscreen.password_type';");
+ db.setTransactionSuccessful();
+ } finally {
+ db.endTransaction();
+ }
+ upgradeVersion = 48;
+ }
- if (upgradeVersion != currentVersion) {
+ if (upgradeVersion != currentVersion) {
Log.w(TAG, "Got stuck trying to upgrade from version " + upgradeVersion
+ ", must wipe the settings provider");
db.execSQL("DROP TABLE IF EXISTS system");
diff --git a/sax/tests/saxtests/Android.mk b/sax/tests/saxtests/Android.mk
new file mode 100644
index 0000000..836711b
--- /dev/null
+++ b/sax/tests/saxtests/Android.mk
@@ -0,0 +1,14 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+# We only want this apk build for tests.
+LOCAL_MODULE_TAGS := tests
+
+# Include all test java files.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_JAVA_LIBRARIES := android.test.runner
+LOCAL_PACKAGE_NAME := FrameworksSaxTests
+
+include $(BUILD_PACKAGE)
+
diff --git a/sax/tests/saxtests/AndroidManifest.xml b/sax/tests/saxtests/AndroidManifest.xml
new file mode 100644
index 0000000..c66844d
--- /dev/null
+++ b/sax/tests/saxtests/AndroidManifest.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.frameworks.saxtests">
+ <uses-permission android:name="android.permission.RECEIVE_SMS"/>
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.READ_CONTACTS" />
+ <uses-permission android:name="android.permission.WRITE_CONTACTS" />
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
+ <uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
+ <uses-permission android:name="android.permission.WRITE_APN_SETTINGS" />
+ <uses-permission android:name="android.permission.BROADCAST_STICKY" />
+
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation
+ android:name="android.test.InstrumentationTestRunner"
+ android:targetPackage="com.android.frameworks.saxtests"
+ android:label="Frameworks Sax Tests" />
+</manifest>
diff --git a/tests/AndroidTests/res/raw/youtube.xml b/sax/tests/saxtests/res/raw/youtube.xml
similarity index 100%
rename from tests/AndroidTests/res/raw/youtube.xml
rename to sax/tests/saxtests/res/raw/youtube.xml
diff --git a/tests/AndroidTests/src/com/android/unit_tests/ExpatPerformanceTest.java b/sax/tests/saxtests/src/android/sax/ExpatPerformanceTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/ExpatPerformanceTest.java
rename to sax/tests/saxtests/src/android/sax/ExpatPerformanceTest.java
index 0d51047..892c490 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/ExpatPerformanceTest.java
+++ b/sax/tests/saxtests/src/android/sax/ExpatPerformanceTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.sax;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -31,6 +31,8 @@
import java.io.IOException;
import java.io.InputStream;
+import com.android.frameworks.saxtests.R;
+
public class ExpatPerformanceTest extends AndroidTestCase {
private static final String TAG = ExpatPerformanceTest.class.getSimpleName();
diff --git a/tests/AndroidTests/src/com/android/unit_tests/SafeSaxTest.java b/sax/tests/saxtests/src/android/sax/SafeSaxTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/SafeSaxTest.java
rename to sax/tests/saxtests/src/android/sax/SafeSaxTest.java
index 8ccd26e..bee3938 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/SafeSaxTest.java
+++ b/sax/tests/saxtests/src/android/sax/SafeSaxTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.sax;
import android.graphics.Bitmap;
import android.sax.Element;
@@ -40,6 +40,8 @@
import java.io.IOException;
import java.io.InputStream;
+import com.android.frameworks.saxtests.R;
+
public class SafeSaxTest extends AndroidTestCase {
private static final String TAG = SafeSaxTest.class.getName();
diff --git a/services/java/com/android/server/AppWidgetService.java b/services/java/com/android/server/AppWidgetService.java
index 8797a42..ec7c60b 100644
--- a/services/java/com/android/server/AppWidgetService.java
+++ b/services/java/com/android/server/AppWidgetService.java
@@ -1107,10 +1107,9 @@
}
};
- // TODO: If there's a better way of matching an intent filter against the
- // packages for a given package, use that.
void addProvidersForPackageLocked(String pkgName) {
Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
+ intent.setPackage(pkgName);
List<ResolveInfo> broadcastReceivers = mPackageManager.queryBroadcastReceivers(intent,
PackageManager.GET_META_DATA);
@@ -1125,11 +1124,10 @@
}
}
- // TODO: If there's a better way of matching an intent filter against the
- // packages for a given package, use that.
void updateProvidersForPackageLocked(String pkgName) {
HashSet<String> keep = new HashSet<String>();
Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
+ intent.setPackage(pkgName);
List<ResolveInfo> broadcastReceivers = mPackageManager.queryBroadcastReceivers(intent,
PackageManager.GET_META_DATA);
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 72e26f8..62dcb08 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -43,18 +43,20 @@
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
+import android.os.HandlerThread;
import android.os.IBinder;
+import android.os.Looper;
import android.os.Message;
import android.os.ParcelFileDescriptor;
import android.os.PowerManager;
import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
-import android.os.SystemProperties;
import android.provider.Settings;
import android.util.EventLog;
import android.util.Log;
import android.util.SparseArray;
+import android.util.SparseIntArray;
import com.android.internal.backup.BackupConstants;
import com.android.internal.backup.IBackupTransport;
@@ -98,20 +100,27 @@
private static final int MSG_RUN_RESTORE = 3;
private static final int MSG_RUN_CLEAR = 4;
private static final int MSG_RUN_INITIALIZE = 5;
+ private static final int MSG_TIMEOUT = 6;
// Timeout interval for deciding that a bind or clear-data has taken too long
static final long TIMEOUT_INTERVAL = 10 * 1000;
+ // Timeout intervals for agent backup & restore operations
+ static final long TIMEOUT_BACKUP_INTERVAL = 30 * 1000;
+ static final long TIMEOUT_RESTORE_INTERVAL = 60 * 1000;
+
private Context mContext;
private PackageManager mPackageManager;
private IActivityManager mActivityManager;
private PowerManager mPowerManager;
private AlarmManager mAlarmManager;
+ IBackupManager mBackupManagerBinder;
boolean mEnabled; // access to this is synchronized on 'this'
boolean mProvisioned;
PowerManager.WakeLock mWakelock;
- final BackupHandler mBackupHandler = new BackupHandler();
+ HandlerThread mHandlerThread = new HandlerThread("backup", Process.THREAD_PRIORITY_BACKGROUND);
+ BackupHandler mBackupHandler;
PendingIntent mRunBackupIntent, mRunInitIntent;
BroadcastReceiver mRunBackupReceiver, mRunInitReceiver;
// map UIDs to the set of backup client services within that UID's app set
@@ -185,6 +194,16 @@
}
}
+ // Bookkeeping of in-flight operations for timeout etc. purposes. The operation
+ // token is the index of the entry in the pending-operations list.
+ static final int OP_PENDING = 0;
+ static final int OP_ACKNOWLEDGED = 1;
+ static final int OP_TIMEOUT = -1;
+
+ final SparseIntArray mCurrentOperations = new SparseIntArray();
+ final Object mCurrentOpLock = new Object();
+ final Random mTokenGenerator = new Random();
+
// Where we keep our journal files and other bookkeeping
File mBaseStateDir;
File mDataDir;
@@ -200,6 +219,115 @@
HashSet<String> mPendingInits = new HashSet<String>(); // transport names
volatile boolean mInitInProgress = false;
+ // ----- Asynchronous backup/restore handler thread -----
+
+ private class BackupHandler extends Handler {
+ public BackupHandler(Looper looper) {
+ super(looper);
+ }
+
+ public void handleMessage(Message msg) {
+
+ switch (msg.what) {
+ case MSG_RUN_BACKUP:
+ {
+ mLastBackupPass = System.currentTimeMillis();
+ mNextBackupPass = mLastBackupPass + BACKUP_INTERVAL;
+
+ IBackupTransport transport = getTransport(mCurrentTransport);
+ if (transport == null) {
+ Log.v(TAG, "Backup requested but no transport available");
+ synchronized (mQueueLock) {
+ mBackupOrRestoreInProgress = false;
+ }
+ mWakelock.release();
+ break;
+ }
+
+ // snapshot the pending-backup set and work on that
+ ArrayList<BackupRequest> queue = new ArrayList<BackupRequest>();
+ synchronized (mQueueLock) {
+ // Do we have any work to do?
+ if (mPendingBackups.size() > 0) {
+ for (BackupRequest b: mPendingBackups.values()) {
+ queue.add(b);
+ }
+ if (DEBUG) Log.v(TAG, "clearing pending backups");
+ mPendingBackups.clear();
+
+ // Start a new backup-queue journal file too
+ File oldJournal = mJournal;
+ mJournal = null;
+
+ // At this point, we have started a new journal file, and the old
+ // file identity is being passed to the backup processing thread.
+ // When it completes successfully, that old journal file will be
+ // deleted. If we crash prior to that, the old journal is parsed
+ // at next boot and the journaled requests fulfilled.
+ (new PerformBackupTask(transport, queue, oldJournal)).run();
+ } else {
+ Log.v(TAG, "Backup requested but nothing pending");
+ synchronized (mQueueLock) {
+ mBackupOrRestoreInProgress = false;
+ }
+ mWakelock.release();
+ }
+ }
+ break;
+ }
+
+ case MSG_RUN_FULL_BACKUP:
+ break;
+
+ case MSG_RUN_RESTORE:
+ {
+ RestoreParams params = (RestoreParams)msg.obj;
+ Log.d(TAG, "MSG_RUN_RESTORE observer=" + params.observer);
+ (new PerformRestoreTask(params.transport, params.observer,
+ params.token)).run();
+ break;
+ }
+
+ case MSG_RUN_CLEAR:
+ {
+ ClearParams params = (ClearParams)msg.obj;
+ (new PerformClearTask(params.transport, params.packageInfo)).run();
+ break;
+ }
+
+ case MSG_RUN_INITIALIZE:
+ {
+ HashSet<String> queue;
+
+ // Snapshot the pending-init queue and work on that
+ synchronized (mQueueLock) {
+ queue = new HashSet<String>(mPendingInits);
+ mPendingInits.clear();
+ }
+
+ (new PerformInitializeTask(queue)).run();
+ break;
+ }
+
+ case MSG_TIMEOUT:
+ {
+ synchronized (mCurrentOpLock) {
+ final int token = msg.arg1;
+ int state = mCurrentOperations.get(token, OP_TIMEOUT);
+ if (state == OP_PENDING) {
+ if (DEBUG) Log.v(TAG, "TIMEOUT: token=" + token);
+ mCurrentOperations.put(token, OP_TIMEOUT);
+ }
+ mCurrentOpLock.notifyAll();
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ // ----- Main service implementation -----
+
public BackupManagerService(Context context) {
mContext = context;
mPackageManager = context.getPackageManager();
@@ -208,6 +336,13 @@
mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
+ mBackupManagerBinder = asInterface(asBinder());
+
+ // spin up the backup/restore handler thread
+ mHandlerThread = new HandlerThread("backup", Process.THREAD_PRIORITY_BACKGROUND);
+ mHandlerThread.start();
+ mBackupHandler = new BackupHandler(mHandlerThread.getLooper());
+
// Set up our bookkeeping
boolean areEnabled = Settings.Secure.getInt(context.getContentResolver(),
Settings.Secure.BACKUP_ENABLED, 0) != 0;
@@ -506,7 +641,7 @@
mTransports.put(name, transport);
} else {
mTransports.remove(name);
- if (mCurrentTransport.equals(name)) {
+ if ((mCurrentTransport != null) && mCurrentTransport.equals(name)) {
mCurrentTransport = null;
}
// Nothing further to do in the unregistration case
@@ -593,95 +728,6 @@
}
};
- // ----- Run the actual backup process asynchronously -----
-
- private class BackupHandler extends Handler {
- public void handleMessage(Message msg) {
-
- switch (msg.what) {
- case MSG_RUN_BACKUP:
- {
- mLastBackupPass = System.currentTimeMillis();
- mNextBackupPass = mLastBackupPass + BACKUP_INTERVAL;
-
- IBackupTransport transport = getTransport(mCurrentTransport);
- if (transport == null) {
- Log.v(TAG, "Backup requested but no transport available");
- synchronized (mQueueLock) {
- mBackupOrRestoreInProgress = false;
- }
- mWakelock.release();
- break;
- }
-
- // snapshot the pending-backup set and work on that
- ArrayList<BackupRequest> queue = new ArrayList<BackupRequest>();
- synchronized (mQueueLock) {
- // Do we have any work to do?
- if (mPendingBackups.size() > 0) {
- for (BackupRequest b: mPendingBackups.values()) {
- queue.add(b);
- }
- Log.v(TAG, "clearing pending backups");
- mPendingBackups.clear();
-
- // Start a new backup-queue journal file too
- File oldJournal = mJournal;
- mJournal = null;
-
- // At this point, we have started a new journal file, and the old
- // file identity is being passed to the backup processing thread.
- // When it completes successfully, that old journal file will be
- // deleted. If we crash prior to that, the old journal is parsed
- // at next boot and the journaled requests fulfilled.
- (new PerformBackupThread(transport, queue, oldJournal)).start();
- } else {
- Log.v(TAG, "Backup requested but nothing pending");
- synchronized (mQueueLock) {
- mBackupOrRestoreInProgress = false;
- }
- mWakelock.release();
- }
- }
- break;
- }
-
- case MSG_RUN_FULL_BACKUP:
- break;
-
- case MSG_RUN_RESTORE:
- {
- RestoreParams params = (RestoreParams)msg.obj;
- Log.d(TAG, "MSG_RUN_RESTORE observer=" + params.observer);
- (new PerformRestoreThread(params.transport, params.observer,
- params.token)).start();
- break;
- }
-
- case MSG_RUN_CLEAR:
- {
- ClearParams params = (ClearParams)msg.obj;
- (new PerformClearThread(params.transport, params.packageInfo)).start();
- break;
- }
-
- case MSG_RUN_INITIALIZE:
- {
- HashSet<String> queue;
-
- // Snapshot the pending-init queue and work on that
- synchronized (mQueueLock) {
- queue = new HashSet<String>(mPendingInits);
- mPendingInits.clear();
- }
-
- (new PerformInitializeThread(queue)).start();
- break;
- }
- }
- }
- }
-
// Add the backup agents in the given package to our set of known backup participants.
// If 'packageName' is null, adds all backup agents in the whole system.
void addPackageParticipantsLocked(String packageName) {
@@ -978,16 +1024,44 @@
}
}
+ // -----
+ // Utility methods used by the asynchronous-with-timeout backup/restore operations
+ boolean waitUntilOperationComplete(int token) {
+ int finalState = OP_PENDING;
+ synchronized (mCurrentOpLock) {
+ try {
+ while ((finalState = mCurrentOperations.get(token, OP_TIMEOUT)) == OP_PENDING) {
+ try {
+ mCurrentOpLock.wait();
+ } catch (InterruptedException e) {}
+ }
+ } catch (IndexOutOfBoundsException e) {
+ // the operation has been mysteriously cleared from our
+ // bookkeeping -- consider this a success and ignore it.
+ }
+ }
+ mBackupHandler.removeMessages(MSG_TIMEOUT);
+ if (DEBUG) Log.v(TAG, "operation " + token + " complete: finalState=" + finalState);
+ return finalState == OP_ACKNOWLEDGED;
+ }
+
+ void prepareOperationTimeout(int token, long interval) {
+ if (DEBUG) Log.v(TAG, "starting timeout: token=" + token + " interval=" + interval);
+ mCurrentOperations.put(token, OP_PENDING);
+ Message msg = mBackupHandler.obtainMessage(MSG_TIMEOUT, token, 0);
+ mBackupHandler.sendMessageDelayed(msg, interval);
+ }
+
// ----- Back up a set of applications via a worker thread -----
- class PerformBackupThread extends Thread {
+ class PerformBackupTask implements Runnable {
private static final String TAG = "PerformBackupThread";
IBackupTransport mTransport;
ArrayList<BackupRequest> mQueue;
File mStateDir;
File mJournal;
- public PerformBackupThread(IBackupTransport transport, ArrayList<BackupRequest> queue,
+ public PerformBackupTask(IBackupTransport transport, ArrayList<BackupRequest> queue,
File journal) {
mTransport = transport;
mQueue = queue;
@@ -1000,7 +1074,6 @@
}
}
- @Override
public void run() {
int status = BackupConstants.TRANSPORT_OK;
long startRealtime = SystemClock.elapsedRealtime();
@@ -1158,6 +1231,7 @@
ParcelFileDescriptor newState = null;
PackageInfo packInfo;
+ int token = mTokenGenerator.nextInt();
try {
// Look up the package info & signatures. This is first so that if it
// throws an exception, there's no file setup yet that would need to
@@ -1189,8 +1263,16 @@
ParcelFileDescriptor.MODE_CREATE |
ParcelFileDescriptor.MODE_TRUNCATE);
- // Run the target's backup pass
- agent.doBackup(savedState, backupData, newState);
+ // Initiate the target's backup pass
+ prepareOperationTimeout(token, TIMEOUT_BACKUP_INTERVAL);
+ agent.doBackup(savedState, backupData, newState, token, mBackupManagerBinder);
+ boolean success = waitUntilOperationComplete(token);
+
+ if (!success) {
+ // timeout -- bail out into the failed-transaction logic
+ throw new RuntimeException("Backup timeout");
+ }
+
logBackupComplete(packageName);
if (DEBUG) Log.v(TAG, "doBackup() success");
} catch (Exception e) {
@@ -1204,6 +1286,9 @@
try { if (backupData != null) backupData.close(); } catch (IOException e) {}
try { if (newState != null) newState.close(); } catch (IOException e) {}
savedState = backupData = newState = null;
+ synchronized (mCurrentOpLock) {
+ mCurrentOperations.clear();
+ }
}
// Now propagate the newly-backed-up data to the transport
@@ -1299,7 +1384,7 @@
return true;
}
- class PerformRestoreThread extends Thread {
+ class PerformRestoreTask implements Runnable {
private IBackupTransport mTransport;
private IRestoreObserver mObserver;
private long mToken;
@@ -1315,7 +1400,7 @@
}
}
- PerformRestoreThread(IBackupTransport transport, IRestoreObserver observer,
+ PerformRestoreTask(IBackupTransport transport, IRestoreObserver observer,
long restoreSetToken) {
mTransport = transport;
Log.d(TAG, "PerformRestoreThread mObserver=" + mObserver);
@@ -1329,7 +1414,6 @@
}
}
- @Override
public void run() {
long startRealtime = SystemClock.elapsedRealtime();
if (DEBUG) Log.v(TAG, "Beginning restore process mTransport=" + mTransport
@@ -1579,6 +1663,7 @@
ParcelFileDescriptor backupData = null;
ParcelFileDescriptor newState = null;
+ int token = mTokenGenerator.nextInt();
try {
// Run the transport's restore pass
backupData = ParcelFileDescriptor.open(backupDataName,
@@ -1602,7 +1687,14 @@
ParcelFileDescriptor.MODE_CREATE |
ParcelFileDescriptor.MODE_TRUNCATE);
- agent.doRestore(backupData, appVersionCode, newState);
+ // Kick off the restore, checking for hung agents
+ prepareOperationTimeout(token, TIMEOUT_RESTORE_INTERVAL);
+ agent.doRestore(backupData, appVersionCode, newState, token, mBackupManagerBinder);
+ boolean success = waitUntilOperationComplete(token);
+
+ if (!success) {
+ throw new RuntimeException("restore timeout");
+ }
// if everything went okay, remember the recorded state now
//
@@ -1635,20 +1727,20 @@
try { if (backupData != null) backupData.close(); } catch (IOException e) {}
try { if (newState != null) newState.close(); } catch (IOException e) {}
backupData = newState = null;
+ mCurrentOperations.delete(token);
}
}
}
- class PerformClearThread extends Thread {
+ class PerformClearTask implements Runnable {
IBackupTransport mTransport;
PackageInfo mPackage;
- PerformClearThread(IBackupTransport transport, PackageInfo packageInfo) {
+ PerformClearTask(IBackupTransport transport, PackageInfo packageInfo) {
mTransport = transport;
mPackage = packageInfo;
}
- @Override
public void run() {
try {
// Clear the on-device backup state to ensure a full backup next time
@@ -1678,14 +1770,13 @@
}
}
- class PerformInitializeThread extends Thread {
+ class PerformInitializeTask implements Runnable {
HashSet<String> mQueue;
- PerformInitializeThread(HashSet<String> transportNames) {
+ PerformInitializeTask(HashSet<String> transportNames) {
mQueue = transportNames;
}
- @Override
public void run() {
try {
for (String transportName : mQueue) {
@@ -2073,6 +2164,16 @@
return mActiveRestoreSession;
}
+ // Note that a currently-active backup agent has notified us that it has
+ // completed the given outstanding asynchronous backup/restore operation.
+ public void opComplete(int token) {
+ synchronized (mCurrentOpLock) {
+ if (DEBUG) Log.v(TAG, "opComplete: " + token);
+ mCurrentOperations.put(token, OP_ACKNOWLEDGED);
+ mCurrentOpLock.notifyAll();
+ }
+ }
+
// ----- Restore session -----
class ActiveRestoreSession extends IRestoreSession.Stub {
diff --git a/services/java/com/android/server/DevicePolicyManagerService.java b/services/java/com/android/server/DevicePolicyManagerService.java
index 17a3ab8..e4ee4ae 100644
--- a/services/java/com/android/server/DevicePolicyManagerService.java
+++ b/services/java/com/android/server/DevicePolicyManagerService.java
@@ -64,7 +64,7 @@
IPowerManager mIPowerManager;
- int mActivePasswordMode = DevicePolicyManager.PASSWORD_MODE_UNSPECIFIED;
+ int mActivePasswordQuality = DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
int mActivePasswordLength = 0;
int mFailedPasswordAttempts = 0;
@@ -76,7 +76,7 @@
static class ActiveAdmin {
final DeviceAdminInfo info;
- int passwordMode = DevicePolicyManager.PASSWORD_MODE_UNSPECIFIED;
+ int passwordQuality = DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
int minimumPasswordLength = 0;
long maximumTimeToUnlock = 0;
int maximumFailedPasswordsForWipe = 0;
@@ -89,17 +89,17 @@
void writeToXml(XmlSerializer out)
throws IllegalArgumentException, IllegalStateException, IOException {
- if (passwordMode != DevicePolicyManager.PASSWORD_MODE_UNSPECIFIED) {
- out.startTag(null, "password-mode");
- out.attribute(null, "value", Integer.toString(passwordMode));
- out.endTag(null, "password-mode");
+ if (passwordQuality != DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
+ out.startTag(null, "password-quality");
+ out.attribute(null, "value", Integer.toString(passwordQuality));
+ out.endTag(null, "password-quality");
if (minimumPasswordLength > 0) {
out.startTag(null, "min-password-length");
out.attribute(null, "value", Integer.toString(minimumPasswordLength));
out.endTag(null, "mn-password-length");
}
}
- if (maximumTimeToUnlock != DevicePolicyManager.PASSWORD_MODE_UNSPECIFIED) {
+ if (maximumTimeToUnlock != DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
out.startTag(null, "max-time-to-unlock");
out.attribute(null, "value", Long.toString(maximumTimeToUnlock));
out.endTag(null, "max-time-to-unlock");
@@ -121,8 +121,8 @@
continue;
}
String tag = parser.getName();
- if ("password-mode".equals(tag)) {
- passwordMode = Integer.parseInt(
+ if ("password-quality".equals(tag)) {
+ passwordQuality = Integer.parseInt(
parser.getAttributeValue(null, "value"));
} else if ("min-password-length".equals(tag)) {
minimumPasswordLength = Integer.parseInt(
@@ -435,34 +435,34 @@
}
}
- public void setPasswordMode(ComponentName who, int mode) {
+ public void setPasswordQuality(ComponentName who, int mode) {
synchronized (this) {
if (who == null) {
throw new NullPointerException("ComponentName is null");
}
ActiveAdmin ap = getActiveAdminForCallerLocked(who,
DeviceAdminInfo.USES_POLICY_LIMIT_PASSWORD);
- if (ap.passwordMode != mode) {
- ap.passwordMode = mode;
+ if (ap.passwordQuality != mode) {
+ ap.passwordQuality = mode;
saveSettingsLocked();
}
}
}
- public int getPasswordMode(ComponentName who) {
+ public int getPasswordQuality(ComponentName who) {
synchronized (this) {
- int mode = DevicePolicyManager.PASSWORD_MODE_UNSPECIFIED;
+ int mode = DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
if (who != null) {
ActiveAdmin admin = getActiveAdminUncheckedLocked(who);
- return admin != null ? admin.passwordMode : mode;
+ return admin != null ? admin.passwordQuality : mode;
}
final int N = mAdminList.size();
for (int i=0; i<N; i++) {
ActiveAdmin admin = mAdminList.get(i);
- if (mode < admin.passwordMode) {
- mode = admin.passwordMode;
+ if (mode < admin.passwordQuality) {
+ mode = admin.passwordQuality;
}
}
return mode;
@@ -509,7 +509,7 @@
// so try to retrieve it to check that the caller is one.
getActiveAdminForCallerLocked(null,
DeviceAdminInfo.USES_POLICY_LIMIT_PASSWORD);
- return mActivePasswordMode >= getPasswordMode(null)
+ return mActivePasswordQuality >= getPasswordQuality(null)
&& mActivePasswordLength >= getPasswordMinimumLength(null);
}
}
@@ -563,14 +563,24 @@
}
public boolean resetPassword(String password) {
- int mode;
+ int quality;
synchronized (this) {
// This API can only be called by an active device admin,
// so try to retrieve it to check that the caller is one.
getActiveAdminForCallerLocked(null,
DeviceAdminInfo.USES_POLICY_RESET_PASSWORD);
- mode = getPasswordMode(null);
- if (password.length() < getPasswordMinimumLength(null)) {
+ quality = getPasswordQuality(null);
+ if (quality != DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
+ int adjQuality = LockPatternUtils.adjustPasswordMode(password, quality);
+ if (adjQuality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
+ Log.w(TAG, "resetPassword: password does not meet quality " + quality);
+ return false;
+ }
+ quality = adjQuality;
+ }
+ int length = getPasswordMinimumLength(null);
+ if (password.length() < length) {
+ Log.w(TAG, "resetPassword: password does not meet length " + length);
return false;
}
}
@@ -580,7 +590,7 @@
long ident = Binder.clearCallingIdentity();
try {
LockPatternUtils utils = new LockPatternUtils(mContext);
- utils.saveLockPassword(password, mode);
+ utils.saveLockPassword(password, quality);
} finally {
Binder.restoreCallingIdentity(ident);
}
@@ -709,16 +719,16 @@
}
}
- public void setActivePasswordState(int mode, int length) {
+ public void setActivePasswordState(int quality, int length) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.BIND_DEVICE_ADMIN, null);
synchronized (this) {
- if (mActivePasswordMode != mode || mActivePasswordLength != length
+ if (mActivePasswordQuality != quality || mActivePasswordLength != length
|| mFailedPasswordAttempts != 0) {
long ident = Binder.clearCallingIdentity();
try {
- mActivePasswordMode = mode;
+ mActivePasswordQuality = quality;
mActivePasswordLength = length;
if (mFailedPasswordAttempts != 0) {
mFailedPasswordAttempts = 0;
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index 801c86f..05cea46 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -206,7 +206,7 @@
if (mUmsEnabled) {
if (newUmsNotifyEnabled) {
Intent intent = new Intent();
- intent.setClass(mContext, com.android.internal.app.UsbStorageStopActivity.class);
+ intent.setClass(mContext, com.android.internal.app.UsbStorageActivity.class);
PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0);
setUsbStorageNotification(com.android.internal.R.string.usb_storage_stop_notification_title,
com.android.internal.R.string.usb_storage_stop_notification_message,
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 3ffb8bf..cd4ae4cc 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -4369,18 +4369,13 @@
String idxStr = "";
int idx = 1;
if (oldCodePath != null) {
- int eidx = -1;
- if (suffix != null) {
- eidx = oldCodePath.indexOf(suffix);
+ String subStr = oldCodePath;
+ if (subStr.startsWith(prefix)) {
+ subStr = subStr.substring(prefix.length());
}
- if (eidx == -1) {
- eidx = oldCodePath.length();
+ if (subStr.endsWith(suffix)) {
+ subStr = subStr.substring(0, subStr.length() - suffix.length());
}
- int sidx = oldCodePath.indexOf(prefix);
- if (sidx == -1) {
- sidx = 0;
- }
- String subStr = oldCodePath.substring(sidx + prefix.length(), eidx);
if (subStr != null) {
if (subStr.startsWith("-")) {
subStr = subStr.substring(1);
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index cefd312..e14a973 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -2011,6 +2011,10 @@
}
}
}
+
+ if (mPolicy != null) {
+ mPolicy.userActivity();
+ }
}
private int getAutoBrightnessValue(int sensorValue, int[] values) {
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index 1d14e5e..88aadbd 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -2385,7 +2385,8 @@
// to provide the correct semantics while starting.
final int mask =
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
- | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD;
+ | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
+ | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON;
WindowManager.LayoutParams sa = win.mAppToken.startingWindow.mAttrs;
sa.flags = (sa.flags&~mask) | (win.mAttrs.flags&mask);
}
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index c2c6e76..b723dcd 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -8081,6 +8081,14 @@
}
}
+ public boolean isUserAMonkey() {
+ // For now the fact that there is a controller implies
+ // we have a monkey.
+ synchronized (this) {
+ return mController != null;
+ }
+ }
+
public void registerActivityWatcher(IActivityWatcher watcher) {
mWatchers.register(watcher);
}
diff --git a/services/tests/servicestests/Android.mk b/services/tests/servicestests/Android.mk
new file mode 100644
index 0000000..2caccf7
--- /dev/null
+++ b/services/tests/servicestests/Android.mk
@@ -0,0 +1,15 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+# We only want this apk build for tests.
+LOCAL_MODULE_TAGS := tests
+
+# Include all test java files.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+
+LOCAL_JAVA_LIBRARIES := android.test.runner services
+LOCAL_PACKAGE_NAME := FrameworksServicesTests
+
+include $(BUILD_PACKAGE)
+
diff --git a/services/tests/servicestests/AndroidManifest.xml b/services/tests/servicestests/AndroidManifest.xml
new file mode 100644
index 0000000..9856c6d
--- /dev/null
+++ b/services/tests/servicestests/AndroidManifest.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.frameworks.servicestests">
+ <uses-permission android:name="android.permission.RECEIVE_SMS"/>
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.READ_CONTACTS" />
+ <uses-permission android:name="android.permission.WRITE_CONTACTS" />
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
+ <uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
+ <uses-permission android:name="android.permission.WRITE_APN_SETTINGS" />
+ <uses-permission android:name="android.permission.BROADCAST_STICKY" />
+
+
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation
+ android:name="android.test.InstrumentationTestRunner"
+ android:targetPackage="com.android.frameworks.servicestests"
+ android:label="Frameworks Services Tests" />
+</manifest>
diff --git a/tests/AndroidTests/src/com/android/unit_tests/DropBoxTest.java b/services/tests/servicestests/src/com/android/server/DropBoxTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/DropBoxTest.java
rename to services/tests/servicestests/src/com/android/server/DropBoxTest.java
index d20abd9..3842d45 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/DropBoxTest.java
+++ b/services/tests/servicestests/src/com/android/server/DropBoxTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package com.android.server;
import android.content.ContentResolver;
import android.content.Context;
diff --git a/telephony/java/com/android/internal/telephony/BaseCommands.java b/telephony/java/com/android/internal/telephony/BaseCommands.java
index 7586ba2..7421854 100644
--- a/telephony/java/com/android/internal/telephony/BaseCommands.java
+++ b/telephony/java/com/android/internal/telephony/BaseCommands.java
@@ -65,6 +65,7 @@
protected RegistrantList mT53ClirInfoRegistrants = new RegistrantList();
protected RegistrantList mT53AudCntrlInfoRegistrants = new RegistrantList();
protected RegistrantList mRingbackToneRegistrants = new RegistrantList();
+ protected RegistrantList mResendIncallMuteRegistrants = new RegistrantList();
protected Registrant mSMSRegistrant;
protected Registrant mNITZTimeRegistrant;
@@ -579,6 +580,15 @@
mRingbackToneRegistrants.remove(h);
}
+ public void registerForResendIncallMute(Handler h, int what, Object obj) {
+ Registrant r = new Registrant (h, what, obj);
+ mResendIncallMuteRegistrants.add(r);
+ }
+
+ public void unregisterForResendIncallMute(Handler h) {
+ mResendIncallMuteRegistrants.remove(h);
+ }
+
//***** Protected Methods
/**
* Store new RadioState and send notification based on the changes
diff --git a/telephony/java/com/android/internal/telephony/CommandsInterface.java b/telephony/java/com/android/internal/telephony/CommandsInterface.java
index 1d9f10a..d90c305 100644
--- a/telephony/java/com/android/internal/telephony/CommandsInterface.java
+++ b/telephony/java/com/android/internal/telephony/CommandsInterface.java
@@ -537,6 +537,18 @@
void registerForRingbackTone(Handler h, int what, Object obj);
void unregisterForRingbackTone(Handler h);
+ /**
+ * Registers the handler when mute/unmute need to be resent to get
+ * uplink audio during a call.<p>
+ *
+ * @param h Handler for notification message.
+ * @param what User-defined message code.
+ * @param obj User object.
+ *
+ */
+ void registerForResendIncallMute(Handler h, int what, Object obj);
+ void unregisterForResendIncallMute(Handler h);
+
/**
* Supply the ICC PIN to the ICC card
*
diff --git a/telephony/java/com/android/internal/telephony/Phone.java b/telephony/java/com/android/internal/telephony/Phone.java
index a8ad80e..7179bef 100644
--- a/telephony/java/com/android/internal/telephony/Phone.java
+++ b/telephony/java/com/android/internal/telephony/Phone.java
@@ -407,6 +407,16 @@
void unregisterForRingbackTone(Handler h);
+ /**
+ * Registers the handler to reset the uplink mute state to get
+ * uplink audio.
+ */
+ void registerForResendIncallMute(Handler h, int what, Object obj);
+
+ /**
+ * Unregisters for resend incall mute notifications.
+ */
+ void unregisterForResendIncallMute(Handler h);
/**
* Notifies when a voice connection has disconnected, either due to local
@@ -1389,11 +1399,6 @@
/* CDMA support methods */
- /*
- * TODO(Moto) TODO(Teleca): can getCdmaMin, getEsn, getMeid use more generic calls
- * already defined getXxxx above?
- */
-
/**
* Retrieves the MIN for CDMA phones.
*/
diff --git a/telephony/java/com/android/internal/telephony/PhoneBase.java b/telephony/java/com/android/internal/telephony/PhoneBase.java
index bad9ab3..358af95 100644
--- a/telephony/java/com/android/internal/telephony/PhoneBase.java
+++ b/telephony/java/com/android/internal/telephony/PhoneBase.java
@@ -495,6 +495,16 @@
mCM.unregisterForRingbackTone(h);
}
+ // Inherited documentation suffices.
+ public void registerForResendIncallMute(Handler h, int what, Object obj) {
+ mCM.registerForResendIncallMute(h,what,obj);
+ }
+
+ // Inherited documentation suffices.
+ public void unregisterForResendIncallMute(Handler h) {
+ mCM.unregisterForResendIncallMute(h);
+ }
+
/**
* Subclasses of Phone probably want to replace this with a
* version scoped to their packages
diff --git a/telephony/java/com/android/internal/telephony/PhoneProxy.java b/telephony/java/com/android/internal/telephony/PhoneProxy.java
index d56d99f..6d3798e 100644
--- a/telephony/java/com/android/internal/telephony/PhoneProxy.java
+++ b/telephony/java/com/android/internal/telephony/PhoneProxy.java
@@ -351,6 +351,14 @@
mActivePhone.unregisterForRingbackTone(h);
}
+ public void registerForResendIncallMute(Handler h, int what, Object obj) {
+ mActivePhone.registerForResendIncallMute(h,what,obj);
+ }
+
+ public void unregisterForResendIncallMute(Handler h) {
+ mActivePhone.unregisterForResendIncallMute(h);
+ }
+
public boolean getIccRecordsLoaded() {
return mActivePhone.getIccRecordsLoaded();
}
diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java
index 1ffcf9b..d8e313a7 100644
--- a/telephony/java/com/android/internal/telephony/RIL.java
+++ b/telephony/java/com/android/internal/telephony/RIL.java
@@ -2333,6 +2333,7 @@
case RIL_UNSOL_CDMA_INFO_REC: ret = responseCdmaInformationRecord(p); break;
case RIL_UNSOL_OEM_HOOK_RAW: ret = responseRaw(p); break;
case RIL_UNSOL_RINGBACK_TONE: ret = responseInts(p); break;
+ case RIL_UNSOL_RESEND_INCALL_MUTE: ret = responseVoid(p); break;
default:
throw new RuntimeException("Unrecognized unsol response: " + response);
@@ -2625,6 +2626,15 @@
mRingbackToneRegistrants.notifyRegistrants(
new AsyncResult (null, playtone, null));
}
+ break;
+
+ case RIL_UNSOL_RESEND_INCALL_MUTE:
+ if (RILJ_LOGD) unsljLogRet(response, ret);
+
+ if (mResendIncallMuteRegistrants != null) {
+ mResendIncallMuteRegistrants.notifyRegistrants(
+ new AsyncResult (null, ret, null));
+ }
}
}
@@ -2972,10 +2982,9 @@
numServiceCategories = p.readInt();
if (numServiceCategories == 0) {
- // TODO(Teleca) TODO(Moto): The logic of providing default
- // values should not be done by this transport layer. And
- // needs to be done by the vendor ril or application logic.
- // TODO(Google): Remove ASAP
+ // TODO: The logic of providing default values should
+ // not be done by this transport layer. And needs to
+ // be done by the vendor ril or application logic.
int numInts;
numInts = CDMA_BROADCAST_SMS_NO_OF_SERVICE_CATEGORIES * CDMA_BSI_NO_OF_INTS_STRUCT + 1;
response = new int[numInts];
@@ -3268,6 +3277,7 @@
case RIL_UNSOL_CDMA_INFO_REC: return "UNSOL_CDMA_INFO_REC";
case RIL_UNSOL_OEM_HOOK_RAW: return "UNSOL_OEM_HOOK_RAW";
case RIL_UNSOL_RINGBACK_TONE: return "UNSOL_RINGBACK_TONG";
+ case RIL_UNSOL_RESEND_INCALL_MUTE: return "UNSOL_RESEND_INCALL_MUTE";
default: return "<unknown reponse>";
}
}
diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java
index c29adcf..4d8c7ec 100644
--- a/telephony/java/com/android/internal/telephony/RILConstants.java
+++ b/telephony/java/com/android/internal/telephony/RILConstants.java
@@ -259,4 +259,5 @@
int RIL_UNSOL_CDMA_INFO_REC = 1027;
int RIL_UNSOL_OEM_HOOK_RAW = 1028;
int RIL_UNSOL_RINGBACK_TONE = 1029;
+ int RIL_UNSOL_RESEND_INCALL_MUTE = 1030;
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
index d4b1652..1f5accf 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
@@ -681,7 +681,7 @@
public String getVoiceMailNumber() {
String number = null;
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
- // TODO(Moto): The default value of voicemail number should be read from a system property
+ // TODO: The default value of voicemail number should be read from a system property
number = sp.getString(VM_NUMBER_CDMA, "*86");
return number;
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaInformationRecords.java b/telephony/java/com/android/internal/telephony/cdma/CdmaInformationRecords.java
index 7402769..ce6530a 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaInformationRecords.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaInformationRecords.java
@@ -74,7 +74,7 @@
break;
case RIL_CDMA_T53_RELEASE_INFO_REC:
- // TODO(Moto): WHAT to do, for now fall through and throw exception
+ // TODO: WHAT to do, for now fall through and throw exception
default:
throw new RuntimeException("RIL_UNSOL_CDMA_INFO_REC: unsupported record. Got "
+ CdmaInformationRecords.idToString(id) + " ");
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
index 42feaa9..7f2ba47 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
@@ -1622,9 +1622,7 @@
* Returns IMSI as MCC + MNC + MIN
*/
String getImsi() {
- // TODO(Moto): When RUIM is enabled, IMSI will come from RUIM
- // not build-time props. Moto will provide implementation
- // for RUIM-ready case later.
+ // TODO: When RUIM is enabled, IMSI will come from RUIM not build-time props.
String operatorNumeric = SystemProperties.get(
TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC, "");
diff --git a/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java b/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java
index b9ece8b..87b0c60 100644
--- a/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java
+++ b/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java
@@ -166,10 +166,8 @@
return null;
}
- // TODO(Moto): mncLength is not set anywhere.
if (mncLength != UNINITIALIZED && mncLength != UNKNOWN) {
// Length = length of MCC + length of MNC
- // TODO: change spec name
// length of mcc = 3 (3GPP2 C.S0005 - Section 2.3)
return mImsi.substring(0, 3 + mncLength);
}
diff --git a/telephony/tests/telephonytests/AndroidManifest.xml b/telephony/tests/telephonytests/AndroidManifest.xml
index 70aeebc..6a97423 100644
--- a/telephony/tests/telephonytests/AndroidManifest.xml
+++ b/telephony/tests/telephonytests/AndroidManifest.xml
@@ -33,4 +33,5 @@
android:label="Frameworks Telephony Tests">
</instrumentation>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
+
</manifest>
diff --git a/tests/AndroidTests/src/com/android/unit_tests/GsmSmsTest.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/GsmSmsTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/GsmSmsTest.java
rename to telephony/tests/telephonytests/src/com/android/internal/telephony/GsmSmsTest.java
index 8987d6b..3103fc1 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/GsmSmsTest.java
+++ b/telephony/tests/telephonytests/src/com/android/internal/telephony/GsmSmsTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package com.android.internal.telephony;
import com.android.internal.telephony.GsmAlphabet;
import com.android.internal.telephony.SmsHeader;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/MccTableTest.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/MccTableTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/MccTableTest.java
rename to telephony/tests/telephonytests/src/com/android/internal/telephony/MccTableTest.java
index b2f1ded..1ea1285 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/MccTableTest.java
+++ b/telephony/tests/telephonytests/src/com/android/internal/telephony/MccTableTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package com.android.internal.telephony;
import com.android.internal.telephony.MccTable;
diff --git a/telephony/tests/telephonytests/src/com/android/internal/telephony/NeighboringCellInfoTest.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/NeighboringCellInfoTest.java
new file mode 100644
index 0000000..b63dc71
--- /dev/null
+++ b/telephony/tests/telephonytests/src/com/android/internal/telephony/NeighboringCellInfoTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.internal.telephony;
+
+import android.os.Parcel;
+import android.test.AndroidTestCase;
+import android.telephony.NeighboringCellInfo;
+import android.test. suitebuilder.annotation.SmallTest;
+
+import static android.telephony.TelephonyManager.NETWORK_TYPE_UNKNOWN;
+import static android.telephony.TelephonyManager.NETWORK_TYPE_EDGE;
+import static android.telephony.TelephonyManager.NETWORK_TYPE_GPRS;
+import static android.telephony.TelephonyManager.NETWORK_TYPE_UMTS;
+
+public class NeighboringCellInfoTest extends AndroidTestCase {
+ @SmallTest
+ public void testConstructor() {
+ int rssi = 31;
+ NeighboringCellInfo nc;
+
+ nc = new NeighboringCellInfo(rssi, "FFFFFFF", NETWORK_TYPE_EDGE);
+ assertEquals(NETWORK_TYPE_EDGE, nc.getNetworkType());
+ assertEquals(rssi, nc.getRssi());
+ assertEquals(0xfff, nc.getLac());
+ assertEquals(0xffff, nc.getCid());
+ assertEquals(NeighboringCellInfo.UNKNOWN_CID, nc.getPsc());
+
+ nc = new NeighboringCellInfo(rssi, "1FF", NETWORK_TYPE_UMTS);
+ assertEquals(NETWORK_TYPE_UMTS, nc.getNetworkType());
+ assertEquals(rssi, nc.getRssi());
+ assertEquals(NeighboringCellInfo.UNKNOWN_CID, nc.getCid());
+ assertEquals(NeighboringCellInfo.UNKNOWN_CID, nc.getLac());
+ assertEquals(0x1ff, nc.getPsc());
+
+ nc = new NeighboringCellInfo(rssi, "1FF", NETWORK_TYPE_UNKNOWN);
+ assertEquals(NETWORK_TYPE_UNKNOWN, nc.getNetworkType());
+ assertEquals(rssi, nc.getRssi());
+ assertEquals(NeighboringCellInfo.UNKNOWN_CID, nc.getCid());
+ assertEquals(NeighboringCellInfo.UNKNOWN_CID, nc.getLac());
+ assertEquals(NeighboringCellInfo.UNKNOWN_CID, nc.getPsc());
+ }
+
+ @SmallTest
+ public void testParcel() {
+ int rssi = 20;
+
+ NeighboringCellInfo nc = new NeighboringCellInfo(rssi, "12345678", NETWORK_TYPE_GPRS);
+ assertEquals(NETWORK_TYPE_GPRS, nc.getNetworkType());
+ assertEquals(rssi, nc.getRssi());
+ assertEquals(0x1234, nc.getLac());
+ assertEquals(0x5678, nc.getCid());
+ assertEquals(NeighboringCellInfo.UNKNOWN_CID, nc.getPsc());
+
+ Parcel p = Parcel.obtain();
+ p.setDataPosition(0);
+ nc.writeToParcel(p, 0);
+
+ p.setDataPosition(0);
+ NeighboringCellInfo nw = new NeighboringCellInfo(p);
+ assertEquals(NETWORK_TYPE_GPRS, nw.getNetworkType());
+ assertEquals(rssi, nw.getRssi());
+ assertEquals(0x1234, nw.getLac());
+ assertEquals(0x5678, nw.getCid());
+ assertEquals(NeighboringCellInfo.UNKNOWN_CID, nw.getPsc());
+ }
+}
diff --git a/tests/AndroidTests/src/com/android/unit_tests/CdmaSmsTest.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/cdma/sms/CdmaSmsTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/CdmaSmsTest.java
rename to telephony/tests/telephonytests/src/com/android/internal/telephony/cdma/sms/CdmaSmsTest.java
index db47693..58e73e0 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/CdmaSmsTest.java
+++ b/telephony/tests/telephonytests/src/com/android/internal/telephony/cdma/sms/CdmaSmsTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package com.android.internal.telephony.cdma.sms;
import android.telephony.TelephonyManager;
diff --git a/test-runner/android/test/mock/MockPackageManager.java b/test-runner/android/test/mock/MockPackageManager.java
index 2f313af..cbe0253 100644
--- a/test-runner/android/test/mock/MockPackageManager.java
+++ b/test-runner/android/test/mock/MockPackageManager.java
@@ -438,4 +438,12 @@
public boolean isSafeMode() {
throw new UnsupportedOperationException();
}
+
+ /**
+ * @hide
+ */
+ @Override
+ public int recommendAppInstallLocation(ApplicationInfo appInfo, Uri packageURI) {
+ throw new UnsupportedOperationException();
+ }
}
diff --git a/tests/AndroidTests/Android.mk b/tests/AndroidTests/Android.mk
index a81b779..bff8fba 100644
--- a/tests/AndroidTests/Android.mk
+++ b/tests/AndroidTests/Android.mk
@@ -11,8 +11,7 @@
LOCAL_AAPT_FLAGS = -c xx_YY -c cs -c 160dpi -c 32dpi -c 240dpi
LOCAL_SRC_FILES := \
- $(call all-subdir-java-files) \
- src/com/android/unit_tests/os/IAidlTest.aidl
+ $(call all-subdir-java-files)
LOCAL_PACKAGE_NAME := AndroidTests
LOCAL_CERTIFICATE := platform
diff --git a/tests/AndroidTests/AndroidManifest.xml b/tests/AndroidTests/AndroidManifest.xml
index e0d8f79..c2548b9 100644
--- a/tests/AndroidTests/AndroidManifest.xml
+++ b/tests/AndroidTests/AndroidManifest.xml
@@ -17,21 +17,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.unit_tests"
android:sharedUserId="com.android.uid.test">
- <permission android:name="com.android.unit_tests.permission.TEST_GRANTED"
- android:protectionLevel="normal"
- android:label="@string/permlab_testGranted"
- android:description="@string/permdesc_testGranted">
- <meta-data android:name="com.android.unit_tests.string" android:value="foo" />
- <meta-data android:name="com.android.unit_tests.boolean" android:value="true" />
- <meta-data android:name="com.android.unit_tests.integer" android:value="100" />
- <meta-data android:name="com.android.unit_tests.color" android:value="#ff000000" />
- <meta-data android:name="com.android.unit_tests.float" android:value="100.1" />
- <meta-data android:name="com.android.unit_tests.reference" android:resource="@xml/metadata" />
- </permission>
- <permission android:name="com.android.unit_tests.permission.TEST_DENIED"
- android:protectionLevel="normal"
- android:label="@string/permlab_testDenied"
- android:description="@string/permdesc_testDenied" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
@@ -39,19 +24,12 @@
<uses-permission android:name="android.permission.CLEAR_APP_USER_DATA" />
<uses-permission android:name="android.permission.DELETE_CACHE_FILES" />
<uses-permission android:name="android.permission.GET_PACKAGE_SIZE" />
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.READ_CONTACTS" />
- <uses-permission android:name="android.permission.READ_LOGS"/>
- <uses-permission android:name="android.permission.READ_PHONE_STATE" />
- <uses-permission android:name="android.permission.READ_SMS"/>
- <uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
- <uses-permission android:name="android.permission.WRITE_CONTACTS" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
- <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
- <uses-permission android:name="android.permission.WRITE_SMS"/>
<uses-permission android:name="com.android.unit_tests.permission.TEST_GRANTED" />
+ <uses-permission android:name="com.google.android.googleapps.permission.ACCESS_GOOGLE_PASSWORD" />
+ <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH" />
+ <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.ALL_SERVICES" />
<!-- InstrumentationTestRunner for AndroidTests -->
<instrumentation android:name="android.test.InstrumentationTestRunner"
@@ -60,17 +38,6 @@
<application>
<uses-library android:name="android.test.runner" />
-
- <!-- Activity-level metadata -->
- <meta-data android:name="com.android.unit_tests.isApp" android:value="true" />
- <meta-data android:name="com.android.unit_tests.string" android:value="foo" />
- <meta-data android:name="com.android.unit_tests.boolean" android:value="true" />
- <meta-data android:name="com.android.unit_tests.integer" android:value="100" />
- <meta-data android:name="com.android.unit_tests.color" android:value="#ff000000" />
- <meta-data android:name="com.android.unit_tests.float" android:value="100.1" />
- <meta-data android:name="com.android.unit_tests.reference"
- android:resource="@xml/metadata_app" />
-
<activity android:name="AndroidPerformanceTests" android:label="Android Performance Tests">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -78,167 +45,5 @@
</intent-filter>
</activity>
- <!-- Application components used for activity tests -->
-
- <activity android:name=".activity.TestedActivity"
- android:process=":remoteActivity">
- </activity>
- <activity android:name=".activity.LocalActivity" android:multiprocess="true">
- <meta-data android:name="com.android.unit_tests.string" android:value="foo" />
- <meta-data android:name="com.android.unit_tests.boolean" android:value="true" />
- <meta-data android:name="com.android.unit_tests.integer" android:value="100" />
- <meta-data android:name="com.android.unit_tests.color" android:value="#ff000000" />
- <meta-data android:name="com.android.unit_tests.float" android:value="100.1" />
- <meta-data android:name="com.android.unit_tests.reference" android:resource="@xml/metadata" />
- </activity>
- <activity android:name=".activity.TestedScreen"
- android:process=":remoteScreen">
- </activity>
- <activity android:name=".activity.LocalScreen" android:multiprocess="true">
- </activity>
- <activity android:name=".activity.ClearTop" android:multiprocess="true"
- android:launchMode="singleTop">
- </activity>
- <activity android:name=".activity.LocalDialog" android:multiprocess="true"
- android:theme="@android:style/Theme.Dialog">
- </activity>
- <activity android:name=".activity.SubActivityScreen">
- </activity>
- <activity android:name=".activity.RemoteSubActivityScreen"
- android:process=":remoteActivity">
- </activity>
- <activity android:name=".activity.LaunchpadActivity" android:multiprocess="true">
- </activity>
- <activity android:name=".activity.LaunchpadTabActivity" android:multiprocess="true">
- </activity>
-
- <receiver android:name=".activity.AbortReceiver">
- <intent-filter android:priority="1">
- <action android:name="com.android.unit_tests.activity.BROADCAST_ABORT" />
- </intent-filter>
- </receiver>
- <receiver android:name=".activity.LocalReceiver">
- <intent-filter android:priority="-1">
- <action android:name="com.android.unit_tests.activity.BROADCAST_ABORT" />
- <action android:name="com.android.unit_tests.activity.BROADCAST_ALL" />
- <action android:name="com.android.unit_tests.activity.BROADCAST_REPEAT" />
- <action android:name="com.android.unit_tests.activity.BROADCAST_LOCAL" />
- <action android:name="com.android.unit_tests.activity.BROADCAST_FAIL_REGISTER" />
- <action android:name="com.android.unit_tests.activity.BROADCAST_FAIL_BIND" />
- </intent-filter>
- <meta-data android:name="com.android.unit_tests.string" android:value="foo" />
- <meta-data android:name="com.android.unit_tests.boolean" android:value="true" />
- <meta-data android:name="com.android.unit_tests.integer" android:value="100" />
- <meta-data android:name="com.android.unit_tests.color" android:value="#ff000000" />
- <meta-data android:name="com.android.unit_tests.float" android:value="100.1" />
- <meta-data android:name="com.android.unit_tests.reference" android:resource="@xml/metadata" />
- </receiver>
- <receiver android:name=".activity.ResultReceiver">
- <intent-filter>
- <action android:name="com.android.unit_tests.activity.BROADCAST_RESULT" />
- </intent-filter>
- </receiver>
- <receiver android:name=".activity.LocalGrantedReceiver"
- android:permission="com.android.unit_tests.permission.TEST_GRANTED">
- <intent-filter android:priority="-1">
- <action android:name="com.android.unit_tests.activity.BROADCAST_LOCAL_GRANTED" />
- </intent-filter>
- </receiver>
- <receiver android:name=".activity.LocalDeniedReceiver"
- android:permission="com.android.unit_tests.permission.TEST_DENIED">
- <intent-filter android:priority="-1">
- <action android:name="com.android.unit_tests.activity.BROADCAST_LOCAL_DENIED" />
- </intent-filter>
- </receiver>
- <receiver android:name=".activity.RemoteReceiver"
- android:process=":remoteReceiver">
- <intent-filter android:priority="2">
- <action android:name="com.android.unit_tests.activity.BROADCAST_ABORT" />
- <action android:name="com.android.unit_tests.activity.BROADCAST_ALL" />
- <action android:name="com.android.unit_tests.activity.BROADCAST_REPEAT" />
- <action android:name="com.android.unit_tests.activity.BROADCAST_REMOTE" />
- </intent-filter>
- </receiver>
- <receiver android:name=".activity.RemoteGrantedReceiver"
- android:permission="com.android.unit_tests.permission.TEST_GRANTED">
- <intent-filter android:priority="2">
- <action android:name="com.android.unit_tests.activity.BROADCAST_REMOTE_GRANTED" />
- </intent-filter>
- </receiver>
- <receiver android:name=".activity.RemoteDeniedReceiver"
- android:permission="com.android.unit_tests.permission.TEST_DENIED">
- <intent-filter android:priority="2">
- <action android:name="com.android.unit_tests.activity.BROADCAST_REMOTE_DENIED" />
- </intent-filter>
- </receiver>
- <service android:name=".activity.LocalService">
- <intent-filter>
- <action android:name="com.android.unit_tests.activity.SERVICE_LOCAL" />
- </intent-filter>
- <meta-data android:name="com.android.unit_tests.string" android:value="foo" />
- <meta-data android:name="com.android.unit_tests.boolean" android:value="true" />
- <meta-data android:name="com.android.unit_tests.integer" android:value="100" />
- <meta-data android:name="com.android.unit_tests.color" android:value="#ff000000" />
- <meta-data android:name="com.android.unit_tests.float" android:value="100.1" />
- <meta-data android:name="com.android.unit_tests.reference" android:resource="@xml/metadata" />
- </service>
- <service android:name=".activity.LocalDeniedService"
- android:permission="com.android.unit_tests.permission.TEST_DENIED">
- <intent-filter>
- <action android:name="com.android.unit_tests.activity.SERVICE_LOCAL_DENIED" />
- </intent-filter>
- </service>
- <service android:name=".activity.LocalGrantedService"
- android:permission="com.android.unit_tests.permission.TEST_GRANTED">
- <intent-filter>
- <action android:name="com.android.unit_tests.activity.SERVICE_LOCAL_GRANTED" />
- </intent-filter>
- </service>
-
- <provider android:name=".activity.LocalProvider"
- android:authorities="com.android.unit_tests.LocalProvider">
- <meta-data android:name="com.android.unit_tests.string" android:value="foo" />
- <meta-data android:name="com.android.unit_tests.boolean" android:value="true" />
- <meta-data android:name="com.android.unit_tests.integer" android:value="100" />
- <meta-data android:name="com.android.unit_tests.color" android:value="#ff000000" />
- <meta-data android:name="com.android.unit_tests.float" android:value="100.1" />
- <meta-data android:name="com.android.unit_tests.reference" android:resource="@xml/metadata" />
- </provider>
-
- <!-- Application components used for content tests -->
- <provider android:name=".content.MemoryFileProvider"
- android:authorities="com.android.unit_tests.content.MemoryFileProvider"
- android:process=":MemoryFileProvider">
- </provider>
-
- <!-- Application components used for os tests -->
-
- <service android:name=".os.MessengerService"
- android:process=":messengerService">
- </service>
-
- <!-- Application components used for search manager tests -->
-
- <activity android:name=".SearchableActivity"
- android:label="Searchable Activity">
- <intent-filter>
- <action android:name="android.intent.action.SEARCH" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
- <meta-data android:name="android.app.searchable"
- android:resource="@xml/searchable" />
- </activity>
-
- <provider android:name=".SuggestionProvider"
- android:authorities="com.android.unit_tests.SuggestionProvider">
- </provider>
-
- <!-- Used to test IPC. -->
- <service android:name=".binder.BinderTestService"
- android:process="binder.BinderTestService" />
- <service android:name=".binder.BinderPerformanceService"
- android:process="binder.BinderPerformanceService" />
- <service android:name=".binder.BinderVsMessagingService"
- android:process="binder.BinderVsMessagingService" />
</application>
</manifest>
diff --git a/tests/AndroidTests/res/layout/layout_three.xml b/tests/AndroidTests/res/layout/layout_three.xml
deleted file mode 100644
index 7b1ccc5..0000000
--- a/tests/AndroidTests/res/layout/layout_three.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2006, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/content" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
- <view class="com.android.unit_tests.InflateTest$ViewOne" android:id="@+id/view1" android:layout_width="match_parent" android:layout_height="match_parent"/>
- <view class="com.android.unit_tests.InflateTest$ViewOne" android:id="@+id/view2" android:layout_width="match_parent" android:layout_height="match_parent"/>
- <view class="com.android.unit_tests.InflateTest$ViewOne" android:id="@+id/view3" android:layout_width="match_parent" android:layout_height="match_parent"/>
- <view class="com.android.unit_tests.InflateTest$ViewOne" android:id="@+id/view4" android:layout_width="match_parent" android:layout_height="match_parent"/>
- <view class="com.android.unit_tests.InflateTest$ViewOne" android:id="@+id/view5" android:layout_width="match_parent" android:layout_height="match_parent"/>
- <view class="com.android.unit_tests.InflateTest$ViewOne" android:id="@+id/view6" android:layout_width="match_parent" android:layout_height="match_parent"/>
-</LinearLayout>
diff --git a/tests/AndroidTests/res/values/strings.xml b/tests/AndroidTests/res/values/strings.xml
index 49d8ae7..e8b150a 100644
--- a/tests/AndroidTests/res/values/strings.xml
+++ b/tests/AndroidTests/res/values/strings.xml
@@ -8,25 +8,13 @@
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
+ distributed under the License is distributed on an "AS IS" BASI
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="permlab_testGranted">Test Granted</string>
- <string name="permdesc_testGranted">Used for running unit tests, for
- testing operations where we have the permission.</string>
- <string name="permlab_testDenied">Test Denied</string>
- <string name="permdesc_testDenied">Used for running unit tests, for
- testing operations where we do not have the permission.</string>
-
- <string name="layout_five_text_text">S</string>
-
- <string name="layout_four_text_text">S</string>
-
- <string name="layout_six_text_text">S</string>
<string name="coerceIntegerToString">100</string>
<string name="coerceBooleanToString">true</string>
@@ -41,17 +29,10 @@
<string name="reference">here</string>
- <string name="metadata_text">text</string>
-
- <string name="menu_test">test</string>
-
<plurals name="plurals_test">
<item quantity="one">A dog</item>
<item quantity="other">Some dogs</item>
</plurals>
- <string name="searchable_label">SearchManager Test</string>
- <string name="searchable_hint">A search hint</string>
-
<!-- <string name="layout_six_text_text">F</string> -->
</resources>
diff --git a/tests/AndroidTests/src/com/android/unit_tests/AndroidPerformanceTests.java b/tests/AndroidTests/src/com/android/unit_tests/AndroidPerformanceTests.java
index b6a8594..795fe2b 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/AndroidPerformanceTests.java
+++ b/tests/AndroidTests/src/com/android/unit_tests/AndroidPerformanceTests.java
@@ -27,12 +27,8 @@
public static class Suite {
public static String[] children() {
return new String[] {
- DatabasePerformanceTests.class.getName(),
- GraphicsPerformanceTests.class.getName(),
JavaPerformanceTests.class.getName(),
- LogTest.PerformanceTest.class.getName(),
PerformanceTests.class.getName(),
- TextViewPerformanceTest.class.getName(),
};
}
}
diff --git a/tests/AndroidTests/src/com/android/unit_tests/DatabaseTests.java b/tests/AndroidTests/src/com/android/unit_tests/DatabaseTests.java
deleted file mode 100644
index a288c73..0000000
--- a/tests/AndroidTests/src/com/android/unit_tests/DatabaseTests.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.unit_tests;
-
-import junit.framework.TestSuite;
-
-public class DatabaseTests {
- public static TestSuite suite() {
- TestSuite suite = new TestSuite(DatabaseTests.class.getName());
-
- suite.addTestSuite(DatabaseGeneralTest.class);
- suite.addTestSuite(DatabaseLocaleTest.class);
- suite.addTestSuite(CursorWindowTest.class);
- suite.addTestSuite(DatabaseLockTest.class);
-
- return suite;
- }
-}
diff --git a/tests/FrameworkTest/AndroidManifest.xml b/tests/FrameworkTest/AndroidManifest.xml
index 3030c06..4db8952 100644
--- a/tests/FrameworkTest/AndroidManifest.xml
+++ b/tests/FrameworkTest/AndroidManifest.xml
@@ -41,934 +41,12 @@
</intent-filter>
</activity>
- <activity android:name=".focus.DescendantFocusability" android:label="DescendantFocusability">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".focus.FocusAfterRemoval" android:label="FocusAfterRemoval">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".focus.RequestFocus" android:label="RequestFocus">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />V
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".focus.ListOfButtons" android:label="ListOfButtons">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".focus.LinearLayoutGrid" android:label="LinearLayoutGrid">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".focus.ListOfEditTexts" android:label="ListOfEditTexts">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".focus.ListOfInternalSelectionViews" android:label="ListOfInternalSelectionViews">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".focus.ListWithFooterViewAndNewLabels" android:label="FocusListWithFooter">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".focus.ListWithMailMessages" android:label="ListWithMailMessages">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".focus.HorizontalFocusSearch" android:label="HorizontalFocusSearch">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".focus.VerticalFocusSearch" android:label="VerticalFocusSearch">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".focus.AdjacentVerticalRectLists" android:label="AdjacentVerticalRectLists">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".focus.GoneParentFocusedChild" android:label="GoneParentFocusedChild">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".layout.frame.FrameLayoutGravity" android:label="FrameLayoutGravity">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".layout.frame.FrameLayoutMargin" android:label="FrameLayoutMargin">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".layout.linear.BaselineAlignmentCenterGravity" android:label="BaselineAlignmentCenterGravity">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".layout.linear.BaselineButtons" android:label="BaselineButtons">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".layout.linear.FillInWrap" android:label="FillInWrap">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".layout.linear.BaselineAlignmentZeroWidthAndWeight" android:label="Baseline0WidthAndWeight">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".layout.linear.HorizontalOrientationVerticalAlignment" android:label="HorizontalOrientationVerticalAlignment">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".layout.linear.LLEditTextThenButton" android:label="LLEditTextThenButton">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".layout.linear.LLOfButtons1" android:label="LLOfButtons1">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".layout.linear.LinearLayoutEditTexts" android:label="LinearLayoutEditTexts">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".layout.linear.LLOfButtons2" android:label="LLOfButtons2">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".layout.linear.LLOfTwoFocusableInTouchMode" android:label="LLOfTwoFocusableInTouchMode">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".layout.linear.Weight" android:label="Weight">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".layout.linear.WeightSum" android:label="WeightSum">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.AdjacentListsWithAdjacentISVsInside" android:label="AdjacentListsWithAdjacentISVsInside">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListDividers" android:label="ListDividers">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListViewHeight" android:label="ListViewHeight">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".layout.table.FixedWidth" android:label="CellFixedWidth">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".layout.table.Weight" android:label="CellWeight">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".layout.table.HorizontalGravity" android:label="CellHorizontalGravity">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".layout.table.VerticalGravity" android:label="CellVerticalGravity">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".layout.table.AddColumn" android:label="AddColumnInTable">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".layout.table.CellSpan" android:label="CellSpan">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".scroll.ButtonAboveTallInternalSelectionView" android:label="ButtonAboveTallInternalSelectionView">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".scroll.ButtonsWithTallTextViewInBetween" android:label="scrollButtonsWithTallTextViewInBetween">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".scroll.RequestRectangleVisible" android:label="ScrollToChildRect">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".scroll.RequestRectangleVisibleWithInternalScroll" android:label="ScrollToChildRectWithInternalScroll">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".scroll.ScrollViewButtonsAndLabels" android:label="ScrollViewButtonsAndLabels">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".scroll.ShortButtons" android:label="scrollShortButtons">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".scroll.TallTextAboveButton" android:label="scrollTallTextAboveButton">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".view.Include" android:label="IncludeTag">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".view.Merge" android:label="MergeTag">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".view.StubbedView" android:label="ViewStub">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".view.RunQueue" android:label="RunQueue">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".view.Visibility" android:label="Visibility">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".view.VisibilityCallback" android:label="VisibilityCallback">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".view.BigCache" android:label="BigCache">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".view.ZeroSized" android:label="ZeroSized">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".view.Disabled" android:label="Disabled">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".view.PopupWindowVisibility" android:label="PopupWindowVisibility">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".view.PreDrawListener" android:label="PreDrawListener">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".view.GlobalFocusChange" android:label="GlobalFocusChange">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListSetSelection" android:label="ListSetSelection">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListSimple" android:label="ListSimple">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListFilter" android:label="ListFilter">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListScrollListener" android:label="ListScrollListener">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListThrasher" android:label="ListThrasher">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListTakeFocusFromSide" android:label="ListTakeFocusFromSide">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListBottomGravity" android:label="ListBottomGravity">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListBottomGravityMany" android:label="ListBottomGravityMany">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
-
- <activity android:name=".listview.ListButtonsDiagonalAcrossItems" android:label="ListButtonsDiagonalAcrossItems">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListTopGravity" android:label="ListTopGravity">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListTopGravityMany" android:label="ListTopGravityMany">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListEndingWithMultipleSeparators" android:label="ListEndingWithMultipleSeparators">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListGetSelectedView" android:label="ListGetSelectedView">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListInHorizontal" android:label="ListInHorizontal">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListInVertical" android:label="ListInVertical">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListInterleaveFocusables" android:label="ListInterleaveFocusables">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListOfItemsShorterThanScreen" android:label="ListOfItemsShorterThanScreen">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListOfItemsTallerThanScreen" android:label="ListOfItemsTallerThanScreen">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListOfThinItems" android:label="ListOfThinItems">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListOfShortTallShort" android:label="ListOfShortTallShort">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListOfShortShortTallShortShort" android:label="ListOfShortShortTallShortShort">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListWithOffScreenNextSelectable" android:label="ListWithOffScreenNextSelectable">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListWithFirstScreenUnSelectable" android:label="ListWithFirstScreenUnSelectable">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
-
- <activity android:name=".listview.ListWithSeparators" android:label="ListWithSeparators">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListWithHeaders" android:label="ListWithHeaders">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListWithEditTextHeader" android:label="ListWithEditTextHeader">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
-
- <activity android:name=".listview.ListWithNoFadingEdge" android:label="ListWithNoFadingEdge">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListWithScreenOfNoSelectables" android:label="ListWithScreenOfNoSelectables">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListItemFocusablesFarApart" android:label="ListItemFocusablesFarApart">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListItemFocusableAboveUnfocusable" android:label="ListItemFocusableAboveUnfocusable">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListItemFocusablesClose" android:label="ListItemFocusablesClose">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListLastItemPartiallyVisible" android:label="ListLastItemPartiallyVisible">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListItemsExpandOnSelection" android:label="ListItemsExpandOnSelection">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListWithOnItemSelectedAction" android:label="ListWithOnItemSelectedAction">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListItemISVAndButton" android:label="ListItemISVAndButton">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListOfTouchables" android:label="ListOfTouchables">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListRecyclerProfiling" android:label="ListRecyclerProfiling">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListHeterogeneous" android:label="ListHeterogeneous">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListHorizontalFocusWithinItemWins" android:label="ListHorizontalFocusWithinItemWins">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListManagedCursor" android:label="ListManagedCursor">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListWithEmptyView" android:label="ListWithEmptyView">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".gridview.GridInHorizontal" android:label="GridInHorizontal">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".gridview.GridPadding" android:label="GridPadding">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".gridview.GridInVertical" android:label="GridInVertical">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".gridview.GridScrollListener" android:label="GridScrollListener">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".gridview.GridThrasher" android:label="GridThrasher">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".gridview.GridSimple" android:label="GridSimple">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".gridview.GridDelete" android:label="GridDelete">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".gridview.GridSetSelection" android:label="GridSetSelection">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".gridview.GridSetSelectionMany" android:label="GridSetSelectionMany">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".gridview.GridSetSelectionStackFromBottom" android:label="GridSetSelectionStackFromBottom">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".gridview.GridSetSelectionStackFromBottomMany" android:label="GridSetSelectionStackFromBottomMany">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".gridview.GridStackFromBottom" android:label="GridStackFromBottom">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".gridview.GridStackFromBottomMany" android:label="GridStackFromBottomMany">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".gridview.GridVerticalSpacing" android:label="GridVerticalSpacing">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".gridview.GridVerticalSpacingStackFromBottom" android:label="GridVerticalSpacingStackFromBottom">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".gridview.GridSingleColumn" android:label="GridSingleColumn">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".menus.ListContextMenu" android:label="ListContextMenu">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".view.ViewGroupChildren" android:label="ViewGroup Children">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".view.RemoteViewsActivity" android:label="RemoteViewsActicity">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".drawable.BitmapDrawable" android:label="BitmapDrawable">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".drawable.DrawableBgMinSize" android:label="DrawableBgMinSize">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".drawable.MutateDrawable" android:label="MutateDrawable">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".activity.TranslucentFancyActivity" android:label="TranslucentFancyActivity">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".view.Longpress" android:label="Longpress">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".expandablelistview.ExpandableListWithHeaders" android:label="ExpandableListWithHeaders">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".listview.ListWithDisappearingItemBug" android:label="ListWithDisappearingItemBug">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".menus.MenuWith1Item" android:label="MenuWith1Item">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".menus.MenuLayoutPortrait" android:label="MenuLayoutPortrait"
- android:screenOrientation="portrait">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".menus.MenuLayoutLandscape" android:label="MenuLayoutLandscape"
- android:screenOrientation="landscape">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".expandablelistview.InflatedExpandableListView" android:label="ExpandableListView Inflated">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".expandablelistview.ExpandableListSimple" android:label="ExpandableListSimple">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
<activity android:name=".settings.RingtonePickerActivityLauncher" android:label="RingtonePickerActivityLauncher">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
</intent-filter>
</activity>
-
- <activity android:name=".settings.BrightnessLimit" android:label="BrightnessLimit">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name="android.widget.AutoCompleteTextViewSimple"
- android:label="AutoCompleteTextViewSimple">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <service android:name=".accessibility.AccessibilityTestService">
- <intent-filter>
- <action android:name="android.accessibilityservice.AccessibilityService" />
- </intent-filter>
- </service>
-
- <activity android:name=".radiogroup.RadioGroupActivity" android:label="RadioGroupActivity">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
</application>
diff --git a/tools/aapt/Bundle.h b/tools/aapt/Bundle.h
index c53f7f1..cbb5203 100644
--- a/tools/aapt/Bundle.h
+++ b/tools/aapt/Bundle.h
@@ -38,7 +38,7 @@
mUpdate(false), mExtending(false),
mRequireLocalization(false), mPseudolocalize(false),
mUTF8(false), mEncodingSpecified(false), mValues(false),
- mCompressionMethod(0), mOutputAPKFile(NULL),
+ mCompressionMethod(0), mOutputAPKFile(NULL), mManifestPackageNameOverride(NULL),
mAssetSourceDir(NULL), mProguardFile(NULL),
mAndroidManifestFile(NULL), mPublicOutputFile(NULL),
mRClassDir(NULL), mResourceIntermediatesDir(NULL),
@@ -88,6 +88,8 @@
void setJunkPath(bool val) { mJunkPath = val; }
const char* getOutputAPKFile() const { return mOutputAPKFile; }
void setOutputAPKFile(const char* val) { mOutputAPKFile = val; }
+ const char* getManifestPackageNameOverride() const { return mManifestPackageNameOverride; }
+ void setManifestPackageNameOverride(const char * val) { mManifestPackageNameOverride = val; }
/*
* Input options.
@@ -178,6 +180,7 @@
int mCompressionMethod;
bool mJunkPath;
const char* mOutputAPKFile;
+ const char* mManifestPackageNameOverride;
const char* mAssetSourceDir;
const char* mProguardFile;
const char* mAndroidManifestFile;
diff --git a/tools/aapt/Main.cpp b/tools/aapt/Main.cpp
index 1e6b52e..6675ac2 100644
--- a/tools/aapt/Main.cpp
+++ b/tools/aapt/Main.cpp
@@ -436,6 +436,15 @@
} else if (strcmp(cp, "-utf16") == 0) {
bundle.setEncodingSpecified(true);
bundle.setUTF8(false);
+ } else if (strcmp(cp, "-rename-manifest-package") == 0) {
+ argc--;
+ argv++;
+ if (!argc) {
+ fprintf(stderr, "ERROR: No argument supplied for '--rename-manifest-package' option\n");
+ wantUsage = true;
+ goto bail;
+ }
+ bundle.setManifestPackageNameOverride(argv[0]);
} else {
fprintf(stderr, "ERROR: Unknown option '-%s'\n", cp);
wantUsage = true;
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index d53c472..0d2ea60 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -489,11 +489,11 @@
DefaultKeyedVector<AaptGroupEntry, sp<AaptFile> > baseFiles =
baseGroup->getFiles();
for (size_t i=0; i < baseFiles.size(); i++) {
- printf("baseFile %d has flavor %s\n", i,
+ printf("baseFile %ld has flavor %s\n", i,
baseFiles.keyAt(i).toString().string());
}
for (size_t i=0; i < overlayFiles.size(); i++) {
- printf("overlayFile %d has flavor %s\n", i,
+ printf("overlayFile %ld has flavor %s\n", i,
overlayFiles.keyAt(i).toString().string());
}
}
@@ -507,7 +507,7 @@
keyAt(overlayGroupIndex));
if(baseFileIndex < UNKNOWN_ERROR) {
if (bundle->getVerbose()) {
- printf("found a match (%d) for overlay file %s, for flavor %s\n",
+ printf("found a match (%ld) for overlay file %s, for flavor %s\n",
baseFileIndex,
overlayGroup->getLeaf().string(),
overlayFiles.keyAt(overlayGroupIndex).toString().string());
@@ -562,6 +562,33 @@
node->addAttribute(ns, attr, String16(value));
}
+static void fullyQualifyClassName(String8& package, sp<XMLNode> node) {
+ XMLNode::attribute_entry* attr = node->editAttribute(
+ String16("http://schemas.android.com/apk/res/android"), String16("name"));
+ if (attr != NULL) {
+ String8 name(attr->string);
+
+ // asdf --> package.asdf
+ // .asdf .a.b --> package.asdf package.a.b
+ // asdf.adsf --> asdf.asdf
+ String8 className;
+ const char* p = name.string();
+ const char* q = strchr(p, '.');
+ if (p == q) {
+ className += package;
+ className += name;
+ } else if (q == NULL) {
+ className += package;
+ className += ".";
+ className += name;
+ } else {
+ className += name;
+ }
+ NOISY(printf("Qualifying class '%s' to '%s'", name.string(), className.string()));
+ attr->string.setTo(String16(className));
+ }
+}
+
status_t massageManifest(Bundle* bundle, sp<XMLNode> root)
{
root = root->searchElement(String16(), String16("manifest"));
@@ -591,7 +618,36 @@
addTagAttribute(vers, RESOURCES_ANDROID_NAMESPACE, "maxSdkVersion",
bundle->getMaxSdkVersion());
}
-
+
+ // Deal with manifest package name overrides
+ const char* manifestPackageNameOverride = bundle->getManifestPackageNameOverride();
+ if (manifestPackageNameOverride != NULL) {
+ // Update the actual package name
+ XMLNode::attribute_entry* attr = root->editAttribute(String16(), String16("package"));
+ if (attr == NULL) {
+ fprintf(stderr, "package name is required with --rename-manifest-package.\n");
+ return UNKNOWN_ERROR;
+ }
+ String8 origPackage(attr->string);
+ attr->string.setTo(String16(manifestPackageNameOverride));
+ NOISY(printf("Overriding package '%s' to be '%s'\n", origPackage.string(), manifestPackageNameOverride));
+
+ // Make class names fully qualified
+ sp<XMLNode> application = root->getChildElement(String16(), String16("application"));
+ if (application != NULL) {
+ fullyQualifyClassName(origPackage, application);
+
+ Vector<sp<XMLNode> >& children = const_cast<Vector<sp<XMLNode> >&>(application->getChildren());
+ for (size_t i = 0; i < children.size(); i++) {
+ sp<XMLNode> child = children.editItemAt(i);
+ String8 tag(child->getElementName());
+ if (tag == "activity" || tag == "service" || tag == "receiver" || tag == "provider") {
+ fullyQualifyClassName(origPackage, child);
+ }
+ }
+ }
+ }
+
return NO_ERROR;
}
@@ -1173,14 +1229,14 @@
table.writePublicDefinitions(String16(assets->getPackage()), fp);
fclose(fp);
}
-
+#if 0
NOISY(
ResTable rt;
rt.add(resFile->getData(), resFile->getSize(), NULL);
printf("Generated resources:\n");
rt.print();
)
-
+#endif
// These resources are now considered to be a part of the included
// resources, for others to reference.
err = assets->addIncludedResources(resFile);
diff --git a/tools/aapt/StringPool.cpp b/tools/aapt/StringPool.cpp
index ec58591..51afc0a 100644
--- a/tools/aapt/StringPool.cpp
+++ b/tools/aapt/StringPool.cpp
@@ -25,7 +25,7 @@
const size_t NS = pool->size();
for (size_t s=0; s<NS; s++) {
size_t len;
- printf("String #%d: %s\n", s,
+ printf("String #%ld: %s\n", s,
String8(pool->stringAt(s, &len)).string());
}
}
diff --git a/tools/aapt/XMLNode.cpp b/tools/aapt/XMLNode.cpp
index 036dde4..4c59288 100644
--- a/tools/aapt/XMLNode.cpp
+++ b/tools/aapt/XMLNode.cpp
@@ -555,6 +555,19 @@
return NULL;
}
+XMLNode::attribute_entry* XMLNode::editAttribute(const String16& ns,
+ const String16& name)
+{
+ for (size_t i=0; i<mAttributes.size(); i++) {
+ attribute_entry * ae = &mAttributes.editItemAt(i);
+ if (ae->ns == ns && ae->name == name) {
+ return ae;
+ }
+ }
+
+ return NULL;
+}
+
const String16& XMLNode::getCData() const
{
return mChars;
diff --git a/tools/aapt/XMLNode.h b/tools/aapt/XMLNode.h
index dc92fa7..e9a263b 100644
--- a/tools/aapt/XMLNode.h
+++ b/tools/aapt/XMLNode.h
@@ -95,6 +95,8 @@
const attribute_entry* getAttribute(const String16& ns, const String16& name) const;
+ attribute_entry* editAttribute(const String16& ns, const String16& name);
+
const String16& getCData() const;
const String16& getComment() const;
diff --git a/vpn/tests/vpntests/Android.mk b/vpn/tests/vpntests/Android.mk
new file mode 100644
index 0000000..a19fb56
--- /dev/null
+++ b/vpn/tests/vpntests/Android.mk
@@ -0,0 +1,14 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+# We only want this apk build for tests.
+LOCAL_MODULE_TAGS := tests
+
+# Include all test java files.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_JAVA_LIBRARIES := android.test.runner
+LOCAL_PACKAGE_NAME := FrameworksVpnTests
+
+include $(BUILD_PACKAGE)
+
diff --git a/vpn/tests/vpntests/AndroidManifest.xml b/vpn/tests/vpntests/AndroidManifest.xml
new file mode 100644
index 0000000..d8405f6
--- /dev/null
+++ b/vpn/tests/vpntests/AndroidManifest.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.frameworks.vpntests">
+ <uses-permission android:name="android.permission.RECEIVE_SMS"/>
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.READ_CONTACTS" />
+ <uses-permission android:name="android.permission.WRITE_CONTACTS" />
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
+ <uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
+ <uses-permission android:name="android.permission.WRITE_APN_SETTINGS" />
+ <uses-permission android:name="android.permission.BROADCAST_STICKY" />
+
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation
+ android:name="android.test.InstrumentationTestRunner"
+ android:targetPackage="com.android.frameworks.vpntests"
+ android:label="Frameworks VPN Tests" />
+</manifest>
diff --git a/tests/AndroidTests/src/com/android/unit_tests/VpnTest.java b/vpn/tests/vpntests/src/android/net/vpn/VpnTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/VpnTest.java
rename to vpn/tests/vpntests/src/android/net/vpn/VpnTest.java
index cb64293..46a57d3 100755
--- a/tests/AndroidTests/src/com/android/unit_tests/VpnTest.java
+++ b/vpn/tests/vpntests/src/android/net/vpn/VpnTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.unit_tests;
+package android.net.vpn;
import android.content.BroadcastReceiver;
import android.content.Context;